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)
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)
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)