Instructions to use AXERA-TECH/mobilenetv3-small with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- timm
How to use AXERA-TECH/mobilenetv3-small with timm:
import timm model = timm.create_model("hf_hub:AXERA-TECH/mobilenetv3-small", pretrained=True) - Notebooks
- Google Colab
- Kaggle
File size: 598 Bytes
088c799 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 | #!/usr/bin/env python3
"""MobileNetV3-Small classification example."""
import sys, numpy as np
from PIL import Image
from inference import MobileNetV3Classifier
model_path = sys.argv[1] if len(sys.argv) > 1 else "../models/model.axmodel"
image_path = sys.argv[2] if len(sys.argv) > 2 else "../demo/demo.jpg"
img = Image.open(image_path).resize((224, 224))
data = np.array(img, dtype=np.float32).transpose(2, 0, 1)[np.newaxis] / 255.0
clf = MobileNetV3Classifier(model_path)
out = clf.classify(data)
top5 = np.argsort(-out[0])[:5]
print(f"Top-5 classes: {top5}")
print(f"Scores: {out[0][top5]}")
|