在 tensorflow js 中重新训练图像分类器 [英] Retrain an Image Classifier in tensorflow js

查看:98
本文介绍了在 tensorflow js 中重新训练图像分类器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有什么想法可以转换重新训练图像分类器以与 tensorflow js 一起使用从https://www.tensorflow.org/hub/tutorials/image_retraining

hii any idea to convert retrain image classifier for use with tensorflow js from https://www.tensorflow.org/hub/tutorials/image_retraining

mkdir ~/example_code
cd ~/example_code
curl -LO https://github.com/tensorflow/hub/raw/r0.1/examples/image_retraining/retrain.py

python retrain.py --image_dir ~/flower_photos

尝试使用 tensorflowjs_converter 转换模型https://github.com/tensorflow/tfjs-converter

try to convert model using tensorflowjs_converter https://github.com/tensorflow/tfjs-converter

tensorflowjs_converter \
    --input_format=tf_frozen_model \
    --output_node_names='MobilenetV1/Predictions/Reshape_1' \
    --saved_model_tags=serve \
    /tmp/output_graph.pb \
    /tmp/web_model

出现这个错误

"graph." % repr(name))
KeyError: "The name 'MobilenetV1/Predictions/Reshape_1' refers to an Operation not in the graph."

使用命令生成 mobilenet v1 模型也失败

also fail for mobilenet v1 model generate using command

python retrain.py \
    --image_dir ~/flower_photos \
    --tfhub_module https://tfhub.dev/google/imagenet/mobilenet_v1_100_224/feature_vector/1

谢谢

推荐答案

@Mustafa 我认为您在 --output_node_names 中给出了错误的值, 尝试使用 tensorboard 浏览模型,然后您将找到必须在此处给出的值,它应该类似于 final_result(在我的情况下).

@Mustafa I think you're giving the wrong value in the --output_node_names , try going through the model using tensorboard and you will find the value what has to be given here, it should be something like final_result(this is in my case).

这篇关于在 tensorflow js 中重新训练图像分类器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