mediapipe icon indicating copy to clipboard operation
mediapipe copied to clipboard

Can't detect tilted face in the image input

Open Aarushi240 opened this issue 3 years ago • 3 comments

Hello everyone,

I was trying Mediapipe Facemesh Solutions. When processing some images containing face couldn't detect the tilted face in the image.

System information

  • OS Platform and Distribution: Windows 8
  • Solution: Facemesh
  • Programming Language: Javascript

Image to reproduce:

output (tilted photo)

Code to reproduce:

const canvasElement = document.getElementsByClassName('output_canvas')[0];
const canvasCtx = canvasElement.getContext('2d');
main();
function onResults(results) {
  canvasCtx.save();
  
  canvasCtx.clearRect(0, 0, canvasElement.width, canvasElement.height);
  canvasCtx.drawImage(results.image, 0, 0, canvasElement.width, canvasElement.height);
  if (results.multiFaceLandmarks) {
    for (const landmarks of results.multiFaceLandmarks) {
        
      drawConnectors(canvasCtx, landmarks, FACEMESH_TESSELATION,
                     {color: '#C0C0C070', lineWidth: 1});
      drawConnectors(canvasCtx, landmarks, FACEMESH_RIGHT_EYE, {color: '#FF3030'});
      drawConnectors(canvasCtx, landmarks, FACEMESH_RIGHT_EYEBROW, {color: '#FF3030'});
      drawConnectors(canvasCtx, landmarks, FACEMESH_RIGHT_IRIS, {color: '#FF3030'});
      drawConnectors(canvasCtx, landmarks, FACEMESH_LEFT_EYE, {color: '#30FF30'});
      drawConnectors(canvasCtx, landmarks, FACEMESH_LEFT_EYEBROW, {color: '#30FF30'});
      drawConnectors(canvasCtx, landmarks, FACEMESH_LEFT_IRIS, {color: '#30FF30'});
      drawConnectors(canvasCtx, landmarks, FACEMESH_FACE_OVAL, {color: '#E0E0E0'});
      drawConnectors(canvasCtx, landmarks, FACEMESH_LIPS, {color: '#E0E0E0'});
    }
  }
  canvasCtx.restore();
}

const faceMesh = new FaceMesh({locateFile: (file) => {
  return `https://cdn.jsdelivr.net/npm/@mediapipe/face_mesh/${file}`;
}});
faceMesh.setOptions({
  staticImageMode: true,
  maxNumFaces: 2,
  refineLandmarks: true,
  minDetectionConfidence: 0.9,     
  minTrackingConfidence: 0.5
});
faceMesh.onResults(onResults);

Output (Not Tilted Face)

Output (straight photo)

Output (Tilted Face)

output (tilted photo)

Aarushi240 avatar Sep 09 '22 10:09 Aarushi240

Hi @Aarushi240, Our dataset for training face detection for front camera is composed of mostly selfie images and we trained with rotation augmentation (+/- 45 degrees). So there're training examples up to 90 degrees rotation. However, we don't have much flipped face in the dataset and the model is not expected to work in that case. Thank you!

kuaashish avatar Sep 09 '22 11:09 kuaashish

Hi @Aarushi240, Could you confirm query has been addressed as per the above comment and could we move this issue to the close status as has been resolved. Thank you!

kuaashish avatar Sep 13 '22 03:09 kuaashish

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.

google-ml-butler[bot] avatar Sep 21 '22 10:09 google-ml-butler[bot]

Closing as stale. Please reopen if you'd like to work on this further.

google-ml-butler[bot] avatar Oct 03 '22 10:10 google-ml-butler[bot]

Are you satisfied with the resolution of your issue? Yes No

google-ml-butler[bot] avatar Oct 03 '22 10:10 google-ml-butler[bot]