报错:
Loading pose model from ./models/sppe/duc_se.pth
loading yolo model ...
/home/trq/wanda/AlphaPose_wanda/yolo/util.py:53: TracerWarning: Converting a tensor to a Python boolean might cause the trace to be incorrect. We can't record the data flow of Python values, so this value will be treated as a constant in the future. This means that the trace might not generalize to other inputs!
grid_len = np.arange(grid_size)
/home/trq/wanda/AlphaPose_wanda/yolo/util.py:53: TracerWarning: Converting a tensor to a Python float might cause the trace to be incorrect. We can't record the data flow of Python values, so this value will be treated as a constant in the future. This means that the trace might not generalize to other inputs!
grid_len = np.arange(grid_size)
/home/trq/wanda/AlphaPose_wanda/yolo/util.py:68: TracerWarning: Converting a tensor to a Python float might cause the trace to be incorrect. We can't record the data flow of Python values, so this value will be treated as a constant in the future. This means that the trace might not generalize to other inputs!
anchors = torch.FloatTensor(anchors)
Traceback (most recent call last):
File "/home/trq/wanda/AlphaPose_wanda/demo.py", line 191, in
Pose_model=Pose(opt)
File "/home/trq/wanda/AlphaPose_wanda/demo.py", line 61, in init
self.det_model,self.det_inp_dim=load_yolo_model(self.args)
File "/home/trq/wanda/AlphaPose_wanda/demo.py", line 48, in load_yolo_model
torch.onnx.export(det_model, dummy_input, './yolov3-spp-cat.onnx', verbose=True, opset_version=11)
File "/home/trq/anaconda3/lib/python3.6/site-packages/torch/onnx/init.py", line 230, in export
custom_opsets, enable_onnx_checker, use_external_data_format)
File "/home/trq/anaconda3/lib/python3.6/site-packages/torch/onnx/utils.py", line 91, in export
use_external_data_format=use_external_data_format)
File "/home/trq/anaconda3/lib/python3.6/site-packages/torch/onnx/utils.py", line 639, in _export
dynamic_axes=dynamic_axes)
File "/home/trq/anaconda3/lib/python3.6/site-packages/torch/onnx/utils.py", line 450, in _model_to_graph
_export_onnx_opset_version)
RuntimeError: Tensors must have same number of dimensions: got 2 and 1
您好: 看了您的转换,很厉害,如果我直接在alphapose代码中导出yolov3-spp加了convcat等操作报错,请帮忙指导一下
def load_yolo_model(args): print('loading yolo model ...') det_model = Darknet("yolo/cfg/yolov3-spp.cfg") det_model.load_weights('models/yolo/yolov3-spp.weights') det_model.net_info['height'] = args.inp_dim det_inp_dim = int(det_model.net_info['height']) assert det_inp_dim % 32 == 0 assert det_inp_dim > 32 det_model.cuda() det_model.eval() dummy_input = torch.randn(1, 3, 608, 608, device='cuda') torch.onnx.export(det_model, dummy_input, './yolov3-spp-cat.onnx', verbose=True, opset_version=11)
报错: Loading pose model from ./models/sppe/duc_se.pth loading yolo model ... /home/trq/wanda/AlphaPose_wanda/yolo/util.py:53: TracerWarning: Converting a tensor to a Python boolean might cause the trace to be incorrect. We can't record the data flow of Python values, so this value will be treated as a constant in the future. This means that the trace might not generalize to other inputs! grid_len = np.arange(grid_size) /home/trq/wanda/AlphaPose_wanda/yolo/util.py:53: TracerWarning: Converting a tensor to a Python float might cause the trace to be incorrect. We can't record the data flow of Python values, so this value will be treated as a constant in the future. This means that the trace might not generalize to other inputs! grid_len = np.arange(grid_size) /home/trq/wanda/AlphaPose_wanda/yolo/util.py:68: TracerWarning: Converting a tensor to a Python float might cause the trace to be incorrect. We can't record the data flow of Python values, so this value will be treated as a constant in the future. This means that the trace might not generalize to other inputs! anchors = torch.FloatTensor(anchors) Traceback (most recent call last): File "/home/trq/wanda/AlphaPose_wanda/demo.py", line 191, in
Pose_model=Pose(opt)
File "/home/trq/wanda/AlphaPose_wanda/demo.py", line 61, in init
self.det_model,self.det_inp_dim=load_yolo_model(self.args)
File "/home/trq/wanda/AlphaPose_wanda/demo.py", line 48, in load_yolo_model
torch.onnx.export(det_model, dummy_input, './yolov3-spp-cat.onnx', verbose=True, opset_version=11)
File "/home/trq/anaconda3/lib/python3.6/site-packages/torch/onnx/init.py", line 230, in export
custom_opsets, enable_onnx_checker, use_external_data_format)
File "/home/trq/anaconda3/lib/python3.6/site-packages/torch/onnx/utils.py", line 91, in export
use_external_data_format=use_external_data_format)
File "/home/trq/anaconda3/lib/python3.6/site-packages/torch/onnx/utils.py", line 639, in _export
dynamic_axes=dynamic_axes)
File "/home/trq/anaconda3/lib/python3.6/site-packages/torch/onnx/utils.py", line 450, in _model_to_graph
_export_onnx_opset_version)
RuntimeError: Tensors must have same number of dimensions: got 2 and 1