Closed ilkergalipatak closed 2 years ago
just run python3 train.py --weight {previous weights}.pt ...
if you have pretrained weights like some_model/weights/best.pt
, the code below in train.py will catch it.
# Model
pretrained = weights.endswith(".pt")
if pretrained:
with torch_distributed_zero_first(rank):
attempt_download(weights) # download if not found locally
ckpt = torch.load(weights, map_location=device) # load checkpoint
model = Darknet(opt.cfg).to(device) # create
state_dict = {
k: v
for k, v in ckpt["model"].items()
if model.state_dict()[k].numel() == v.numel()
}
model.load_state_dict(state_dict, strict=False)
print(
"Transferred %g/%g items from %s"
% (len(state_dict), len(model.state_dict()), weights)
) # report
else:
model = Darknet(opt.cfg).to(device) # create
just run
python3 train.py --weight {previous weights}.pt ...
if you have pretrained weights likesome_model/weights/best.pt
, the code below in train.py will catch it.# Model pretrained = weights.endswith(".pt") if pretrained: with torch_distributed_zero_first(rank): attempt_download(weights) # download if not found locally ckpt = torch.load(weights, map_location=device) # load checkpoint model = Darknet(opt.cfg).to(device) # create state_dict = { k: v for k, v in ckpt["model"].items() if model.state_dict()[k].numel() == v.numel() } model.load_state_dict(state_dict, strict=False) print( "Transferred %g/%g items from %s" % (len(state_dict), len(model.state_dict()), weights) ) # report else: model = Darknet(opt.cfg).to(device) # create
thank you for answer
Hello. I trained one model with yolor but I want to add one more class my yolor model. I think I need fine tune my model new dataset. I require how to fine tune yolor model? Can you help for this situation?