-
-
Save agnesmm/493031c4572cbd8480cb66c300737868 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import cv2 | |
import numpy as np | |
vgg_mean = np.array([123.68, 116.779, 103.939], dtype=np.float32) | |
path = '/Users/agnesmustar/data/color_images/image.jpeg' | |
def preprocess_image(path): | |
im = cv2.resize(cv2.imread(path), (224, 224)).astype(np.float32) | |
im = im - vgg_mean | |
return im[:, ::-1] # RGB to BGR | |
image = preprocess_image(path) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
ModuleNotFoundError Traceback (most recent call last)
in
----> 1 import cv2
2 import numpy as np
3
4 vgg_mean = np.array([123.68, 116.779, 103.939], dtype=np.float32)
5 path = 'G:/DOCTORAT/TensorFlow/tests/vgg16/image.jpg'
ModuleNotFoundError: No module named 'cv2'