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 and id2label mapping.
  • 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
Safetensors
Model size
11.2M params
Tensor type
F32
Β·
Inference Providers NEW
This model isn't deployed by any Inference Provider. πŸ™‹ Ask for provider support

Space using waltertaya/kenyan-food-13 1