- Python 3.9.18
- Anaconda (Make sure you are in an environment with the correct python version)
- Run
conda create -n python=3.9.18 yourenv pip
to create an environment with pip installed. - Run
conda activate yourenv
to activate your virtual environment. - (While at the root of the project directory) Run
pip install -r requirements.txt
to install the necessary dependencies.
-
In the
model_training
directory, you can find theimage_data
folder. This is where the dataset is stored. You can view it and add your own data. Just make sure to follow the same folder structure. -
You can run the
train_classifier.ipynb
to train your own data. You can also change some parameters, such as the epoch, image dimension, etc., in the Jupyter notebook. -
Important: After running the Jupyter notebook, two files will be generated:
resnet_model.h5
andclass_names.json
. If you train your own data, you need to relocateresnet_model.h5
to the root of theapplication
folder and transferclass_names.json
to/applications/configurations
Reminders: Before running the application, ensure that you have the generated resnet_model.h5
from the model training on the root directory of the application folder. Moreover, make sure that class_names.json
is available in the configurations folder.
Activate your anaconda environment first by inputting the following command into the terminal:
conda activate yourenv
Go to the application
directory in the terminal through (assuming your terminal working directory is the root directory of the project folder):
cd application
To run the application, input the following command in the terminal:
python main.py
application
: Contains the files for running the applicationmodel_training
: Contains the files for training the ResNet50 image classification model.
- The
utils
directory contains the helper classes. - The
configurations
folder contains the class which for the application configurations which you can modify.
- UseApi: Class for calling the API Ninjas which is used to obtain data about nutritional facts
- UseModel: Class to load the image and make predictions using the trained model.
- ModelConfig: Class for modifying applications configurations, such as the dimensions of the image.