在 tensorflow js 中重新训练图像分类器

编程入门 行业动态 更新时间:2024-10-10 14:28:06
本文介绍了在 tensorflow js 中重新训练图像分类器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

限时送ChatGPT账号..

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

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

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

python retrain.py --image_dir ~/flower_photos

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

try to convert model using tensorflowjs_converter https://github/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屋!

更多推荐

[db:关键词]

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

发布评论

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

>www.elefans.com

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