| Face Engine SDK 5.12.0 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
20 enum class HeadWearState {
21 Yes = 0, //< there is headwear
22 No, //< there is no headwear
23 Count
24 };
25
32 struct HeadWearStateEstimation {
33 HeadWearState result;
34 float scores[static_cast<int>(HeadWearState::Count)];
35
41 inline float getScore(HeadWearState state) const;
42 };
43
48 enum class HeadWearType : uint8_t {
49 NoHeadWear = 0, //< there is no headwear on the head
50 BaseballCap, //< there is baseball cap on the head
51 Beanie, //< there is beanie on the head
52 PeakedCap, //< there is peaked cap on the head
53 Shawl, //< there is shawl on the head
54 HatWithEarFlaps, //< there is hat with ear flaps on the head
55 Helmet, //< there is helmet on the head
56 Hood, //< there is hood on the head
57 Hat, //< there is hat on the head
58 Other, //< something other is on the head
59 Count
60 };
61
68 struct HeadWearTypeEstimation {
69 HeadWearType result;
70 float scores[static_cast<int>(HeadWearType::Count)];
71
77 inline float getScore(HeadWearType type) const;
78 };
79
85 struct HeadWearEstimation {
86 HeadWearStateEstimation state;
87 HeadWearTypeEstimation type;
89 };
91
96 struct IHeadWearEstimator : IRefCounted {
105 virtual Result<FSDKError> estimate(
106 const Image& warp,
107 HeadWearEstimation& estimation) const noexcept = 0;
108
119 virtual Result<FSDKError> estimate(
120 Span<const Image> warps,
121 Span<HeadWearEstimation> estimations) const noexcept = 0;
122
133 virtual Result<FSDKError> validate(
134 Span<const Image> warps,
135 Span<Result<FSDKError>> errors) const noexcept = 0;
136 };
137
138 /*
139 Implementation details.
140 */
141 float HeadWearStateEstimation::getScore(HeadWearState state) const {
142 switch (state) {
143 case HeadWearState::Yes:
144 case HeadWearState::No:
145 return scores[static_cast<int>(state)];
146 default:
147 return -1.0f;
148 }
149 }
150
151 /*
152 Implementation details.
153 */
154 float HeadWearTypeEstimation::getScore(HeadWearType type) const {
155 switch (type) {
156 case HeadWearType::NoHeadWear:
157 case HeadWearType::BaseballCap:
158 case HeadWearType::Beanie:
159 case HeadWearType::PeakedCap:
160 case HeadWearType::Shawl:
161 case HeadWearType::HatWithEarFlaps:
162 case HeadWearType::Helmet:
163 case HeadWearType::Hood:
164 case HeadWearType::Hat:
165 case HeadWearType::Other:
166 return scores[static_cast<int>(type)];
167 default:
168 return -1.0f;
169 }
170 }
171
172 } // namespace fsdk
fsdk::HeadWearTypeEstimation::getScore
float getScore(HeadWearType type) const
Returns score of required headwear type.
Definition: IHeadWearEstimator.h:154
DECLARE_SMARTPTR
#define DECLARE_SMARTPTR(X)
Smart ptr declaration helper macro.
Definition: Def.h:59
fsdk::HeadWearTypeEstimation::scores
float scores[static_cast< int >(HeadWearType::Count)]
estimation scores
Definition: IHeadWearEstimator.h:70
fsdk
SDK namespace.
Definition: IAGSEstimator.h:8
fsdk::Result
A structure that encapsulates an action result enumeration.
Definition: Result.h:29
fsdk::HeadWearTypeEstimation
HeadWearType estimator output structure. This structure contains the result of estimation (...
Definition: IHeadWearEstimator.h:68
fsdk::HeadWearState
HeadWearState
HeadWearState estimator output enum. This enum contains all possible estimation results.
Definition: IHeadWearEstimator.h:20
fsdk::IHeadWearEstimator
HeadWear estimator interface.
Definition: IHeadWearEstimator.h:96
IObject.h
Object system types and interfaces.
fsdk::HeadWearStateEstimation::result
HeadWearState result
estimation result (
Definition: IHeadWearEstimator.h:33
FSDKError.h
Common SDK error codes.
fsdk::IRefCounted
Base strong reference counted object interface.
Definition: IRefCounted.h:36
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:34
fsdk::Image
Image.
Definition: Image.h:38
fsdk::HeadWearEstimation::state
HeadWearStateEstimation state
Definition: IHeadWearEstimator.h:86
fsdk::HeadWearEstimation::type
HeadWearTypeEstimation type
Definition: IHeadWearEstimator.h:88
fsdk::HeadWearType
HeadWearType
HeadWearType estimator output enum. This enum contains all possible estimation results.
Definition: IHeadWearEstimator.h:48
fsdk::HeadWearStateEstimation::getScore
float getScore(HeadWearState state) const
Returns score of required headwear state.
Definition: IHeadWearEstimator.h:141
fsdk::HeadWearEstimation
HeadWear estimator output structure. This structure contains the result of HeadWearState and HeadWear...
Definition: IHeadWearEstimator.h:85
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:32
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:69