Nigerian Food Classification Model 🍲🇳🇬

An EfficientNetB4 feature extractor computer vision model to classify 18 classes of Nigerian food.

Examples
Pages:

About This Model

This model was trained to classify images of Nigerian food into 18 different categories using transfer learning with the EfficientNetB0 architecture. The model leverages pre-trained weights and fine-tunes the classifier layer to adapt to the specific task of Nigerian food classification. The model achieved a high accuracy on the validation set, demonstrating its effectiveness in recognizing various Nigerian dishes.

Model Architecture

The model uses the EfficientNetB4 architecture as a feature extractor. The classifier layer was replaced to accommodate the 18 classes of Nigerian food. The model was trained using cross-entropy loss and the Adam optimizer. Click here to download the trained model. Key Details:

  • Model Architecture: EfficientNet-B4
  • Pre-trained Weights: ImageNet
  • Fine-tuning: Classifier layer replaced for 18 Nigerian food classes
  • Training Framework: PyTorch
  • Evaluation Metrics: Accuracy, Precision, Recall, F1-Score
  • Validation Accuracy: ~72.2%

Dataset

The dataset used for training and validation consists of images of 18 different Nigerian food classes. The images were collected from various sources publicly available on the internet. Click here to access the dataset.

Performance

On the validation set, the EfficientNet-B4 variant achieved an overall accuracy of approximately 72.2%. Performance is strong on classes such as Moi Moi, Akara, Jollof Rice, Puff Puff, and Suya, with balanced precision and recall. However, recall remains lower for visually similar viscous soups like Okra, Ogbono, and Banga, indicating class-specific confusion. Macro F1 is around 0.715, suggesting reasonably balanced performance across classes, with room for targeted improvements.

Food Classes

The model can classify the following Nigerian food classes:

  • Jollof Rice
  • Egusi Soup
  • Moi Moi
  • Akara
  • Suya
  • Efo Riro
  • Okra Soup
  • Ofada Rice
  • Pounded Yam
  • Banga Soup
  • Pepper Soup
  • Nkwobi
  • Amala
  • Ewedu Soup
  • Ogbono Soup
  • Yam Porridge
  • Puff Puff
  • Chin Chin

Limitations

While the model performs well on the validation set, it may still face challenges with images that have poor lighting, occlusions, or unusual angles. Additionally, the model's performance may vary when tested on images from different sources or with different quality.

EfficientNet-B4-specific limitations:

  • Computationally Intensive: EfficientNet-B4 is more computationally intensive compared to smaller models, which may lead to longer inference times on devices with limited resources.
  • Memory Usage: The model requires more memory, which could be a limitation for deployment on edge devices with constrained memory capacity.
  • Class-specific recall: Without calibration, B4 may under-predict visually similar viscous soups (e.g., Okra, Ogbono, Banga), leading to lower recall unless class-wise thresholds, focal loss, or targeted augmentation are applied.
  • Data Bias: The model's performance is highly dependent on the quality and diversity of the training dataset. If the dataset lacks representation of certain food classes or variations, the model may struggle to generalize well to unseen images.
  • Domain Shift: The model may not perform well on images that differ significantly from the training data in terms of style, background, or context.

Future Work

Future improvements could include expanding the dataset with more diverse images, experimenting with different architectures, and fine-tuning hyperparameters to further enhance model performance.

Acknowledgements

This model was developed as part of a project to promote Nigerian cuisine and culture through technology. Special thanks to the open-source community for providing the tools and resources necessary for building this model.

How to Use This Demo

  1. Upload an image of Nigerian food in the food classification category.
  2. Click the "Submit" button to get predictions.
  3. View the top 5 predicted classes and their probabilities.

Example Images

Try out the model with the example images provided or upload your own images of Nigerian food to see how well the model performs!