google-ai-edge / mediapipe

Cross-platform, customizable ML solutions for live and streaming media.
https://ai.google.dev/edge/mediapipe
Apache License 2.0
27.76k stars 5.18k forks source link

Getting face landmarks of previous image even though I'm sending a new image for prediction #2068

Closed Narendra186 closed 3 years ago

Narendra186 commented 3 years ago

I'm using @tensorflow-models/face-landmarks-detection npm package for detecting face landmarks

I'm facing a problem when I switch between images, even though the new image is sent for prediction, the API is returning the face landmarks which somewhat look like those of previous image. I'm attaching some screenshots, please refer those

Screenshot from 2021-05-21 13-09-18 Screenshot from 2021-05-21 13-09-32

I selected the first girl, got her face landmarks and drawn those, and then I've gone to second image by clicking on the arrow mark, basically I resize that image, draw it on a canvas and then send the canvas as an input to the API, I'm pretty sure that the new canvas which contains image of blue dressed girl is going for the prediction(I checked it), but somehow the face landmarks that are returned had characteristics of previous image landmarks.

I've checked the face-landmarks-detection github read me page and didn't find any configuration option related to this. When I checked an article on mediapipe website, there is a configuration option named "STATIC_IMAGE_MODE". I'm pasting the description of it.

STATIC_IMAGE_MODE If set to false, the solution treats the input images as a video stream. It will try to detect faces in the first input images, and upon a successful detection further localizes the face landmarks. In subsequent images, once all max_num_faces faces are detected and the corresponding face landmarks are localized, it simply tracks those landmarks without invoking another detection until it loses track of any of the faces. This reduces latency and is ideal for processing video frames. If set to true, face detection runs on every input image, ideal for processing a batch of static, possibly unrelated, images. Default to false.

This STATIC_IMAGE_MODE is available only for python API but not for javascript API

sgowroji commented 3 years ago

Hi @Narendra186, Could you please provide your code changes to understand the issue much better. Thanks

mhays-google commented 3 years ago

Uh oh. I know what the issue is. I thought it was already fixed, but I will check and have a new version up in the next few days.

google-ml-butler[bot] commented 3 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.

google-ml-butler[bot] commented 3 years ago

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

google-ml-butler[bot] commented 3 years ago

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