This repository contains two separate web applications for detecting bacterial infections in fruits using image classification:
-
Microscopic Images:
This app is designed to classify bacterial infections using microscopic images of fruit samples. -
Macroscopic Images:
This app focuses on classifying infections using macroscopic images of fruits.
Both applications can classify images into one of seven categories, including five types of bacterial infections, a healthy class, and an unknown class:
- Streptococcal
- Staphylococcus
- E. coli
- Klebsiella
- Pseudomonas
- Healthy
- Unknown
The model was trained specifically on images of three fruits:
- Green Apple
- Tomato
- Strawberry
The application combines VGG19 and Vision Transformer (ViT) models to produce accurate classification results.
To set up this project on your local machine, follow these steps:
- Clone the repository
git clone https://github.com/A1pha-Z3r0/FMD.git cd FMD - Set up a virtual environment (optional but recommended)
python3.10 -m venv venv source venv/bin/activate # On Windows, use `venv\Scripts\activate`
- Install the dependencies
pip install -r requirements.txt
- Download the necessary model files
Before running either project, download the model files:
Note: If the bash script doesn't download the models, you can manually download them using the link below and place them in the appropriate directory: **Link:**https://drive.google.com/drive/folders/19BDQ2pEjPD47Y6qnieiKriKlTA_kTRbf?usp=drive_link
bash download_models.sh
- Download Model Files After downloading, ensure that you adjust the model file paths in the app.py files as necessary to match your directory structure.
To use the web application:
- Navigate into any of the directory
- Run the FastAPI server
uvicorn app:app --reload
- Access the web app Open your web browser and navigate to http://localhost:8000
- Upload images for classification The microscopic model has higher accuracy on microscopic images. The macroscopic model has higher accuracy on macroscopic images
- Microscopic App: Classifies microscopic images into 7 categories, including 5 bacterial infections.
- Macroscopic App: Classifies macroscopic images into the same 7 categories.
- Combined Models: Utilizes both VGG19 and Vision Transformer (ViT) models for enhanced accuracy.
- Easy Setup: Built using FastAPI for a simple and quick setup process.
- User-Friendly Interface: Easy-to-use web interface for uploading images and viewing results.