| Face Engine SDK 5.12.0 A face detection, recognition and tracking engine.

IMedicalMaskEstimator.h
1 #pragma once
2
3 #pragma once
4
5 #include <fsdk/IObject.h>
6 #include <fsdk/FSDKError.h>
7 #include <fsdk/Optional.h>
8 #include <fsdk/Types.h>
9
10 namespace fsdk {
11
12 #ifndef DOXYGEN_SHOULD_SKIP_THIS
13 DECLARE_SMARTPTR(IMedicalMaskEstimator);
14 #endif
15
20 enum class MedicalMask {
21 Mask = 0,
22 NoMask,
23 OccludedFace
24 };
25
30 enum class MedicalMaskExtended {
31 Mask = 0,
32 NoMask,
33 MaskNotInPlace,
34 OccludedFace
35 };
36
41 enum class DetailedMaskType {
42 CorrectMask = 0,
43 MouthCoveredWithMask,
44 ClearFace,
45 ClearFaceWithMaskUnderChin,
46 PartlyCoveredFace,
47 FullMask,
48 Count
49 };
50
57 struct MedicalMaskEstimation {
58 MedicalMask result;
59 DetailedMaskType maskType;
60
61 // scores
62 float maskScore;
63 float noMaskScore;
64 float occludedFaceScore;
65
66 float scores[static_cast<int>(DetailedMaskType::Count)];
67
73 inline float getScore(DetailedMaskType type) const;
74 };
81 struct MedicalMaskEstimationExtended {
82 MedicalMaskExtended result;
83 // scores
84 float maskScore;
85 float noMaskScore;
86 float maskNotInPlace;
87 float occludedFaceScore;
88 };
89
94 struct IMedicalMaskEstimator : IRefCounted {
103 virtual Result<FSDKError>
104 estimate(
105 const Image& warp,
106 MedicalMaskEstimation& estimation) const noexcept = 0;
107
116 virtual Result<FSDKError>
117 estimate(
118 const Image& warp,
119 MedicalMaskEstimationExtended& estimation) const noexcept = 0;
120
130 virtual Result<FSDKError>
131 estimate(
132 const Image& image,
133 const Detection& detection,
134 MedicalMaskEstimation& estimation) const noexcept = 0;
135
145 virtual Result<FSDKError>
146 estimate(
147 const Image& image,
148 const Detection& detection,
149 MedicalMaskEstimationExtended& estimation) const noexcept = 0;
150
161 virtual Result<FSDKError> estimate(
162 Span<const Image> warps,
163 Span<MedicalMaskEstimation> estimations) const noexcept = 0;
164
175 virtual Result<FSDKError> estimate(
176 Span<const Image> warps,
177 Span<MedicalMaskEstimationExtended> estimations) const noexcept = 0;
178
190 virtual Result<FSDKError> estimate(
191 Span<const Image> images,
192 Span<const Detection> detections,
193 Span<MedicalMaskEstimation> estimations) const noexcept = 0;
194
206 virtual Result<FSDKError> estimate(
207 Span<const Image> images,
208 Span<const Detection> detections,
209 Span<MedicalMaskEstimationExtended> estimations) const noexcept = 0;
220 virtual Result<FSDKError>
221 validate(
222 Span<const Image> warps,
223 Span<Result<FSDKError>> errors) const noexcept = 0;
224
236 virtual Result<FSDKError>
237 validate(
238 Span<const Image> images,
239 Span<const Detection> detections,
240 Span<Result<FSDKError>> errors) const noexcept = 0;
241 };
242
243 /*
244 Implementation details.
245 */
246 float MedicalMaskEstimation::getScore(DetailedMaskType type) const {
247 switch (type) {
248 case DetailedMaskType::CorrectMask:
249 case DetailedMaskType::MouthCoveredWithMask:
250 case DetailedMaskType::ClearFace:
251 case DetailedMaskType::ClearFaceWithMaskUnderChin:
252 case DetailedMaskType::PartlyCoveredFace:
253 case DetailedMaskType::FullMask:
254 return scores[static_cast<int>(type)];
255 default:
256 return 0.f;
257 }
258 }
259
260 } // namespace fsdk
fsdk::DetailedMaskType::ClearFace
clear face - no mask on the face
fsdk::IMedicalMaskEstimator::validate
virtual Result< FSDKError > validate(Span< const Image > warps, Span< Result< FSDKError >> errors) const noexcept=0
Validate input of multiple frames in a single function call.
fsdk::MedicalMask::NoMask
no medical mask on the face
fsdk::MedicalMaskExtended::MaskNotInPlace
mask is not on the right place
DECLARE_SMARTPTR
#define DECLARE_SMARTPTR(X)
Smart ptr declaration helper macro.
Definition: Def.h:59
fsdk
SDK namespace.
Definition: IAGSEstimator.h:8
fsdk::DetailedMaskType::CorrectMask
correct mask on the face (mouth and nose are covered correctly)
fsdk::Result
A structure that encapsulates an action result enumeration.
Definition: Result.h:29
fsdk::MedicalMaskEstimation::getScore
float getScore(DetailedMaskType type) const
Returns score of required detailed mask type.
Definition: IMedicalMaskEstimator.h:246
Types.h
Common data types and structures.
fsdk::MedicalMask::Mask
medical mask is on the face
fsdk::DetailedMaskType::PartlyCoveredFace
face is covered with not a medical mask or a full mask
fsdk::MedicalMaskExtended
MedicalMaskExtended
MedicalMask estimator output enum. This enum contains all possible extended estimation results...
Definition: IMedicalMaskEstimator.h:30
IObject.h
Object system types and interfaces.
fsdk::MedicalMaskEstimationExtended::occludedFaceScore
float occludedFaceScore
face is occluded by something score
Definition: IMedicalMaskEstimator.h:87
fsdk::DetailedMaskType::MouthCoveredWithMask
mask covers only a mouth
FSDKError.h
Common SDK error codes.
fsdk::MedicalMaskEstimation::noMaskScore
float noMaskScore
no medical mask on the face score
Definition: IMedicalMaskEstimator.h:63
fsdk::MedicalMaskEstimation::result
MedicalMask result
estimation result (
Definition: IMedicalMaskEstimator.h:58
fsdk::IRefCounted
Base strong reference counted object interface.
Definition: IRefCounted.h:36
fsdk::MedicalMaskEstimationExtended::noMaskScore
float noMaskScore
no medical mask on the face score
Definition: IMedicalMaskEstimator.h:85
fsdk::DetailedMaskType
DetailedMaskType
MedicalMask estimator output enum. This enum contains all type of DetailedMaskType results...
Definition: IMedicalMaskEstimator.h:41
fsdk::MedicalMaskEstimation::occludedFaceScore
float occludedFaceScore
face is occluded by something score
Definition: IMedicalMaskEstimator.h:64
fsdk::IMedicalMaskEstimator
MedicalMask estimator interface.
Definition: IMedicalMaskEstimator.h:94
fsdk::MedicalMaskEstimationExtended::maskScore
float maskScore
medical mask is on the face score
Definition: IMedicalMaskEstimator.h:84
fsdk::MedicalMaskEstimationExtended
MedicalMask estimator output structure. This structure contains the result of estimation (...
Definition: IMedicalMaskEstimator.h:81
fsdk::MedicalMaskEstimationExtended::maskNotInPlace
float maskNotInPlace
mask is not on the right place
Definition: IMedicalMaskEstimator.h:86
fsdk::DetailedMaskType::ClearFaceWithMaskUnderChin
clear face with a mask around of a chin, mask does not cover anything in the face region (from mouth ...
fsdk::Image
Image.
Definition: Image.h:38
fsdk::MedicalMaskEstimation
MedicalMask estimator output structure. This structure contains the result of estimation (...
Definition: IMedicalMaskEstimator.h:57
fsdk::IMedicalMaskEstimator::estimate
virtual Result< FSDKError > estimate(const Image &warp, MedicalMaskEstimation &estimation) const noexcept=0
Estimate MedicalMask probabilities.
fsdk::MedicalMask
MedicalMask
MedicalMask estimator output enum. This enum contains all possible estimation results.
Definition: IMedicalMaskEstimator.h:20
fsdk::MedicalMaskEstimation::maskScore
float maskScore
medical mask is on the face score
Definition: IMedicalMaskEstimator.h:62
fsdk::MedicalMaskEstimationExtended::result
MedicalMaskExtended result
estimation result (
Definition: IMedicalMaskEstimator.h:82
fsdk::MedicalMaskEstimation::maskType
DetailedMaskType maskType
detailed type (
Definition: IMedicalMaskEstimator.h:59
fsdk::DetailedMaskType::FullMask
face is covered with a full mask (such as balaclava, sky mask, etc.)
fsdk::Detection
Detection structure. Stores a detected bounding box within a source image rect.
Definition: Detection.h:10
fsdk::MedicalMask::OccludedFace
face is occluded by something
fsdk::Span
Span. Not owning data view. It incapsulated pointer to the continuous array with one or more T objec...
Definition: Span.h:14
fsdk::MedicalMaskEstimation::scores
float scores[static_cast< int >(DetailedMaskType::Count)]
detailed estimation scores
Definition: IMedicalMaskEstimator.h:66