Simple deep learning templates. Presented by Laboratory of Analytics on Knowledge Engineering (LAKE).
簡單好用的深度學習訓練模板
The framework / template is mainly built upon three components: Trainer
, Updater
, and Validator
.
- Trainer: Manages the overall training process, including initialization, progress tracking, and coordinating between the updater and validator.
- Updater: Handles network weight updates during training, with customizable update functions for different optimization strategies.
- Validator: Evaluates model performance on validation data, providing metrics to assess training progress.
The architecture is designed for flexibility, allowing users to easily customize or extend each component. This structure supports efficient development and experimentation with various neural network models and training approaches.
- Install PyTorch and clone this repo by running
git clone https://github.com/kevinkevin556/deeplake.git
- (manual) Install dependencies:
monai[pydicom]
,ruamel.yaml
,tqdm
,loguru
,tensorboard
,dicom2nifti
,opencv-python
,jsonargparse[omegaconf]
- We utilize jsonargparse to generate a easy-to-use CLI automatically.
- (pip) Or run the following command in the terminal to install requirements
pip install -r requirements.txt
🔥 To train the models, run this command:
python train.py --config <path_to_config_file>
🔥 To evaluate the model, run:
python test.py --config <path_to_config_file>
📋 See the example [lenet06] train-cli.py
in notebooks to build your own training/testing CLI.
This project is setup as a package which means you can now easily import any file into any other file like so:
from deeplake.modules.base.trainer import BaseTrainer
from deeplake.modules.base.updater import BaseUpdater
from deeplake.modules.base.validator import BaseValidator
lenet = LeNet5().cuda()
validator = BaseValidator(metric=batch_acc)
updater = BaseUpdater()
trainer = BaseTrainer(max_iter=1000, eval_step=334, validator=validator)
# train
trainer.train(
module=lenet,
updater=updater,
train_dataloader=train_dataloader,
val_dataloader=val_dataloader
)
# test
validator.validation(module=lenet, dataloader=test_dataloader)
📋 See notebooks [lenet01-05] to use this framework as a package.
- Segmentation Models (smp)
- Monai
- SDUNet: A Spatial Deformable Kernel-based U-Net