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

Help needed with postprocessing - Yolor model #12

Closed AshwinRaikar88 closed 2 years ago

AshwinRaikar88 commented 2 years ago

I've ported Mobile detection Onnx model for Yolor

imageHeight = multiple of 64 ( 768 ) imageWidth = multiple of 64 ( 1280 )

The input dimensions are [1, 3, imageHeight, imageWidth ] The output dimensions are [ 1, 102000, 6]

The prediction engine gives me a 1D array of 612000 float values Since I used only 1 class = "mobile", I think it is in [ x, y, w, h, confidence, class_score ] format.

I'm unable to get inferences after modifying the inference script

I'm also unable to understand how to use anchors in this case The anchors as per the model config are as follows anchors = 19,27, 44,40, 38,94, 96,68, 86,152, 180,137, 140,301, 303,264, 238,542, 436,615, 739,380, 925,792

This is the official repo from which I have trained the model

I'm also unable to understand how to parse the 1D array to correctly map the bounding box values

All help is appreciated Thanks

AshwinRaikar88 commented 2 years ago

Thanks, I figured it out ...... Now I'm able to run inference on YoloR model

BobLd commented 2 years ago

Sounds great! Feel free to share your code, it might help someone else in the future!

AshwinRaikar88 commented 2 years ago

Hey @BobLd I've recently made new changes to the Yolor model seems like it is pretty similar to this inference script https://github.com/BobLd/YOLOv4MLNet/blob/yolo-v5-incl/YOLOv4MLNet/DataStructures/YoloV4Prediction.cs

We only need to refer to the output dimensions then after changing the outputs it works pretty fine

AshwinRaikar88 commented 2 years ago

Hey @BobLd do you have social media accounts ...... we could discuss ideas and other possible solutions Like LinkedIn, Meta