Image classification/"cannot set tensor: got value of type uint8 but expected type float32 for input 0, name: input_1 "
I am trying to expose my tflite image classification to web API but I keep getting the error message from fast API which says detail": "cannot set tensor: got value of type uint8 but expected type float32 for input 0, name: input_1 ". in addition, attached are the files for my web API, please how do I correct this sir, I believe there is something wrong in the codes. Details for reproducing is found in step.txt issue.zip
sound like your model is in the wrong format, see something like https://stackoverflow.com/questions/52530724/python-tensorflow-lite-error-cannot-set-tensor-got-tensor-of-type-1-but-expecte
Issues are not a place for code reviews except for on this codebase
Did you solve this error? If so, how did you solve it?
@haticeozdemir My guess is a greyscale image has been passed but RGB is expected by the model
Do you have posting your solution?
8 Eyl 2021 Çar 07:36 tarihinde Robin @.***> şunu yazdı:
@haticeozdemir https://github.com/haticeozdemir My guess is a greyscale image has been passed but RGB is expected by the model
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/robmarkcole/tensorflow-lite-rest-server/issues/41#issuecomment-914905437, or unsubscribe https://github.com/notifications/unsubscribe-auth/AK224NANGIZY4IQTEBE5BXLUA3R5BANCNFSM4YEMSDZQ . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.
This example in the current (August 2022) TensorFlow documentation helped with this.
The calling code can ask the TensorFlow Lite interpreter if the model needs int or float inputs and converts if needed: https://github.com/tensorflow/tensorflow/blob/master/tensorflow/lite/examples/python/label_image.py
Thanks for highlighting @tonytw1 I will reopen in case anyone wants to create a pull request