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

IHeadWearEstimator.h
1 #pragma once
2
3 #include <fsdk/IObject.h>
4 #include <fsdk/FSDKError.h>
5
6 #include <fsdk/Types/Image.h>
7 #include <fsdk/Types/Result.h>
8 #include <fsdk/Types/Span.h>
9
10 namespace fsdk {
11
12 #ifndef DOXYGEN_SHOULD_SKIP_THIS
13 DECLARE_SMARTPTR(IHeadWearEstimator);
14 #endif
15
25 enum class HeadWearState {
26 Yes = 0, //< there is headwear
27 No, //< there is no headwear
28 Count
29 };
30
37 struct HeadWearStateEstimation {
38 HeadWearState result;
39 float scores[static_cast<int>(HeadWearState::Count)];
40
46 inline float getScore(HeadWearState state) const;
47 };
48
53 enum class HeadWearType : uint8_t {
54 NoHeadWear = 0, //< there is no headwear on the head
55 BaseballCap, //< there is baseball cap on the head
56 Beanie, //< there is beanie on the head
57 PeakedCap, //< there is peaked cap on the head
58 Shawl, //< there is shawl on the head
59 HatWithEarFlaps, //< there is hat with ear flaps on the head
60 Helmet, //< there is helmet on the head
61 Hood, //< there is hood on the head
62 Hat, //< there is hat on the head
63 Other, //< something other is on the head
64 Count
65 };
66
73 struct HeadWearTypeEstimation {
74 HeadWearType result;
75 float scores[static_cast<int>(HeadWearType::Count)];
76
82 inline float getScore(HeadWearType type) const;
83 };
84
90 struct HeadWearEstimation {
91 HeadWearStateEstimation state;
92 HeadWearTypeEstimation type;
93 };
94
99 struct IHeadWearEstimator : IRefCounted {
108 virtual Result<FSDKError> estimate(const Image& warp, HeadWearEstimation& estimation) const noexcept = 0;
109
120 virtual Result<FSDKError>
121 estimate(Span<const Image> warps, Span<HeadWearEstimation> estimations) const noexcept = 0;
122
133 virtual Result<FSDKError>
134 validate(Span<const Image> warps, Span<Result<FSDKError>> errors) const noexcept = 0;
135 };
136
137 /*
138 Implementation details.
139 */
140 float HeadWearStateEstimation::getScore(HeadWearState state) const {
141 switch(state) {
142 case HeadWearState::Yes:
143 case HeadWearState::No:
144 return scores[static_cast<int>(state)];
145 default:
146 return -1.0f;
147 }
148 }
149
150 /*
151 Implementation details.
152 */
153 float HeadWearTypeEstimation::getScore(HeadWearType type) const {
154 switch(type) {
155 case HeadWearType::NoHeadWear:
156 case HeadWearType::BaseballCap:
157 case HeadWearType::Beanie:
158 case HeadWearType::PeakedCap:
159 case HeadWearType::Shawl:
160 case HeadWearType::HatWithEarFlaps:
161 case HeadWearType::Helmet:
162 case HeadWearType::Hood:
163 case HeadWearType::Hat:
164 case HeadWearType::Other:
165 return scores[static_cast<int>(type)];
166 default:
167 return -1.0f;
168 }
169 }
170
172 } // namespace fsdk
DECLARE_SMARTPTR
#define DECLARE_SMARTPTR(X)
Smart ptr declaration helper macro.
Definition: Def.h:56
fsdk::HeadWearTypeEstimation::scores
float scores[static_cast< int >(HeadWearType::Count)]
estimation scores
Definition: IHeadWearEstimator.h:75
fsdk
SDK namespace.
Definition: IAGSEstimator.h:8
fsdk::Result
A structure that encapsulates an action result enumeration.
Definition: Result.h:27
fsdk::HeadWearTypeEstimation
HeadWearType estimator output structure. This structure contains the result of estimation (...
Definition: IHeadWearEstimator.h:73
fsdk::HeadWearState
HeadWearState
HeadWearState estimator output enum. This enum contains all possible estimation results.
Definition: IHeadWearEstimator.h:25
fsdk::IHeadWearEstimator
HeadWear estimator interface.
Definition: IHeadWearEstimator.h:99
IObject.h
Object system types and interfaces.
fsdk::HeadWearStateEstimation::result
HeadWearState result
estimation result (
Definition: IHeadWearEstimator.h:38
fsdk::HeadWearType
HeadWearType
HeadWearType estimator output enum. This enum contains all possible estimation results.
Definition: IHeadWearEstimator.h:53
FSDKError.h
Common SDK error codes.
fsdk::IRefCounted
Base strong reference counted object interface.
Definition: IRefCounted.h:37
fsdk::HeadWearTypeEstimation::getScore
float getScore(HeadWearType type) const
Returns score of required headwear type.
Definition: IHeadWearEstimator.h:153
fsdk::IHeadWearEstimator::estimate
virtual Result< FSDKError > estimate(const Image &warp, HeadWearEstimation &estimation) const noexcept=0
Estimate Head Wear probabilities.
fsdk::HeadWearStateEstimation::scores
float scores[static_cast< int >(HeadWearState::Count)]
estimation scores
Definition: IHeadWearEstimator.h:39
fsdk::FaceOcclusionType::Count
Total number of occlusion types.
fsdk::Image
Image.
Definition: Image.h:38
fsdk::HeadWearEstimation::state
HeadWearStateEstimation state
headwear state estimation (
Definition: IHeadWearEstimator.h:91
fsdk::HeadWearEstimation::type
HeadWearTypeEstimation type
headwear type estimation (
Definition: IHeadWearEstimator.h:92
fsdk::HeadWearStateEstimation::getScore
float getScore(HeadWearState state) const
Returns score of required headwear state.
Definition: IHeadWearEstimator.h:140
fsdk::HeadWearEstimation
HeadWear estimator output structure. This structure contains the result of HeadWearState and HeadWear...
Definition: IHeadWearEstimator.h:90
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::HeadWearStateEstimation
HeadWearState estimator output structure. This structure contains the result of estimation (...
Definition: IHeadWearEstimator.h:37
fsdk::IHeadWearEstimator::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::HeadWearTypeEstimation::result
HeadWearType result
estimation result (
Definition: IHeadWearEstimator.h:74