Skip to content

Commit

Permalink
refine infer
Browse files Browse the repository at this point in the history
  • Loading branch information
AstarLight committed Jan 28, 2019
1 parent fa4f838 commit 4e140fa
Show file tree
Hide file tree
Showing 4 changed files with 33 additions and 9 deletions.
6 changes: 5 additions & 1 deletion detector/ctpn/infer.py
Original file line number Diff line number Diff line change
Expand Up @@ -342,8 +342,12 @@ def random_test(net):

if __name__ == '__main__':
running_mode = sys.argv[2] # cpu or gpu
print("Mode: %s" % running_mode)
net = Net.CTPN()
net.load_state_dict(torch.load(MODEL, map_location=running_mode))
if running_mode == 'cpu':
net.load_state_dict(torch.load(MODEL, map_location=running_mode))
else:
net.load_state_dict(torch.load(MODEL))
print(net)
net.eval()

Expand Down
2 changes: 1 addition & 1 deletion recognizer/crnn/Config.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
gpu_id = '4'
model_dir = './model'
data_worker = 4
batch_size = 128
batch_size = 64
img_height = 32
img_width = 100
alphabet = alphabets.alphabet
Expand Down
Loading

0 comments on commit 4e140fa

Please sign in to comment.