Skip to content

Instantly share code, notes, and snippets.

@agnesmm agnesmm/a3g2.py Secret
Last active Feb 7, 2019

Embed
What would you like to do?
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)
@MAMahmoudi

This comment has been minimized.

Copy link

commented Feb 7, 2019

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'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.