-
-
Notifications
You must be signed in to change notification settings - Fork 56.5k
Description
System Information
Python: 3.10.13
Tensorflow-macos : 2.15.0
Opencv-python: 4.9.0.80
TFLite:2.10.0
TFLite-support: 0.1.0a1
Detailed description
I am trying to deploy OpenCV with TFLite (Experimental), its classification model (LeNet5), i usually use ONNX. The TFLite test works fine until i am using the TFLite internal interpreter. But it fails with [ERROR:0@2.615] global tflite_importer.cpp:246 populateNet DNN/TFLite: Problem during import of operator [CAST]:(model/rescale_uint8/Cast) (10/22). Exception: OpenCV(4.9.0) /xperience/GHA-OpenCV-Python2/_work/opencv-python/opencv-python/opencv/modules/dnn/src/tflite/tflite_importer.cpp:238: error: (-213:The function/feature is not implemented) Unsupported operator type CAST in function 'populateNet' when i try it with net = cv2.dnn.readNetFromTFLite(name_base+".tflite").
For Context:
This is how i converted the model to TFLite
converter = tf.lite.TFLiteConverter.from_keras_model(model)
converter.optimizations = [tf.lite.Optimize.DEFAULT]
converter.target_spec.supported_types = [tf.float16]
tflite_model = converter.convert()
# Save the converted model to a file
temp_model_file = name_base + ".tflite"
with open(temp_model_file,'wb') as f:
f.write(tflite_model)
Steps to reproduce
Try reproducing with a basic Lenet5 classifier and testing it out witth cv2.dnn.readNetFromTFLite
Issue submission checklist
- I report the issue, it's not a question
- I checked the problem with documentation, FAQ, open issues, forum.opencv.org, Stack Overflow, etc and have not found any solution
- I updated to the latest OpenCV version and the issue is still there