ECO-pytorch icon indicating copy to clipboard operation
ECO-pytorch copied to clipboard

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

Open Liquor520 opened this issue 3 years ago • 2 comments

`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!

Liquor520 avatar Apr 19 '21 03:04 Liquor520

Yes,I have the same problem

zkyunqi avatar Apr 20 '21 10:04 zkyunqi

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

Liquor520 avatar Apr 20 '21 10:04 Liquor520