Package: pyfron
pyfronAn OpenDR-based face recognition CLI appWhy pyfronBecause it has a cool name that combines the termsPythonandFace Recognitioninto an anagram. Also, because
pyfron provides an easy-to-use methodology for:Creating OpenDR face recognizersManipulating several image databases with environmentsReporting the overall performance of recognizers in beautiful markdownsInstallationManuallyinstall OpenDRRunpip install pyfronUsageYou can invoke pyfron by running eitherpyfron [options]orpython -m pyfron [options]. Although the first way is
more elegant, the latter one is considered to be more stable. For more information about options, runpyfron --help.Directory StructuresIn order to facilitate the process of image discovery and ease the confusion that comes with directory schemas, pyfron
introduces two basic concepts, the ImageDir and the ImageBase.ImageDirAn ImageDir is a directory that contains only images of supported type (currently only IMAGE/JPEG). Semantically,
an ImageDir should only contain pictures of the same person. A valid ImageDir would look like this:i_am_an_image_dir/
|--- image1.jpg
|--- image2.jpg
|--- arbitrary_name.jpg
|--- ...
|--- imageN.jpgImageBaseAn ImageBase is simply a directory that stores many ImageDirs. Semantically, those ImageDirs are ment to represent one
person each. One valid example of an ImageBase is LFW itself. Generally, an ImageBase should look like this:i_am_an_image_base/
|--- and_i_am_an_image_dir/
|    |--- 1.jpg
|    |--- ...
|    |--- N.jpg
|--- image_dir_2/
|--- ...
|--- last_image_dir/Quick StartSet up your workspaceSay that you have downloaded the LFW dataset from theofficial but slow siteor
from thisfaster mirror. Also, in your
Desktop directory, you have gathered three "stalking" subdirectories. Each one of them includes images of a
different celebrity. Finally, you have your own directory under Pictures, which contains photos of you. To sum up,
your workstation consists of something like this:~/Downloads/lfw/~/Downloads/lfw/Aaron_Eckhart/~/Downloads/lfw/Aaron_Guiel/...~/Downloads/lfw/Zydrunas_Ilgauskas/~/Desktop/Stalking/~/Desktop/Stalking/Bradley Cooper/~/Desktop/Stalking/Jennifer Lawrence/~/Desktop/Stalking/Jim Carrey/~/Pictures/Me/Experiment 1Now, say that you want to ensure that your personal data haven't been leaked. Let's start by checking if your face can
be identified in the LFW database.The reference ImageBase should contain the whole LFW ImageBase. You can create a new environment and append the desired
images to its reference ImageBase.Thereference ImageBaserefers to the pictures that will be known to a recognizer after it has been trained.
On the other hand, thetest ImageBaserefers to the pictures that are going to be used as input to the trained
recognizer.You can achieve this by running:$ pyfron --env am_i_in_lfw populate-reference --from-dir ~/Downloads/lfwThis should copy the LFW images in a special location in the new environment. Then, you may configure the test
ImageBase. In this scenario, test ImageBase should just contain pictures of yourself.$ pyfron --env am_i_in_lfw populate-test --from-dir ~/Pictures/MeNote that, although the source of reference ImageBase is a validImageBase(because it contains many ImageDirs), the
source of test ImageBase is in fact anImageDir. However, pyfron is smart enough to understand your intentions, and
it will automatically handle the given path as expected.With the new environment ready-to-go, you may now test your input images and report the results.Since LFW consists of 5749 ImageDirs, this step is expected to, practically, take forever. Removing manually a
considerably large amount of ImageDirs from reference ImageBase is quite a reasonable move. For example, in this
scenario only 300 ImageDirs from LFW were kept and used.You may run:$ pyfron --env am_i_in_lfw runThis command loads every image found in test ImageBase and compares it against reference ImageBase. The generated
markdown summarizes the images that have the maximum confidence of similarity in decreasing order.  Thus, just by
examining the markdown report, you may see that luckily there are no images of yourself in this database.Experiment 2Now, say that you want to see how similar to LFW faces each of your favorite celebrities is.You could create a new environment and train a new model, but since the reference ImageBase will be the same, there is
no need to do so. Instead, you can simply append the celebrities' images in the test ImageBase:$ pyfron --env am_i_in_lfw populate-test --from-dir ~/Desktop/StalkingThen, run the testing procedure by executing:$ pyfron --env am_i_in_lfw runExperiment 3What if you wanted to run the previous experiment with a different recognizer configuration? This can actually be done
pretty effortlessly.Begin by querying pyfron which models are already known to it:$ pyfron --list-modelsThis will display a json-like representation of registered models, along with the file that can be edited to register
your custom models. You can then choose the desired one by specifying the--modeloption. This would look like:$ pyfron --env am_i_in_lfw populate-test --from-dir ~/Desktop/Stalking --model ir_50Here, the modelir_50is a built-in model, and you can use it as is. Although batteriesareincluded, you are
encouraged to explore how you can create your custom models in OpenDR 'sdocs.Future Features - Help needed :DMore control over environments (delete, clone, reuse models, utilize symlinks for shared files)Refined CLI options. Theargparsemodule is used too naivelyRandom selection/ exception options for populate commands (e.g.--keep-max Nto keep the firstNobjects
while populating)Support for creating and training full models (backbone + head)