Skip to content

Instantly share code, notes, and snippets.

@dkurt
Created July 10, 2018 08:31
Show Gist options
  • Save dkurt/73348a807d2bfff3ee7b6fb072305e5e to your computer and use it in GitHub Desktop.
Save dkurt/73348a807d2bfff3ee7b6fb072305e5e to your computer and use it in GitHub Desktop.
import cv2 as cv
import numpy as np
img = cv.imread('/home/dkurt/Pictures/download.jpeg')
inp = cv.dnn.blobFromImage(img, 0.017, (224, 224), (103.94,116.78,123.68), swapRB=False, crop=False)
net = cv.dnn.readNet('shufflenet_1x_g3_deploy.prototxt', 'shufflenet_1x_g3.caffemodel')
net.setPreferableBackend(cv.dnn.DNN_BACKEND_OPENCV)
net.setInput(inp)
out = net.forward()
print np.argmax(out), np.max(out)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment