The codes of my CV Project.
My best result (0.67250) won the 7th place in the 'DLUT CV Project 2021: Image Classification' competition.
-
python3.7
-
numpy
-
pytorch1.6
-
torchvision
-
pandas
-
[Optionally] Change line 15~21 in utils/mail.py according to your information. Note that you should comment the line with 'mail' if you don't want to receive the e-mail when your training-process ends.
-
Change data_path in
main.py
and others. -
And then, if you want to run 2.1crop64_Baseline_step160, just
sh experiments/2.1crop64_Baseline_step160.sh
- You can download my best checkpoints
0524_kdMSE_finetune250_pre_Results_step50.pth.tar
with many tricks here.
- train resnet_t (resnet-101) with official pretrained weight, remenber to freeze the layers before
fc
layers with:
# change L130~173:
with torch.no_grad():
x = self.conv1(x)
x = self.bn1(x)
x = self.relu(x)
x = self.layer1(x)
x = self.layer2(x)
x = self.layer3(x)
x = self.layer4(x)
x = self.avgpool(x)
x = x.view(x.size(0), -1)
x = self.fc(x)
Then, you will get the weight of the fc-finetuned model.
You can also download resnet101_fine_fc.pth.tar
here and put it in ./pretrained
.
- train resnet_t (resnet-101) with the pretrained weight you gain below, remenber not to freeze anything to finetune the whole model this time.
# change L130~173:
x = self.conv1(x)
x = self.bn1(x)
x = self.relu(x)
x = self.layer1(x)
x = self.layer2(x)
x = self.layer3(x)
x = self.layer4(x)
x = self.avgpool(x)
x = x.view(x.size(0), -1)
x = self.fc(x)
Then, you will get the weight of the whole finetuned model.
You can also download resnet101_fine_all.pth.tar
here and put it in ./pretrained
.
For convenienceļ¼ I put all the programs you should run in all_in.sh, so just:
sh experiments/all_in.sh
Note that some paths should be changed.
-
Author: Hatimwen
-
Email: hatimwen@163.com