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 loss of classification network doesn't decrease #1

Closed
kevinlee9 opened this issue Jun 3, 2018 · 9 comments
Closed

the loss of classification network doesn't decrease #1

kevinlee9 opened this issue Jun 3, 2018 · 9 comments

Comments

@kevinlee9
Copy link

When I trained the classification network(using both pretrained vgg and resnet weights), the loss didn't decrease succesfully using given hyperparamters. For example, the loss of vgg network vibrated around 0.24 after 1k iters, I also tried the learning rate of 0.01, it also failed. Could you give me some suggestions? Thanks~

@jiwoon-ahn
Copy link
Owner

Hi kevenlee,
I'm not sure what causes the problem, but I recommend you to double-check you have loaded the pretrained weights properly. Instead using vgg16_20M.caffemodel, you may try this file to initialize VGG network.

@yangyu12
Copy link

Hi @jiwoon-ahn
I just wonder what's the difference between vgg16_20M.caffemodel and the model you provided in this issue. And where's this model originally from?

@jiwoon-ahn
Copy link
Owner

I just converted vgg16_20M.caffemodel to PyTorch format. The weights are exactly the same.

@jiwoon-ahn jiwoon-ahn reopened this Oct 22, 2018
@yangyu12
Copy link

Thanks for reply. I've tried both pretrained models. The loss decreases normally in both case. This code really works well.

@LeiyuanMa
Copy link

I tried with two gpus, learing rate 0.01 and batch size 6,the code works fine,so May I ask how many gpus are you using?and could you provide the parameter for resnet?

@Yinyf0804
Copy link

Hi @jiwoon-ahn
I have met the same problem that the loss of vgg network vibrated around 0.24 after 1k iters, then I try to download the model you provided in this issue, but I don't have the right to download it.
Could you give me some suggestions? Thanks!

@Yinyf0804
Copy link

Hi @kevinlee9
How did you finally solve the problem?

@kevinlee9
Copy link
Author

Hi @kevinlee9
How did you finally solve the problem?

I tried the weights file provided by ahn, then loss decreased.

@Kobusvdwalt
Copy link

Kobusvdwalt commented Nov 10, 2021

To save the next guy some time:

If you don't want to set up caffe you can do this :

  1. Get the caffe weights from https://www.cs.jhu.edu/~alanlab/ccvl/init_models/
  2. Convert the weights to pytorch format with https://github.com/vadimkantorov/caffemodel2pytorch
  3. Change the loading script to load the pytorch weights

weights = torch.load('vgg16_20M.caffemodel.pt')
weights_dict = {}
for key in weights.keys():
if '.bias' in key:
weights_dict[key] = torch.squeeze(weights[key])
else:
weights_dict[key] = weights[key]

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

6 participants