简体   繁体   中英

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. I found a sample code that uses MobileNet. In this code, the preprocess on the image is done by the following code in 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. Therefore, I need to know the procedure of MobileNet preprocesses in TensorFlow. I will be grateful to guide.

As already stated here :

[...] mobilenet.preprocess_input will scale input pixels between -1 and 1.

As already mentioned, you could also check out the source code itself. With opencv , you would just use cv2.resize(*) .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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