Instructions to use kd13/Modern-MobileNet with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use kd13/Modern-MobileNet with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("image-classification", model="kd13/Modern-MobileNet", trust_remote_code=True) pipe("https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/hub/parrots.png")# Load model directly from transformers import AutoModelForImageClassification model = AutoModelForImageClassification.from_pretrained("kd13/Modern-MobileNet", trust_remote_code=True, device_map="auto") - Notebooks
- Google Colab
- Kaggle
Update README.md
Browse files
README.md
CHANGED
|
@@ -11,4 +11,64 @@ tags:
|
|
| 11 |
- edge
|
| 12 |
- image
|
| 13 |
- clf
|
| 14 |
-
---
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 11 |
- edge
|
| 12 |
- image
|
| 13 |
- clf
|
| 14 |
+
---
|
| 15 |
+
|
| 16 |
+
# Modern MobileNetV1 (Modernized MobileNet Architecture)
|
| 17 |
+
|
| 18 |
+
**Modern MobileNetV1** is an enhanced, highly optimized variant of the classic MobileNetV1 architecture. It incorporates modern deep learning design choices—including **SiLU activations**, **FP32 Layer Normalization**, and **learnable residual scaling**—delivering stabilized training and high inference accuracy while keeping memory footprint and computational complexity low.
|
| 19 |
+
|
| 20 |
+
---
|
| 21 |
+
|
| 22 |
+
## Key Architectural Improvements (vs. Original MobileNetV1)
|
| 23 |
+
|
| 24 |
+
Compared to the classic MobileNetV1 (Howard et al., 2017), this modernized implementation introduces several key architectural upgrades:
|
| 25 |
+
|
| 26 |
+
| Feature | Legacy MobileNetV1 | Modern MobileNetV1 (This Model) |
|
| 27 |
+
| :--- | :--- | :--- |
|
| 28 |
+
| **Activation Function** | Standard ReLU | **SiLU (Swish)** |
|
| 29 |
+
| **Normalization** | Batch Normalization | **FP32 Layer Normalization (`GroupNorm(1, C)`)** |
|
| 30 |
+
| **Residual Connections** | None (pure feed-forward) | **Learnable Residual Block Scaling (`identity + scale * out`)** |
|
| 31 |
+
| **Batch Size Dependency** | High (sensitive to batch statistics) | **Zero (Inference identical across any batch size)** |
|
| 32 |
+
| **Precision Stability** | Standard FP32 / FP16 | **FP32-Capped Normalization (Prevents Underflow/Overflow)** |
|
| 33 |
+
|
| 34 |
+
---
|
| 35 |
+
|
| 36 |
+
## Benchmark & Evaluation
|
| 37 |
+
|
| 38 |
+
- **Evaluation Dataset:** Tiny-ImageNet (200-Class Test Split)
|
| 39 |
+
- **Input Resolution:** 64 × 64 pixels (native)
|
| 40 |
+
- **Top-1 Accuracy:** 44.38%
|
| 41 |
+
- **Top-5 Accuracy:** 67.26%
|
| 42 |
+
|
| 43 |
+
---
|
| 44 |
+
|
| 45 |
+
## Target Use Cases & Applications
|
| 46 |
+
|
| 47 |
+
Due to its parameter efficiency and depthwise separable convolution structure, Modern MobileNetV1 is optimized for edge deployment:
|
| 48 |
+
|
| 49 |
+
- **Edge & Embedded AI:** Deployment on Raspberry Pi, NVIDIA Jetson, microcontrollers, and IoT vision devices.
|
| 50 |
+
- **Mobile Vision Applications:** Real-time on-device classification (Android ONNX / iOS CoreML).
|
| 51 |
+
- **High-Throughput Microservices:** Lightweight backbone for low-latency web services and microservices.
|
| 52 |
+
- **Robotics & Drones:** Compact feature extractor for fast object recognition and navigational awareness.
|
| 53 |
+
|
| 54 |
+
---
|
| 55 |
+
|
| 56 |
+
## How to Use
|
| 57 |
+
|
| 58 |
+
### Fast Inference with Hugging Face `pipeline`
|
| 59 |
+
|
| 60 |
+
```python
|
| 61 |
+
from transformers import pipeline
|
| 62 |
+
|
| 63 |
+
# Initialize the classification pipeline (requires trust_remote_code=True for custom code)
|
| 64 |
+
classifier = pipeline(
|
| 65 |
+
"image-classification",
|
| 66 |
+
model="kd13/Modern-MobileNet",
|
| 67 |
+
trust_remote_code=True
|
| 68 |
+
)
|
| 69 |
+
|
| 70 |
+
# Run prediction on an image URL or local PIL Image
|
| 71 |
+
results = classifier("https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/hub/parrots.png")
|
| 72 |
+
|
| 73 |
+
for pred in results:
|
| 74 |
+
print(f"Label: {pred['label']} | Score: {pred['score']:.4f}")
|