Boilerplate code for building and prototyping custom models with PyTorch.
Building machine learning models from scratch can be a daunting task. It involves writing a lot of repetitive code for data loading, model architecture, training loops, testing loops, and more. This process can be time-consuming and error-prone, especially for beginners.
TorchCraft aims to solve this problem by providing a boilerplate code for building and prototyping custom models with PyTorch. It provides a structured and modular approach to machine learning model development, allowing for easy customization and reuse.
By using TorchCraft, you can focus more on the unique aspects of your model and less on the boilerplate code. This can significantly speed up your model development process and reduce the chances of errors.
The dataloader
module is responsible for loading and preprocessing the data that will be used to train and test the models. It ensures that the data is in the correct format and is ready to be fed into the models. The main script in this module is data_loader.py
.
The models
module contains the implementation of various machine learning models. Currently, it includes the implementation of a ResNet model (resnet.py
). You can add your custom models in this module.
The utils
module contains several utility scripts that assist in various tasks throughout the module. These include:
- gradcam.py: Implementation of Grad-CAM, a technique for making Convolutional Neural Network (CNN)-based models more interpretable.
- helper.py: Contains helper functions that assist in various tasks.
- plot_metrics.py: Used for visualizing various metrics during or after the training process.
- test.py: Contains the testing loop for the models.
- train.py: Contains the training loop for the models.
To use TorchCraft as a boilerplate for your custom models, follow these steps:
- Clone the repository to your local machine.
- Add your custom models to the
models
module. - If your data loading and preprocessing steps are different, modify the
dataloader
module accordingly. - Update the
train.py
andtest.py
scripts in theutils
module to work with your custom models and data. - Run the
main.py
script to start the training and testing process.
The following diagram represents the interdependencies of the scripts in the repository:
You can edit this diagram online if you want to make any changes.
Contributions are welcome! Feel free to submit a pull request.
This project is licensed under the terms of the MIT license.