Welcome to our repo for our project for Applied machine learning project.
Our project is to train an model to approximate depth data from RGB images in a tilling pattern.
Make sure you have the following software and tools installed:
- Conda: Conda is used for dependency management. This tools is a standard for a lot of machine learning libraries and has support for pip packages as well. "conda install --yes --file conda_requirements.txt"
- python 3.11: a tested version of python that this repository works in.
- Clone this repository.
- Get the training and validation data and place in the data folder in the project_name folder.
- Create conda environment with python 3.11
- Install the packages from "conda_requirements.txt" using the command under.
conda install --yes --file conda_requirements.txt- Install pytorch using the command from their website.
- Download the model from the release page and place it in the root folder of the repository
Both the commands below should be ran in the root folder of the repository
python main.py --epochs (amount epoch) --batch-size (batch size) --lr (learning rate) --freeze (amount before freeze) cnnpython main.py evaluate (model file name with extension) --batch-size (batch size)- Run the following command in the root directory of the repository.
uvicorn FastAPI:app --reload- In a new tab in the terminal, run the following, replacing image_path.jpg with the path and file name for the input image:
curl -X 'POST' \
'http://127.0.0.1:8000/predict_depth/' \
-H 'accept: application/json' \
-H 'Content-Type: multipart/form-data' \
-F 'file=@image_path.jpg;type=image/jpeg'
-- output output.png
- Run the following command in the root directory of the repository.
streamlit run streamlit_main.py" when in the main folder of repository.- Follow instruction on the web demo.
To run all the tests developed using unittest, simply use:
python -m unittest discover testsIf you wish to see additional details, run it in verbose mode:
python -m unittest discover -v testsrepository map:
├───.github
│ └────workflows
│ └──── style.yml
├───project_name
│ ├───data
│ │ ├───val_subset # only there when validating
│ │ ├───train_subset # only there when training
│ │ ├───data_loader.py
│ │ ├───data_test.py
│ │ ├───path_grapper.py
│ │ └───subset_maker.py
│ ├───models
│ │ ├───cnn.py
│ │ └───Preprocessing_class.py
│ └───Training
│ ├───Evaluation
│ │ ├───evaluate.py
│ │ └───validation.py
│ └───model_trainer.py
├───tests
│ ├───data
│ ├───features
│ └───models
├───.gitignore
├───cnn_best.pth # download from release page
├───main.py
├───streamlit_main.py
├───FastAPI.py
├───conda_requirements.txt
└───README.md