Instructions to use Anoderb/sku-mobilenetv4-cbam-classifier with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- TF-Keras
How to use Anoderb/sku-mobilenetv4-cbam-classifier with TF-Keras:
# Note: 'keras<3.x' or 'tf_keras' must be installed (legacy) # See https://github.com/keras-team/tf-keras for more details. from huggingface_hub import from_pretrained_keras model = from_pretrained_keras("Anoderb/sku-mobilenetv4-cbam-classifier") - Notebooks
- Google Colab
- Kaggle
π SKU Product Classifier (MobileNetV4 + CBAM)
Model klasifikasi gambar untuk mendeteksi 19 kategori produk SKU (retail/UMKM Indonesia) via kamera atau upload.
π Metrics
| Metric | Value |
|---|---|
| Accuracy | 98.8% |
| F1 Macro | 0.984 |
| Model Size | 12.4 MB (Keras) / 3.5 MB (TFLite Quantized) |
| Inference | 86 ms (11.6 FPS) |
ποΈ Architecture
- Backbone: MobileNetV4ConvSmall (pretrained ImageNet)
- Attention: CBAM (Convolutional Block Attention Module)
- Head: GlobalAvgPool β BN β Dropout(0.3) β Dense(19)
- Input: 224Γ224 RGB, raw pixels [0,255]
- Output: 19 classes (softmax)
π Usage
TFLite (Edge / Mobile)
import numpy as np
from PIL import Image
from tflite_runtime.interpreter import Interpreter
interp = Interpreter(model_path="mobilenetv4_cbam_quantized.tflite")
interp.allocate_tensors()
inp, out = interp.get_input_details()[0], interp.get_output_details()[0]
img = Image.open("product.jpg").convert("RGB").resize((224,224))
x = np.array(img, dtype=np.float32) # [0,255]
interp.set_tensor(inp['index'], x[None,...])
interp.invoke()
preds = interp.get_tensor(out['index'])[0]
print(CLASS_NAMES[preds.argmax()])
Gradio Webcam Demo
pip install gradio tflite-runtime pillow numpy
python app.py
Buka browser β klik webcam β scan produk β lihat prediksi realtime.
π Files
| File | Description |
|---|---|
mobilenetv4_cbam.keras |
Full Keras 3 model (28.5 MB) |
mobilenetv4_cbam_fp32.tflite |
TFLite FP32 (12.9 MB) |
mobilenetv4_cbam_quantized.tflite |
TFLite INT8 (3.5 MB) β recommended for edge |
mobilenetv4_cbam_saved_model/ |
SavedModel format |
class_names.json |
19 SKU class labels |
app.py |
Gradio webcam demo |
π·οΈ Classes (19 SKU)
frisian-flag-fullcrm-250ml, frisian-flag-strwbry-250ml, gaga-100-grg-jalapeto, gaga-100-kuah-jalapeto, indomie-grg-cb-ijo, indomie-grg-cb-ijo-jumbo, klik-crackers-keju, nabati-siip-keju, pepsodent-72g, sarimi-aym-bwng, sarimi-gls-baso-pds, sedaap-grng, sedaap-kuah-aym-bwg, sedaap-sg-laksa, siplah-mineral-220ml, soffell-bunga, soffell-jeruk, ultramlk-fullcrm-200ml, vica-600ml
π Notes
- Trained on Kaggle GPU (T4), 1649 images, 19 classes
- Preprocessing embedded in model (raw [0,255] pixels)
- Best of 6 architectures tested (MobileNetV4 / EfficientNetV2-B0 / ConvNeXt-Tiny Γ baseline/CBAM)
Created with Hermes Agent π€
- Downloads last month
- 9