Skip to main content
Version: 3.24.1 (latest)

Quality assessment

Facial image Quality Assessment processing block

Modifications of Quality Assessment processing block

Currently, there are the following modifications:

  • "assessment" — the first of the implemented modes of the Quality Assessment block, which evaluates the following parameters:

    Parameters evaluating the 1st version of "assessment" modification

    Click to display the list of parameters being evaluated
    • total_score — a numeric value that indicates the overall image quality score from 0 to 1.
    • is_background_uniform — a boolean value, indicates the uniformity of the background.
    • background_uniformity_score — numeric value, indicates the background uniformity score in points from 0 to 2.
    • is_dynamic_range_acceptable — a logical value, indicates that the dynamic range of the image intensity in the face area is greater or less than the value of 1.28.
    • dynamic_range_score — numeric value, a dynamic intensity range score in a score from 0 to 1.
    • is_eyes_distance_acceptable — a logical value, indicates the acceptable/unacceptable distance between eyes.
    • eyes_distance — numeric value of the distance between eyes in pixels.
    • is_evenly_illuminated — boolean value, denotes uniformity of illumination in the image.
    • illumination_score — numeric value, indicates the uniformity of illumination in points from 0 to 1.
    • no_flare — a logical value, indicates the presence or absence of flare in the image.
    • is_left_eye_opened — logical value, indicates the position of the left eye (open or closed).
    • left_eye_openness_score — numeric value, indicates the degree of eye openness in points from 0 to 1.
    • is_right_eye_opened — logical value, indicates the position of the right eye (open or closed).
    • right_eye_openness_score — numeric value, indicates the degree of eye openness in scores from 0 to 1.
    • is_neutral_emotion — logical value, denotes the presence or absence of a neutral facial expression.
    • neutral_emotion_score — numerical value, scores the degree of neutral emotion in points from 0 to 1.
    • is_not_noisy — logical value, denotes the presence or absence of noise in the image.
    • noise_score — numerical value, evaluation of image noise in scores from 0 to 1.
    • is_sharp — logical value, denotes sharpness of the image.
    • sharpness_score — numeric value, denotes the sharpness score in points from 0 to 1.
    • is_margins_acceptable — a logical value, denotes acceptable/unacceptable indents.
    • margin_inner_deviation — numeric value of internal deviation in pixels.
    • margin_outer_deviation — numeric value of outer deviation in pixels.
    • is_rotation_acceptable — boolean value, indicates acceptable/unacceptable head rotation.
    • max_rotation_deviation — numeric value, maximum degree of deviation for three (yaw, pitch, roll) head rotation angles.
    • not_masked — boolean value, indicates the presence or absence of a mask on the face.
    • not_masked_score — numeric value, indicates the degree of confidence in the absence of a mask on the face from 0 to 1.
    • has_watermark — boolean value, indicates the presence or absence of a watermark on the image.
    • watermark_score — numeric value, indicates the degree of confidence in the presence of a watermark on the image from 0 to 1.

    Parameters evaluating the 2nd version of "assessment" modification

    Click to display the list of parameters being evaluated
    • total_score — a numeric value that indicates the overall image quality score from 0 to 1.
    • is_background_uniform — a boolean value, indicates the uniformity of the background.
    • background_uniformity_score — numeric value, indicates the background uniformity score in points from 0 to 2.
    • is_dynamic_range_acceptable — a logical value, indicates that the dynamic range of the image intensity in the face area is greater or less than the value of 1.28.
    • dynamic_range_score — numeric value, a dynamic intensity range score in a score from 0 to 1.
    • is_eyes_distance_acceptable — a logical value, indicates the acceptable/unacceptable distance between eyes.
    • eyes_distance — numeric value of the distance between eyes in pixels.
    • is_evenly_illuminated — boolean value, denotes uniformity of illumination in the image.
    • illumination_score — numeric value, indicates the uniformity of illumination in points from 0 to 1.
    • no_flare — a logical value, indicates the presence or absence of flare in the image.
    • is_left_eye_opened — logical value, indicates the position of the left eye (open or closed).
    • left_eye_openness_score — numeric value, indicates the degree of eye openness in points from 0 to 1.
    • is_right_eye_opened — logical value, indicates the position of the right eye (open or closed).
    • right_eye_openness_score — numeric value, indicates the degree of eye openness in scores from 0 to 1.
    • is_neutral_emotion — logical value, denotes the presence or absence of a neutral facial expression.
    • neutral_emotion_score — numerical value, scores the degree of neutral emotion in points from 0 to 1.
    • is_not_noisy — logical value, denotes the presence or absence of noise in the image.
    • noise_score — numerical value, evaluation of image noise in scores from 0 to 1.
    • is_sharp — logical value, denotes sharpness of the image.
    • sharpness_score — numeric value, denotes the sharpness score in points from 0 to 1.
    • is_margins_acceptable — a logical value, denotes acceptable/unacceptable indents.
    • margin_inner_deviation — numeric value of internal deviation in pixels.
    • margin_outer_deviation — numeric value of outer deviation in pixels.
    • is_rotation_acceptable — boolean value, indicates acceptable/unacceptable head rotation.
    • max_rotation_deviation — numeric value, maximum degree of deviation for three (yaw, pitch, roll) head rotation angles.
    • not_masked — boolean value, indicates the presence or absence of a mask on the face.
    • not_masked_score — numeric value, indicates the degree of confidence in the absence of a mask on the face from 0 to 1.
    • has_watermark — boolean value, indicates the presence or absence of a watermark on the image.
    • watermark_score — numeric value, indicates the degree of confidence in the presence of a watermark on the image from 0 to 1.
    • face_width_pixels - numeric value, indicates the width of the face in pixels
    • face_height_pixels - numeric value, indicates the height of the face in pixels
    • face_size_on_image - numeric value, indicates the size of the face on the image from 0 to 1 (ICAO parameter)
    • is_face_size_acceptable - logical value, indicates the acceptable size of the face on the image (70-80% of the image area) (ICAO parameter)
    • is_image_gray - logical value, indicates whether the image is gray (ICAO parameter)
    • min_image_dpi - numeric value, indicates the number of pixels per inch (ICAO parameter)
    • is_high_resolution - logical value, indicates whether the image is a high-quality image (ICAO parameter)
    • image_width_to_height_ratio - numeric value, indicates the ratio of the width to the height of the image
    • red_eyes_right_score - numeric value, right eye redness score (ICAO parameter)
    • red_eyes_left_score - numeric value, left eye redness score (ICAO parameter)
    • is_red_eyes - logical value, indicates the presence of red eyes (ICAO parameter)
    • glasses_score - numeric value, indicates the presence of glasses score from 0 to 1 (ICAO parameter)
    • mouth_openness_score - numeric value, mouth openness score from to 1 (ICAO parameter)
    • is_mouth_openness - logical value, indicates whether the mouth is open (ICAO parameter)
    Key points

    For the better results when assessing image quality using the 2nd version of "assessment" modification, use FACE_FITTER with tddfa or tddfa_faster modification.

    Checks

    The 2nd version of "assessment" modification allows you to disable some checks. Disabled checks will not affect the final result.

    Disabled checks of the 2nd version of "assessment" modification

    Click to display the list of disabled parameters. All options are enabled by default
    • is_enable_check_sharpness - boolean, sharpness check
    • is_enable_check_illumination - boolean, illumination uniformity check
    • is_enable_check_flare - boolean, flare check
    • is_enable_check_noise - boolean, noise check
    • is_enable_check_dynamic_range - boolean, intensity dynamic range check
    • is_enable_check_watermark - boolean, watermark check
    • is_enable_check_background - boolean, background uniformity check
    • is_enable_check_eye_openness - boolean, eye openness check
    • is_enable_check_mask - boolean, mask check
    • is_enable_check_neutral_emotion - boolean, emotion check
    • is_enable_check_eye_distance - boolean, check the distance between the eyes
    • is_enable_check_margin - boolean, check the margins
    • is_enable_check_rotation - boolean, check the head rotation
    • is_enable_check_resolution - boolean, check the image resolution
    • is_enable_check_gray_scale - boolean, check if the image is gray
    • is_enable_check_face_size - boolean, check the face size
    • is_enable_check_red_eye - boolean, check if the eyes are red
    • is_enable_check_glasses - boolean, check if the glasses are on
    • is_enable_check_mouth_openness - boolean, check if the mouth is open
  • "estimation" — this mode evaluates the overall image quality, and the result ("total_score") is a real number from 0 (worst quality) to 1 (perfect quality).

