Detecting faces in a photo is easy. Just point detect to a photo. Here’s one with some faces:
$ ml detect azface https://bit.ly/3dBOUNA 302 202 302 315 415 315 415 202,31.0,male,no glasses,happiness,no occlusion 398 238 398 329 489 329 489 238,30.0,female,no glasses,happiness,no occlusion 495 238 495 320 577 320 577 238,4.0,female,no glasses,happiness,no occlusion 211 162 211 243 292 243 292 162,6.0,male,no glasses,happiness,no occlusion
When we first look at the output it can be a little confusing—a mass of numbers and some text. It is actually a very carefully structured output.
Each line of the output corresponds to one of the faces the model has identified. It begins (before the first comma) with pairs of numbers corresponding to x and y coordinates (points). Together these four points define a box corresponding to the face that has been recognised. We could use that to draw the box on the photo itself which we saw an example of in Section 13.2, though the commands to do that were not shared there. See Sections 13.7 and 4.1 for details.
After the first comma is the predicted age based on the recognised face. Then the gender is after the next comma, then whether glasses were found on the face, then the suggested emotion of the face, and whether there is any occlusion of the face.
Notice that all of the different bits of information are separated by commas (that’s called comma separated values, or **csv*). This makes it easy to extract the bits we might be interested in when we use the command within a pipeline (see Chapter 4). We’ll also see examples of pipelines through this Chapter.
Your donation will support ongoing availability and give you access to the PDF version of this book. Desktop Survival Guides include Data Science, GNU/Linux, and MLHub. Books available on Amazon include Data Mining with Rattle and Essentials of Data Science. Popular open source software includes rattle, wajig, and mlhub. Hosted by Togaware, a pioneer of free and open source software since 1984. Copyright © 1995-2022 Graham.Williams@togaware.com Creative Commons Attribution-ShareAlike 4.0