cmusatyalab / openface

Face recognition with deep neural networks.
http://cmusatyalab.github.io/openface/
Apache License 2.0
15.15k stars 3.6k forks source link

error while trying to get values from neural network #354

Closed pvsaisandeep closed 6 years ago

pvsaisandeep commented 6 years ago

when i write code for getting values from neural network , I am getting following error: Traceback (most recent call last): File "D:\Face Detection\Real Time Face Recognition Using OpenCV and MATLAB\some.py", line 23, in network=openface.TorchNeuralNet(net,96) File "C:\Python27\lib\site-packages\openface\torch_neural_net.py", line 84, in init self.p = Popen(self.cmd, stdin=PIPE, stdout=PIPE, bufsize=0, universal_newlines=True) File "C:\Python27\lib\subprocess.py", line 711, in init errread, errwrite) File "C:\Python27\lib\subprocess.py", line 959, in _execute_child startupinfo) WindowsError: [Error 2] The system cannot find the file specified

please help me my code is as follows: import sys import dlib import cv2 import openface

predictor_model = "shape_predictor_68_face_landmarks.dat"

file_name = "C:\local\openface\samples\sample1.jpg"

face_detector = dlib.get_frontal_face_detector() face_pose_predictor = dlib.shape_predictor(predictor_model) face_aligner = openface.AlignDlib(predictor_model)

image = cv2.imread(file_name) net="C:\local\openface-master\models\openface\nn4.small2.v1.t7" network=openface.TorchNeuralNet(net,96)

detected_faces = face_detector(image, 1)

print("Found {} faces in the image file {}".format(len(detected_faces), file_name))

for i, face_rect in enumerate(detected_faces):

print("- Face #{} found at Left: {} Top: {} Right: {} Bottom: {}".format(i, face_rect.left(), face_rect.top(), face_rect.right(), face_rect.bottom()))

# Get the the face's pose
pose_landmarks = face_pose_predictor(image, face_rect)

# Use openface to calculate and perform the face alignment
alignedFace = face_aligner.align(534, image, face_rect, landmarkIndices=openface.AlignDlib.OUTER_EYES_AND_NOSE)

rep= network.forward(alignedFace)

cv2.imwrite("alignedface{}.jpg".format(i), alignedFace) cv2.imshow("oimage",image) cv2.imshow("aligned",alignedFace) cv2.waitKey(0)

stale[bot] commented 6 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.