YOLOV3 SPP3 stranger tensor sizes

Description

Hi, guys.

I have two YOLOV3 models trained: a) YOLOV3 (https://github.com/ultralytics/yolov3/blob/master/cfg/yolov3-1cls.cfg) and b) YOLOV3 SPP3 (https://github.com/ultralytics/yolov3/blob/master/cfg/yolov3-spp3.cfg). The second one I did the modification to one class.
I’ve converted these models to TensorRT. (YOLOV3 > ONNX > TensorRT). When I’ve tested, the first model ran well, detections, etc. But, when I’ve tested the second one, I’ve got a strange error and I don’t know how solve it. The error message was:

for output, shape in zip(trt_outputs, self.output_shapes)] ValueError: cannot reshape array of size 173056 into shape (1,18,13,13)

I’ve printed the tensor sizes of the trt_outputs list and I’ve got these two situations:

a) YOLOV3: 3042, 12168, 48672
b) YOLOV3 SPP3: 173056, 346112, 692224

In both cases, I’m using the same image to test.

Environment

tensorrt 7.1.3.4
onnx 1.4.1
pycuda 2019.1.2
torch 1.6.0

Relevant Files

a) YOLOV3 (https://github.com/ultralytics/yolov3/blob/master/cfg/yolov3-1cls.cfg)
b) YOLOV3 SPP3 (https://github.com/ultralytics/yolov3/blob/master/cfg/yolov3-spp3.cfg).

Steps To Reproduce

Implementation used to conversion process:

Hi @AdrianoSantosPB,
Can you share your onnx model so that i can try reproducing the issue and assist you on the same.
Thanks!

Yes. For sure.
https://drive.google.com/file/d/1nLESyrXu8f_MHbqRbKIvus9OWjqhxX41/view?usp=sharing

Hi @AakankshaS, I’ve shared the model with you.

Hi @AdrianoSantosPB,
I tried running your model and it worked fine for me.


I am not sure why your model and cfg file settings are different. It should be same.
Request you to try the mdoel with the below command.
trtexec --onnx=yolov3-spp3-416.onnx --explicitBatch
Thanks!