File size: 2,806 Bytes
ae13549
 
4858b39
 
 
 
 
 
 
 
 
 
 
45118a6
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
---
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}")