[英]How is the MobileNet preprocess input in tensorflow
When we use some famous CNN deep neural networks such as MobileNet, it is recommended to preprocess an image before feeding it into the network.当我们使用一些著名的 CNN 深度神经网络(例如 MobileNet)时,建议在将图像输入网络之前对其进行预处理。 I found a sample code that uses MobileNet.
我找到了一个使用 MobileNet 的示例代码。 In this code, the preprocess on the image is done by the following code in TensorFlow 2.7.0:
在这段代码中,对图像的预处理由TensorFlow 2.7.0中的以下代码完成:
tf.keras.applications.mobilenet.preprocess_input(image)
I need to preprocess the input image only using PIL and OpenCV in python.我只需要在 python 中使用 PIL 和 OpenCV 对输入图像进行预处理。 Therefore, I need to know the procedure of MobileNet preprocesses in TensorFlow.
因此,我需要了解 TensorFlow 中 MobileNet 预处理的过程。 I will be grateful to guide.
我将不胜感激指导。
As already stated here :正如这里已经说过的:
[...] mobilenet.preprocess_input will scale input pixels between -1 and 1.
[...] mobilenet.preprocess_input 将在 -1 和 1 之间缩放输入像素。
As already mentioned, you could also check out the source code itself.如前所述,您还可以查看源代码本身。 With
opencv
, you would just use cv2.resize(*)
.使用
opencv
,您只需使用cv2.resize(*)
。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.