diff --git a/configs/rec/rec_icdar15_train.yml b/configs/rec/rec_icdar15_train.yml index e16264fa5939ca82236ca3d9c23f431ac81e5162..f57aa465e82fc95981ee5aae1488a4da32557b7f 100755 --- a/configs/rec/rec_icdar15_train.yml +++ b/configs/rec/rec_icdar15_train.yml @@ -1,12 +1,12 @@ Global: algorithm: CRNN use_gpu: true - epoch_num: 300 + epoch_num: 3000 log_smooth_window: 20 print_batch_step: 10 - save_model_dir: output_ic15 - save_epoch_step: 3 - eval_batch_step: 2000 + save_model_dir: ./output/rec + save_epoch_step: 300 + eval_batch_step: 500 train_batch_size_per_card: 256 test_batch_size_per_card: 256 image_shape: [3, 32, 100] @@ -37,6 +37,6 @@ Loss: Optimizer: function: ppocr.optimizer,AdamDecay - base_lr: 0.001 + base_lr: 0.0001 beta1: 0.9 beta2: 0.999 diff --git a/ppocr/data/rec/dataset_traversal.py b/ppocr/data/rec/dataset_traversal.py index 839448e4ff3ea36cbb471e7c048ec52cbc8f0cf5..cb3c9bbd3cc14132235126b84943858324eece27 100755 --- a/ppocr/data/rec/dataset_traversal.py +++ b/ppocr/data/rec/dataset_traversal.py @@ -184,6 +184,9 @@ class SimpleReader(object): substr = label_infor.decode('utf-8').strip("\n").split("\t") img_path = self.img_set_dir + "/" + substr[0] img = cv2.imread(img_path) + if img.shape[-1]==1 or len(list(img.shape))==2: + print("this is a gry") + img = cv2.cvtColor(img, cv2.COLOR_GRAY2BGR) if img is None: logger.info("{} does not exist!".format(img_path)) continue diff --git a/ppocr/utils/character.py b/ppocr/utils/character.py index b40750392291f271b26fef88e58844be9020d2ea..7dfeeef4c15b6bb95d37edc16b99f04ea5ffe020 100755 --- a/ppocr/utils/character.py +++ b/ppocr/utils/character.py @@ -64,7 +64,7 @@ class CharacterOps(object): [sum(text_lengths)] = [text_index_0 + text_index_1 + ... + text_index_(n - 1)] length: length of each text. [batch_size] """ - if self.character_type == "en": + if self.character_type == "en" or text.encode( 'UTF-8' ).isalpha(): text = text.lower() text_list = []