问题描述
限时送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:关键词]
发布评论