Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use the Face API to follow user face #21

Open
diego3g opened this issue May 20, 2021 · 6 comments
Open

Use the Face API to follow user face #21

diego3g opened this issue May 20, 2021 · 6 comments
Labels
enhancement New feature or request

Comments

@diego3g
Copy link
Collaborator

diego3g commented May 20, 2021

Use the Face API to follow user face

@diego3g
Copy link
Collaborator Author

diego3g commented May 20, 2021

@maykbrito maykbrito added the enhancement New feature or request label May 20, 2021
@lenivene
Copy link

Hi @diego3g
It's don't good idea, because I tested in low configuration computer (low memory) and the computer stay lagged.
If creating with the option to use or not to use, it is a good idea.

@diego3g
Copy link
Collaborator Author

diego3g commented May 24, 2021

Hi @diego3g
It's don't good idea, because I tested in low configuration computer (low memory) and the computer stay lagged.
If creating with the option to use or not to use, it is a good idea.

Yeah, i think this one can be a plug in option.

Also, we don't need to use Face API itself, maybe we can find another solution that has an improved performance.

@DanielGustavo
Copy link

Hi, guys! 👋
So, I've searched for some API's for face detection and I got to know MediaPipe Face Detection:

machineUsageWithMediaPipeOn
You can test it here

It's working really well in the codepen example, and I also tested it in a new electron project. However, for some reason it's not working well in this project, the CPU consumption stay high basically all the time:

machineUsageWithMediaPipeOn (in mini-me-video)

Anyway, I don't have a solution for this problem yet. But if someone have any idea of what to do to solve this, I think this feature would be more lightweight with MediaPipe Face Detection than with face-api.js:

machineUsageWithFaceApiOn
You can test it here

Code that I wrote to implement MediaPipe (src/index.ts)

// Import these.
import { FaceDetection } from '@mediapipe/face_detection'
import { Camera } from '@mediapipe/camera_utils'
const faceDetection = new FaceDetection({
  locateFile: file => {
    return `https://cdn.jsdelivr.net/npm/@mediapipe/face_detection@0.4/${file}`
  },
})

faceDetection.setOptions({ minDetectionConfidence: 0.5, model: 'short' })

// Here is where the data about the detected face will be returned.
faceDetection.onResults(results => {
  console.log(results)
})

// Important to constantly check where is the person's face.
// And it has a better perfomance than calling the setInterval function.
const camera = new Camera(cameraController.videoElement, {
  onFrame: async () => {
    faceDetection.send({ image: cameraController.videoElement })
  },
})
camera.start()

@ayusuke7
Copy link

ayusuke7 commented Aug 5, 2021

Guys, reliving this discussion about using an approach to face detection, I leave here my contribution on how this feature could be made and detect not only faces but also eyes, mouths and any objects in the image.

Hugs.

https://www.youtube.com/watch?v=ayW6y8HzSe4

@renanalencar
Copy link

Hi, guys! I saw both videos in this thread here. However, I didn't get the point on using face detection in the app. A suggestion would have having the Mini Video Me tracking face to zoom in automatically or if there is no face at all the app would close the camera.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

6 participants