timm documentation
GhostNet
GhostNet
Category: Efficient/Mobile · Code: timm/models/ghostnet.py · Architectures: 10 · Pretrained weights: 5 (5 with ImageNet-1k results)
GhostNet generates part of its feature maps with cheap operations (Ghost modules). GhostNetV2 adds DFC attention for long-range dependencies, GhostNetV3 uses re-parameterization and knowledge distillation in training.
Papers
- GhostNet: More Features from Cheap Operations
- GhostNetV2: Enhance Cheap Operation with Long-Range Attention
- GhostNetV3: Exploring the Training Strategies for Compact Models
Usage
See the Quickstart for loading pretrained weights, image preprocessing and fine-tuning, and Feature Extraction for using the models as backbones.
>>> import timm
>>> model = timm.create_model('ghostnetv2_160.in1k', pretrained=True)
>>> data_config = timm.data.resolve_model_data_config(model)Model API support
✓ supported, ✓ (square) works for square sizes only, ✗ not supported, – not needed (the model already accepts any input
size). Checked by running each feature on a randomly initialized model (GhostNet with ghostnet_050 at 224), other
architectures of the same class are expected to behave the same. See the Model API page for details.
Architectures
| Architecture | Params (M) | GMACs | Input size | Pretrained weights |
|---|---|---|---|---|
ghostnet_050 | 2.59 | 0.05 | 224 | 0 |
ghostnet_100 | 5.18 | 0.15 | 224 | 1 |
ghostnet_130 | 7.36 | 0.24 | 224 | 0 |
ghostnetv2_100 | 6.16 | 0.18 | 224 | 1 |
ghostnetv2_130 | 8.96 | 0.28 | 224 | 1 |
ghostnetv2_160 | 12.39 | 0.42 | 224 | 1 |
ghostnetv3_050 | 2.85 | 0.05 | 224 | 0 |
ghostnetv3_100 | 6.15 | 0.17 | 224 | 1 |
ghostnetv3_130 | 8.95 | 0.28 | 224 | 0 |
ghostnetv3_160 | 12.38 | 0.41 | 224 | 0 |
GMACs and parameter counts are for the default input size and classifier of each architecture, from the benchmark results.
Pretrained weights
Top-1 is ImageNet-1k validation accuracy from results-imagenet.csv at
the listed eval size, - if the weight has no ImageNet-1k result (e.g. pretraining or image-text weights). Classes is the
size of the pretrained classifier, none for weights without one.
| Weight | Input size | Top-1 (%) | Eval size | Classes | License | Hub |
|---|---|---|---|---|---|---|
ghostnet_100.in1k | 224 | 73.958 | 224 | 1000 | apache-2.0 | timm |
ghostnetv2_100.in1k | 224 | 75.186 | 224 | 1000 | apache-2.0 | timm |
ghostnetv2_130.in1k | 224 | 76.746 | 224 | 1000 | apache-2.0 | timm |
ghostnetv2_160.in1k | 224 | 77.836 | 224 | 1000 | apache-2.0 | timm |
ghostnetv3_100.in1k | 224 | 76.936 | 224 | 1000 | apache-2.0 | timm |