def main(): """ Entry point when using CRNN from the commandline """ args = parse_arguments() if not args.train and not args.test: print("If we are not training, and not testing, what is the point?") crnn = None if args.train: crnn = CRNN(args.iteration_count, args.batch_size, args.model_path, args.examples_path, args.max_image_width, args.train_test_ratio, args.restore, 0) crnn.train(args.iteration_count) if args.test: if crnn is None: crnn = CRNN(args.iteration_count, args.batch_size, args.model_path, args.examples_path, args.max_image_width, 0, args.restore, 1) crnn.test()
def main(): args = parse_arguments() if not args.train and not args.test: print("If we are not training,and not testing,what is the point?") crnn = None if args.train: crnn = CRNN( args.batch_size, args.model_path, args.example_path, args.max_image_width, args.train_test_ratio, args.restore ) crnn.train(args.iteration_count) if args.test: if crnn is None: crnn = CRNN( args.batch_size, args.model_path, args.examples_path, args.max_image_width, 0, args.restore ) crnn.test()
def main(): """ Entry point when using CRNN from the commandline """ args = parse_arguments() if not args.train and not args.test: print("If we are not training, and not testing, what is the point?") crnn = None charset = "" if os.path.isfile(args.char_set_string): # if charset is file read from file. with open(args.char_set_string, "r") as f: while True: c = f.readline() charset += c.strip("\n") if not c: charset += "\n" # Add line break to charset at the end break else: charset = args.char_set_string if args.train: crnn = CRNN( args.batch_size, args.model_path, args.examples_path, args.max_image_width, args.train_test_ratio, args.restore, charset, args.use_trdg, args.language, args.learning_rate ) crnn.train(args.iteration_count) if args.test: if crnn is None: crnn = CRNN( args.batch_size, args.model_path, args.examples_path, args.max_image_width, 0, args.restore, charset, args.use_trdg, args.language, args.learning_rate ) crnn.test()
def main(): """ Entry point when using CRNN from the commandline """ args = parse_arguments() crnn = None if crnn is None: crnn = CRNN( args.iteration_count, args.batch_size, args.model_path, args.examples_path, args.max_image_width, 0, #train/test ratio here train rate is 0 args.restore, 1) predict_result = crnn.test() f = open(args.output_path, 'w') for str in predict_result: str1 = str.split(':')[0] str2 = str.split(':')[1] str2 = str2.strip('_') f.writelines(str1 + ':' + str2) f.close()
def main(): """ Entry point when using CRNN from the commandline """ args = parse_arguments() if not args.train and not args.test: print("If we are not training, and not testing, what is the point?") crnn = None if args.train: crnn = CRNN( args.batch_size, args.model_path, args.examples_path, args.max_image_width, args.train_test_ratio, args.restore ) crnn.train(args.iteration_count) if args.test: if crnn is None: crnn = CRNN( args.batch_size, args.model_path, args.examples_path, args.max_image_width, 0, args.restore ) crnn.test()
def recognition2(examples_path, output_path): """ Entry point when using CRNN from the commandline """ crnn = None if crnn is None: crnn = CRNN( 10, 1, "./save/", examples_path, 230, 0, #train/test ratio here train rate is 0 True, 1) predict_result = crnn.test() f = open(output_path, 'w') for str in predict_result: str1 = str.split(':')[0] str2 = str.split(':')[1] str2 = str2.strip('_') f.writelines(str1 + ':' + str2) f.close()