Mask Detection
-
ErrorCode Trueface::SDK::detectMask(const TFImage &tfImage, const FaceBoxAndLandmarks &faceBoxAndLandmarks, MaskLabel &result, float &maskScore)
Detect whether the face in the image is wearing a mask or not.
- Parameters:
tfImage – [in] The input image returned by preprocessImage().
faceBoxAndLandmarks – [in] FaceBoxAndLandmarks returned by detectFaces() or detectLargestFace().
result – [out] The predicted MaskLabel for face image.
maskScore – [out] The mask score for this image. This can be used for setting custom thresholds that work better for the use case. By default, we use a mask score greater than 0.82 to determine that no mask was detected.
- Returns:
Error code, see ErrorCode.
-
ErrorCode Trueface::SDK::detectMasks(const std::vector<TFFacechip> &tfFacechips, std::vector<MaskLabel> &results, std::vector<float> &maskScores)
Detect whether the faces are wearing a mask or not. This batch processing method increases throughput when using GPU inference.
- Parameters:
tfFacechips – [in] A vector of TFFacechip on which to run mask detection.
results – [out] The predicted MaskLabel for the input face chips.
maskScores – [out] The mask scores for these images. This can be used for setting custom thresholds that work better for the use case. By default, we use a mask score greater than 0.82 to determine that no mask was detected.
- Returns:
Error code, see ErrorCode.