This work implements the building blocks and network of the GhostNet [1] in tensorflow keras. It follows the logic presented in [4] with some adaptions towards the used machine learning framework.
The authors of the GhostNet were inspired by MobilenetV3 [2] architecture, this work is implemented 2 architectures:
-
"large" that is according to the GhostNet paper (and follows the structure of
MobilenetV3-Large
). -
"small" folows the
MobileNetV3-Small
from MobilenetV3 paper.
Architecture selection (use "small" or "large" tags in constructor):
# create the ghostnet model
ghost_net_model = ghost_net_obj.create_model("small")
The "width_multiplier" parameter can be used to scale up or down the GhostNet, which results in architectures with fewer parameters (i.e. width_multiplier=0.1) ~1.4M.
Block configuration and meaning: [16,16,0.25,2,3]
- expansion, out_channels, Squeeze-Excitation[3] value, strides, kernel size.
Note: the original paper used the standard 224x224 input, smaller inputs can be applied, if the AveragePooling kernel is adjusted, or adjusting the Squeeze-Excitation module value.
Model | Parameters [M] | FLOPS[G] |
---|---|---|
GhostNet (small) / SE - 0.25 | 1.47 | 0.103 |
ResNet [5] - custom | 0.287 | 0.594 |
- GhostNet: More Features from Cheap Operations, Kai Han, et all
- Searching for MobileNetV3, Andrew Howard, et all
- Squeeze-and-Excitation Networks, Jie Hu, et all
- HUAWEI Noah's Ark Lab, Efficient-AI-Backbones
- fvilmos, ResNet_keras
/Enjoy.