Luna-api utils¶
Upload images from folder¶
The “folder_uploader.py” script uploads images from the specified folder and processes uploaded images according to the preassigned parameters.
The path to the script is: “./luna-api/utils/folder_uploader.py”.
Run:
Example:
python folder_uploader.py --account_id "8b8b5937-2e9c-4e8b-a7a7-5caf86621b5a" --source "./data" --warped 0
Script pipeline:
search images of the allowed type (‘.jpg’, ‘.jpeg’, ‘.png’, ‘.bmp’, ‘.ppm’, ‘.tif’, ‘.tiff’) in the specified folder (source),
start async image processing according to the specified parameters (see the concurrency command line argument).
Image processing pipeline:
detect faces and create samples,
extract attributes,
create faces and link them to a list,
add record to success load logfile: {“image name”: …, “face id”: […]}.
If errors occur at any step of the script processing, the single image processing routine is terminated and a record is added to the error log file: {“image name”: …, “error”: …}.
See help for more information:
python folder_uploader.py --help
Command line arguments:
account_id: an account ID used in requests to LUNA PLATFORM (deprecated)
login: a login used in requests to LUNA PLATFORM
password: a password used in requests to LUNA PLATFORM
source: a directory with images to load (required)
warped: are images warped or not (0,1) (required)
pitch_threshold: maximum deviation pitch angle [0..180];
roll_threshold: maximum deviation roll angle [0..180];
yaw_threshold: maximum deviation yaw angle [0..180];
multi_face_policy: multiple face detection policy [0..2]: 0 - multiple face detection not allowed, 1 - multiple face detection allowed, 2 - get best detection; default - 0
basic_attr: whether to extract basic attributes (0,1); default - 1
descriptor: whether to extract descriptor (0,1); default - 1
score_threshold: descriptor quality score threshold (0..1); default - 0
name_as_userdata: whether to use image name as userdata (0,1); default - 0
avatar: whether to set sample as avatar (0,1); default - 0
list_linked: whether to link faces with list (0,1); default - 1
list_id: list ID to link faces with (a new LUNA list will be created if list_id is not set and list_linked=1); default - None
list_userdata: userdata for list to link faces with (for newly created list); default - None
concurrency: parallel processing image count; default - 10
origin: origin; default - “http://127.0.0.1:5000”
api: API version of the API service; default - 6
Logfiles:
{start_upload_time}_success_log.txt: success load logfile
{start_upload_time}_error_log.txt: error logfile