- download and build dataset
- download example dataset (SIGNS) from google drive here
- build SIGNS dataset:
python build_dataset.py --data_dir data/SIGNS --output_dir data/64x64_SIGNS
- check build_dataset.py for dataset structure and format requirement
- baseline model training
python train.py --data_dir data/64x64_SIGNS --model_dir experiments/base_model
- under experiments directory the base_model directory contain a file params.json, which sets the hyperparameters for the experiment.
- hyperparameters search:
- created a new directory learning_rate in experiments
python search_hyperparams.py --data_dir data/64x64_SIGNS --parent_dir experiments/learning_rate
- Display the results of the hyperparameters search
python synthesize_results.py --parent_dir experiments/learning_rate
- Evaluation on the test set
python evaluate.py --data_dir data/64x64_SIGNS --model_dir experiments/base_model
- build cifar10 dataset
- training on colab
- cs230 example code
Note: in folder
pytorch/vision
.
We recommend reading through train.py
to get a high-level overview of the training loop steps:
- loading the hyperparameters for the experiment (the
params.json
) - loading the training and validation data
- creating the model, loss_fn and metrics
- training the model for a given number of epochs by calling
train_and_evaluate(...)
You can then have a look at data_loader.py
to understand:
- how jpg images are loaded and transformed to torch Tensors
- how the
data_iterator
creates a batch of data and labels and pads sentences
Once you get the high-level idea, depending on your dataset, you might want to modify
model/net.py
to change the neural network, loss function and metricsmodel/data_loader.py
to suit the data loader to your specific needstrain.py
for changing the optimizertrain.py
andevaluate.py
for some changes in the model or input require changes here
Once you get something working for your dataset, feel free to edit any part of the code to suit your own needs.