简体   繁体   English

我们可以使用 tensorflow 用新数据训练预训练模型吗?

[英]Can we train a pre-trained model with new data using tensorflow?

I have a trained model which can classify a cat or a dog as an h5 file named我有一个训练有素的模型,可以将猫或狗分类为名为的 h5 文件

catsvsdogs.h5 catvsdogs.h5

Now I want to add another animal in the list.现在我想在列表中添加另一种动物。 Say I want to classify cat/dog/tiger using that model and I don't want to redo the training process of cat and dog, instead I want to feed the tiger data set in my neural network and then it will classify dog or cat or tiger with that same file.假设我想使用该模型对猫/狗/老虎进行分类,并且我不想重做猫和狗的训练过程,而是想在我的神经网络中输入老虎数据集,然后它将对狗或猫进行分类或带有相同文件的老虎。 Is it possible to do so?有可能这样做吗? If yes, how?如果是,如何?

Unfortunately , this is not possible.不幸的是,这是不可能的。 You can of course train a model for tiger class but you would also need the dogs & cats data for making the model to classify between these 3 classes.您当然可以为tiger类训练一个模型,但您还需要dogs & cats数据来使模型在这 3 个类之间进行分类。

If you load this ( catsvsdogs.h5 ) pre-trained model for training on only tiger class you would have to set output layer with 1 class, so at the time of prediction it will only predict if it is tiger or not.如果你加载这个 ( catsvsdogs.h5 ) 预训练模型只训练tiger类,你必须将输出层设置为1类,所以在预测时它只会预测它是否是老虎。

Retraining a trained model on only new class is still a research question.仅在新类上重新训练训练模型仍然是一个研究问题。

这是不可能的,因为您的模型的结构方式可以将两个类中的一个分配给图像,您必须更改最外层并重新训练它。

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

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