I implemented the second problem: "Run validation of the model every few training epochs on validation or test set of the dataset and save the model with the best validation error."
Basically I refactored the orignal imagenet_finetune.py
.
config.py
: contains the config of fine tuningdataloader.py
: a wrapper class that allows easy cifar-10 data loadingimagenet_finetune.py
: contains the logic of fine tuninginference.py
: contains convenient functions to do validation on train/test data set for given modelresnet50cifar.py
: contains the definition of the NN model
To do fine tuning with validation on train/test set and saving models, just run
python imagenet_finetune.py
It will output logs about errors and save the models including the best one. Finally it will output which epoch gives you the best model.
I plot a graph showing loss & accuracy of different epochs.