weihua93 / DFL-CNN

This is a pytorch re-implementation of Learning a Discriminative Filter Bank Within a CNN for Fine-Grained Recognition

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

DFL-CNN : a fine-grained classifier

This is a simple pytorch re-implementation of CVPR 2018 Learning a Discriminative Filter Bank Within a CNN for Fine-Grained Recognition.

Introduction:

This work still need to be updated. The features are summarized blow:

  • Use VGG16 as base Network.
  • Dataset CUB-200-2011, you can split trainset/testset by yourself.Or you can download dataset which has been split directly from BaiduYun Link.
  • This work has been trained on 4 Titan V after epoch 120 with batchsize 56, Now I got best result Top1 85.140% Top5 96.237% which is lower than author's. You can download weights from weights.
  • Part FCs is replaced by Global Average Pooling to reduce parameters.
  • Every some epoches, ten best patches is visualized in vis_result directory, you can put images you want to visualize in vis_img named number.jpg.
  • Update: ResNet-101 DFL-CNN and Multi-scale DFL-CNN need to be done.

Algorithms Introduction:

Display

Display

Results and Visualization of ten boxes for discriminative patches:

  • This work has been trained on 4 Titan V after epoch 120 with batchsize 56, Now I got best result Top1 85.140% Top5 96.237% which is lower than author's. You can download weights from weights. If use TenCrop transform in code, result can improve further.

  • Test Results:

  • Visualization:

Usage:

  • Download dataset, you can split trainset/valset by yourself
wget http://www.vision.caltech.edu/visipedia-data/CUB-200-2011/CUB_200_2011.tgz
  • Or you can directly get it from BaiduYun Link
  • Then link original dataset to our code root/dataset
 ln -s ./train path/to/code/dataset/train 
 ln -s ./test  path/to/code/dataset/test
  • Finally, Train and Test.
  • Check you GPU resources and modify your run.sh.
sh run.sh

Note:

  1. Visualization of ten best boxes is saved in vis_result/, img you want to visualize should be put in vis_img/.
  2. Weight(checkpoint.pth.tar, model_best.pth.tar) is in weight/.
  3. Loss info is saved in log/.

About

This is a pytorch re-implementation of Learning a Discriminative Filter Bank Within a CNN for Fine-Grained Recognition

License:MIT License


Languages

Language:Python 99.5%Language:Shell 0.5%