Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

An Image analysis tool for food safety inspection

Overview

This project is an online tool that uses image analysis to classify food freshness. The system predicts if the food item is fresh or rotten and delivers a concentration percentage reflecting the level of freshness or deterioration using Convolutional Neural Networks (CNN) for picture classification.

Project Structure

/project-root

│── /backend # Flask backend (image processing + ML inference)

│── /frontend # React frontend

│── /testing # Unit and integration test scripts

│── trainmodel.py # CNN training script

│── requirements.txt # Python dependencies

│── package.json # Node dependencies

└── README.md # Project documentation

Technologies Used

- Frontend: React.js

- Backend: Flask (Python)

- Machine Learning: TensorFlow / Keras (CNN)

- Image Processing: OpenCV, NumPy

- Testing: Python unit & integration tests

- Calibration Model: Colorimetric regression model

Dataset

This project uses a publicly available fruit freshness dataset from Mendeley Data:

https://data.mendeley.com/datasets/bdd69gyhv8/1

The dataset is not included in this repository due to size limitations.

To reproduce the model:

1. Download the dataset from the link above.

2. Place it inside a /dataset folder.

3. Run trainmodel.py.

Model & Calibration Files

The trained CNN model (.keras) and calibration model (.pkl) files are excluded from this repository due to GitHub size limitations.

To regenerate:

1. Run trainmodel.py to retrain the CNN model.

2. The calibration model will be generated automatically during training.

Installation

Prerequisites Python 3.x Node.js and npm TensorFlow Flask

Backend Setup

  1. Navigate to the backend directory: cd backend
  2. Install the required Python packages: pip install -r requirements.txt

Frontend Setup

  1. Navigate to the src directory: cd src
  2. Install the dependencies: npm install

How to Run

Backend Run the Flask server: python app.py

Frontend Start the React development server: npm start

Access the Application

Once both the backend and frontend servers are running, you can access the web application at: http://localhost:3000

Testing

The /testing directory contains unit, integration and system test scripts to validate different components of the application.

Model Performance

- Classification: Fresh vs Rotten

- Test Accuracy: 99.56%

- Model: Convolutional Neural Network (CNN)

- Calibration: Colorimetric analysis provides a concentration percentage reflecting freshness or deterioration

Results

The uploaded food image is classified as Fresh or Rotten using a trained CNN model.

A concentration percentage based on colorimetric analysis is also provided to indicate spoilage level.

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages