You are on page 1of 2

1. Train your own CNN models using MNIST training data and check accuracy on test data.

2. Please download DogCat dataset at the link below. Then, complete custom dataset code
“DogCatDataset” (see below) using the filename and attached “test.csv” file. At that time, split the
training data to training and validation data on your own. Finally, train a CNN model using
training/validation data (Use “3_cnn_imagenet.py” in the attached files). Print train/val/test accuracy
and error graphs in every epoch.

https://www.kaggle.com/competitions/dogs-vs-cats

class DogCatDataset(data.Dataset):

def __init__(self, root, split='train', transform=None, target_transform=None):

# TODO:

def __getitem__(self, index):

# TODO:

def __len__(self):

# TODO:

3. Store the model with the highest validation accuracy (pth) and save the test accuracy of that
model.

4. Compare the performance with and without data augmentation.

5. Compare the performance with and without the pre-trained ResNet18 model attached
“pretrained_resnet18.pth”. You will need to update the model using the DogCat training/validation
data. At this time, you will need to change the number of class because the pretrained model was
trained with the data including 1000 classes. Please refer the code below.

model = ResNet(BasicBlock, [2, 2, 2, 2], num_classes=2)

...

state_dict = torch.load(args.pretrained_model)

# Need to do something here.

model.load_state_dict(state_dict)
* do not set num_classes=1000

You might also like