shaqian / flutter_tflite

Flutter plugin for TensorFlow Lite
https://pub.dartlang.org/packages/tflite
MIT License
631 stars 404 forks source link

runModelOnBinary method not working for segmentation. #91

Open Ehtasha opened 4 years ago

Ehtasha commented 4 years ago

Hello Qian @shaqian

We are running our own nails detection custom model using runModelOnBinary method but it is not doing segmentation on nails.

Even there is no crash no warning showing in logs but still it is not doing segmentation.

Example App deeplab segmentation model is working with 'runSegmentationOnImage' method but when I use this method with my own custom model it gives me bellow error.

Cannot convert between a TensorFlowLite buffer with 196608 bytes and a Java Buffer with 786432 bytes.org.tensorflow.lite.Tensor.throwIfShapeIsIncompatible

Is runModelOnBinary method support segmentation or not ?

Bellow is the code I'm using var recognitions = await Tflite.runSegmentationOnBinary( binary: imageToByteListUint8(resizedImage, 128), labelColors: [colorbackground,colorbase,colornail,colortip], outputType: "jpg",); print('Output of our model recognitions $recognitions');

Output returning from model is

I/flutter (15954): Output of our model recognitions [0, 0, 0, 255, 0, 0, 0, 255, 0, 0, 0, 255, 0, 0, 0, 255, 0, 0, 0, 255, 0, 0, 0, 255, 0, 0, 0, 255, 0, 0, 0, 255, 0, 0, 0, 255, 0, 0, 0, 255, 0, 0, 0, 255, 0, 0, 0, 255, 0, 0, 0, 255, 0, 0, 0, 255, 0, 0, 0, 255, 0, 0, 0, 255, 0, 0, 0, 255, 0, 0, 0, 255, 0, 0, 0, 255, 0, 0, 0, 255, 0, 0, 0, 255, 0, 0, 0, 255, 0, 0, 0, 255, 0, 0, 0, 255, 0, 0, 0, 255, 0, 0, 0, 255, 0, 0, 0, 255, 0, 0, 0, 255, 0, 0, 0, 255, 0, 0, 0, 255, 0, 0, 0, 255, 0, 0, 0, 255, 0, 0, 0, 255, 0, 0, 0, 255, 0, 0, 0, 255, 0, 0, 0, 255, 0, 0, 0, 255, 0, 0, 0, 255, 0, 0, 0, 255, 0, 0, 0, 255, 0, 0, 0, 255, 0, 0, 0, 255, 0, 0, 0, 255, 0, 0, 0, 255, 0, 0, 0, 255, 0, 0, 0, 255, 0, 0, 0, 255, 0, 0, 0, 255, 0, 0, 0, 255, 0, 0, 0, 255, 0, 0, 0, 255, 0, 0, 0, 255, 0, 0, 0, 255, 0, 0, 0, 255, 0, 0, 0, 255, 0, 0, 0, 255, 0, 0, 0, 255, 0, 0, 0, 255, 0, 0, 0, 255, 0, 0, 0, 255, 0, 0, 0, 255, 0, 0, 0, 255, 0, 0, 0, 255, 0, 0, 0, 255, 0, 0, 0, 255, 0, 0, 0, 255, 0, 0, 0, 255, 0, 0, 0, 255, 0, 0, 0, 255, 0, 0, 0, 255, 0, 0, 0,

Thanks Ehtasham Ali

Leena1666 commented 3 years ago

have you found any solution?

wbdsnx commented 2 years ago

@Leena1666 I have the same issue ,any solution? Please !