12.5 azcv adult


Is a picture suitable to my audience? Images that are not appropriate for many users of the Internet unfortunately abound. With the adult command we can check in advance of display the suitability of an image for display. The command returns a score from 0 to 1, with 1 the most certain, for each of three characteristics: adult material, racy, and gory content.

For modesty, actual example images are not provided here. Rather we simply illustrate the output for a number of images (links are not provided to the images either).

The first image here is rather racy, and adult in nature, though not particularly gory.

$ ml adult azcv https://aaa/aaa01.jpg

This second image is gory and not racy or otherwise adult type material.

$ ml adult azcv https://aaa/aaa02.jpg

An image can be racy without being adult material nor gory.

$ ml adult azcv https://aaa/aaa03.jpg

This command can be utilised as a filter over a folder of images being displayed for a family event. In the following script we use a for loop that iterates over the jpg images in the current folder, refering to each one, in turn, as $f. The scores for the image file are cut as the second to fourth comma separated numbers. Using sed to write the numbers one per line, awk is then used to add the numbers together, after multiplying by 10 (to keep the next test simpler). Using an if statement the next command tests if the score is less than 50, and if so the image is displayed for 5 seconds, using sleep.

for f in *.jpg; do
  score=`ml adult azcv "$f" |
         cut -d"," -f2-4 |
         sed 's|,|\n|g' |
         awk '{s+=10*$1} END {print s}'`;
  if test $score -lt 5; then
    display "$f"; sleep 5;

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