In my previous post, I documented my tests with Node-RED and IBM Watson’s sentiment and tone analysis services. This post will look at basic face detection using the visual recognition service.
Ultimately, I hope to use visual recognition for emotion detection.
For this testing, I will be using a Raspberry Pi, Pi Camera, and a local installation on the Pi of Node-RED.
- An injection node sends an empty string to the execute node.
- The execute node runs the following script:
raspistill -o /home/pi/Pictures/image1.jpg -q 25This uses the Pi camera to take a still image and save it in the specified directory with a JPEG quality of 25%.
- A template node can optionally be used to output to the debug console.
- The file in node gets the previously saved image and outputs it as a buffer object.
- The function node receives the image buffer and passes it to the visual recognition node.
- The visual recognition node processes the image data and passes the result to a debug node to output to the console.
Here are some results of testing on two different images:
In both tests, the results of the analysis of age and gender of the individual’s face was accurate.
The code for the above flow is available here: