简体   繁体   English

'str' object 在将.model 转换为 tflite 文件时没有属性 'call'

[英]'str' object has no attribute 'call' when converting .model to tflite file

I have been following this tutorial to perform voice command recognition for a couple words on my ESP32: https://github.com/atomic14/voice-controlled-robot我一直在按照本教程在我的 ESP32 上对几个词执行语音命令识别: https://github.com/atomic14/voice-controlled-robot

I was able to train my model and have the "fully_trained.model" file: "fully_trained.model"我能够训练我的 model 并拥有“fully_trained.model”文件: “fully_trained.model”

Currently I am trying to convert the.model file into the tflite file, however I am getting the "'str' has no attribute 'call'" error: Code , Code , Errors目前我正在尝试将 .model 文件转换为 tflite 文件,但是我收到“‘str’没有属性‘call’”错误:代码代码错误

My tensorflow version is 2.6.2 and python version is 3.10.我的tensorflow版本是2.6.2,python版本是3.10。

Unfortunately, I do not have 10 reputation points yet, so I couldnt embed the images.不幸的是,我还没有 10 个声望点,所以我无法嵌入图像。

If you use tf.lite.TFLiteConverter.from_keras_model you need to pass the tf.keras.Model instance, not the path to the saved_model folder.如果您使用tf.lite.TFLiteConverter.from_keras_model ,您需要传递tf.keras.Model实例,而不是 saved_model 文件夹的路径。

Use tf.lite.TFLiteConverter.from_saved_model() instead and pass the path to the "fully_trained.model" folder.请改用tf.lite.TFLiteConverter.from_saved_model()并将路径传递到“fully_trained.model”文件夹。

You've passed "fully_trained.model" , with quotation marks, as an argument to TFLiteConverter.您已将带引号的"fully_trained.model"作为参数传递给 TFLiteConverter。 That's a string.那是一个字符串。 Give the model a name and pass that name as an argument to the converter, without quotation marks.为 model 命名并将该名称作为参数传递给转换器,不带引号。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM