alicewish / MomoTranslator

Pure OpenCV comic translation tool
MIT License
203 stars 28 forks source link

开始OCR之后提示area_dic未定义 #22

Closed Bacchusyun closed 9 months ago

Bacchusyun commented 9 months ago

image

Bacchusyun commented 9 months ago

2023-10-20 11:19:16.548 | DEBUG | main:istart_task:4817 - [3]文字识别 - C:\Users\9\Documents\默墨汉化\ComicProcess\Neonomicon 01 2023-10-20 11:19:16.563 | WARNING | main:step3_OCR:4800 - img_file=WindowsPath('C:/Users/9/Documents/默墨汉化/ComicProcess/Neonomicon 01/neo_01_00.jpg') 2023-10-20 11:19:16.563 | WARNING | main:ocr1pic:7614 - img_file=WindowsPath('C:/Users/9/Documents/默墨汉化/ComicProcess/Neonomicon 01/neo_01_00.jpg') 2023-10-20 11:19:16.617 | WARNING | main:get_grid_masks:6295 - frame_grid_strs=['0,0,1280,2027~0,24,1280,2003'] 2023-10-20 11:19:16.618 | WARNING | main:get_grid_masks:6321 - inner_br=(0, 24, 1280, 2003) 2023-10-20 11:19:16.662 | DEBUG | main:wrapper:609 - get_grid_masks took: 0.07秒 2023-10-20 11:19:16.667 | WARNING | main:step3_OCR:4800 - img_file=WindowsPath('C:/Users/9/Documents/默墨汉化/ComicProcess/Neonomicon 01/neo_01_01-02.jpg') 2023-10-20 11:19:16.668 | WARNING | main:ocr1pic:7614 - img_file=WindowsPath('C:/Users/9/Documents/默墨汉化/ComicProcess/Neonomicon 01/neo_01_01-02.jpg') 2023-10-20 11:19:16.756 | WARNING | main:get_grid_masks:6295 - frame_grid_strs=['0,0,2560,1962~0,0,2560,1962'] 2023-10-20 11:19:16.757 | WARNING | main:get_grid_masks:6321 - inner_br=(0, 0, 2560, 1962) 2023-10-20 11:19:16.831 | DEBUG | main:wrapper:609 - get_grid_masks took: 0.12秒 2023-10-20 11:19:17.313 | DEBUG | main:get_single_cnts:6139 - px_area=486 2023-10-20 11:19:17.429 | DEBUG | main:get_single_cnts:6139 - px_area=6531 2023-10-20 11:19:17.436 | DEBUG | main:ocr1pic:7631 - len(single_cnts)=2 2023-10-20 11:19:18.478 | DEBUG | main:wrapper:609 - get_ordered_cnts took: 1.04秒 [2023/10/20 11:19:18] ppocr DEBUG: Namespace(help='==SUPPRESS==', use_gpu=False, use_xpu=False, use_npu=False, ir_optim=True, use_tensorrt=False, min_subgraph_size=15, precision='fp32', gpu_mem=500, gpu_id=0, image_dir=None, page_num=0, det_algorithm='DB', det_model_dir='C:\Users\9/.paddleocr/whl\det\en\en_PP-OCRv3_det_infer', det_limit_side_len=960, det_limit_type='max', det_box_type='quad', det_db_thresh=0.3, det_db_box_thresh=0.6, det_db_unclip_ratio=1.5, max_batch_size=10, use_dilation=False, det_db_score_mode='fast', det_east_score_thresh=0.8, det_east_cover_thresh=0.1, det_east_nms_thresh=0.2, det_sast_score_thresh=0.5, det_sast_nms_thresh=0.2, det_pse_thresh=0, det_pse_box_thresh=0.85, det_pse_min_area=16, det_pse_scale=1, scales=[8, 16, 32], alpha=1.0, beta=1.0, fourier_degree=5, rec_algorithm='SVTR_LCNet', rec_model_dir='C:\Users\9/.paddleocr/whl\rec\en\en_PP-OCRv4_rec_infer', rec_image_inverse=True, rec_image_shape='3, 48, 320', rec_batch_num=6, max_text_length=25, rec_char_dict_path='E:\Programs\Python\Python39\lib\site-packages\paddleocr\ppocr\utils\en_dict.txt', use_space_char=True, vis_font_path='./doc/fonts/simfang.ttf', drop_score=0.5, e2e_algorithm='PGNet', e2e_model_dir=None, e2e_limit_side_len=768, e2e_limit_type='max', e2e_pgnet_score_thresh=0.5, e2e_char_dict_path='./ppocr/utils/ic15_dict.txt', e2e_pgnet_valid_set='totaltext', e2e_pgnet_mode='fast', use_angle_cls=False, cls_model_dir='C:\Users\9/.paddleocr/whl\cls\ch_ppocr_mobile_v2.0_cls_infer', cls_image_shape='3, 48, 192', label_list=['0', '180'], cls_batch_num=6, cls_thresh=0.9, enable_mkldnn=False, cpu_threads=10, use_pdserving=False, warmup=False, sr_model_dir=None, sr_image_shape='3, 32, 128', sr_batch_num=1, draw_img_save_dir='./inference_results', save_crop_res=False, crop_res_save_dir='./output', use_mp=False, total_process_num=1, process_id=0, benchmark=False, save_log_path='./log_output/', show_log=True, use_onnx=False, output='./output', table_max_len=488, table_algorithm='TableAttn', table_model_dir=None, merge_no_span_structure=True, table_char_dict_path=None, layout_model_dir=None, layout_dict_path=None, layout_score_threshold=0.5, layout_nms_threshold=0.5, kie_algorithm='LayoutXLM', ser_model_dir=None, re_model_dir=None, use_visual_backbone=True, ser_dict_path='../train_data/XFUND/class_list_xfun.txt', ocr_order_method=None, mode='structure', image_orientation=False, layout=True, table=True, ocr=True, recovery=False, use_pdf2docx_api=False, invert=False, binarize=False, alphacolor=(255, 255, 255), lang='en', det=True, rec=True, type='ocr', ocr_version='PP-OCRv4', structure_version='PP-StructureV2') [2023/10/20 11:19:19] ppocr WARNING: Since the angle classifier is not initialized, it will not be used during the forward process [2023/10/20 11:19:19] ppocr DEBUG: dt_boxes num : 2, elapsed : 0.025522947311401367 [2023/10/20 11:19:19] ppocr DEBUG: rec_res num : 2, elapsed : 0.23470759391784668 [2023/10/20 11:19:19] ppocr DEBUG: Namespace(help='==SUPPRESS==', use_gpu=False, use_xpu=False, use_npu=False, ir_optim=True, use_tensorrt=False, min_subgraph_size=15, precision='fp32', gpu_mem=500, gpu_id=0, image_dir=None, page_num=0, det_algorithm='DB', det_model_dir='C:\Users\9/.paddleocr/whl\det\en\en_PP-OCRv3_det_infer', det_limit_side_len=960, det_limit_type='max', det_box_type='quad', det_db_thresh=0.3, det_db_box_thresh=0.6, det_db_unclip_ratio=1.5, max_batch_size=10, use_dilation=False, det_db_score_mode='fast', det_east_score_thresh=0.8, det_east_cover_thresh=0.1, det_east_nms_thresh=0.2, det_sast_score_thresh=0.5, det_sast_nms_thresh=0.2, det_pse_thresh=0, det_pse_box_thresh=0.85, det_pse_min_area=16, det_pse_scale=1, scales=[8, 16, 32], alpha=1.0, beta=1.0, fourier_degree=5, rec_algorithm='SVTR_LCNet', rec_model_dir='C:\Users\9/.paddleocr/whl\rec\en\en_PP-OCRv4_rec_infer', rec_image_inverse=True, rec_image_shape='3, 48, 320', rec_batch_num=6, max_text_length=25, rec_char_dict_path='E:\Programs\Python\Python39\lib\site-packages\paddleocr\ppocr\utils\en_dict.txt', use_space_char=True, vis_font_path='./doc/fonts/simfang.ttf', drop_score=0.5, e2e_algorithm='PGNet', e2e_model_dir=None, e2e_limit_side_len=768, e2e_limit_type='max', e2e_pgnet_score_thresh=0.5, e2e_char_dict_path='./ppocr/utils/ic15_dict.txt', e2e_pgnet_valid_set='totaltext', e2e_pgnet_mode='fast', use_angle_cls=False, cls_model_dir='C:\Users\9/.paddleocr/whl\cls\ch_ppocr_mobile_v2.0_cls_infer', cls_image_shape='3, 48, 192', label_list=['0', '180'], cls_batch_num=6, cls_thresh=0.9, enable_mkldnn=False, cpu_threads=10, use_pdserving=False, warmup=False, sr_model_dir=None, sr_image_shape='3, 32, 128', sr_batch_num=1, draw_img_save_dir='./inference_results', save_crop_res=False, crop_res_save_dir='./output', use_mp=False, total_process_num=1, process_id=0, benchmark=False, save_log_path='./log_output/', show_log=True, use_onnx=False, output='./output', table_max_len=488, table_algorithm='TableAttn', table_model_dir=None, merge_no_span_structure=True, table_char_dict_path=None, layout_model_dir=None, layout_dict_path=None, layout_score_threshold=0.5, layout_nms_threshold=0.5, kie_algorithm='LayoutXLM', ser_model_dir=None, re_model_dir=None, use_visual_backbone=True, ser_dict_path='../train_data/XFUND/class_list_xfun.txt', ocr_order_method=None, mode='structure', image_orientation=False, layout=True, table=True, ocr=True, recovery=False, use_pdf2docx_api=False, invert=False, binarize=False, alphacolor=(255, 255, 255), lang='en', det=True, rec=True, type='ocr', ocr_version='PP-OCRv4', structure_version='PP-StructureV2') [2023/10/20 11:19:20] ppocr WARNING: Since the angle classifier is not initialized, it will not be used during the forward process [2023/10/20 11:19:20] ppocr DEBUG: dt_boxes num : 4, elapsed : 0.051047563552856445 [2023/10/20 11:19:20] ppocr DEBUG: rec_res num : 4, elapsed : 0.4719216823577881 Traceback (most recent call last): File "E:\MomoTranslator-main\pyqt5_momotranslator.py", line 4836, in istart_task self.step3_OCR() File "E:\MomoTranslator-main\pyqt5_momotranslator.py", line 4802, in step3_OCR ocr_doc, all_cropped_imgs = update_ocr_doc(ocr_doc, pic_results, self.ocr_yml, i, self.img_list) File "E:\MomoTranslator-main\pyqt5_momotranslator.py", line 7951, in update_ocr_doc ocr_doc = process_para(ocr_doc, pic_result, cur_img_np) File "E:\MomoTranslator-main\pyqt5_momotranslator.py", line 7789, in process_para if color_locate in area_dic: NameError: name 'area_dic' is not defined

alicewish commented 9 months ago

fixed in https://github.com/alicewish/MomoTranslator/commit/a2ff9270f52a5cf6cf9afde4dabbd8cdfa3b7439