加载 mobilenet v2 有效,但预训练的 mobilenet v2 失败

编程入门 行业动态 更新时间:2024-10-11 03:20:47
本文介绍了加载 mobilenet v2 有效,但预训练的 mobilenet v2 失败的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

限时送ChatGPT账号..

我使用自己的图像重新训练了 mobilenet v2 模型,并且可以使用 python 中的输出标记新图像(https://www.tensorflow/hub/tutorials/image_retraining).加载文件有效,但在预测期间失败(Firefox 和 Chromium 的 concole.log):

I retrain a mobilenet v2 modell using my own images and i can label new images with the output in python (https://www.tensorflow/hub/tutorials/image_retraining). Loading the file works, but during prediction it fails with (concole.log of Firefox and Chromium):

The dict provided in model.execute(dict) has keys: [images] not part of   model graph.

我使用提供的 retrain.py 重新训练模型

I retrain a modell using the provided retrain.py

python retrain.py --image_dir flower_photos/ --tfhub_module https://tfhub.dev/google/imagenet/mobilenet_v2_100_224/classification/2 --random_brightness 10 --how_many_training_steps 100

在flower_photos 内有包含图像名称和相应图像的文件夹.

inside flower_photos there are folders with the name of the images and inside the appropriate images.

花照片

--- Huflattich

--- Huflattich

------- 1.jpg

------- 1.jpg

------- 2.jpg

------- 2.jpg

....

--- Buschwindröschen

--- Buschwindröschen

------- 1.jpg

------- 1.jpg

------- 2.jpg

------- 2.jpg

我可以使用

tensorflowjs_converter --input_format=tf_frozen_model --output_node_names='module_apply_default/MobilenetV2/Logits/output' /tmp/output_graph.pb   Mobilenetv2/web_model

但这在 https://提供的示例中不起作用github/tensorflow/tfjs-examples/tree/master/mobilenet

如果我使用

tensorflowjs_converter --input_format=tf_hub 'https://tfhub.dev/google/imagenet/mobilenet_v2_100_224/classification/2' mobilenetv2/web_model

我可以在提供的示例中加载.

i can load inside the provided example.

最后,程序应该检测网络摄像头显示的不同早熟花并进行分类.这应该是学生的 PWA,并激励他们体验自然.

In the end, the programme should detect different early bloomer flowers shown by the webcam and classify. This should be a PWA for students and motivate them to experience nature.

推荐答案

Tensorflow.js 目前有两种模型,

Tensorflow.js currently has two types of models,

允许训练的层模型,您可以使用 tf.loadModel(...) 加载它们从 TensorFlow 生成的模型转换而来的模型,不允许进行训练.这就是你所拥有的,你应该使用 tf.loadFrozenModel(...)

这里是加载冻结模型并对图像执行预测的示例.https://github/tensorflow/tfjs-converter/tree/主/演示/移动网络

here is an example for loading the frozen model and performing a prediction on an image. https://github/tensorflow/tfjs-converter/tree/master/demo/mobilenet

这篇关于加载 mobilenet v2 有效,但预训练的 mobilenet v2 失败的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

更多推荐

[db:关键词]

本文发布于:2023-05-01 00:51:56,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1402379.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:加载   mobilenet

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!