Skip to content

Parsaardehali/example_deeplearning_project

Repository files navigation

Example project for training a Deeplearning model using PyTorch

How to install?

  1. Clone the repository
git clone https://github.com/Parsaardehali/example_deeplearning_project.git
cd example_deeplearning_project
  1. Create a virtual environment (recommended)
python3 -m venv venv
source venv/bin/activate
  1. Install dependencies
pip install -r requirements.txt

How to use?

This jupyter notebook gives an overall view of a simple project. Specially for a segmentation task. Example_project.ipynb

How to train the model?

First you need to have some data. You can simulate it by running

python Simulator.py

Adjust the number of images (num_samples) and size of each image (img_size) in the last line of the script to what you need.

Preprocessing and splitting data into train an test sets is done by

python preprocess_split.py

Adjust the split ratio of test data (test_size) in the script to what you need. Default is 0.2.

Set data_dir, train_path and test_path carefully .

We do not do preprocessing here, but you can add it as a function in this script.

To train the model make sure your environment is activated by running

source venv/bin/activate

And to run the training run python main.py --config configs/config_file.json. You can edit the config file to adjust the hyperparameters and paths for training and test datasets.

To set up weights and biases (wandb) check this setup link Play around with loss function, for example using MSE loss instead of Dice loss. You can also try different architectures and optimizers.

How to contribute?

If you have any suggestions or find any bugs, please create an issue or a pull request.

Acknowledgements

  • This repo is highly inspired by Simple-UNet repo that uses only pytorch. -Thanks to Prof. Michael Habeck for motivating me and providing feedback and suggestions.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •