Closed mochechan closed 4 years ago
A solution was found. Add the following code to generate weight files, and use the weights to predict/test.
torch.save(lprnet.state_dict(), os.path.join(save_dir, 'lprnet' + str(total_iters) + '.model'))
torch.save(STN.state_dict(), os.path.join(save_dir, 'stn' + str(total_iters) + '.moodel'))
In my evaluation, the LPRNet weights are fine from pre-trained weights.
lprnet.load_state_dict(torch.load('LPRNet/weights/Final_LPRNet_model.pth', map_location=lambda storage, loc: storage))
STN.load_state_dict(torch.load('LPRNet/weights/Final_STN_model.pth', map_location=lambda storage, loc: storage)
However, the trained weights in checkpoint folder cannot be used.
lprnet.load_state_dict(torch.load(os.getcwd() + '/saving_ckpt/lprnet_Iter_001800_model.ckpt', map_location=lambda storage, loc: storage))
STN.load_state_dict(torch.load(os.getcwd() + '/saving_ckpt/stn_Iter_001800_model.ckpt', map_location=lambda storage, loc: storage))
The following main.py is modified for my environment, so the line numbers in the following error messages are not identical to main.py.
How to use my trained weights?