下面的代码生成了常规的 tensorflow 模型,但是当我尝试将其转换为 tensorflow lite 时它不起作用,我遵循了以下文档。
https://www.tensorflow.org/tutorials/estimator/linear 1 https://www.tensorflow.org/lite/guide/get_started
export_dir = "tmp"
serving_input_fn = tf.estimator.export.build_parsing_serving_input_receiver_fn(
tf.feature_column.make_parse_example_spec(feat_cols))
estimator.export_saved_model(export_dir, serving_input_fn)
# Convert the model.
converter = tf.lite.TFLiteConverter.from_saved_model("tmp/1571728920/saved_model.pb")
tflite_model = converter.convert()
Run Code Online (Sandbox Code Playgroud)
错误信息
Traceback (most recent call last):
File "C:/Users/Dacorie Smith/PycharmProjects/JamaicaClassOneNotifableModels/ClassOneModels.py", line 208, in <module>
tflite_model = converter.convert()
File "C:\Users\Dacorie Smith\PycharmProjects\JamaicaClassOneNotifableModels\venv\lib\site-packages\tensorflow_core\lite\python\lite.py", line 400, in convert
raise ValueError("This converter can only convert a single "
ValueError: This converter can only convert a single ConcreteFunction. Converting multiple functions is under development.
Run Code Online (Sandbox Code Playgroud)
文档摘录
TensorFlow Lite 转换器 TensorFlow …
python android tensorflow tensorflow-lite tensorflow-estimator
我已实现以下代码来上传文件.该文件将上载到该位置("../App_Data/uploads"),但它不会显示在项目中.我必须在项目中手动包含该文件.为什么文件没有显示?
public ActionResult ChangeSetting(SettingViewModel setting)
{
string userId = User.Identity.GetUserId();
ApplicationUser currentUser = this._appUserRepo.Find(e => e.Id.Equals(userId)).FirstOrDefault();
if (setting.PictureUrl != null)
{
if (setting.PictureUrl.ContentLength > 0)
{
string fileName = Path.GetFileName(setting.PictureUrl.FileName);
if (fileName != null)
{
string path = Path.Combine(Server.MapPath("../App_Data/uploads"), fileName);
setting.PictureUrl.SaveAs(path);
if (currentUser != null)
{
currentUser.PictureUrl = path;
currentUser.PictureSmalUrl = path;
currentUser.PictureBigUrl = path;
}
}
}
}
if (setting.FirstName != null)
{
if (currentUser != null) currentUser.FirstName = setting.FirstName;
}
_appUserRepo.Update(currentUser);
return RedirectToAction("index", "Admin");
}
Run Code Online (Sandbox Code Playgroud)