Skip to content
 
 

Latest commit

 

History

21 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Neural Computing: Food Classification with CNN

Project Description

This project implements a Convolutional Neural Network (CNN) for multi-class classification of food images across 91 distinct categories. The dataset is split into training (~44k samples) and testing (~22k samples) subsets and undergoes preprocessing. A custom model is then built using TensorFlow, trained on the dataset, and evaluated for accuracy. The main challenge involved tuning hyperparameters—such as learning rate and dropout—and shaping an effective CNN architecture, with fixed random seeds used to ensure reproducibility. Finally, a simulation is performed in which a hypothetical user submits 10 random food images to be classified by the trained model.

The purpose of this project is to demonstrate the application of deep learning for image classification in a real-world-like setting such as food recommendation systems.

It is designed for the NC2425 Neural Computing course at Leiden University and runs on LIACS remote servers.

Features

  • Classifies images across 91 food categories. Classifies food images into 91 distinct categories.
  • Builds and trains a Convolutional Neural Network (CNN) from scratch, without relying on pretrained models.
  • Simulates real-life usage by testing with random food images.
  • Tracks training progress using accuracy and loss per epoch.
  • Integrates visualization of the model development process for interpretation and debugging. -Designed for deployment on LIACS remote servers via SSH, integrated with each student’s /data directory.

Prerequisites

This project must be run on LIACS remote servers and is intended only for Leiden University students who have:

  • Valid Leiden University account

  • SSH access to ssh.liacs.nl and internal servers (e.g., vibranium)

  • Working WSL terminal

  • Basic knowledge of SSH, Git, and Python venv

  • Required Python packages from requirements.txt

Running Instructions

Setup Instructions (via LIACS SSH)


  1. Open WSL terminal.

  1. SSH into the LIACS login server:
ssh s[student_number]@ssh.liacs.nl

(Enter your Brightspace/ULCN password when prompted)

(During the first time, write 'yes' when asked to connect with a fingerprint.)


  1. SSH into the Internal Server
ssh vibranium

(Enter your Brightspace/ULCN password when prompted)

(During the first time, write 'yes' when asked to connect with a fingerprint.)


  1. Start a screen session:

During the setup

screen -S cnn_training

During the next sessions to restore the screen During the setup

screen -r cnn_training

[TIP - use whenever in screen you want to reset the content in the screen]

clear

  1. Navigate to your home directory
cd /home/s[student_number]/

  1. Check if the /data/s[student_number] directory exists
cd /data/s[student_number]

If it does not exist, create it:

mkdir /data/s[student_number]
cd /data/s[student_number]

  1. Clone the repository:
git clone https://github.com/gabz81y/assignment_NC2425.git
cd assignment_NC2425

  1. Sync with Latest Changes:
git pull origin main --rebase

  1. Set Up a Python Virtual Environment
python -m venv nc_venv
source nc_venv/bin/activate

  1. Install Dependencies
pip install -r requirements.txt

  1. Download and Prepare the Dataset
python get_data.py

Verify that train and test directories have been created:

ls

  1. Convert Notebook to Script
jupyter nbconvert --to script assignment_NC2425.ipynb

  1. Run the CNN Training Script
jupyter nbconvert --to script assignment_NC2425.ipynb

  1. Detach from the screen session (only during the setup session)
Ctrl + A, then D

Usage

This CNN-based food classifier supports real-world applications such as:

  • Restaurant Recommendation Systems – Recommend dishes based on identified food types.

  • Diet Tracking Apps – Automatically log and categorize meals from photos.

  • Kitchen Assistants – Detect food in real time from images.

Authors

GROUP_10: NC_PA_2425 10 - NC_PA_2425_311543_39802_10

  • Czapska Gabriela s4053672
  • Doupovcová Livia s3952320
  • Hanganu Ioana s3792773
  • Snepvangers Alex s3700216

Licence

This project is licensed under the MIT License. See the LICENSE file for details.

About

building of gabis work

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages