liigoQi / DATA620004-MidtermPJ

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Midterm Project - Task 1

Pengwei Song & Yifan Qi

Model & Dataset

We use ResNet-34 for image classification on CIFAR-100. When you train or test the model for the first time, CIFAR-100 will be downloaded automatically.

Training

The training and testing should be operated in the resnet folder. Here is an example command to begin training:

python train.py --lr 0.005 --weight_decay 0.001 --epochs 25 --batch_size 32 --data_aug mixup 

Parameters:

  • lr: learning rate (default: 0.01)
  • weight_decay: regularization parameter (default: 0.0001)
  • epochs: number of epochs to train (default: 10)
  • batch_size: (default: 32)
  • data_aug: method of data augmentation, chosen from cutout, mixup, cutmix and None (default: None)
  • tuning: parameters adjusting mode, 0 for False and 1 for True. (default: 0)

After training, the model is saved in model folder with name showing data augmentation methods. Performance of models is shown in our report.

Testing

python test.py --data_aug mixup

A trained model will be loaded and the accuracy of the whole test set will be printed. Necessary model must be downloaded into model folder or generated by training before testing.

Visualization

The visualization of three images and results of data augmentation methods (cutout, mixup and cutmix) can be obtained using visualization.py. Results is shown in our report.

About


Languages

Language:Python 100.0%