Skip to main content
Version: 3.16.0

Quality Assessment

In this section you'll learn how to integrate Quality Assessment Estimator to your C++ project.

Quality Assessment Estimation (C++)

Requirements

  • Windows x86 64-bit or Linux x86 64-bit system.
  • Installed
    package windows_x86_64 or linux_x86_64 (see Getting Started).
  • Windows x86 64-bit or Linux x86 64-bit system.
  • Installed
    package windows_x86_64 or linux_x86_64.

1. Creating a Quality Assessment Estimator

1.1. To create a Quality Assessment Estimator, follow steps 1-3 described in Creating a Processing Block and specify the value "QUALITY_ASSESMENT_ESTIMATOR" for the "unit_type" key. When creating a Quality Assessment Estimator, you can leave out the value for the "model_path" key or pass an empty string "".

configCtx["unit_type"] = "QUALITY_ASSESSMENT_ESTIMATOR";
configCtx["config_name"] = "quality_assessment.xml";

// optional, default value is ".." for samples in <sdk_dir>/bin
configCtx["sdk_path"] = "..";

1.2. Create a Quality Assessment Estimator Processing Block:

pbio::ProcessingBlock qualityAssessmentEstimator = service->createProcessingBlock(configCtx);

2. Quality Assessment Estimation

2.1. Create a Context container ioData for input-output data using the createContext() method:

auto ioData = service->createContext();

2.2. Create a Context container imgCtx with RGB-image following the steps described on Creating a Context container with RGB-image.

2.3. Put input image to the input-output data container:

ioData["image"] = imgCtx;

2.4. Call the qualityAssessmentEstimator and pass the context with source image ioData:

qualityAssessmentEstimator(ioData);

Accurate estimation requires only one person's face in the frame, looking at the camera, otherwise the overall score will be low, since the algorithm takes into account the relative size, position and directionality.

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

The result of calling qualityAssessmentEstimator() will be appended to ioData container. The format of the output data is presented as a list of objects with the "objects" key. Each object in the list has the "class" key with the "face" value.

The "quality":"qaa" keys contain a Context with a full set of estimations score

  • "totalScore" key contains an overall score of type long in a range of [0,100]
/*
{
"objects": [{ "id": {"type": "long", "minimum": 0}
"class": "face",
"confidence": {"type": "double", "minimum": 0, "maximum": 1},
"bbox": {x1, y1, x2, y2},
"quality": {
"qaa": {
"totalScore": {"type": "long", "minimum": 0, "maximum": 100},
"isSharp": {"type": "boolean"},
"sharpnessScore": {"type": "long", "minimum": 0, "maximum": 100},
"isEvenlyIlluminated": {"type": "boolean"},
"illuminationScore": {"type": "long", "minimum": 0, "maximum": 100},
"noFlare": {"type": "boolean"},
"isLeftEyeOpened": {"type": "boolean"},
"leftEyeOpennessScore": {"type": "long", "minimum": 0, "maximum": 100},
"isRightEyeOpened": {"type": "boolean"},
"rightEyeOpennessScore": {"type": "long", "minimum": 0, "maximum": 100},
"isRotationAcceptable": {"type": "boolean"},
"maxRotationDeviation": {"type": "long"},
"notMasked": {"type": "boolean"},
"notMaskedScore": {"type": "long", "minimum": 0, "maximum": 100},
"isNeutralEmotion": {"type": "boolean"},
"neutralEmotionScore": {"type": "long", "minimum": 0, "maximum": 100},
"isEyesDistanceAcceptable": {"type": "boolean"},
"eyesDistance": {"type": "long", "minimum": 0}
"isMarginsAcceptable": {"type": "boolean"},
"marginOuterDeviation": {"type": "long", "minimum": 0}
"marginInnerDeviation": {"type": "long", "minimum": 0}
"isNotNoisy": {"type": "boolean"},
"noiseScore": {"type": "long", "minimum": 0, "maximum": 100},
"watermarkScore": {"type": "long", "minimum": 0},
"hasWatermark": {"type": "boolean"},
"dynamicRangeScore": {"type": "long", "minimum": 0},
"isDynamicRangeAcceptable": {"type": "boolean"}
}
}
}]
}
*/

3. GPU Acceleration

Quality Assessment doesn't support GPU acceleration by itself, but the involved modules, listed in the config file, can have their own acceleration capabilities.