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

Use the pretrained model to initialize the weights of ECO's 2Dnet and 3Dnet #65

Open
Liquor520 opened this issue Apr 19, 2021 · 2 comments

Comments

@Liquor520
Copy link

`model_dict = self.state_dict()

    pretrained_on_kin = torch.utils.model_zoo.load_url(weight_url)
    new_state_dict = {k[18:]: v for k, v in pretrained_on_kin['state_dict'].items() if k[18:] in model_dict}
    

    # init the layer names which is not in pretrained model dict
    un_init_dict_keys = [k for k in model_dict.keys() if k not in new_state_dict]

    print(un_init_dict_keys)

    std = 0.001
    for k in un_init_dict_keys:
        new_state_dict[k] = torch.DoubleTensor(model_dict[k].size()).zero_()
        if 'weight' in k:
            normal(new_state_dict[k], 0, std)
        elif 'bias' in k:
            constant(new_state_dict[k], 0)

    self.load_state_dict(new_state_dict)

`

In this part, the author uses a model trained on other data sets to initialize some parameters of ECO. Since I didn't get this model, I trained directly.The above code was directly deletedby me. During the training process, my loss sometimes drops and sometimes rises. Is this normal? Maybe the loss value should keep dropping? I want to know what the loss and accuracy of the model should be when it is trained correctly?Hope to get help from you .

By the way, if anyone can provide the above pre-trained model, I would be very grateful!

@zkyunqi
Copy link

zkyunqi commented Apr 20, 2021

Yes,I have the same problem

@Liquor520
Copy link
Author

Yes,I have the same problem
If you don't mind, maybe we can talk about it. Qq:253878404

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

2 participants