Skip to content

Commit e4bf4b2

Browse files
committed
fix buf in CPU mode
1 parent ce07620 commit e4bf4b2

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

test.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,10 @@ def test_net(net, image, text_threshold, link_threshold, low_text, cuda):
109109
net = CRAFT() # initialize
110110

111111
print('Loading weights from checkpoint (' + args.trained_model + ')')
112-
net.load_state_dict(copyStateDict(torch.load(args.trained_model)))
112+
if args.cuda:
113+
net.load_state_dict(copyStateDict(torch.load(args.trained_model)))
114+
else:
115+
net.load_state_dict(copyStateDict(torch.load(args.trained_model, map_location='cpu')))
113116

114117
if args.cuda:
115118
net = net.cuda()

0 commit comments

Comments
 (0)