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

- Main Page
- Modules
- Namespaces
- Classes
- Files

- File List
- File Members

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
IHumanAttributeEstimator.h
1 #pragma once
2
3 #include <fsdk/IObject.h>
4 #include <fsdk/FSDKError.h>
5 #include <fsdk/Optional.h>
6
7 #include <fsdk/Types/Image.h>
8 #include <fsdk/Types/Result.h>
9 #include <fsdk/Types/Span.h>
10
11 namespace fsdk {
12
13 #ifndef DOXYGEN_SHOULD_SKIP_THIS
14 DECLARE_SMARTPTR(IHumanAttributeEstimator);
15 #endif
16
20 struct HumanAttributeResult {
25 enum class Gender {
26 Female,
27 Male,
28 Unknown
29 };
30
37 struct GenderEstimation {
38 Gender result;
39 float female;
40 float male;
41 float unknown;
42 };
43
48 enum class SleeveSize {
49 Short,
50 Long,
51 Unknown
52 };
53
60 struct SleeveSizeEstimation {
61 SleeveSize result;
62 float shortSize;
63 float longSize;
64 float unknown;
65 };
66
71 enum class Hat {
72 No, //< there is no headwear
73 Yes, //< there is a headwear
74 Unknown //< headwear state is unknown
75 };
76
83 struct HatEstimation {
84 Hat result;
85 float noHat;
86 float hat;
87 float unknown;
88 };
89
94 enum class Backpack {
95 No, //< there is no backpack
96 Yes, //< there is a backpack
97 Unknown //< backpack state is unknown
98 };
99
106 struct BackpackEstimation {
107 Backpack result;
108 float noBackpack;
109 float backpack;
110 float unknown;
111 };
112
117 enum class Color {
118 Black,
119 Blue,
120 Green,
121 Grey,
122 Orange,
123 Purple,
124 Red,
125 White,
126 Yellow,
127 Pink,
128 Brown,
129 Beige,
130 Khaki,
131 Multicolored,
132 Count
133 };
134
141 struct OutwearColorEstimation {
142 bool isBlack;
143 bool isBlue;
144 bool isGreen;
145 bool isGrey;
146 bool isOrange;
147 bool isPurple;
148 bool isRed;
149 bool isWhite;
150 bool isYellow;
151 bool isPink;
152 bool isBrown;
153 bool isBeige;
154 bool isKhaki;
155 bool isMulticolored;
156 float scores[static_cast<int>(Color::Count)];
157
163 inline float getScore(Color color) const;
164 };
165
170 Optional<float> age;
171
176 Optional<GenderEstimation> gender;
177
178 Optional<SleeveSizeEstimation> sleeve;
179 Optional<HatEstimation> headwear;
180 Optional<BackpackEstimation> backpack;
181 Optional<OutwearColorEstimation> outwearColor;
182 };
183
188 enum class HumanAttributeRequest {
189 EstimateAge = 1 << 0,
190 EstimateGender = 1 << 1,
191 EstimateSleeveSize = 1 << 2,
192 EstimateBackpack = 1 << 3,
193 EstimateOutwearColor = 1 << 4,
194 EstimateHeadwear = 1 << 5,
195 EstimateAll = 0xffff
196 };
197
202 struct IHumanAttributeEstimator : IRefCounted {
203
214 virtual Result<FSDKError> estimate(
215 const Image& humanWarp,
216 HumanAttributeRequest request,
217 HumanAttributeResult& result) const noexcept = 0;
218
231 virtual Result<FSDKError> estimate(
232 Span<const Image> humanWarps,
233 HumanAttributeRequest request,
234 Span<HumanAttributeResult> results) const noexcept = 0;
235
248 virtual Result<FSDKError> validate(
249 Span<const Image> humanWarps,
250 HumanAttributeRequest request,
251 Span<Result<FSDKError>> errors) const noexcept = 0;
252
253
265 virtual Result<FSDKError> aggregate(
266 Span<const HumanAttributeResult> estimations,
267 HumanAttributeRequest request,
268 HumanAttributeResult& result) const noexcept = 0;
269 };
270
271 /*
272 Implementation details.
273 */
274 float HumanAttributeResult::OutwearColorEstimation::getScore(
275 HumanAttributeResult::Color color) const {
276 switch (color) {
277 case Color::Black:
278 case Color::Blue:
279 case Color::Green:
280 case Color::Grey:
281 case Color::Orange:
282 case Color::Purple:
283 case Color::Red:
284 case Color::White:
285 case Color::Yellow:
286 case Color::Pink:
287 case Color::Brown:
288 case Color::Beige:
289 case Color::Khaki:
290 case Color::Multicolored:
291 return scores[static_cast<int>(color)];
292 default:
293 return -1.0f;
294 }
295 }
296
297 /*
298 Implementation details.
299 */
300 inline HumanAttributeRequest operator|(
301 HumanAttributeRequest lhs,
302 HumanAttributeRequest rhs) {
303 return static_cast<HumanAttributeRequest>(
304 static_cast<int>(lhs) | static_cast<int>(rhs));
305 }
306
307 /*
308 Implementation details.
309 */
310 inline bool operator&(HumanAttributeRequest lhs, HumanAttributeRequest rhs) {
311 return static_cast<int>(lhs) & static_cast<int>(rhs);
312 }
313
314 } // namespace fsdk
fsdk::HumanAttributeRequest::EstimateGender
estimate gender
fsdk::HumanAttributeResult::OutwearColorEstimation::isKhaki
bool isKhaki
outwear is khaki
Definition: IHumanAttributeEstimator.h:154
fsdk::HumanAttributeResult::BackpackEstimation::backpack
float backpack
backpack probability score
Definition: IHumanAttributeEstimator.h:109
fsdk::HumanAttributeResult::OutwearColorEstimation::isOrange
bool isOrange
outwear is orange
Definition: IHumanAttributeEstimator.h:146
fsdk::HumanAttributeResult::headwear
Optional< HatEstimation > headwear
headwear estimation (
Definition: IHumanAttributeEstimator.h:179
DECLARE_SMARTPTR
#define DECLARE_SMARTPTR(X)
Smart ptr declaration helper macro.
Definition: Def.h:59
fsdk::HumanAttributeResult::backpack
Optional< BackpackEstimation > backpack
backpack estimation (
Definition: IHumanAttributeEstimator.h:180
fsdk::HumanAttributeResult::GenderEstimation
HumanAttribute estimator gender output structure. This structure contains the result of gender estima...
Definition: IHumanAttributeEstimator.h:37
fsdk::Result
A structure that encapsulates an action result enumeration.
Definition: Result.h:29
fsdk::HumanAttributeRequest::EstimateBackpack
estimate backpack state
fsdk::HumanAttributeRequest::EstimateAge
estimate age
fsdk::HumanAttributeResult::HatEstimation
HumanAttribute estimator hat output structure. This structure contains the result of hat estimation a...
Definition: IHumanAttributeEstimator.h:83
fsdk::HumanAttributeResult
Unified HumanAttribute estimator output structure.
Definition: IHumanAttributeEstimator.h:20
fsdk::HumanAttributeResult::BackpackEstimation::unknown
float unknown
unknown backpack state probability score
Definition: IHumanAttributeEstimator.h:110
fsdk::HumanAttributeResult::OutwearColorEstimation::isMulticolored
bool isMulticolored
outwear is multicolored
Definition: IHumanAttributeEstimator.h:155
fsdk::HumanAttributeResult::BackpackEstimation
HumanAttribute estimator backpack output structure. This structure contains the result of backpack es...
Definition: IHumanAttributeEstimator.h:106
fsdk::HumanAttributeResult::GenderEstimation::female
float female
female gender probability score
Definition: IHumanAttributeEstimator.h:39
fsdk::HumanAttributeResult::GenderEstimation::result
Gender result
estimation result (
Definition: IHumanAttributeEstimator.h:38
fsdk::HumanAttributeResult::Gender::Male
person&#39;s gender is male
fsdk::HumanAttributeResult::OutwearColorEstimation::isGreen
bool isGreen
outwear is green
Definition: IHumanAttributeEstimator.h:144
fsdk::HumanAttributeResult::SleeveSizeEstimation::longSize
float longSize
long sleeves size probability score
Definition: IHumanAttributeEstimator.h:63
IObject.h
Object system types and interfaces.
fsdk::HumanAttributeResult::OutwearColorEstimation::isBeige
bool isBeige
outwear is beige
Definition: IHumanAttributeEstimator.h:153
fsdk::HumanAttributeResult::Gender
Gender
HumanAttribute estimator gender output enum. This enum contains all possible estimation results...
Definition: IHumanAttributeEstimator.h:25
fsdk::HumanAttributeRequest::EstimateSleeveSize
estimate sleeves size
FSDKError.h
Common SDK error codes.
fsdk::IHumanAttributeEstimator::aggregate
virtual Result< FSDKError > aggregate(Span< const HumanAttributeResult > estimations, HumanAttributeRequest request, HumanAttributeResult &result) const noexcept=0
Aggregate human body attributes.
fsdk::HumanAttributeResult::SleeveSizeEstimation::unknown
float unknown
unknown sleeves size probability score
Definition: IHumanAttributeEstimator.h:64
fsdk::HumanAttributeResult::SleeveSize::Long
sleeves are long
fsdk::HumanAttributeResult::OutwearColorEstimation::isBlue
bool isBlue
outwear is blue
Definition: IHumanAttributeEstimator.h:143
fsdk::HumanAttributeResult::OutwearColorEstimation::isBlack
bool isBlack
outwear is black
Definition: IHumanAttributeEstimator.h:142
fsdk::IRefCounted
Base strong reference counted object interface.
Definition: IRefCounted.h:36
fsdk::HumanAttributeRequest::EstimateOutwearColor
estimate outwear color
fsdk::IHumanAttributeEstimator::validate
virtual Result< FSDKError > validate(Span< const Image > humanWarps, HumanAttributeRequest request, Span< Result< FSDKError >> errors) const noexcept=0
Validate input of multiple frames in a single function call.
fsdk::HumanAttributeResult::GenderEstimation::unknown
float unknown
unknown gender probability score
Definition: IHumanAttributeEstimator.h:41
fsdk::HumanAttributeResult::OutwearColorEstimation::isPurple
bool isPurple
outwear is purple
Definition: IHumanAttributeEstimator.h:147
fsdk::HumanAttributeResult::OutwearColorEstimation::getScore
float getScore(Color color) const
Returns score of required outwear color.
Definition: IHumanAttributeEstimator.h:274
fsdk::HumanAttributeResult::Backpack
Backpack
HumanAttribute estimator backpack enum. This enum contains all possible estimation results...
Definition: IHumanAttributeEstimator.h:94
fsdk::IHumanAttributeEstimator
HumanAttribute estimator interface.
Definition: IHumanAttributeEstimator.h:202
fsdk::HumanAttributeRequest::EstimateAll
estimate all attributes
fsdk::HumanAttributeRequest::EstimateHeadwear
estimate headwear state
fsdk::HumanAttributeResult::Gender::Female
person&#39;s gender is female
fsdk::HumanAttributeResult::OutwearColorEstimation::isPink
bool isPink
outwear is pink
Definition: IHumanAttributeEstimator.h:151
fsdk::IHumanAttributeEstimator::estimate
virtual Result< FSDKError > estimate(const Image &humanWarp, HumanAttributeRequest request, HumanAttributeResult &result) const noexcept=0
Estimate human body attributes.
fsdk::HumanAttributeResult::GenderEstimation::male
float male
male gender probability score
Definition: IHumanAttributeEstimator.h:40
fsdk::HumanAttributeResult::sleeve
Optional< SleeveSizeEstimation > sleeve
sleeve estimation (
Definition: IHumanAttributeEstimator.h:178
fsdk::HumanAttributeResult::HatEstimation::result
Hat result
estimation result (
Definition: IHumanAttributeEstimator.h:84
fsdk::HumanAttributeResult::SleeveSize::Unknown
sleeves state is unknown
fsdk::HumanAttributeResult::OutwearColorEstimation::isYellow
bool isYellow
outwear is yellow
Definition: IHumanAttributeEstimator.h:150
fsdk::HumanAttributeResult::outwearColor
Optional< OutwearColorEstimation > outwearColor
outwear color estimation (
Definition: IHumanAttributeEstimator.h:181
fsdk::HumanAttributeResult::gender
Optional< GenderEstimation > gender
Gender estimation by human body.
Definition: IHumanAttributeEstimator.h:176
fsdk::HumanAttributeResult::SleeveSizeEstimation::result
SleeveSize result
estimation result (
Definition: IHumanAttributeEstimator.h:61
fsdk::HumanAttributeResult::Gender::Unknown
person&#39;s gender is unknown
fsdk::Image
Image.
Definition: Image.h:38
fsdk::HumanAttributeResult::OutwearColorEstimation::isGrey
bool isGrey
outwear is grey
Definition: IHumanAttributeEstimator.h:145
fsdk::HumanAttributeResult::age
Optional< float > age
Age estimation by human body.
Definition: IHumanAttributeEstimator.h:170
fsdk::HumanAttributeResult::OutwearColorEstimation::isWhite
bool isWhite
outwear is white
Definition: IHumanAttributeEstimator.h:149
fsdk::HumanAttributeResult::SleeveSizeEstimation
HumanAttribute estimator sleeves size output structure. This structure contains the result of sleeves...
Definition: IHumanAttributeEstimator.h:60
fsdk::HumanAttributeResult::SleeveSize
SleeveSize
HumanAttribute estimator sleeves size output enum. This enum contains all possible estimation results...
Definition: IHumanAttributeEstimator.h:48
fsdk::HumanAttributeResult::Hat
Hat
HumanAttribute estimator hat output enum. This enum contains all possible estimation results...
Definition: IHumanAttributeEstimator.h:71
fsdk::HumanAttributeResult::OutwearColorEstimation::isRed
bool isRed
outwear is red
Definition: IHumanAttributeEstimator.h:148
fsdk::HumanAttributeResult::HatEstimation::unknown
float unknown
unknown hat state probability score
Definition: IHumanAttributeEstimator.h:87
fsdk::HumanAttributeResult::OutwearColorEstimation
HumanAttribute estimator outwear color output structure. This structure contains the result of outwea...
Definition: IHumanAttributeEstimator.h:141
fsdk::HumanAttributeResult::OutwearColorEstimation::scores
float scores[static_cast< int >(Color::Count)]
estimation scores
Definition: IHumanAttributeEstimator.h:156
fsdk::HumanAttributeResult::Color
Color
HumanAttribute estimator color enum. This enum contains all possible estimation results.
Definition: IHumanAttributeEstimator.h:117
fsdk::HumanAttributeResult::HatEstimation::hat
float hat
hat probability score
Definition: IHumanAttributeEstimator.h:86
fsdk::HumanAttributeResult::SleeveSizeEstimation::shortSize
float shortSize
short sleeves size probability score
Definition: IHumanAttributeEstimator.h:62
fsdk::HumanAttributeResult::BackpackEstimation::noBackpack
float noBackpack
no backpack probability score
Definition: IHumanAttributeEstimator.h:108
fsdk::HumanAttributeResult::OutwearColorEstimation::isBrown
bool isBrown
outwear is brown
Definition: IHumanAttributeEstimator.h:152
fsdk::RedEyeStatus::Red
Eye is red.
fsdk::HumanAttributeRequest
HumanAttributeRequest
HumanAttributeRequest lists all possible estimation attributes that HumanAttributeEstimator is curren...
Definition: IHumanAttributeEstimator.h:188
fsdk::HumanAttributeResult::BackpackEstimation::result
Backpack result
estimation result (
Definition: IHumanAttributeEstimator.h:107
fsdk::HumanAttributeResult::SleeveSize::Short
sleeves are short
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::HumanAttributeResult::HatEstimation::noHat
float noHat
no hat probability score
Definition: IHumanAttributeEstimator.h:85