Detecting Faces with TensorFlow
December 15, 2022
ian jojo
my first time working with tensorflow....
javascript
Today I spent a good amount of time messing around with Tensorflow.js and machine learning models. I learned how to request access to a user’s webcam and then I used a prebuilt object detection model called coco-ssd to analyze the image and determine if it contains a person. The model seems to be able to detect a lot of other objects, such as a cup, guitar, and bananas, but it was also wrong about a lot of other things. Tensorflow returns a confidence score with each guess and I have it set up to display a bounding box and label around any object with a confidence score greater than 65%.
There are a lot of directions I could go with this and I’ve really enjoyed this project. I started messing around with a library called html2canvas to take a snapshot, perhaps to share elsewhere, but this is still a work in progress and not currently live.
Just before this post, I started messing around with text to speech and learned that it’s very easy (three lines of code) to implement. So I’ve added a button that speaks the name of whatever object that’s currently detected.
const test = 'test';I’ve only got it working reliably on desktop right now (Chrome and Safari). It worked also on my iPad Pro with Chrome, but not on my iPhone 8 so I’ll have to look into this further...
This is my first time messing around with anything related to machine learning and it was easier to implement than I expected. It gives me a lot of ideas for future directions and/or tools. You can try it out for yourself at https://lnkd.in/gbRfcu8u and feel free to share any ridiculous results. 🙃