breezedeus / CnSTD

CnSTD: 基于 PyTorch/MXNet 的 中文/英文 场景文字检测(Scene Text Detection)、数学公式检测(Mathematical Formula Detection, MFD)、篇章分析(Layout Analysis)的Python3 包
https://www.breezedeus.com/article/cnocr
Apache License 2.0
674 stars 106 forks source link

此项目模型无法被yolov7加载 #72

Closed balmung08 closed 11 months ago

balmung08 commented 11 months ago

我使用yolov7加载这个项目提供的yolov7模型,报错如下:


Namespace(weights='layout-yolov7_tiny.pt', source='inference/images', img_size=640, conf_thres=0.25, iou_thres=0.45, device='', view_img=False, save_txt=False, save_conf=False, nosave=False, classes=None, agnostic_nms=False, augment=False, update=False, project='runs/detect', name='exp', exist_ok=False, no_trace=False)
YOLOR  2023-5-30 torch 2.1.0+cpu CPU

Traceback (most recent call last):
  File "C:\Users\10706\Desktop\LaTeX-OCR-main\yolov7-main\detect.py", line 196, in 
    detect()
  File "C:\Users\10706\Desktop\LaTeX-OCR-main\yolov7-main\detect.py", line 34, in detect
    model = attempt_load(weights, map_location=device)  # load FP32 model
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\10706\Desktop\LaTeX-OCR-main\yolov7-main\models\experimental.py", line 253, in attempt_load
    model.append(ckpt['ema' if ckpt.get('ema') else 'model'].float().fuse().eval())  # FP32 model
                 ~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
KeyError: 'model'

我想知道这个项目的模型针对与yolov7的标准预训练模型区别在什么地方,为什么不能通用,非常感谢!