eslam_fouda:

I would also like to know when I resume training algorithm like yolov3 with darknet backbone should I use model.load_weights(darknet weights) or use model.load_state_dict(checkpoint[‘model’])


I don’t know, how load_weights is defined, as it’s not an nn.Module method so I assume it’s a custom darknet method?



 eslam_fouda:

and what this should do with this piece of code:


This code snippet freezes some weights for 20 epochs. I would guess you would have to keep these weights frozen until the model was trained for 20 epochs. Depending when the model was saved (before or after reaching 20 epochs) you might need to add it.



 eslam_fouda:

RuntimeError: Input type (torch.FloatTensor) and weight type (torch.cuda.HalfTensor) should be the same


This error points to a device mismatch, so make sure the input tensor is on the GPU via:
input = input.to('cuda:0') # change 'cuda:id' to the desired GPUid