dbolya / yolact

A simple, fully convolutional model for real-time instance segmentation.
MIT License
5.01k stars 1.32k forks source link

Transfer Learning #324

Open saisubramani opened 4 years ago

saisubramani commented 4 years ago

Can i apply Transfer Learning on this model?

first i had trained the model with 6 classes now i want to add 2 extra classes on the trained weights.
2.If its possible please guide me . i am looking towards it.

i tried and i got the error?

File "train.py", line 504, in
train()
File "train.py", line 207, in train
yolact_net.load_weights(args.resume)
File "/home/ubuntu/efs_model/models/YOLACT/yolact-master/yolact.py", line 490, in load_weights
self.load_state_dict(state_dict)
File "/home/ubuntu/anaconda3/lib/python3.6/site-packages/torch/nn/modules/module.py", line 777, in load_state_dict
self.class.name, "\n\t".join(error_msgs)))
RuntimeError: Error(s) in loading state_dict for Yolact:
size mismatch for prediction_layers.0.conf_layer.weight: copying a param with shape torch.Size([24, 256, 3, 3]) from checkpoint, the shape in current model is torch.Size([9, 256, 3, 3]).
size mismatch for prediction_layers.0.conf_layer.bias: copying a param with shape torch.Size([24]) from checkpoint, the shape in current model is torch.Size([9]).
size mismatch for semantic_seg_conv.weight: copying a param with shape torch.Size([7, 256, 1, 1]) from checkpoint, the shape in current model is torch.Size([2, 256, 1, 1]).
size mismatch for semantic_seg_conv.bias: copying a param with shape torch.Size([7]) from checkpoint, the shape in current model is torch.Size([2]).
abhigoku10 commented 4 years ago

@saisubramani you can do that , you have to give the data of the previous 6 classes for training along with additional 2 classes . there is some issue while loading ur pretrained model you have to specify the size of the class and input properly

saisubramani commented 4 years ago

@saisubramani you can do that , you have to give the data of the previous 6 classes for training along with additional 2 classes . there is some issue while loading ur pretrained model you have to specify the size of the class and input properly

thanks for the reply @abhigoku10 , Can i know bit clear explanation as i am beginner to this field. i understood that i want to give the dataset of all 8 classes? and what that means size of the class and input properly ?

dbolya commented 4 years ago

You're almost there, you just need to make this change: #36

saisubramani commented 4 years ago

You're almost there, you just need to make this change: #36

ok i will work it out and reply soon, thanks for the reply @dbolya