Closed shreyapamecha closed 3 years ago
Could you share your notebook, so I can debug through your operations?
Thank you for your reply. It is difficult for me to share the notebook. I can tell you the steps I followed:
!pip install onnx==1.6.0 onnx-tf==1.5.0 !pip install tensorflow-gpu==1.15.0
!git clone https://github.com/zldrobit/onnx_tflite_yolov3
!python3 detect.py --cfg cfg/yolov3-counter_detection.cfg --weights weights/yolov3_counter_detection.weights
The error occurred during its execution.
Here's my notebook (https://colab.research.google.com/drive/1Cm3sQXoBMOnCFYNNKqAS-5eqJdlj8gV5?usp=sharing) to reproduce the python3 detect.py xxxxxxx
procedure.
This notebook runs without any error.
You could compare your notebook with this one to find out the cause of the problem.
I close this issue since there is no recent activity.
Hi, facing same problem converting my yolov3 darknet model. Exactly the same error message with your colab notebook. This error does not occur with the base yolov3 weights but with a custom single-class model. @zldrobit any idea ? @shreyapamecha did you solve it ?
File "/content/drive/My Drive/onnx_tflite_yolov3/models.py", line 203, in forward p_cls = torch.cat(p_cls0, io[..., 6:], -1) TypeError: cat() received an invalid combination of arguments - got (int, Tensor, int), but expected one of:
!python3 detect.py --cfg cfg/yolov3_counter_detection.cfg --weights weights/yolov3_counter_detection.weights
I ran this code on Google Colab.
The error which I got is:
Namespace(cfg='cfg/yolov3_counter_detection.cfg', conf_thres=0.3, data='data/coco.data', device='', fourcc='mp4v', half=False, nms_thres=0.5, output='output', source='data/samples', view_img=False, weights='weights/yolov3_counter_detection.weights') Using CPU
Traceback (most recent call last): File "detect.py", line 174, in
detect()
File "detect.py", line 48, in detect
torch.onnx.export(model, img, 'weights/export.onnx', verbose=True, opset_version=9)
File "/usr/local/lib/python3.6/dist-packages/torch/onnx/init.py", line 230, in export
custom_opsets, enable_onnx_checker, use_external_data_format)
File "/usr/local/lib/python3.6/dist-packages/torch/onnx/utils.py", line 91, in export
use_external_data_format=use_external_data_format)
File "/usr/local/lib/python3.6/dist-packages/torch/onnx/utils.py", line 639, in _export
dynamic_axes=dynamic_axes)
File "/usr/local/lib/python3.6/dist-packages/torch/onnx/utils.py", line 411, in _model_to_graph
use_new_jit_passes)
File "/usr/local/lib/python3.6/dist-packages/torch/onnx/utils.py", line 379, in _create_jit_graph
graph, torch_out = _trace_and_get_graph_from_model(model, args)
File "/usr/local/lib/python3.6/dist-packages/torch/onnx/utils.py", line 342, in _trace_and_get_graph_from_model
torch.jit._get_trace_graph(model, args, strict=False, _force_outplace=False, _return_inputs_states=True)
File "/usr/local/lib/python3.6/dist-packages/torch/jit/_trace.py", line 1148, in _get_trace_graph
outs = ONNXTracedModule(f, strict, _force_outplace, return_inputs, _return_inputs_states)(*args, kwargs)
File "/usr/local/lib/python3.6/dist-packages/torch/nn/modules/module.py", line 727, in _call_impl
result = self.forward(*input, kwargs)
File "/usr/local/lib/python3.6/dist-packages/torch/jit/_trace.py", line 130, in forward
self._force_outplace,
File "/usr/local/lib/python3.6/dist-packages/torch/jit/_trace.py", line 116, in wrapper
outs.append(self.inner(trace_inputs))
File "/usr/local/lib/python3.6/dist-packages/torch/nn/modules/module.py", line 725, in _call_impl
result = self._slow_forward(input, kwargs)
File "/usr/local/lib/python3.6/dist-packages/torch/nn/modules/module.py", line 709, in _slow_forward
result = self.forward(*input, kwargs)
File "/content/gdrive/My Drive/Internship_SecureMeters/TFlite/onnx_tflite_yolov3/models.py", line 249, in forward
x = module(x, img_size)
File "/usr/local/lib/python3.6/dist-packages/torch/nn/modules/module.py", line 725, in _call_impl
result = self._slow_forward(*input, *kwargs)
File "/usr/local/lib/python3.6/dist-packages/torch/nn/modules/module.py", line 709, in _slow_forward
result = self.forward(input, **kwargs)
File "/content/gdrive/My Drive/Internship_SecureMeters/TFlite/onnx_tflite_yolov3/models.py", line 203, in forward
p_cls = torch.cat(p_cls0, io[..., 6:], -1)
TypeError: cat() received an invalid combination of arguments - got (int, Tensor, int), but expected one of: