- 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 pipto create an environment with pip installed. - Run
conda activate yourenvto activate your virtual environment. - (While at the root of the project directory) Run
pip install -r requirements.txtto install the necessary dependencies.
-
In the
model_trainingdirectory, you can find theimage_datafolder. 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.ipynbto 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.h5andclass_names.json. If you train your own data, you need to relocateresnet_model.h5to the root of theapplicationfolder and transferclass_names.jsonto/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
utilsdirectory contains the helper classes. - The
configurationsfolder 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.