Coder Social home page Coder Social logo

songdejia / dfl-cnn Goto Github PK

View Code? Open in Web Editor NEW
266.0 4.0 52.0 2.12 MB

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

License: MIT License

Python 99.50% Shell 0.50%
pytorch fine-grained-classification dfl-cnn cub-200-2011 classifier cnn discriminative cvpr2018

dfl-cnn's People

Contributors

songdejia avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

dfl-cnn's Issues

wierd result on my dataset

the train and test process is right on CUB200_2011. the test result is 78%

but the test result is wrong on my dataset, it seem to right rate between top1(33%) and top5(40%), i have no idea why top5 is always 40%? my dadaset have 20 classes.

怎么调整权重?

我在两块Titan xp上,epoch120,batchsize14,效果不好,还有作者给的权重,怎么直接用?初学者,问题有点多,求解答~~

Some issue about non-random Initialization and accuracy when reproducing your work

Hi, thanks for your kind work for implementing the CVPR18 paper DFL-CNN for the community. I notice that your code did not implement the non-random initialization part which the authors claimed it was very important. I found some similar issues like mine, and can I discuss some ideas about non-random initialization with your? In the original paper, the author first calculate the conv4_3 feature map and got C * H * W feature maps. Then they calculated l2-norm along the channel dimension and got H * W heat map. If I did not understand wrongly till now, how should I understand their following operations: for each class i, obtain the initialization weights for k 1 * 1 conv filters by non-maximium suppression and k-means? Does it mean the author first calculate the feature maps of all images in the training set and obtain C_k heat maps per class and performance non-maxium suppression and k-means over the peak regions in the C_k heat maps?

Furthermore, when I ran your code, I only got 56.6% test accuracy in the test set, I did not know what the problem was and it really confused me for a couple day, could you please help me tackle it?

Thanks for your job!

Receptive field calculation to get patch

Hi @songdejia ,

First of all great repo 👍 I am a little confused in this part of code.
p_tl = (8*col, 8*row) p_br = (col*8+92, row*8+92)

I believe this comes from the paper "the output of the 10th convolutional layer conv4_3 represents patches as small as 92 × 92 with stride 8paper ". I didn't get how the author arrive here?
Maybe a novice question but your help is appreciated.
Thanks

Problem downloading the weights

Can someone share the weights via other media (via google drive/dropbox)? Not able to download from the Baidu site. Thanks

关于代码完整性

hi there,
im quite interested in your work and i have try your code some days ago, however, i cant get the same result as the that in the paper.
These days, i notice that you are rebuilding your code these days, would u plz inform me how soon can you finish it? I`m just cant wait to try it.
Thanks a lot!

Ian

Overfitting problem

Hello,

I cloned your repo and downloaded your dataset, but I could not get the same result as yours.

I train the model on 4 GeForce GTX 1080 Ti GPUs, and keep other arguments as the same. But it turns out to be overfitting.

After 100 epochs, I got prec@1 at 99% and prec@5 at 100% on the train set, but only prec@1 at 48% and prec@5 at 73% on the test set.

Here is part of the log:

DFL-CNN <==> Train <==> Epoch: [113][103/107]
Loss 0.5459 (0.5661)	Loss1 0.0756 (0.0739)	Loss2 0.0004 (0.0289)	Loss3 4.6985 (4.6324)
Prec@1 (99.880)	Prec@5 (100.000)
DFL-CNN <==> Train <==> Epoch: [113][104/107]
Loss 0.5188 (0.5656)	Loss1 0.0508 (0.0737)	Loss2 0.0076 (0.0287)	Loss3 4.6041 (4.6321)
Prec@1 (99.881)	Prec@5 (100.000)
DFL-CNN <==> Train <==> Epoch: [113][105/107]
Loss 0.5771 (0.5657)	Loss1 0.0774 (0.0737)	Loss2 0.0189 (0.0286)	Loss3 4.8082 (4.6338)
Prec@1 (99.882)	Prec@5 (100.000)
DFL-CNN <==> Train <==> Epoch: [113][106/107]
Loss 0.8110 (0.5672)	Loss1 0.3277 (0.0753)	Loss2 0.0100 (0.0285)	Loss3 4.7324 (4.6344)
Prec@1 (99.883)	Prec@5 (100.000)
DFL-CNN <==> Test <==> Epoch: [ 106] Top1:48.050% Top5:73.093%
DFL-CNN <==> Test <==> Epoch: [ 108] Top1:48.913% Top5:73.404% 
DFL-CNN <==> Test <==> Epoch: [ 110] Top1:47.515% Top5:72.575%
DFL-CNN <==> Test <==> Epoch: [ 112] Top1:48.205% Top5:72.765%

During training the model, overfitting problem is inevitable. Because there are only about 6000 images for training, but there are too many parameters in VGG16.

Have you ever met the overfitting problem? And how did you get rid of it?

Looking forward to your reply!

Thank you very much!

TypeError: __init__() got an unexpected keyword argument 'pretrained'

DFL-CNN <==> Part1 : prepare for parameters <==> Begin
DFL-CNN <==> Part1 : prepare for parameters <==> Done
DFL-CNN <==> Part2 : Load Network <==> Begin
Traceback (most recent call last):
File "main.py", line 180, in
main()
File "main.py", line 91, in main
model = DFL_VGG16(k = 10, nclass = 200)
File "/home/steven/Documents/test/DFL-CNN/model/DFL.py", line 13, in init
vgg16featuremap = torchvision.models.vgg16_bn(pretrained=True).features
File "/usr/local/lib/python3.5/dist-packages/torchvision/models/vgg.py", line 130, in vgg16_bn
return VGG(make_layers(cfg['D'], batch_norm=True), **kwargs)
TypeError: init() got an unexpected keyword argument 'pretrained'

Hello dejia
when I reappearance your code this error happened ,Where is the problem?

If you get the best result, I need your help☺️

Thanks for clicking into this issue!

If you get 85.14% as the final accuracy, as reported in the homepage, would you please share the loss value when the program reached the best result, the initial learning rate, and the transform of the data?😊😊

I only get 78.6% at best. Every time I run my program, it seems like I will get random results, ranging from 74.0% ~ 78.6%.

The updates I have done:
Resnet-50 based model & no-random initialization

About the version of pytorch

I think my pytorch version is not the same as your work, so I can not get your result of 85.14%. I just get 70%. Can you tell me the version of pytorch which you use for this code?

关于正确率

你好,这个代码得到了与论文中一致的结果吗?

None-random initialization

have reading paper and the source code, i find initialization don't contain none-random initialization part. Does it exist? :-)
And how much accuracy will loss if don't do none-random initialization? Thank you ~

what are the training hyper parameters to get top1 acc>0.87?

What are the training hyper parameters to get top1 acc>0.87, like batch, lr strategy? and how many epochs do you run?
I can only get 0.83 on the CUB_200_2001. I divided the data sets to 70% training, 30% validation.
Please do not close the issues so fast.
Thanks.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.