-
Notifications
You must be signed in to change notification settings - Fork 356
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Bad state: failed precondition #167
Comments
This is similar to what I described here: am15h/tflite_flutter_helper#49 - in case any discussion occurs there, you might want to be a part of it. Note that over there I used |
Can be closed, I just had to resize my image according to input Tensor so I changed |
Thank you for the hint. Indeed, after your remark I noticed that the type was uint8 (if using the method I described initially), while if I use your approach, the type is float32. This has gotten me successfully past that error. Although I still don't get all the results I need, this is probably an issue with my model itself. |
It may be not an issue of your model. I was having the same trouble as you @ralienpp.
If I uncomment the Although the error of this issue is "solved", I have the exact same output every time I run the interpreter on different images: all 0.0 in the Hope this helps someone. I am reeally keen to get this working! |
Have any of you run into an issue like this only after updating from 0.8.0 ? |
I found this plugin already in version 0.9.0, so I cannot tell, but I was about to post that I managed to found the solution and get proper predictions. Following this comment's code:
Hope this helps someone. |
@gabrielglbh are you applying padding at any point? |
@espbee As far as I am concerned, no padding applied. |
@gabrielglbh thanks. |
why would the model effect what's happening with the pre-inference image conversions? (asking in all earnestness, i'm just trying to sort through my issues) |
@espbee Yes, I managed to run it with image processor but predictions for my object detection model are not matching the image itself so I think there is still something wrong with my implementation. Regarding with @gabrielglbh input image procesing it's only valid for single input/output model. |
@espbee The thing I could not perform with the |
@gabrielglbh thanks. and thanks for the post generally. happy new year-- side question: did you have any issues with the TensorFlowLiteC.framework ? |
@espbee I did not try it with TensorFlowLiteC.framework, I am manily focusing on Android side for now. Happy new year :) |
@sDobrzanski thanks a million. in the older lib i didn't have to specify the TensorImage as float32. that was it. my labors on this count are over. happy new year. |
I didn't see How do you guys do the |
Well, I found this: import 'package:image/image.dart' as imglib;
imglib.Image normalize_image_into_range(
imglib.Image image, num min, num max) {
return imglib.normalize(image, min: min, max: max);
}
face_image = normalize_image_into_range(face_image, 0, 1); |
Hello,
I'm working on app that uses my custom created object detection .tflite model. I followed code described in this tutorial:
https://github.com/am15h/object_detection_flutter but I'm getting Bad state: failed precondition error in this line:
checkState(tfLiteTensorCopyFromBuffer(_tensor, ptr.cast(), bytes.length) == TfLiteStatus.ok);
at tensor.dart.Here is my code:
and console output:
[log] Error AiCubit: Bad state: failed precondition (log created by me, nothing comes from library itself)
Thanks for help in advance ;)
The text was updated successfully, but these errors were encountered: