am15h / object_detection_flutter

Truly realtime object-detection in flutter
186 stars 113 forks source link

YoloV3 conversion for the current model #30

Open yechta opened 2 years ago

yechta commented 2 years ago

Hello there,

I have been trying to implement this code for my custom model which uses YoloV3. When I get to the _outputShapes part, I get an error since the default model and mine aren't compatible.

The default model's output shape looks like this: [[1, 10, 4], [1, 10], [1, 10], [1]]

My model's output shape on the other hand, looks like this: [[1, 10647, 6]]

Here is where the problem is. I need to convert this part of code for my model.

    TensorBuffer outputLocations = TensorBufferFloat(_outputShapes[0]);

    TensorBuffer outputClasses = TensorBufferFloat(_outputShapes[1]);

    TensorBuffer outputScores = TensorBufferFloat(_outputShapes[2]);

    TensorBuffer numLocations = TensorBufferFloat(_outputShapes[3]);

What do I need to do in order for my custom model to work?

Romoule commented 2 years ago

@yechta Did you find a workaround ?

Abdullah-Majeed commented 1 year ago

Hey! @yechta @Romoule, Did you find anything about this problem?

ayazmhmd commented 1 year ago

anyone ?

Romoule commented 1 year ago

@Abdullah-Majeed @ayazmhmd Yep.

To put it simply, a step is missing to convert the current ouput ( [[1, LARGE_NUMBER, SMALL_NUMBER]] ) to the default one. The missing step is the non max suppression (NMS). I successfully converted the output by reimplementing this algorithm in Flutter (to check the algo, you can check the official YOLOv5). I can suggest to you to use the package matrix2d to help you with the reimplementation.

ayazmhmd commented 1 year ago

Can you tell us where we need to change the code

asliZenith commented 1 year ago

@Romoule how do i change it?