marcoslucianops / DeepStream-Yolo

NVIDIA DeepStream SDK 7.0 / 6.4 / 6.3 / 6.2 / 6.1.1 / 6.1 / 6.0.1 / 6.0 / 5.1 implementation for YOLO models
MIT License
1.45k stars 356 forks source link

Is darknet/yolov4-csp supported? #483

Closed vtyw closed 10 months ago

vtyw commented 10 months ago

Does this repo support yolov4-csp (scaled yolov4) from darknet?

I tried using a yolov4-csp model by following the same instructions as for yolov4. The detections appear fine in DeepStream, but when I check carefully, it's producing the same detections as the original model but with much lower confidence scores (e.g., 0.4 instead of 0.8).

marcoslucianops commented 10 months ago

Yes, it is supported, but the TensorRT reduces a bit the accuracy of the converted model.

vtyw commented 10 months ago

@marcoslucianops The accuracy drop is higher than I would have expected. I took the pretrained config and weights for darknet yolov4-csp and ran inference on a traffic video through darknet as well as through the equivalent deepstream pipeline that outputs detections. Both methods are using FP32 inference. The detections are roughly the same in a frame by frame comparison, except:

Do you know why the models perform so differently after TensorRT conversion? Even a normal FP32->FP16 conversion rarely exceeds 0.02 error in my experience. I thought it might be something to do with TensorRT not having native support for the Mish activation function.

vtyw commented 10 months ago

I checked whether I also experience the same inaccuracy with regular yolov4:

Error confidence scores can still exceed 0.05, but bbox coordinates are generally within 0.02 of their original value from darknet inference.

marcoslucianops commented 10 months ago

Do you know why the models perform so differently after TensorRT conversion?

I don't.

I checked whether I also experience the same inaccuracy with regular yolov4

It occurs with all converted models.