File tree Expand file tree Collapse file tree 2 files changed +13
-2
lines changed
Expand file tree Collapse file tree 2 files changed +13
-2
lines changed Original file line number Diff line number Diff line change 1+ .DS_Store
2+ * .pth
3+ * .pyc
4+ * .pyo
5+ * .log
6+ * .tmp
7+
Original file line number Diff line number Diff line change 1111img_path = './data/demo.png'
1212alphabet = '0123456789abcdefghijklmnopqrstuvwxyz'
1313
14- model = crnn .CRNN (32 , 1 , 37 , 256 ).cuda ()
14+ model = crnn .CRNN (32 , 1 , 37 , 256 )
15+ if torch .cuda .is_available ():
16+ model = model .cuda ()
1517print ('loading pretrained model from %s' % model_path )
1618model .load_state_dict (torch .load (model_path ))
1719
1820converter = utils .strLabelConverter (alphabet )
1921
2022transformer = dataset .resizeNormalize ((100 , 32 ))
2123image = Image .open (img_path ).convert ('L' )
22- image = transformer (image ).cuda ()
24+ image = transformer (image )
25+ if torch .cuda .is_available ():
26+ image = image .cuda ()
2327image = image .view (1 , * image .size ())
2428image = Variable (image )
2529
You can’t perform that action at this time.
0 commit comments