Code for miniplaces challenge 2017.
Original implementation uses ResNet-34 and achieves op-1 accuracy of 50.2% and top-5 accuracy of 78.8%.
For a detailed explanation of the code within, please refer to the project report.
- The iPython notebooks
Transforms.ipynb
andVisualization.ipynb
are used to generate visuals for the report - The folder
Resnet Code
contains the code used to train and evaluate the modelaccuracy.py
simply calculates the accuracy attained given a target and output vectorfine_tuning_config_file.py
contains constants (like batch size and learning rate)metrics.py
contains code to generate the output file for testingtrain.py
is the meat of the code base, containing code to define and train the modelrunningAvg.py
contains a class to keep track of running averages (for evaluation)test_set.py
contains the test set data loadertrain_set.py
contains the train/validation data loadertester.py
contains code that given a saved model, produces the output.
More information, along with the dataset, can be found at the MiniPlaces Challenge repo.
To train the code and generate a checkpoint each time an epoch is finished, type:
python train.py tr
To produce an output.txt
file containing the properly formatted output file for submission, type:
python train.py test '<path_to_checkpoint>'
This code assumes that the data folder is located outside of this directory at /data
. Checkpoint files will be saved to ../../checkpoint.pth.tar
.
Parts of our code were taken from the following tutorials. Proper citation was given in the write-up.
- Madan, Spandan. "Pytorch Tutorial for Fine Tuning/Transfer Learning a Resnet for Image Classification." https://github.com/Spandan-Madan/Pytorch_fine_tuning_Tutorial
- PyTorch. "ImageNet Training in Pytorch". https://github.com/pytorch/examples/blob/master/imagenet/main.py
- ncullen93. "High-Level Training, Data Augmentation, and Utilities for Pytorch." https://github.com/ncullen93/torchsample