【发布时间】:2022-01-07 20:23:13
【问题描述】:
当我们使用一些著名的 CNN 深度神经网络(例如 MobileNet)时,建议在将图像输入网络之前对其进行预处理。我找到了一个使用 MobileNet 的示例代码。在这段代码中,对图像的预处理是由TensorFlow 2.7.0中的以下代码完成的:
tf.keras.applications.mobilenet.preprocess_input(image)
我只需要在 python 中使用 PIL 和 OpenCV 对输入图像进行预处理。因此,我需要了解 TensorFlow 中 MobileNet 预处理的过程。不胜感激。
【问题讨论】:
-
你为什么不检查源代码?
-
感谢您的回复。我试图阅读源代码。还有其他操作,我应该找出他们到底在做什么。
-
是的,这个答案对我很有帮助。我还检查了源代码,发现它只是执行以下过程:
image_array = (image_array_1 / 127.5) - 1。 @AloneTogether
标签: python tensorflow opencv python-imaging-library mobilenet