object_detection_flutter icon indicating copy to clipboard operation
object_detection_flutter copied to clipboard

YoloV3 conversion for the current model

Open yechta opened this issue 4 years ago • 6 comments

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?

yechta avatar Jan 12 '22 18:01 yechta

@yechta Did you find a workaround ?

Romoule avatar Feb 03 '22 14:02 Romoule

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

Abdullah-Majeed avatar Nov 20 '22 14:11 Abdullah-Majeed

anyone ?

ayazmhmd avatar Jan 29 '23 14:01 ayazmhmd

@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.

Romoule avatar Jan 30 '23 07:01 Romoule

Can you tell us where we need to change the code

ayazmhmd avatar Feb 03 '23 05:02 ayazmhmd

@Romoule how do i change it?

asliZenith avatar Mar 05 '23 16:03 asliZenith