The facefind sample app allows you to learn persons from a provided image and recognize learned persons in images contained in a provided directory.
The syntax of facefind is described below.
facefind usage:
<path to image with face which should be learned for recognion: "face.jpg"> <path to image(s) on which face should be recognized: "dirWithImages"> [-r] [-sort] [-min-size=value] [-min-search-size=value] [-min-confidence=value] [-fd-type=value] [fd-retina=resolution=value] [fr-model=value] [-fr-optimization=value]
Where:
[-r] Recursively search all subdirectories in given path
[-sort] Output all matches sorted by confidence score
[-min-confidence=value] Required minimum confidence[0 - 1], default = 1
[-min-search-size=value] Minimum face width/height in pixels used for facesearch during detection[15-720], default = 40
[-min-size=value] Minimum face width/height in pixels for recognition acceptance[1 - 720], default = 146
[-fr-model=value] Face recognition model (regular, masked). regular - default
[-fr-optimization=value] Face recognition variant optimized for speed vs accuracy (speed, accuracy). speed - default
[-fd-type=value] Face detector type (normal, high_sensitivity). normal - default
[-fd-high-sensitivity-resolution=value] High sensitivity face detector model input resolution. 640x480 - default
Available resolutions: 1280x720, 720x1280, 640x480, 640x640, 480x640, 480x480, 480x320, 320x480, 320x240, 320x320, 240x320, 240x240, 128x128
Environment variables:
PANOPTES_LICENSE If set, specifies the panoptes license
-r
will recursively search through all sub-directories of the specified directory.
-sort
will sort all face matches found in images in the specified directory in descending order.
The learning/recognition configuration options are listed below. (Defaults can be overridden using command-line arguments.)
Setting | Default | Range | Description |
---|---|---|---|
-min-confidence | 1 | 0-1.0 | Required minimum match confidence. |
-min-search-size | 40 | 15 - 720 | Minimum face width/height in pixels used for face search in mtcnn face detector. |
-min-size | 146 | 1 - 720 | Minimum required face width/height in pixels used for face recognition. |
-fd-type | normal | normal, high_sensitivity | Face detector to use. |
-fd-high-sensitivity-resolution | 640x480 | 1280x720, 720x1280, 640x480, 640x640, 480x640, 480x480, 480x320, 320x480, 320x240, 320x320, 240x320, 240x240, 128x128 | Resolution used for face search with high_sensitivity face detector, similar to min-search-size. |
-fr-model | regular | regular, masked | Face recognition model to use. |
-fr-optimization | speed | speed, accuracy | Face recognition model optimized for speed or accuracy. |
Note: You have to set the PANOPTES_LICENSE environment variable to the license key that you've received from RealNetworks before you invoke Panoptes. On a POSIX comparability system you can do this by executing the following line in a shell window:
export PANOPTES_LICENSE=<license key>
This line should be added to your shell startup script to ensure that it will be executed for every new shell window you open.
Decompress the tar.gz file that you have received. The result will be a directory with the name ‘facefind' in your current directory. Push this directory and all its subdirectories with ‘adb push' to a suitable home folder on your device. The facefind app can be found inside the ‘Facefind' folder.
Once you are positioned in the ‘Facefind' folder, you can invoke facefind without recursive directory search using the following command:
./Facefind /home/images/personA/personA1.jpg /home/images/personA
If recursive directory search is desired, use the "-r" option:
./Facefind /home/images/personA/personA1.jpg /home/images/personA -r
If you'd like to override the defaults for face learning and recognition, run the following command:
./Facefind /home/images/personA/personA1.jpg /home/images/personA -r -min-search-size=30 -min-size=30 -min-confidence=0.5
If you'd like to set the face detector type to "high_sensitivity" with a resolution of 640x640, and set the face recognition model to "masked" and the face recognition optimization to "accuracy", run the following command:
./Facefind /home/images/personA/personA1.jpg /home/images/personA -r -fd-type=high_sensitivity -fd-high-sensitivity-resolution=640x640 -fr-model=masked -fr-optimization=accuracy
Note: When using the High Sensitivity face detector, this message can occur:
ERROR: OpenCL library not loaded - dlopen failed: library "libOpenCL-pixel.so" not found
ERROR: Falling back to OpenGL
This error is just a warning that fallback to OpenGL is taking place and can be ignored.
Output face matches sorted by confidence scores for all detected faces (set -min-confidence to 0):
./Facefind /home/images/personA/personA1.jpg /home/images/personA -r -min-confidence=0 -sort
When the app is processing images, it logs the progress as:
Analyzing image 2 of 23 image(s)...
If a face is learned from a given image and recognized in an image from a provided folder, the output contains the confidence, location, and size of the recognized face:
C:\images\personA\personA2.jpg - 98% match @ x=321, y=211, width=89, height=102
Otherwise, the app will output the following message:
No faces recognized in image.
If -sort
is used, all face matches will be printed out, sorted by their confidence scores in descending order.
Total matches: 5
1. /home/images/personA/compare_5.jpg, 100.00% match, (x, y, width, height): (356, 67, 304, 389)
2. /home/images/personA/compare_4.jpg, 89.30% match, (x, y, width, height): (728, 547, 987, 1334)
3. /home/images/personA/compare_2.jpg, 41.32% match, (x, y, width, height): (1122, 195, 391, 494)
4. /home/images/personA/compare_1.jpg, 32.25% match, (x, y, width, height): (1106, 55, 564, 575)
5. /home/images/personA/compare_3.jpg, 26.15% match, (x, y, width, height): (1136, 159, 281, 376)
If you want to stop the app during execution, press Ctrl-Z.