Specification of the Quality Assessment processing block

  1. The Context input container must contain a binary image and an array of objects obtained after running the face detection and fitter detection processing blocks:

    Click to expand the Context input container specification
    {
    "image" : {
    "format": "NDARRAY",
    "blob": "data pointer",
    "dtype": "uint8_t",
    "shape": [height, width, channels]
    },
    "objects": [{
    "id": {"type": "long", "minimum": 0},
    "class": "face",
    "confidence": {"double", "minimum": 0, "maximum": 1},
    "bbox": [x1, y2, x2, y2]
    "keypoints": {
    "left_eye_brow_left": {"proj" : [x, y]},
    "left_eye_brow_up": {"proj" : [x, y]},
    "left_eye_brow_right": {"proj" : [x, y]},
    "right_eye_brow_left": {"proj" : [x, y]},
    "right_eye_brow_up": {"proj" : [x, y]},
    "right_eye_brow_right": {"proj" : [x, y]},
    "left_eye_left": {"proj" : [x, y]},
    "left_eye": {"proj" : [x, y]},
    "left_eye_right": {"proj" : [x, y]},
    "right_eye_left": {"proj" : [x, y]},
    "right_eye": {"proj" : [x, y]},
    "right_eye_right": {"proj" : [x, y]},
    "left_ear_bottom": {"proj" : [x, y]},
    "nose_left": {"proj" : [x, y]},
    "nose": {"proj" : [x, y]},
    "nose_right": {"proj" : [x, y]},
    "right_ear_bottom": {"proj" : [x, y]},
    "mouth_left": {"proj" : [x, y]},
    "mouth": {"proj" : [x, y]},
    "mouth_right": {"proj" : [x, y]},
    "chin": {"proj" : [x, y]},
    "points": ["proj": [x, y]]
    }
    }]
    }
  2. After the Quality Assessment processing block is called, each object from the "objects" array will be added with attributes corresponding to this block.

    Specification of the output container Context:

    {
    "quality": {
    "total_score": {"type": "double", "minimum": 0, "maximum": 1},
    "is_sharp": {"type": "boolean"},
    "sharpness_score": {"type": "double", "minimum": 0, "maximum": 1},
    "is_evenly_illuminated": {"type": "boolean"},
    "illumination_score": {"type": "double", "minimum": 0, "maximum": 1},
    "no_flare": {"type": "boolean"},
    "is_left_eye_opened": {"type": "boolean"},
    "left_eye_openness_score": {"type": "double", "minimum": 0, "maximum": 1},
    "is_right_eye_opened": {"type": "boolean"},
    "right_eye_openness_score": {"type": "double", "minimum": 0, "maximum": 1},
    "is_rotation_acceptable": {"type": "boolean"},
    "max_rotation_deviation": {"type": "long"},
    "not_masked": {"type": "boolean"},
    "not_masked_score": {"type": "double", "minimum": 0, "maximum": 1},
    "is_neutral_emotion": {"type": "boolean"},
    "neutral_emotion_score": {"type": "double", "minimum": 0, "maximum": 1},
    "is_eyes_distance_acceptable": {"type": "boolean"},
    "eyes_distance": {"type": "long", "minimum": 0}
    "is_margins_acceptable": {"type": "boolean"},
    "margin_outer_deviation": {"type": "long", "minimum": 0}
    "margin_inner_deviation": {"type": "long", "minimum": 0}
    "is_not_noisy": {"type": "boolean"},
    "noise_score": {"type": "double", "minimum": 0, "maximum": 1},
    "watermark_score": {"type": "long", "minimum": 0},
    "has_watermark": {"type": "boolean"},
    "dynamic_range_score": {"type": "double", "minimum": 0},
    "is_dynamic_range_acceptable": {"type": "boolean"},
    "is_background_uniform": {"type": "boolean"},
    "background_uniformity_score": {"type": "double", "minimum": 0, "maximum": 1}
    }
    }

Example of working with the Quality Assessment processing block

  1. Create a Context configuration container and specify the values "unit_type", "modification", "version", of the block you are interested in An example of creating a processing block can be found on the Working with Processing Block page.

  2. Pass the container-context obtained after the processing blocks of face detection and fitter's detection work.

  3. Call the evaluation processing block.

  4. Get the result of the processing block.

auto configCtx = service->createContext();
configCtx["unit_type"] = "QUALITY_ASSESSMENT_ESTIMATOR";
pbio::ProcessingBlock blockQuality = service->createProcessingBlock(configCtx);

//------------------
// creation of face detection processing blocks, and Context container with binary image
//------------------

faceDetector(ioData);
faceFitter(ioData);
blockQuality(ioData);

double total_score = ioData["objects"][0]["quality"]["total_score"].getDouble();

Only one face of a person in the frame looking into the camera is required for an accurate score, otherwise the overall score will be low, because the algorithm takes into account the relative size, position and orientation of the head.

If multiple faces are captured, each face will be processed independently.