File size: 746 Bytes
7ee7e3a
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
from text_recognition import TextRecognition

if __name__ == '__main__':
	import os
	import cv2
	import time
	import string

	root_path = os.path.expanduser('~/.Halotec/Models')

	model_config = {
		'filename'  : 'crnn_008000.pt',
		'classes'   : string.digits+string.ascii_uppercase+'. ',
		'url'       : None,
		'file_size' : 592694,
		'img_height': 32,
		'img_width' : 100,
		'map_to_seq_hidden': 64,
		'rnn_hidden': 256,
		'leaky_relu': False
	}
	text_recognition = TextRecognition(root_path, model_config, jic=True)
	image = cv2.imread('./images/12022041113414598_14.jpg')
	start = time.time()
	for i in range(10):
		result = text_recognition.recognition(image, decode='beam_search', beam_size=10)
		print(result)
	print(time.time() - start)