def test_recognize_training(): c.clear_temp() seq = "JWP26" # seq = 'K464J' # Sticking together # seq = 'WMQPQ' # seq = '14FWX' # seq = '4TJ3R' # seq = '5PW9Y' # seq = '6ML6X' # seq = '48HXH' # seq = 'Y581K' # Isolation # seq = 'QN4EL' # Complicated # seq = '2XML9' # seq = 'W9WU4' if seq: image = dataset_manager.get_training_image(seq) else: seq, image = dataset_manager.get_training_image() success, seq_r, weak_confidence = CaptchaRecognizer().recognize( image, verbose=True, save_intermediate=True, force_partition=True ) if success: if weak_confidence: print("Weak confidence") print("Recognized is", seq_r) print("Actual is", seq) print("Result: {}".format(seq == seq_r))
def test_recognize_training(): c.clear_temp() seq = 'JWP26' # seq = 'K464J' # Sticking together # seq = 'WMQPQ' # seq = '14FWX' # seq = '4TJ3R' # seq = '5PW9Y' # seq = '6ML6X' # seq = '48HXH' # seq = 'Y581K' # Isolation # seq = 'QN4EL' # Complicated # seq = '2XML9' # seq = 'W9WU4' if seq: image = dataset_manager.get_training_image(seq) else: seq, image = dataset_manager.get_training_image() success, seq_r, weak_confidence = CaptchaRecognizer().recognize( image, verbose=True, save_intermediate=True, force_partition=True) if success: if weak_confidence: print('Weak confidence') print('Recognized is', seq_r) print('Actual is', seq) print('Result: {}'.format(seq == seq_r))
def main(): c.clear_temp() img = dataset_manager.get_training_image() recognizer = captcha_recognizer.CaptchaRecognizer() mpimg.imsave(c.temp_path('00.origin.png'), img) # 1 img_01 = time_func( 'remove_noise_with_hsv', lambda: recognizer.remove_noise_with_hsv(img) ) mpimg.imsave(c.temp_path('01.hsv.png'), img_01, cmap=cm_greys) # 2 img_02 = time_func( 'remove_noise_with_neighbors', lambda: repeat(recognizer.remove_noise_with_neighbors, 2)(img_01) ) mpimg.imsave(c.temp_path('02.neighbor.png'), img_02, cmap=cm_greys) img_03a = time_func( 'skeletonize', lambda: morph.skeletonize(img_02) ) mpimg.imsave(c.temp_path('03a.skeleton.png'), img_03a, cmap=cm_greys)