BobLd / YOLOv4MLNet

Use the YOLO v4 and v5 (ONNX) models for object detection in C# using ML.Net
MIT License
79 stars 31 forks source link

Bounding boxes not tight #5

Closed farhanrw closed 3 years ago

farhanrw commented 3 years ago

Hello,

First of all thanks for creating this and helping a lot of people (including me). I am having an issue with my prediction. I am detection small rectangular gaps in bundles of boxes. My trained yolov5 gives me very good results when I was doing it on python. Recently, I found this repo and was trying to work out the code. I managed to get it working, the detections are acceptable however, the boxes look loosely bounded. Is there any idea that you could give me to improve this or rectify this completely? Just a couple of things, my network was trained on --rect mode on yolov5 which means the images are rectangular. And the sizes are 1216x960. Please help me with this with any idea you can think of.

Thanks!

BobLd commented 3 years ago

Hi @farhanrw, thanks for your message.

Could you put a screenshot of the issue your talking about (a result image with its bounding boxes) and also the code you are using? It would be very helpful to diagnose your issue.

farhanrw commented 3 years ago

Hey, @BobLd thanks for commenting. I seem to fix that, it was not anything related to your code, it was my problems with the data. Sorry about that. However, there is one more issue that I am facing, and that is the inference time is too long for me. I also mentioned this in the official yolov5 repo. Usually, it was taking me around <100ms to predict for one image using the python implementation in the CPU. However, here in ML.Net, each image seems to take around 2000-3000 ms. Both timings are for CPU and for one image at a time. And I have tested this by turning off everything after var predict = predictionEngine.Predict(new YoloV4BitmapData () { Image = bitmap });. The bottleneck seem to be predict method. Please share your thoughts. Thanks!

BobLd commented 3 years ago

On this, I doubt it's due to what you did... I also noticed some memory issue on my side. Maybe try to create an issue in the ML.Net repos. I would be curious to have there view on that

farhanrw commented 3 years ago

Yes, I just did open a new issue. Let's see. In my case, the RAM usage does not get that high, it is rather the CPU. To be honest, it is strange to observe such a difference in performance in the two platforms. I would be interested in finding out the underlying cause of that.