Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

3D batch processing and BlazeFace

See original GitHub issue

Hi @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/ 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/ 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/ 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/ 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/ 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/ 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



Exactly the same video works correctly with sfd.


Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:1
  • Comments:6 (3 by maintainers)

github_iconTop GitHub Comments

esteriveracommented, Aug 4, 2020

The batch 3D processing is working like a charm. Thank you!!

esteriveracommented, Jul 29, 2020

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:

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

Read more comments on GitHub >

github_iconTop Results From Across the Web

MediaPipe Face Mesh - Google
MediaPipe Face Mesh is a solution that estimates 468 3D face landmarks in real-time ... ideal for processing a batch of static, possibly...
Read more >
Optimizing Face Detection on your browser with Tensorflow.js
Tensorflow serving can batch requests to the same model, which uses hardware (GPUs) more appropriately. Tensorflow serving has performance ...
Read more >
Deepfake Detection using Spatiotemporal Convolutional ...
In this paper, we aim to apply techniques used for video classification, that take advantage of 3D input, on the Deepfake classification problem...
Read more >
Face Detection for low-end hardware using the BlazeFace ...
The Blaze Face architecture claims that we can have good face detection even if our ... BatchNormalization() self.activation = layers.
Read more >
A Cross-camera Multi-face Tracking System Based on Double ...
Joint image processing of multi camera monitoring has become a research hotspot, and many researchers have done a lot of work in this...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Post

No results found

github_iconTop Related Hashnode Post

No results found