使用MobileNet重新训练图像检测

ser*_*inc 6 tensorflow tensorflow.js tensorflowjs-converter mobilenet

重新培训与Tensorflow.js一起使用的MobileNet的几种方法对我来说都是失败的。有没有办法在Tensorflow.js中使用重新训练的模型?

使用现代的,基于中心的教程以及使用两者retrain.py似乎都失败了。

以及其他一些未解决的问题

另外两个最重要的问题显示了在两种情况下均失败的代码,均未解决。

目的是加载移动网络,使用自定义数据进行重新训练,然后在Tensorflow.js中使用它。遵循这两个教程似乎都失败了。可以在node.js内部完成吗?还有另一种方法吗?我在哪里犯了错误(或者该软件无法使用经过重新训练的模型)?这怎么工作?

编辑:最新的github问题和另一个问题

小智 5

我遇到了同样的问题,似乎我们使用了错误的方法。有用于 TF 转换模型的 loadGraphModel 和用于 Keras 的 loadLayersModel 我对这个问题的评论


小智 3

python脚本retrain.py不会生成保存的模型,它实际上生成冻结的图模型。这就是为什么您无法使用 tfjs 1.x 转换器对其进行转换的原因。您需要使用tfjs 0.8.5 pip进行转换。此外,输出节点名称与 mobilenet 模型图不同,重新训练图的输出节点名称为“final_result”。

要转换它,您需要使用tensorflowjs 0.8.5 pip:

  • 使用 virtualenv 创建一个空的环境。
  • pip安装tensorflowjs==0.8.5
  • 运行转换器
tensorflowjs_converter \
  --input_format=tf_frozen_model \
  --output_node_names='final_result' \
  --output_json=true /tmp/output_graph.pb \ /tmp/web_model
Run Code Online (Sandbox Code Playgroud)

这应该会给你类似下面的内容:

ls /tmp/web_model/
group1-shard10of21  group1-shard14of21  group1-shard18of21  group1-shard21of21  group1-shard5of21  group1-shard9of21
group1-shard11of21  group1-shard15of21  group1-shard19of21  group1-shard2of21   group1-shard6of21  model.json
group1-shard12of21  group1-shard16of21  group1-shard1of21   group1-shard3of21   group1-shard7of21
group1-shard13of21  group1-shard17of21  group1-shard20of21  group1-shard4of21   group1-shard8of21
Run Code Online (Sandbox Code Playgroud)