FridgeAI Spoilage Classifier (MobileNetV3-Small)
Binary classifier that detects whether a food item is fresh or spoiled from an image crop.
Model Details
- Architecture: MobileNetV3-Small with custom classifier head
- Training data: Fresh and Rotten Fruits Dataset (Sriram, Kaggle) โ ~13,500 images, 6 fruit classes ร 2 labels
- Training: 15 epochs, Adam lr=1e-3, BCEWithLogitsLoss, WeightedRandomSampler
- Accuracy: 100% on test set (2,698 images)
- Input: 224ร224 RGB image
- Output: P(spoiled) โ [0, 1]
Usage
import requests
API_URL = "/static-proxy?url=https%3A%2F%2Fapi-inference.huggingface.co%2Fmodels%2FYOUR_USERNAME%2Ffridgeai-spoilage"
headers = {"Authorization": "Bearer hf_..."}
with open("apple_crop.jpg", "rb") as f:
response = requests.post(API_URL, headers=headers, data=f.read())
print(response.json())
# [{"label": "spoiled", "score": 0.87}, {"label": "fresh", "score": 0.13}]