Skip to content

Instantly share code, notes, and snippets.

@natxopedreira
Created May 21, 2020 09:58
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 natxopedreira/111d51252b1e759c67738869885d4bc3 to your computer and use it in GitHub Desktop.
Save natxopedreira/111d51252b1e759c67738869885d4bc3 to your computer and use it in GitHub Desktop.
libfacedetection output landmarks
net = cv.dnn.readNet('facedetectcnn_320.xml', 'facedetectcnn_320.bin')
net.setPreferableBackend(cv.dnn.DNN_BACKEND_DEFAULT)
net.setPreferableTarget(cv.dnn.DNN_TARGET_MYRIAD)
outNames = net.getUnconnectedOutLayersNames()
print("outNames ", outNames)
image = cv.imread('27.jpg')
blob = cv.dnn.blobFromImage(image, size=(image.shape[1], image.shape[0]), ddepth=cv.CV_8U)
net.setInput(blob)
outs = net.forward(outNames)
print(outs)
OUTPUT
outNames ['273', '284']
[array([[[ 1.1507194 , 0.9060677 , 0.27372968, ..., 3.6615908 ,
2.6377516 , 3.5587294 ],
[ 1.4655025 , 1.4101121 , -0.77305496, ..., 3.5989683 ,
2.5534937 , 3.5874 ],
[ 1.334346 , 1.60546 , -1.7696022 , ..., 3.3517065 ,
1.783757 , 3.2990403 ],
...,
[-0.26338542, -0.48733017, -0.7256162 , ..., 0.47976866,
0.5010154 , 0.49542978],
[-0.21973787, -0.33746287, -0.74069357, ..., 0.4249959 ,
0.42855752, 0.42897078],
[-0.10707203, -0.26409724, -0.77743214, ..., 0.3657462 ,
0.4018019 , 0.38063642]]], dtype=float32), array([[[0.9696907 , 0.03030928],
[0.9681741 , 0.03182584],
[0.9762263 , 0.02377367],
...,
[0.9796165 , 0.02038354],
[0.9814508 , 0.01854923],
[0.9820987 , 0.01790125]]], dtype=float32)]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment