Skip to content

Instantly share code, notes, and snippets.

@agnesmm

agnesmm/a3g2.py Secret

Last active February 7, 2019 14:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save agnesmm/493031c4572cbd8480cb66c300737868 to your computer and use it in GitHub Desktop.
Save agnesmm/493031c4572cbd8480cb66c300737868 to your computer and use it in GitHub Desktop.
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
Copy link

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