PaddlePaddle / PaddleOCR

Awesome multilingual OCR toolkits based on PaddlePaddle (practical ultra lightweight OCR system, support 80+ languages recognition, provide data annotation and synthesis tools, support training and deployment among server, mobile, embedded and IoT devices)
Apache License 2.0
40.32k stars 7.46k forks source link

ppocr ERROR: rec_algorithm must in ['CRNN', 'SVTR_LCNet'] #11358

Open moyu026 opened 7 months ago

moyu026 commented 7 months ago

ocr = PaddleOCR(rec_model_dir=r'train_model\r45_visionlan\train_process\5\infer', rec_algorithm='VisionLAN', rec_char_dict_path=r'ppocr\utils\number.txt')

我想用这种方法加载自己训练的识别模型'VisionLAN'模型,但是提示只能用'CRNN'和'SVTR_LCNet'这两种方法,那应该怎么修改呢?

honghanh2008 commented 7 months ago

你看看 SUPPORT_REC_MODEL = ['CRNN', 'SVTR_LCNet'] 这个参数设置,如果只有上面两种方法,你模型算法不属于 SUPPORT_REC_MODEL,会导致保持,因为有下面这行判断代码:

    if params.det_algorithm not in SUPPORT_DET_MODEL:
        logger.error('det_algorithm must in {}'.format(SUPPORT_DET_MODEL))
        sys.exit(0)
    if params.rec_algorithm not in SUPPORT_REC_MODEL:
        logger.error('rec_algorithm must in {}'.format(SUPPORT_REC_MODEL))
        sys.exit(0)