zh-plus/tiny-imagenet
Viewer • Updated • 110k • 27.3k • 103
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")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.
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) |
Due to its parameter efficiency and depthwise separable convolution structure, Modern MobileNetV1 is optimized for edge deployment:
pipeline
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}")