You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I found that the accuracy of the prediction when I loaded the model was inconsistent with the accuracy when I trained it. I think there is a problem with the code part
def save_checkpoint(state, is_best, filename='checkpoint.pth.tar'):
"""
Save the training model
"""
if(is_best==1):
torch.save(state, filename)
is_best needs to make a judgment,Otherwise, the last weight will be saved
Further modifications are needed
if epoch > 0 and epoch % args.save_every == 0:
save_checkpoint({
'epoch': epoch + 1,
'state_dict': model.state_dict(),
'best_prec1': best_prec1,
}, 1, filename=os.path.join(args.save_dir, 'checkpoint.th'))
I found that the accuracy of the prediction when I loaded the model was inconsistent with the accuracy when I trained it. I think there is a problem with the code part
def save_checkpoint(state, is_best, filename='checkpoint.pth.tar'):
"""
Save the training model
"""
if(is_best==1):
torch.save(state, filename)
is_best needs to make a judgment,Otherwise, the last weight will be saved
Further modifications are needed
if epoch > 0 and epoch % args.save_every == 0:
save_checkpoint({
'epoch': epoch + 1,
'state_dict': model.state_dict(),
'best_prec1': best_prec1,
}, 1, filename=os.path.join(args.save_dir, 'checkpoint.th'))
The text was updated successfully, but these errors were encountered: