Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The effect of softmax loss and rank loss #6

Open
QQQYang opened this issue Aug 29, 2017 · 21 comments
Open

The effect of softmax loss and rank loss #6

QQQYang opened this issue Aug 29, 2017 · 21 comments

Comments

@QQQYang
Copy link

QQQYang commented Aug 29, 2017

When training the APN layers, it seems that rank loss tries to make the three scale softmax losses listed in descending order and enlarge the gap among them. On the contrary, when training the convolutional/classification layers only with sum of softmax losses, softmax loss of every scale tends to be equal, which means that the gap among them is narrowed.

Is this reasonable for training? Although every training stage only updates corresponding parameters, I still have doubt whether these two stages will cancel each other.

@ZBYuan0813
Copy link

The source code do not have rank loss, can you tell me where I can get the rank loss, or can you send me the rank loss ? Thanks a lot.

@QQQYang
Copy link
Author

QQQYang commented Nov 25, 2017

@zanghao2 Here is a simple implementation. Hope it helps. https://gist.github.com/QQQYang/e535f336813b44d72d3b1d6184bf4586

@chenfeima
Copy link

@QQQYang Hello,I want to retrain the project, but my ability is very low. Are you willing to help me?Sharing your train.prototxt? Thank you very much!

@QQQYang
Copy link
Author

QQQYang commented Nov 27, 2017

@chenfeima This is my train_cnn.prototxt. But I have not achieved good performance on my own dataset. Maybe it needs some fixes. If you find some errors in the prototxt file, please keep me informed. Thank you.
https://gist.github.com/QQQYang/3b8b564554c02fc55325dc026747bdb6

@chenfeima
Copy link

@QQQYang Thank you very much! The RankLoss whether is https://gist.github.com/QQQYang/e535f336813b44d72d3b1d6184bf4586 ? If not I also need your RankLoss. My own train_prototxt and rankloss is very bad, only get 77% accuary on cub200 by scale1+2.

@QQQYang
Copy link
Author

QQQYang commented Nov 28, 2017

@chenfeima I have updated the prototxt file to keep consistent with the RankLoss above. You can check the train.prototxt again.

@chenfeima
Copy link

@QQQYang Tank you very much!

@chenfeima
Copy link

@QQQYang I have down this: 1. Fix the apn net, optimize by softmaxloss. 2. Fix conv/fc, optimize by your RankLoss. 3. Fix the apn net, optimize by softmaxloss. I only get 0.8% acc improvement in scale2. Whether my strategy is wrong? What about your strategy and result? Whether the RankLoss is not perfect?

@QQQYang
Copy link
Author

QQQYang commented Nov 30, 2017

@chenfeima My strategy is the same with you. I did not test on public datasets, but got poor performance on my own dataset. The RankLoss is written according to the original paper and passed the gradient test. Maybe there is something wrong with my RankLoss. I did not debug this project for a time.

@cocowf
Copy link

cocowf commented Dec 28, 2017

@QQQYang Is it necessary that I compile the attentioncrop layer and rank loss in my own caffe firstly ,secondly I can use train.prototxt?

@QQQYang
Copy link
Author

QQQYang commented Dec 29, 2017

@cocowf Yes, you have to compile them first on Linux. Feel free to use the train.prototxt.

@chenfeima
Copy link

@QQQYang Hello!How you adjust the parameters when you optimize APN by RankLoss?(ek, margins, learning rate). When stop optimize APN by RankLoss, and change to optimize scale2 by softmax loss?

@QQQYang
Copy link
Author

QQQYang commented Jan 2, 2018

@chenfeima I did not spend much time on adjusting hyperparameters. So I cannot give any advice. What I have done is preparing two train.prototxt with different learning rate respectively. In each prototxt file, I adopted similar parameters and strategy as traditional networks, like learning rate decay, fixed margin. When training the whole network, these two files are used alternately.

@cocowf
Copy link

cocowf commented Jan 2, 2018

@QQQYang when I trian my own data,rank loss is increasing ,loss1,2,3 and accuracy shake steady.I want to know your learning rate and how to change margin .In addtion,is it comvenient for you to leave another contact,such as QQ .my qq is 597512150

@felix-duan
Copy link

felix-duan commented Jan 27, 2018

@QQQYang HELLO, why I think your rankloss is not consistent with the original paper? Pred[label[i]+i×dim+dim/3×j]- Pred[label[i]+i×dim+dim/3×(j+1)]

@lhCheung1991
Copy link

@QQQYang
Thanks for your contribution to implementing the Rank Loss. Have your re-implement the result on the paper? Or you just trained on your own dataset?

@QQQYang
Copy link
Author

QQQYang commented Mar 6, 2018

@lhCheung1991 I just tested on my own dataset.

@lhCheung1991
Copy link

@QQQYang
OK. Could you share the alternating-training script for RA-CNN. I will very appreciate.

@zhangjian0826
Copy link

@QQQYang I am trying to train the RACNN, could you send me the rank_loss?
I think the loss is not correct. https://gist.github.com/QQQYng/e535f336813b44d72d3b1d6184bf4586

@meanqqq
Copy link

meanqqq commented Jul 22, 2018

Hello, I have added the rank_loss2_layer you provided to the RACNN provided by the original author, but even after training many times, the loss has not changed. Have you solved this problem?

@lmy418lmy
Copy link

I can't download the source code,can you send me the source code with caffe?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

9 participants