Hi,
I tried to convert the yolov3-tiny model which trained in darknet to tensorrt , I referred the yolov3_onnx sample in tensorrt and modified the yolov3_to_onnx.py , I removed the _make_shortcut_node function and added a _make_maxpool_node function , it was successfully generated the onnx model , but when I ran the onnx_to_tensorrt.py , the error occurred:
Beginning ONNX file parsing
[TensorRT] ERROR: (Unnamed Layer* 44) [Concatenation]: all concat input tensors must have the same dimensions except on the concatenation axis
When I tried with the trtexec , it showed :
ONNX IR version: 0.0.3
Opset version: 8
Producer name: NVIDIA TensorRT sample
Producer version:
Domain:
Model version: 0
Doc string:
(Unnamed Layer* 44) [Concatenation]: all concat input tensors must have the same dimensions except on the concatenation axis
While parsing node number 45 [Conv → “024_convolutional”]:
ERROR: /home/erisuser/p4sw/sw/gpgpu/MachineLearning/DIT/release/5.0/parsers/onnxOpenSource/builtin_op_importers.cpp:535 In function importConv:
[8] Assertion failed: dims.nbDims == 3
failed to parse onnx file
Engine could not be created
Engine could not be created
the _make_maxpool_node function I wrote is fllowing:
def _make_maxpool_node(self, layer_name, layer_dict):
“”"Create an ONNX Add node with the maxpool properties from
the DarkNet-based graph.
Keyword arguments:
layer_name -- the layer's name (also the corresponding key in layer_configs)
layer_dict -- a layer parameter dictionary (one element of layer_configs)
"""
previous_node_specs = self._get_previous_node_specs()
inputs = [previous_node_specs.name]
kernel_size = layer_dict['size']
stride = layer_dict['stride']
channels = previous_node_specs.channels
kernel_shape = [kernel_size, kernel_size]
strides = [stride, stride]
assert inputs
assert channels > 0
maxpool_node = helper.make_node(
'MaxPool',
inputs=inputs,
outputs=[layer_name],
kernel_shape=kernel_shape,
strides=strides,
name=layer_name,
)
self._nodes.append(maxpool_node)
return layer_name, channels
Is the code I wrote wrong? or something else? Did anyone converted the yolov3-tiny to tensorrt successfully?
Any suggestions are needed!Thank you!