This is how you should structure your data models.
dataset/
train/
unripe/
unripe_image1.jpg
unripe_image2.jpg
...
semi-ripe/
semi_ripe_image1.jpg
semi_ripe_image2.jpg
...
ripe/
ripe_image1.jpg
ripe_image2.jpg
...
overripe/
overripe_image1.jpg
overripe_image2.jpg
...
test/
unripe/
unripe_image1.jpg
unripe_image2.jpg
...
semi-ripe/
semi_ripe_image1.jpg
semi_ripe_image2.jpg
...
ripe/
ripe_image1.jpg
ripe_image2.jpg
...
overripe/
overripe_image1.jpg
overripe_image2.jpg
...
This works best with NVIDIA GPUs that supports CUDA.
Installation
- Install the required packages
pip install -r requirements.txt
- Install CUDA and cuDNN if you have an NVIDIA GPU
Usage
- Inorder to get accurate results, run trainer.py and strucutre your dataset as shown above
- To run the model on your own dataset, change the path in trainer.py to your dataset path
- To use the trained model replace the model variable as below
from keras.models import load_model # Load the saved model from the .h5 file model = load_model('path/to/model.h5') # Use the loaded model to make predictions predictions = model.predict(data)
Setup
- Open a terminal inside the directory and run the python venv module to create a virtual environment
python -m venv venv
- Activate the virtual environment
- Windows
venv\Scripts\activate
- Linux
source venv/bin/activate
- Windows
- Activate the virtual environment
- Install the required packages
pip install -r requirements.txt
- Install CUDA and cuDNN if you have an NVIDIA GPU (OPTIONAL)
- Run the trainer.py file
cd trainer && python trainer_gui.py
- After training the models you can run the main file
cd .. && python main.py