3D batch processing and BlazeFace
See original GitHub issueHi @imadtoubal ! Thank you for the amazing code; I would like to know, if processing 3D landmarks for a complete batch is on the roadmap of the library.
Aditionally, I have a problem when I try to run the 2D landmark detector with the BlazeFace detector. I use the same code as in the notebook, with a different video:
fa = face_alignment.FaceAlignment(face_alignment.LandmarksType._2D, device='cpu', face_detector='blazeface')
t_start = time.time() preds = fa.get_landmarks_from_image(frames[0])
`--------------------------------------------------------------------------- AssertionError Traceback (most recent call last) <ipython-input-17-bf2e795286ee> in <module> 1 t_start = time.time() ----> 2 preds = fa.get_landmarks_from_image(frames[0]) 3 #print(f’BlazeFace: Execution time for a single image: {time.time() - t_start}')
~/anaconda3/envs/bulat/lib/python3.7/site-packages/torch/autograd/grad_mode.py in decorate_context(*args, **kwargs) 13 def decorate_context(*args, **kwargs): 14 with self: —> 15 return func(*args, **kwargs) 16 return decorate_context 17
~/python_custom_packages/face-alignment/face_alignment/api.py in get_landmarks_from_image(self, image_or_path, detected_faces) 138 139 if detected_faces is None: –> 140 detected_faces = self.face_detector.detect_from_image(image[…, ::-1].copy()) 141 142 if len(detected_faces) == 0:
~/python_custom_packages/face-alignment/face_alignment/detection/blazeface/blazeface_detector.py in detect_from_image(self, tensor_or_path) 50 image = self.tensor_or_path_to_ndarray(tensor_or_path) 51 —> 52 bboxlist = detect(self.face_detector, image, device=self.device)[0] 53 54 return bboxlist
~/python_custom_packages/face-alignment/face_alignment/detection/blazeface/detect.py in detect(net, img, device) 22 orig_size = min(H, W) 23 img, (xshift, yshift) = resize_and_crop_image(img, 128) —> 24 preds = net.predict_on_image(img) 25 26 if 0 == len(preds):
~/python_custom_packages/face-alignment/face_alignment/detection/blazeface/net_blazeface.py in predict_on_image(self, img) 189 img = torch.from_numpy(img).permute((2, 0, 1)) 190 –> 191 return self.predict_on_batch(img.unsqueeze(0))[0] 192 193 def predict_on_batch(self, x):
~/python_custom_packages/face-alignment/face_alignment/detection/blazeface/net_blazeface.py in predict_on_batch(self, x) 212 213 assert x.shape[1] == 3 –> 214 assert x.shape[2] == 128 215 assert x.shape[3] == 128 216
AssertionError:
`
Exactly the same video works correctly with sfd.
Thanks!
Issue Analytics
- State:
- Created 3 years ago
- Reactions:1
- Comments:6 (3 by maintainers)
Top GitHub Comments
The batch 3D processing is working like a charm. Thank you!!
Hi @imadtoubal , thank you very much, Im looking forward for the 3D batch processing, it would really help me.
Regarding the BlazeFace issue, here is the problematic video:
output1.zip
It is vertical oriented; I tested with one horizontal oriented video, and it worked, so maybe that is the source of the issue.
Thank you in advance, regards