简体   繁体   English

在Tensorflow(python)中使用初始模型进行传递学习

[英]Transfer learning with inception model in Tensorflow (python)

How can I load a .pb protobuf model and then tweak the network as needed (specially the outer layers) in order to train a new model for completely different classes? 如何加载.pb protobuf模型,然后根据需要调整网络(特别是外层),以便为完全不同的类训练新模型? Effectively doing transfer learning? 有效地进行转学习吗?

I want to do something like these (ie train the outer layers with a bigger learning rate than the inner layers) among other things, so I need a way to not only load the graph with the variables, but to alter the network's structure and hyperparameters too. 我想这样做这些 (即培养具有更大的学习速度比内层外层)除其他事情,所以我需要一种方法来不仅加载与变量的图形,而是要改变网络的结构和超参数太。

If anyone has an example to follow with the inception model, it would be amazing! 如果有人有一个跟随初始模型的例子,那将是惊人的!

My question is very similar to this one . 我的问题与非常相似。

I've searched all over the internet (TF docs, Github, StackOverflow, Google...) but I can't seam to find something useful for a novice. 我在互联网上搜索过(TF文档,Github,StackOverflow,Google ......)但是我找不到新手有用的东西。

Thanks a lot! 非常感谢!

tf.import_graph_def() is the function for loading a GraphDef: tf.import_graph_def()是加载GraphDef的函数:

https://www.tensorflow.org/versions/0.6.0/api_docs/python/framework.html#import_graph_def https://www.tensorflow.org/versions/0.6.0/api_docs/python/framework.html#import_graph_def

Hopefully once imported, you can make the modifications to the graph you need. 希望一旦导入,您可以对所需的图形进行修改。 It would be easier, though, to modify the Python code that generated the graph in the first place, if you have access to that. 但是,如果您有权访问,那么首先修改生成图形的Python代码会更容易。

This is the updated tutorial from official Tensorflow website https://www.tensorflow.org/hub/tutorials/image_retraining 这是来自Tensorflow官方网站的更新教程https://www.tensorflow.org/hub/tutorials/image_retraining

They use the pre trained Inception V3 model and everything works fine. 他们使用经过预先训练的Inception V3模型,一切正常。 You can change the dataset folder to your own dataset 您可以将数据集文件夹更改为您自己的数据集

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM