top of page
Image by Antoine Rault

Create Your First Project

Start adding your projects to your portfolio. Click on "Manage Projects" to get started

Food-Category-Image-Classification

Github Link

OVERVIEW
--------------------------------------------------
Objective:
• Predict the food category of an image. The model is trained to classify images into one of 11 categories (bread, dessert, rice, noodles, meat, seafood, dairy products, egg, soup, fruit, and fried food).

--------------------------------------------------
Method:
• A neural network is built and trained from scratch for image classification.
• Custom CNN Architecture: Designed without pretrained weights.
• Data Augmentation: Optional usage of torchvision.transforms to increase dataset diversity.
• Hyperparameter Tuning & Optimization: Adjust learning rates, optimizers, and other parameters to boost performance.
• Cross Validation / Train-Validation Split: Used for robust model evaluation.
• Kaggle Submission Format: Generates a CSV file with predicted labels for test images.

--------------------------------------------------
Data:
• Download the dataset from the provided Google Drive link:
  https://drive.google.com/file/d/1TBSv0tkTGLnqPUP9nPHUAWAExzQsisQV/view
• Training Set: 9,867 JPEG images.
• Validation Set: 3,431 JPEG images.
• Test Set: 1,501 JPEG images.
• Label Format: Image file names are in the format [label]_[id].jpg (e.g., 0_5.jpg indicates an image with id 5 and label 0).

--------------------------------------------------
Model Architecture:
• Convolutional Neural Network (CNN):
  - Built from scratch (no pretrained models).
  - Includes several convolutional layers followed by activation functions and pooling layers.
  - Fully connected layers map the final feature maps to 11 output classes.
• Data Augmentation (Optional):
  - Utilizes torchvision.transforms to generate additional diverse images.
  - Custom Dataset modifications (e.g., creating linear combinations of images and adjusting labels) for enhanced robustness.

--------------------------------------------------
Training Details:
• Loss Function:
  - Cross-entropy loss is used for multiclass classification.
• Optimization:
  - The model is trained with an optimizer (e.g., Adam) with tuned hyperparameters.
• Validation:
  - A separate validation set is used to monitor performance and fine-tune hyperparameters.
• Kaggle Submission:
  - The final model generates predictions on the test set.
  - The submission file is a CSV with two columns: Id (sequential test image IDs) and Label (predicted category labels).
• Evaluation Metric:
  - Categorization Accuracy.

--------------------------------------------------
Code Structure:
• Notebook:
  - DL_HW3_final (1).ipynb contains the full implementation, including:
    • Data loading and preprocessing.
    • Definition of the custom Dataset and data augmentation methods.
    • Design and training of the CNN model.
    • Hyperparameter tuning and optimization.
    • Generation of the prediction CSV file for submission.
• Dependencies:
  - torch and torch.nn for building and training the model.
  - torchvision for image transformations and data augmentation.
  - numpy, pandas, and other utilities for data processing and evaluation.

--------------------------------------------------
Conclusion:
This project demonstrates the process of building a neural network from scratch for food category image classification. By leveraging custom CNN architectures, data augmentation, and careful hyperparameter tuning, the model aims to achieve high categorization accuracy on a challenging dataset. All code, experiments, and final predictions are provided in this repository.

Anchor 1

© 2025 by Anish Panicker. 

bottom of page