| Face Engine SDK 5.35.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
25 enum class MedicalMask {
26 Mask = 0,
27 NoMask,
28 OccludedFace
29 };
30
35 enum class MedicalMaskExtended {
36 Mask = 0,
37 NoMask,
38 MaskNotInPlace,
39 OccludedFace
40 };
41
46 enum class DetailedMaskType {
47 CorrectMask = 0,
48 MouthCoveredWithMask,
49 ClearFace,
50 ClearFaceWithMaskUnderChin,
51 PartlyCoveredFace,
52 FullMask,
53 Count
54 };
55
62 struct MedicalMaskEstimation {
63 MedicalMask result;
64 DetailedMaskType maskType;
65
66 // scores
67 float maskScore;
68 float noMaskScore;
69 float occludedFaceScore;
70
71 float scores[static_cast<int>(DetailedMaskType::Count)];
72
78 inline float getScore(DetailedMaskType type) const;
79 };
80
87 struct MedicalMaskEstimationExtended {
88 MedicalMaskExtended result;
89 // scores
90 float maskScore;
91 float noMaskScore;
92 float maskNotInPlace;
93 float occludedFaceScore;
94 };
95
100 struct IMedicalMaskEstimator : IRefCounted {
109 virtual Result<FSDKError>
110 estimate(const Image& warp, MedicalMaskEstimation& estimation) const noexcept = 0;
111
120 virtual Result<FSDKError>
121 estimate(const Image& warp, MedicalMaskEstimationExtended& estimation) const noexcept = 0;
122
132 virtual Result<FSDKError> estimate(
133 const Image& image,
134 const Detection& detection,
135 MedicalMaskEstimation& estimation) const noexcept = 0;
136
146 virtual Result<FSDKError> estimate(
147 const Image& image,
148 const Detection& detection,
149 MedicalMaskEstimationExtended& estimation) const noexcept = 0;
150
161 virtual Result<FSDKError>
162 estimate(Span<const Image> warps, Span<MedicalMaskEstimation> estimations) const noexcept = 0;
163
174 virtual Result<FSDKError>
175 estimate(Span<const Image> warps, Span<MedicalMaskEstimationExtended> estimations) const noexcept = 0;
176
188 virtual Result<FSDKError> estimate(
189 Span<const Image> images,
190 Span<const Detection> detections,
191 Span<MedicalMaskEstimation> estimations) const noexcept = 0;
192
204 virtual Result<FSDKError> estimate(
205 Span<const Image> images,
206 Span<const Detection> detections,
207 Span<MedicalMaskEstimationExtended> estimations) const noexcept = 0;
218 virtual Result<FSDKError>
219 validate(Span<const Image> warps, Span<Result<FSDKError>> errors) const noexcept = 0;
220
232 virtual Result<FSDKError> validate(
233 Span<const Image> images,
234 Span<const Detection> detections,
235 Span<Result<FSDKError>> errors) const noexcept = 0;
236 };
237
238 /*
239 Implementation details.
240 */
241 float MedicalMaskEstimation::getScore(DetailedMaskType type) const {
242 switch(type) {
243 case DetailedMaskType::CorrectMask:
244 case DetailedMaskType::MouthCoveredWithMask:
245 case DetailedMaskType::ClearFace:
246 case DetailedMaskType::ClearFaceWithMaskUnderChin:
247 case DetailedMaskType::PartlyCoveredFace:
248 case DetailedMaskType::FullMask:
249 return scores[static_cast<int>(type)];
250 default:
251 return 0.f;
252 }
253 }
254
256 } // namespace fsdk
fsdk::DetailedMaskType::PartlyCoveredFace
face is covered with not a medical mask or a full mask
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::MedicalMaskEstimation::getScore
float getScore(DetailedMaskType type) const
Returns score of required detailed mask type.
Definition: IMedicalMaskEstimator.h:241
DECLARE_SMARTPTR
#define DECLARE_SMARTPTR(X)
Smart ptr declaration helper macro.
Definition: Def.h:70
fsdk
SDK namespace.
Definition: IAGSEstimator.h:8
fsdk::Result
A structure that encapsulates an action result enumeration.
Definition: Result.h:27
fsdk::DetailedMaskType
DetailedMaskType
MedicalMask estimator output enum. This enum contains all type of DetailedMaskType results...
Definition: IMedicalMaskEstimator.h:46
Types.h
Common data types and structures.
fsdk::DetailedMaskType::MouthCoveredWithMask
mask covers only a mouth
fsdk::MedicalMask
MedicalMask
MedicalMask estimator output enum. This enum contains all possible estimation results.
Definition: IMedicalMaskEstimator.h:25
fsdk::DetailedMaskType::CorrectMask
correct mask on the face (mouth and nose are covered correctly)
IObject.h
Object system types and interfaces.
fsdk::MedicalMaskEstimationExtended::occludedFaceScore
float occludedFaceScore
face is occluded by something score
Definition: IMedicalMaskEstimator.h:93
FSDKError.h
Common SDK error codes.
fsdk::MedicalMaskEstimation::noMaskScore
float noMaskScore
no medical mask on the face score
Definition: IMedicalMaskEstimator.h:68
fsdk::MedicalMaskEstimation::result
MedicalMask result
estimation result (
Definition: IMedicalMaskEstimator.h:63
fsdk::DetailedMaskType::ClearFaceWithMaskUnderChin
face with a mask around a chin, not covering anything from mouth to eyes
fsdk::IRefCounted
Base strong reference counted object interface.
Definition: IRefCounted.h:37
fsdk::MedicalMaskEstimationExtended::noMaskScore
float noMaskScore
no medical mask on the face score
Definition: IMedicalMaskEstimator.h:91
fsdk::MedicalMaskEstimation::occludedFaceScore
float occludedFaceScore
face is occluded by something score
Definition: IMedicalMaskEstimator.h:69
fsdk::IMedicalMaskEstimator
MedicalMask estimator interface.
Definition: IMedicalMaskEstimator.h:100
fsdk::MedicalMaskEstimationExtended::maskScore
float maskScore
medical mask is on the face score
Definition: IMedicalMaskEstimator.h:90
fsdk::MedicalMaskEstimationExtended
MedicalMask estimator output structure. This structure contains the result of estimation (...
Definition: IMedicalMaskEstimator.h:87
fsdk::MedicalMaskEstimationExtended::maskNotInPlace
float maskNotInPlace
mask is not on the right place
Definition: IMedicalMaskEstimator.h:92
fsdk::FaceOcclusionType::Count
Total number of occlusion types.
fsdk::MedicalMask::Mask
medical mask is on the face
fsdk::MedicalMask::OccludedFace
face is occluded by something
fsdk::MedicalMaskExtended
MedicalMaskExtended
MedicalMask estimator output enum. This enum contains all possible extended estimation results...
Definition: IMedicalMaskEstimator.h:35
fsdk::Image
Image.
Definition: Image.h:38
fsdk::MedicalMaskEstimation
MedicalMask estimator output structure. This structure contains the result of estimation (...
Definition: IMedicalMaskEstimator.h:62
fsdk::IMedicalMaskEstimator::estimate
virtual Result< FSDKError > estimate(const Image &warp, MedicalMaskEstimation &estimation) const noexcept=0
Estimate MedicalMask probabilities.
fsdk::MedicalMaskEstimation::maskScore
float maskScore
medical mask is on the face score
Definition: IMedicalMaskEstimator.h:67
fsdk::MedicalMaskEstimationExtended::result
MedicalMaskExtended result
estimation result (
Definition: IMedicalMaskEstimator.h:88
fsdk::MedicalMaskEstimation::maskType
DetailedMaskType maskType
detailed type (
Definition: IMedicalMaskEstimator.h:64
fsdk::MedicalMaskExtended::MaskNotInPlace
mask is not on the right place
fsdk::DetailedMaskType::FullMask
face is covered with a full mask (such as balaclava, sky mask, etc.)
fsdk::DetailedMaskType::ClearFace
clear face - no mask on the face
fsdk::Detection
Detection structure. Stores a detected bounding box within a source image rect.
Definition: Detection.h:10
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:71
fsdk::MedicalMask::NoMask
no medical mask on the face