AlexeyAB / darknet

YOLOv4 / Scaled-YOLOv4 / YOLO - Neural Networks for Object Detection (Windows and Linux version of Darknet )
http://pjreddie.com/darknet/
Other
21.64k stars 7.95k forks source link

yolov3-spp to tenssorrt #5606

Open ou525 opened 4 years ago

ou525 commented 4 years ago

@AlexeyAB Thank you for your work, I encountered a problem When I converted to the tensorrt model, I found that the darknet maxpool layer implementation is l-> out_w = (w + l-> pad-l-> size) / l-> stride_x + 1, but other frameworks are l-> out_w = (w + 2 * l-> pad-l-> size) / l-> stride_x + 1. Now the results of these two tests are different, mainly reflected in small targets.

AlexeyAB commented 4 years ago

What padding SAME or VALID do you use? How did you convert it?

ou525 commented 4 years ago

@AlexeyAB My setup code is as follows, and did not set the same or valid nvinfer1::IPoolingLayer pool = network->addPooling(input, nvinfer1::PoolingType::kMAX, nvinfer1::DimsHW{size, size}); assert(pool); std::string maxpoolLayerName = "maxpool_" + std::to_string(layerIdx); pool->setStride(nvinfer1::DimsHW{stride, stride}); pool->setPadding(nvinfer1::DimsHW{(size-1)/2, (size-1)/2});

ou525 commented 4 years ago

@AlexeyAB Sorry, continue to disturb.Sorry, continue to disturb. I found that there were mainly some false detections of small targets, so I suspect that the maxpool layer of the spp module is not delivered correctly.

AlexeyAB commented 4 years ago

Try to use https://github.com/wang-xinyu/tensorrtx It supports both yolov3-spp and yolov4

ou525 commented 4 years ago

I have read and referred to this code, it is based on the implementation of pytorch, so the implementation of maxpool is still different from darknet.