marcoslucianops / DeepStream-Yolo

NVIDIA DeepStream SDK 7.0 / 6.4 / 6.3 / 6.2 / 6.1.1 / 6.1 / 6.0.1 / 6.0 / 5.1 implementation for YOLO models
MIT License
1.39k stars 344 forks source link

I'm getting this error when trying to export yolov7 #403

Closed ed830418 closed 1 year ago

ed830418 commented 1 year ago

environment: use docker with dockerfile below(reference to https://github.com/WongKinYiu/yolov7#installation): FROM nvcr.io/nvidia/pytorch:21.08-py3 RUN apt-get update && apt update && apt-get install -y zip htop screen libgl1-mesa-glx && pip3 install seaborn thop

P.S. I don't follow your instruction to install onnx, onnxsim, onnxruntime. Because it will upgrade numpy and cause another error: module 'numpy' has no attribute 'object'. The cause of this issue is 'np.object' is deprecated

full log:

Starting: /weights/yolov7.pt Opening YOLOv7 model

Fusing layers... RepConv.fuse_repvgg_block RepConv.fuse_repvgg_block RepConv.fuse_repvgg_block IDetect.fuse Traceback (most recent call last): File "export_yoloV7.py", line 124, in sys.exit(main(args)) File "export_yoloV7.py", line 56, in main model = yolov7_export(args.weights, device) File "export_yoloV7.py", line 34, in yolov7_export model = attempt_load(weights, map_location=device) File "/yolov7/models/experimental.py", line 255, in attemptload model.append(ckpt['ema' if ckpt.get('ema') else 'model'].float().fuse().eval()) # FP32 model File "/yolov7/models/yolo.py", line 709, in fuse m.fuse() File "/yolov7/models/yolo.py", line 185, in fuse self.m[i].bias = self.m[i].bias + torch.matmul(self.m[i].weight.reshape(c1,c2),self.ia[i].implicit.reshape(c2,c1_)).squeeze(1) File "/opt/conda/lib/python3.8/site-packages/torch/nn/modules/module.py", line 1152, in setattr raise TypeError("cannot assign '{}' as parameter '{}' " TypeError: cannot assign 'torch.FloatTensor' as parameter 'bias' (torch.nn.Parameter or None expected)

ed830418 commented 1 year ago

oh... I have found the reason. I used the wrong model file(.yaml) during reparameterization cfg/training/yolov7.yaml (X) <=> cfg/deploy/yolov7.yaml (O)

so, please ignore this issue