简体   繁体   English

tensorflow中的MobileNet预处理输入如何

[英]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.

相关问题 如何在 tensorflow 数据集上使用 mobilenet_v2.preprocess_input - How to use mobilenet_v2.preprocess_input on tensorflow dataset TensorFlow 如何计算 vgg19.preprocess_input 的梯度? - How does TensorFlow compute the gradient of vgg19.preprocess_input? 如何为导出的 tensorflow 2.0 keras 模型的输入层设计/预处理特征以用于 tensorflow 服务 - How to engineer/preprocess features for the input layer of a exported tensorflow 2.0 keras model for tensorflow serving Tensorflow /移动网络培训/ ValueError:不支持的input_reader_config - Tensorflow / mobilenet training / ValueError: Unsupported input_reader_config 如何预处理 tensorflow imdb_review 数据集 - How to preprocess tensorflow imdb_review dataset 使用 Tensorflow 构建 RNN。 如何正确预处理我的数据集以匹配 RNN 的输入和 output 形状? - Building RNN with Tensorflow. How do I preprocess my dataset correctly to match the RNN's input and output shape? 如何预处理音频数据以输入到神经网络 - How to preprocess audio data for input into a Neural Network Python mrjob mapreduce如何预处理输入文件 - Python mrjob mapreduce how to preprocess the input file 在Numpy中预处理Tensorflow张量 - Preprocess a Tensorflow tensor in Numpy 如何在 map 方法中预处理和标记 TensorFlow CsvDataset? - How do I preprocess and tokenize a TensorFlow CsvDataset inside the map method?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM