DEV Community

React + TypeScript: Face detection with Tensorflow

Yuiko Koyanagi on May 25, 2021

Hello guys, I have developed an application with face detection, that applies a mask automatically to your face in real time. In this article, ...
Collapse
 
vitalii0927 profile image
sapronov1021

Hi, @yuikoito

Does this work on mobile as a Selfie?

Collapse
 
toffy profile image
Yuiko Koyanagi

Yes it works on my environment. (ios)

Collapse
 
vitalii0927 profile image
sapronov1021

Thanks, Yuiko

Thread Thread
 
vitalii0927 profile image
sapronov1021

@yuikoito , do you know how to get screenshot automatically, when doing selfie?

Thread Thread
 
toffy profile image
Yuiko Koyanagi

@vitalii0927
sorry for my late reply.
I don't really know how to get screenshot "automatically" but maybe you can use "getScreenshot" method as follows.

  const webcamRef = useRef<Webcam>(null);
  const capture = useCallback(() => {
    const imageSrc = webcamRef.current?.getScreenshot();
    // write anything about imageSrc
  }, [webcamRef]);
Enter fullscreen mode Exit fullscreen mode

Then maybe you can loop this for example in requestAnimationFrame.

Thread Thread
 
vitalii0927 profile image
sapronov1021

Thank you, @yuikoito

Collapse
 
james_palermo_bc208e463e4 profile image
James Palermo

Fun project! 😎

Collapse
 
toffy profile image
Yuiko Koyanagi

Thanks !

Collapse
 
erikobryant profile image
erikobryant

Hey Yuiko Koyanagi,

My name is Erik O’Bryant and I’m assembling a team of developers to create an AI operating system. An OS like this would use AI to interpret and execute user commands (just imagine being able to type plain English into your terminal and having your computer do exactly what you tell it). You seem to know a lot about AI development and so I was wondering if you’d be interested in joining my team and helping me develop the first ever intelligent operating system. If you’re interested, please shoot me a message at erockthefrog@gmail.com and let me know.

Collapse
 
basicvisual profile image
basicvisual

great post. Have you tried similarily media pipe pose. I did try it and got misc resutls . But i didnt manage to get the 3d landmarks up and running

Collapse
 
toffy profile image
Yuiko Koyanagi

Thank you for reading! No I didn't try other media pipe pose yet. I will try :)
But actually at first I tried to use face-api.js but I couldn't manage it. I searched how the face-api.js is running and which library is based on, and I found Tensorflow.
I am really beginner for Machine Learning and I still have many things I don't understand but I am happy if my article would help you!

Collapse
 
basicvisual profile image
basicvisual

I am the same here , Just learning by experimenting.

Thread Thread
 
toffy profile image
Yuiko Koyanagi • Edited

Hey I just posted a new one about TensorFlow.js. If you are interested, please have a look! This is not about 3d landmarks, but I hope my article help your learning :)

dev.to/yuikoito/tensorflow-next-js...

Collapse
 
rishisippy profile image
Rishi sippy

great