1adrianb / face-alignment

:fire: 2D and 3D Face alignment library build using pytorch
https://www.adrianbulat.com
BSD 3-Clause "New" or "Revised" License
7.05k stars 1.34k forks source link

Detector fails with gray images #154

Open neverUseThisName opened 5 years ago

neverUseThisName commented 5 years ago

When dealing with single channel images, the following error was raised: Traceback (most recent call last): File "face_align.py", line 5, in <module> lms = fa.get_landmarks_from_directory(dir) File "/usr/local/lib/python3.5/dist-packages/face_alignment/api.py", line 223, in get_landmarks_from_directory detected_faces = self.face_detector.detect_from_directory(path, extensions, recursive, show_progress_bar) File "/usr/local/lib/python3.5/dist-packages/face_alignment/detection/core.py", line 97, in detect_from_directory predictions[image_path] = self.detect_from_image(image_path) File "/usr/local/lib/python3.5/dist-packages/face_alignment/detection/sfd/sfd_detector.py", line 51, in detect_from_image bboxlist = detect(self.face_detector, image, device=self.device) File "/usr/local/lib/python3.5/dist-packages/face_alignment/detection/sfd/detect.py", line 20, in detect img = img - np.array([104, 117, 123]) ValueError: operands could not be broadcast together with shapes (398,377) (3,)

vinayak618 commented 5 years ago

The input to detector is 3 channel, please refer the detector code here make changes accordingly

dwy6626 commented 4 years ago

same issue here, I use get_landmarks_from_directory to load image