This code is part of a project developed for the course "Procesamiento de Imágenes Digitales" (Digital Image Processing) at the University of Seville. We trained a ResNet model on an augmented version of the Stanford Cars dataset with Spanish car models.
First, run the following command to install the required dependencies:
pip install -r requirements.txtTo prepare the dataset, run the following command:
python scripts.prepare_datasetThis assumes you have Kaggle API credentials set up. In order to set them up,
- Create an account on Kaggle if you don't have one (https://www.kaggle.com)
- Go to your profile → Account → Create New API Token
- You will download a
kaggle.jsonfile - Create a directory
.kagglein the project root:
mkdir .kaggle- Move the
kaggle.jsonfile to the.kaggledirectory:
mv /path/to/kaggle.json .kaggle/To check that the dataset has been prepared correctly, run the following command:
python scripts.check_datasetYou can launch a training session with the following command:
python -m scripts.train --experiment <exp_name>The details about experiments can be found in lib/experiment.py.
You must have a trained checkpoint to run inference. You can run the following command to start a Streamlit app for inference:
streamlit run app.py -- <resnet_number> <trained_path>For instance, you can run the following command to start a Streamlit app for inference with ResNet-18:
streamlit run app.py -- 18 ./resnet18.pthwhere <resnet_number> is the number of the ResNet model you want to use (currently, only 18 and 50 are supported) and <trained_path> is the path to the trained checkpoint file.