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
| license: mit | |
| datasets: | |
| - zh-plus/tiny-imagenet | |
| metrics: | |
| - accuracy | |
| pipeline_tag: image-classification | |
| library_name: transformers | |
| tags: | |
| - Mobile | |
| - edge | |
| - image | |
| - clf | |
| # Modern MobileNetV1 (Modernized MobileNet Architecture) | |
| **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. | |
| --- | |
| ## Key Architectural Improvements (vs. Original MobileNetV1) | |
| Compared to the classic MobileNetV1 (Howard et al., 2017), this modernized implementation introduces several key architectural upgrades: | |
| | Feature | Legacy MobileNetV1 | Modern MobileNetV1 (This Model) | | |
| | :--- | :--- | :--- | | |
| | **Activation Function** | Standard ReLU | **SiLU (Swish)** | | |
| | **Normalization** | Batch Normalization | **FP32 Layer Normalization (`GroupNorm(1, C)`)** | | |
| | **Residual Connections** | None (pure feed-forward) | **Learnable Residual Block Scaling (`identity + scale * out`)** | | |
| | **Batch Size Dependency** | High (sensitive to batch statistics) | **Zero (Inference identical across any batch size)** | | |
| | **Precision Stability** | Standard FP32 / FP16 | **FP32-Capped Normalization (Prevents Underflow/Overflow)** | | |
| --- | |
| ## Benchmark & Evaluation | |
| - **Evaluation Dataset:** Tiny-ImageNet (200-Class Test Split) | |
| - **Input Resolution:** 64 × 64 pixels (native) | |
| - **Top-1 Accuracy:** 44.38% | |
| - **Top-5 Accuracy:** 67.26% | |
| --- | |
| ## Target Use Cases & Applications | |
| Due to its parameter efficiency and depthwise separable convolution structure, Modern MobileNetV1 is optimized for edge deployment: | |
| - **Edge & Embedded AI:** Deployment on Raspberry Pi, NVIDIA Jetson, microcontrollers, and IoT vision devices. | |
| - **Mobile Vision Applications:** Real-time on-device classification (Android ONNX / iOS CoreML). | |
| - **High-Throughput Microservices:** Lightweight backbone for low-latency web services and microservices. | |
| - **Robotics & Drones:** Compact feature extractor for fast object recognition and navigational awareness. | |
| --- | |
| ## How to Use | |
| ### Fast Inference with Hugging Face `pipeline` | |
| ```python | |
| from transformers import pipeline | |
| # Initialize the classification pipeline (requires trust_remote_code=True for custom code) | |
| classifier = pipeline( | |
| "image-classification", | |
| model="kd13/Modern-MobileNet", | |
| trust_remote_code=True | |
| ) | |
| # Run prediction on an image URL or local PIL Image | |
| results = classifier("https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/hub/parrots.png") | |
| for pred in results: | |
| print(f"Label: {pred['label']} | Score: {pred['score']:.4f}") |