Kenyan-Food-13 Classifier
This is a ResNet-18 model fine-tuned on 13 Kenyan dishes.
Model Details
This repository contains a fine-tuned ResNet-18 image classifier for 13 Kenyan dishes:
Architecture: ResNet-18 (pretrained on ImageNet, final layer re-trained)
Labels (id2label):
0 β bhaji 1 β chapati 2 β githeri 3 β kachumbari 4 β kukuchoma 5 β mandazi 6 β masalachips 7 β matoke 8 β mukimo 9 β nyamachoma 10 β pilau 11 β sukumawiki 12 β ugali
It was trained on a custom βFood13β folder structure.
Model architecture: ResNet-18 (pretrained on ImageNet, then last layer re-trained).
Files
pytorch_model.binβ PyTorch state dict of the trained ResNet-18.config.jsonβ Hugging Face configuration describing number of labels andid2labelmapping.README.mdβ (this file).
Usage
from transformers import AutoImageProcessor, AutoModelForImageClassification
from PIL import Image
MODEL_ID = "walter-taya/kenyan-food-13"
# 1. Load a compatible image processor + model:
processor = AutoImageProcessor.from_pretrained(MODEL_ID)
model = AutoModelForImageClassification.from_pretrained(MODEL_ID)
# 2. Preprocess & predict:
image = Image.open("some_kenyan_dish.jpg").convert("RGB")
inputs = processor(images=image, return_tensors="pt")
outputs = model(**inputs)
logits = outputs.logits
probs = logits.softmax(dim=1)
predicted_class_idx = probs.argmax(-1).item()
label = model.config.id2label[str(predicted_class_idx)]
print(f"Predicted dish: {label} (score={probs[0,predicted_class_idx]:.3f})")
license: apache-2.0
- Downloads last month
- 3