linyiLYi / pose-monitor

“让爷康康”是一款手机 AI 应用程序,可以监测不良坐姿并进行语音提示
Apache License 2.0
2.53k stars 388 forks source link

请教 想要自己训练动作,但最后生成tflite时报错 #23

Open shankaijie opened 1 year ago

shankaijie commented 1 year ago

想要自己训练一些动作,编译大佬的文件报错

报错位置: converter = tf.lite.TFLiteConverter.from_keras_model(model) converter.optimizations = [tf.lite.Optimize.DEFAULT] tflite_model = converter.convert()

报错信息:Some of the operators in the model are not supported by the standard TensorFlow Lite runtime. If those are native TensorFlow operators, you might be able to use the extended runtime by passing --enable_select_tf_ops, or by setting target_ops=TFLITE_BUILTINS,SELECT_TF_OPS when calling tf.lite.TFLiteConverter(). Otherwise, if you have a custom implementation for them you can disable this error with --allow_custom_ops, or by setting allow_custom_ops=True when calling tf.lite.TFLiteConverter(). Here is a list of builtin operators you are using: ADD, DIV, EXPAND_DIMS, FLOOR_DIV, FULLY_CONNECTED, GATHER, MAXIMUM, MUL, PACK, REDUCE_MAX, RESHAPE, SOFTMAX, SQRT, SQUEEZE, STRIDED_SLICE, SUB, SUM. Here is a list of operators for which you will need custom implementations: BroadcastTo, Size.

需要增加 这句: converter.allow_custom_ops=True

得到最终:16:23converter = tf.lite.TFLiteConverter.from_keras_model(model) converter.optimizations = [tf.lite.Optimize.DEFAULT] converter.allow_custom_ops=True tflite_model = converter.convert()

这样编译通过了 但是得到的tflite的文件运行到AS上面跑不通,想知道up主为什么不需要加就能编译通过

18335076880 commented 1 year ago

请问一下您的utils里的utils中的'visualize'内容是什么啊

AttributeError Traceback (most recent call last)

in 10 ) 11 ---> 12 preprocessor.process(per_pose_class_limit=None in process(self, per_pose_class_limit, detection_threshold) 111 112 # Draw the prediction result on top of the image for debugging later --> 113 output_overlay = draw_prediction_on_image( 114 image.numpy().astype(np.uint8), person, 115 close_figure=True, keep_input_size=True) in draw_prediction_on_image(image, person, crop_region, close_figure, keep_input_size) 18 """ 19 # Draw the detection result on top of the image. ---> 20 image_np = utils.visualize(image, [person]) 21 22 # Plot the image with detection results. AttributeError: module 'utils' has no attribute 'visualize' 我报错了,找不到这个visualize