简体   繁体   English

在 tf.keras 中使用预训练的 model 进行预测

[英]Predicting using pre-trained model in tf.keras

What is the difference between rescaling and not rescaling images for predicting using a tf.keras Resnet50 pre-trained on ImageNet?使用在 ImageNet 上预训练的 tf.keras Resnet50 进行预测时,重新缩放和不重新缩放图像有什么区别?

Is it necessary?有必要吗? How much of an impact does it have on the predictions?它对预测有多大影响?

It is the difference between the model working as expected, and not working at all, usually if you do not apply the proper normalization that was applied to the training set, then the model performs weird, like always producing the same output, which is undesirable.这是 model 按预期工作和根本不工作之间的区别,通常如果你没有对训练集应用适当的归一化,那么 model 的表现很奇怪,就像总是产生相同的 Z78E6221F6393D13CE65Z668 一样,这是不可取的.

So always use the exact same scaling and normalization used to train a model.因此,始终使用与训练 model 完全相同的缩放和归一化。

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

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