CoolFace
Modelpublic

Anoderb/sku-mobilenetv4-cbam-classifier

sourceHugging Facemitupdated 2mo agoView on Hugging Face
0likes11downloads
Model Card

๐Ÿ›’ SKU Product Classifier (MobileNetV4 + CBAM)

Model klasifikasi gambar untuk mendeteksi 19 kategori produk SKU (retail/UMKM Indonesia) via kamera atau upload.

๐Ÿ“Š Metrics

MetricValue
Accuracy98.8%
F1 Macro0.984
Model Size12.4 MB (Keras) / 3.5 MB (TFLite Quantized)
Inference86 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)

python
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

bash
pip install gradio tflite-runtime pillow numpy
python app.py

Buka browser โ†’ klik webcam โ†’ scan produk โ†’ lihat prediksi realtime.

๐Ÿ“ Files

FileDescription
mobilenetv4_cbam.kerasFull Keras 3 model (28.5 MB)
mobilenetv4_cbam_fp32.tfliteTFLite FP32 (12.9 MB)
mobilenetv4_cbam_quantized.tfliteTFLite INT8 (3.5 MB) โ€” recommended for edge
mobilenetv4_cbam_saved_model/SavedModel format
class_names.json19 SKU class labels
app.pyGradio 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 ๐Ÿค–