mbconv
MBConv Layer API
This module provides classes to build mobile inverted bottleneck convolutional layers.
Classes:
-
MBConvParams
–MBConv parameters
Functions:
-
mbconv_block
–MBConv block w/ expansion and SE
Classes
MBConvParams
MBConv parameters
Attributes:
-
filters
(int
) –Number of filters
-
depth
(int
) –Layer depth
-
ex_ratio
(float
) –Expansion ratio
-
kernel_size
(int | tuple[int, int]
) –Kernel size
-
strides
(int | tuple[int, int]
) –Stride size
-
se_ratio
(float
) –Squeeze Excite ratio
-
droprate
(float
) –Drop rate
-
bn_momentum
(float
) –Batch normalization momentum
-
activation
(str
) –Activation function
Functions
mbconv_block
mbconv_block(output_filters: int, expand_ratio: float = 1, kernel_size: int | tuple[int, int] = 3, strides: int | tuple[int, int] = 1, se_ratio: float = 8, droprate: float = 0, bn_momentum: float = 0.9, activation: str | Callable = 'relu6', name: str | None = None) -> keras.Layer
MBConv block w/ expansion and SE
This layer can support 1D inputs by providing a dummy dimension. In such cases, the kernel_size and strides should be adjusted accordingly.
Parameters:
-
output_filters
(int
) –Number of output filter channels
-
expand_ratio
(float
, default:1
) –Expansion ratio. Defaults to 1.
-
kernel_size
(int | tuple[int, int]
, default:3
) –Kernel size. Defaults to 3.
-
strides
(int | tuple[int, int]
, default:1
) –Stride length. Defaults to 1.
-
se_ratio
(float
, default:8
) –SE ratio. Defaults to 8.
-
droprate
(float
, default:0
) –Drop rate. Defaults to 0.
-
bn_momentum
(float
, default:0.9
) –Batch normalization momentum. Defaults to 0.9.
-
activation
(str
, default:'relu6'
) –Activation function. Defaults to "relu6".
-
name
(str | None
, default:None
) –Block name. Defaults to None.
Returns:
-
Layer
–keras.Layer: Functional layer
Source code in neuralspot_edge/layers/mbconv.py
51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 |
|