Face Engine SDK
5.25.0
A face detection, recognition and tracking engine.
|
00001 #pragma once 00002 00003 #pragma once 00004 00005 #include <fsdk/IObject.h> 00006 #include <fsdk/FSDKError.h> 00007 #include <fsdk/Optional.h> 00008 #include <fsdk/Types.h> 00009 00010 namespace fsdk { 00011 00012 #ifndef DOXYGEN_SHOULD_SKIP_THIS 00013 DECLARE_SMARTPTR(IMedicalMaskEstimator); 00014 #endif 00015 00025 enum class MedicalMask { 00026 Mask = 0, 00027 NoMask, 00028 OccludedFace 00029 }; 00030 00035 enum class MedicalMaskExtended { 00036 Mask = 0, 00037 NoMask, 00038 MaskNotInPlace, 00039 OccludedFace 00040 }; 00041 00046 enum class DetailedMaskType { 00047 CorrectMask = 0, 00048 MouthCoveredWithMask, 00049 ClearFace, 00050 ClearFaceWithMaskUnderChin, 00051 PartlyCoveredFace, 00052 FullMask, 00053 Count 00054 }; 00055 00062 struct MedicalMaskEstimation { 00063 MedicalMask result; 00064 DetailedMaskType maskType; 00065 00066 // scores 00067 float maskScore; 00068 float noMaskScore; 00069 float occludedFaceScore; 00070 00071 float scores[static_cast<int>(DetailedMaskType::Count)]; 00072 00078 inline float getScore(DetailedMaskType type) const; 00079 }; 00080 00087 struct MedicalMaskEstimationExtended { 00088 MedicalMaskExtended result; 00089 // scores 00090 float maskScore; 00091 float noMaskScore; 00092 float maskNotInPlace; 00093 float occludedFaceScore; 00094 }; 00095 00100 struct IMedicalMaskEstimator : IRefCounted { 00109 virtual Result<FSDKError> 00110 estimate(const Image& warp, MedicalMaskEstimation& estimation) const noexcept = 0; 00111 00120 virtual Result<FSDKError> 00121 estimate(const Image& warp, MedicalMaskEstimationExtended& estimation) const noexcept = 0; 00122 00132 virtual Result<FSDKError> estimate( 00133 const Image& image, 00134 const Detection& detection, 00135 MedicalMaskEstimation& estimation) const noexcept = 0; 00136 00146 virtual Result<FSDKError> estimate( 00147 const Image& image, 00148 const Detection& detection, 00149 MedicalMaskEstimationExtended& estimation) const noexcept = 0; 00150 00161 virtual Result<FSDKError> 00162 estimate(Span<const Image> warps, Span<MedicalMaskEstimation> estimations) const noexcept = 0; 00163 00174 virtual Result<FSDKError> 00175 estimate(Span<const Image> warps, Span<MedicalMaskEstimationExtended> estimations) const noexcept = 0; 00176 00188 virtual Result<FSDKError> estimate( 00189 Span<const Image> images, 00190 Span<const Detection> detections, 00191 Span<MedicalMaskEstimation> estimations) const noexcept = 0; 00192 00204 virtual Result<FSDKError> estimate( 00205 Span<const Image> images, 00206 Span<const Detection> detections, 00207 Span<MedicalMaskEstimationExtended> estimations) const noexcept = 0; 00218 virtual Result<FSDKError> 00219 validate(Span<const Image> warps, Span<Result<FSDKError>> errors) const noexcept = 0; 00220 00232 virtual Result<FSDKError> validate( 00233 Span<const Image> images, 00234 Span<const Detection> detections, 00235 Span<Result<FSDKError>> errors) const noexcept = 0; 00236 }; 00237 00238 /* 00239 Implementation details. 00240 */ 00241 float MedicalMaskEstimation::getScore(DetailedMaskType type) const { 00242 switch(type) { 00243 case DetailedMaskType::CorrectMask: 00244 case DetailedMaskType::MouthCoveredWithMask: 00245 case DetailedMaskType::ClearFace: 00246 case DetailedMaskType::ClearFaceWithMaskUnderChin: 00247 case DetailedMaskType::PartlyCoveredFace: 00248 case DetailedMaskType::FullMask: 00249 return scores[static_cast<int>(type)]; 00250 default: 00251 return 0.f; 00252 } 00253 } 00254 00256 } // namespace fsdk