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

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 {
21
26 enum class Color {
27 Black,
28 Blue,
29 Green,
30 Grey,
31 Orange,
32 Purple,
33 Red,
34 White,
35 Yellow,
36 Pink,
37 Brown,
38 Beige,
39 Khaki,
40 Multicolored,
41 Count
42 };
43
50 struct OutwearColorEstimation {
51 bool isBlack;
52 bool isBlue;
53 bool isGreen;
54 bool isGrey;
55 bool isOrange;
56 bool isPurple;
57 bool isRed;
58 bool isWhite;
59 bool isYellow;
60 bool isPink;
61 bool isBrown;
62 bool isBeige;
63 bool isKhaki;
64 bool isMulticolored;
65 float scores[static_cast<int>(Color::Count)];
66
72 inline float getScore(Color color) const;
73 };
74
79 enum class ApparentColor {
80 Black,
81 White,
82 Other,
83 Unknown,
84 Count
85 };
86
93 struct ApparentColorEstimation {
94 bool isBlack;
95 bool isWhite;
96 bool isOther;
97 bool isUnknown;
98 float scores[static_cast<int>(ApparentColor::Count)];
99
105 inline float getScore(ApparentColor color) const;
106 };
107
112 enum class Gender {
113 Female,
114 Male,
115 Unknown
116 };
117
124 struct GenderEstimation {
125 Gender result;
126 float female;
127 float male;
128 float unknown;
129 };
130
135 enum class SleeveSize {
136 Short,
137 Long,
138 Unknown
139 };
140
147 struct SleeveSizeEstimation {
148 SleeveSize result;
149 float shortSize;
150 float longSize;
151 float unknown;
152 };
153
158 enum class Hat {
159 No, //< there is no headwear
160 Yes, //< there is a headwear
161 Unknown //< headwear state is unknown
162 };
163
170 struct HatEstimation {
171 Hat result;
172 float noHat;
173 float hat;
174 float unknown;
175
176 ApparentColorEstimation hatColor;
177 };
178
183 enum class Backpack {
184 No, //< there is no backpack
185 Yes, //< there is a backpack
186 Unknown //< backpack state is unknown
187 };
188
195 struct BackpackEstimation {
196 Backpack result;
197 float noBackpack;
198 float backpack;
199 float unknown;
200 };
201
206 enum class LowerBodyClothing {
207 Pants, //< there is pants
208 Shorts, //< there is shorts
209 Skirt, //< there is skirt
210 Unknown //< lower body clothing state is unknown
211 };
212
219 struct LowerBodyClothingEstimation {
220 LowerBodyClothing result;
221 float pants;
222 float shorts;
223 float skirt;
224 float unknown;
225
226 OutwearColorEstimation lowerBodyClothingColor;
227 };
228
233 Optional<float> age;
234
239 Optional<GenderEstimation> gender;
240
241 Optional<SleeveSizeEstimation> sleeve;
242 Optional<HatEstimation> headwear;
243 Optional<BackpackEstimation> backpack;
244 Optional<OutwearColorEstimation> outwearColor;
245 Optional<LowerBodyClothingEstimation> lowerBodyClothing;
246 Optional<ApparentColorEstimation> shoeColor;
247 };
248
253 enum class HumanAttributeRequest {
254 EstimateAge = 1 << 0,
255 EstimateGender = 1 << 1,
256 EstimateSleeveSize = 1 << 2,
257 EstimateBackpack = 1 << 3,
258 EstimateOutwearColor = 1 << 4,
259 EstimateHeadwear = 1 << 5,
260 EstimateLowerBodyClothing = 1 << 7,
261 EstimateShoeColor = 1 << 8,
262 EstimateAll = 0xffff
263 };
264
269 struct IHumanAttributeEstimator : IRefCounted {
270
281 virtual Result<FSDKError> estimate(
282 const Image& humanWarp,
283 HumanAttributeRequest request,
284 HumanAttributeResult& result) const noexcept = 0;
285
298 virtual Result<FSDKError> estimate(
299 Span<const Image> humanWarps,
300 HumanAttributeRequest request,
301 Span<HumanAttributeResult> results) const noexcept = 0;
302
315 virtual Result<FSDKError> validate(
316 Span<const Image> humanWarps,
317 HumanAttributeRequest request,
318 Span<Result<FSDKError>> errors) const noexcept = 0;
319
320
332 virtual Result<FSDKError> aggregate(
333 Span<const HumanAttributeResult> estimations,
334 HumanAttributeRequest request,
335 HumanAttributeResult& result) const noexcept = 0;
336 };
337
338 /*
339 Implementation details.
340 */
341 float HumanAttributeResult::OutwearColorEstimation::getScore(
342 HumanAttributeResult::Color color) const {
343 switch (color) {
344 case Color::Black:
345 case Color::Blue:
346 case Color::Green:
347 case Color::Grey:
348 case Color::Orange:
349 case Color::Purple:
350 case Color::Red:
351 case Color::White:
352 case Color::Yellow:
353 case Color::Pink:
354 case Color::Brown:
355 case Color::Beige:
356 case Color::Khaki:
357 case Color::Multicolored:
358 return scores[static_cast<int>(color)];
359 default:
360 return -1.0f;
361 }
362 }
363
364 /*
365 Implementation details.
366 */
367 float HumanAttributeResult::ApparentColorEstimation::getScore(
368 HumanAttributeResult::ApparentColor color) const {
369 switch (color) {
370 case ApparentColor::Black:
371 case ApparentColor::White:
372 case ApparentColor::Other:
373 case ApparentColor::Unknown:
374 return scores[static_cast<int>(color)];
375 default:
376 return -1.0f;
377 }
378 }
379
380 /*
381 Implementation details.
382 */
383 inline HumanAttributeRequest operator|(
384 HumanAttributeRequest lhs,
385 HumanAttributeRequest rhs) {
386 return static_cast<HumanAttributeRequest>(
387 static_cast<int>(lhs) | static_cast<int>(rhs));
388 }
389
390 /*
391 Implementation details.
392 */
393 inline bool operator&(HumanAttributeRequest lhs, HumanAttributeRequest rhs) {
394 return static_cast<int>(lhs) & static_cast<int>(rhs);
395 }
396
397 } // namespace fsdk
fsdk::HumanAttributeRequest::EstimateGender
estimate gender
fsdk::HumanAttributeResult::ApparentColorEstimation::isBlack
bool isBlack
attribute is black
Definition: IHumanAttributeEstimator.h:94
fsdk::HumanAttributeResult::OutwearColorEstimation::isKhaki
bool isKhaki
outwear is khaki
Definition: IHumanAttributeEstimator.h:63
fsdk::HumanAttributeResult::BackpackEstimation::backpack
float backpack
backpack probability score
Definition: IHumanAttributeEstimator.h:198
fsdk::HumanAttributeResult::LowerBodyClothingEstimation::shorts
float shorts
shorts probability score
Definition: IHumanAttributeEstimator.h:222
fsdk::HumanAttributeResult::OutwearColorEstimation::isOrange
bool isOrange
outwear is orange
Definition: IHumanAttributeEstimator.h:55
fsdk::HumanAttributeRequest::EstimateLowerBodyClothing
estimate lower body clothing state
fsdk::HumanAttributeResult::headwear
Optional< HatEstimation > headwear
headwear estimation (
Definition: IHumanAttributeEstimator.h:242
DECLARE_SMARTPTR
#define DECLARE_SMARTPTR(X)
Smart ptr declaration helper macro.
Definition: Def.h:59
fsdk::HumanAttributeRequest::EstimateShoeColor
estimate shoe color
fsdk
SDK namespace.
Definition: IAGSEstimator.h:8
fsdk::HumanAttributeResult::backpack
Optional< BackpackEstimation > backpack
backpack estimation (
Definition: IHumanAttributeEstimator.h:243
fsdk::HumanAttributeResult::GenderEstimation
HumanAttribute estimator gender output structure. This structure contains the result of gender estima...
Definition: IHumanAttributeEstimator.h:124
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:170
fsdk::HumanAttributeResult::LowerBodyClothingEstimation::result
LowerBodyClothing result
estimation result (
Definition: IHumanAttributeEstimator.h:220
fsdk::HumanAttributeResult::ApparentColorEstimation
HumanAttribute estimator simplified color output structure. This structure contains the result of tru...
Definition: IHumanAttributeEstimator.h:93
fsdk::HumanAttributeResult::OutwearColorEstimation::getScore
float getScore(Color color) const
Returns score of required outwear color.
Definition: IHumanAttributeEstimator.h:341
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:199
fsdk::HumanAttributeResult::OutwearColorEstimation::isMulticolored
bool isMulticolored
outwear is multicolored
Definition: IHumanAttributeEstimator.h:64
fsdk::HumanAttributeResult::BackpackEstimation
HumanAttribute estimator backpack output structure. This structure contains the result of backpack es...
Definition: IHumanAttributeEstimator.h:195
fsdk::HumanAttributeResult::shoeColor
Optional< ApparentColorEstimation > shoeColor
shoe color color estimation (
Definition: IHumanAttributeEstimator.h:246
fsdk::HumanAttributeResult::GenderEstimation::female
float female
female gender probability score
Definition: IHumanAttributeEstimator.h:126
fsdk::HumanAttributeResult::GenderEstimation::result
Gender result
estimation result (
Definition: IHumanAttributeEstimator.h:125
fsdk::HumanAttributeResult::Gender::Male
person&#39;s gender is male
fsdk::HumanAttributeResult::OutwearColorEstimation::isGreen
bool isGreen
outwear is green
Definition: IHumanAttributeEstimator.h:53
fsdk::HumanAttributeResult::SleeveSizeEstimation::longSize
float longSize
long sleeves size probability score
Definition: IHumanAttributeEstimator.h:150
IObject.h
Object system types and interfaces.
fsdk::HumanAttributeResult::OutwearColorEstimation::isBeige
bool isBeige
outwear is beige
Definition: IHumanAttributeEstimator.h:62
fsdk::HumanAttributeResult::Gender
Gender
HumanAttribute estimator gender output enum. This enum contains all possible estimation results...
Definition: IHumanAttributeEstimator.h:112
fsdk::HumanAttributeRequest::EstimateSleeveSize
estimate sleeves size
fsdk::HumanAttributeResult::ApparentColorEstimation::scores
float scores[static_cast< int >(ApparentColor::Count)]
estimation scores
Definition: IHumanAttributeEstimator.h:98
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:151
fsdk::HumanAttributeResult::LowerBodyClothingEstimation
HumanAttribute estimator lower body clothing output structure. This structure contains the result of ...
Definition: IHumanAttributeEstimator.h:219
fsdk::HumanAttributeResult::SleeveSize::Long
sleeves are long
fsdk::HumanAttributeResult::OutwearColorEstimation::isBlue
bool isBlue
outwear is blue
Definition: IHumanAttributeEstimator.h:52
fsdk::HumanAttributeResult::OutwearColorEstimation::isBlack
bool isBlack
outwear is black
Definition: IHumanAttributeEstimator.h:51
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:128
fsdk::HumanAttributeResult::OutwearColorEstimation::isPurple
bool isPurple
outwear is purple
Definition: IHumanAttributeEstimator.h:56
fsdk::HumanAttributeResult::Backpack
Backpack
HumanAttribute estimator backpack enum. This enum contains all possible estimation results...
Definition: IHumanAttributeEstimator.h:183
fsdk::IHumanAttributeEstimator
HumanAttribute estimator interface.
Definition: IHumanAttributeEstimator.h:269
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:60
fsdk::IHumanAttributeEstimator::estimate
virtual Result< FSDKError > estimate(const Image &humanWarp, HumanAttributeRequest request, HumanAttributeResult &result) const noexcept=0
Estimate human body attributes.
fsdk::HumanAttributeResult::LowerBodyClothingEstimation::lowerBodyClothingColor
OutwearColorEstimation lowerBodyClothingColor
lower body clothing color estimation (
Definition: IHumanAttributeEstimator.h:226
fsdk::HumanAttributeResult::LowerBodyClothingEstimation::skirt
float skirt
skirt probability score
Definition: IHumanAttributeEstimator.h:223
fsdk::HumanAttributeResult::ApparentColorEstimation::getScore
float getScore(ApparentColor color) const
Returns score of required color.
Definition: IHumanAttributeEstimator.h:367
fsdk::HumanAttributeResult::GenderEstimation::male
float male
male gender probability score
Definition: IHumanAttributeEstimator.h:127
fsdk::HumanAttributeResult::sleeve
Optional< SleeveSizeEstimation > sleeve
sleeve estimation (
Definition: IHumanAttributeEstimator.h:241
fsdk::HumanAttributeResult::HatEstimation::result
Hat result
estimation result (
Definition: IHumanAttributeEstimator.h:171
fsdk::HumanAttributeResult::ApparentColorEstimation::isWhite
bool isWhite
attribute is white
Definition: IHumanAttributeEstimator.h:95
fsdk::HumanAttributeResult::LowerBodyClothingEstimation::pants
float pants
pants probability score
Definition: IHumanAttributeEstimator.h:221
fsdk::HumanAttributeResult::SleeveSize::Unknown
sleeves state is unknown
fsdk::HumanAttributeResult::LowerBodyClothingEstimation::unknown
float unknown
unknown state probability score
Definition: IHumanAttributeEstimator.h:224
fsdk::HumanAttributeResult::OutwearColorEstimation::isYellow
bool isYellow
outwear is yellow
Definition: IHumanAttributeEstimator.h:59
fsdk::HumanAttributeResult::outwearColor
Optional< OutwearColorEstimation > outwearColor
outwear color estimation (
Definition: IHumanAttributeEstimator.h:244
fsdk::HumanAttributeResult::gender
Optional< GenderEstimation > gender
Gender estimation by human body.
Definition: IHumanAttributeEstimator.h:239
fsdk::HumanAttributeResult::SleeveSizeEstimation::result
SleeveSize result
estimation result (
Definition: IHumanAttributeEstimator.h:148
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:54
fsdk::HumanAttributeResult::age
Optional< float > age
Age estimation by human body.
Definition: IHumanAttributeEstimator.h:233
fsdk::HumanAttributeResult::OutwearColorEstimation::isWhite
bool isWhite
outwear is white
Definition: IHumanAttributeEstimator.h:58
fsdk::HumanAttributeResult::LowerBodyClothing
LowerBodyClothing
HumanAttribute estimator lower body clothing enum. This enum contains all possible estimation results...
Definition: IHumanAttributeEstimator.h:206
fsdk::HumanAttributeResult::SleeveSizeEstimation
HumanAttribute estimator sleeves size output structure. This structure contains the result of sleeves...
Definition: IHumanAttributeEstimator.h:147
fsdk::HumanAttributeResult::SleeveSize
SleeveSize
HumanAttribute estimator sleeves size output enum. This enum contains all possible estimation results...
Definition: IHumanAttributeEstimator.h:135
fsdk::HumanAttributeResult::ApparentColorEstimation::isOther
bool isOther
attribute is some other
Definition: IHumanAttributeEstimator.h:96
fsdk::HumanAttributeResult::Hat
Hat
HumanAttribute estimator hat output enum. This enum contains all possible estimation results...
Definition: IHumanAttributeEstimator.h:158
fsdk::HumanAttributeResult::OutwearColorEstimation::isRed
bool isRed
outwear is red
Definition: IHumanAttributeEstimator.h:57
fsdk::HumanAttributeResult::HatEstimation::unknown
float unknown
unknown hat state probability score
Definition: IHumanAttributeEstimator.h:174
fsdk::HumanAttributeResult::OutwearColorEstimation
HumanAttribute estimator outwear color output structure. This structure contains the result of outwea...
Definition: IHumanAttributeEstimator.h:50
fsdk::HumanAttributeResult::OutwearColorEstimation::scores
float scores[static_cast< int >(Color::Count)]
estimation scores
Definition: IHumanAttributeEstimator.h:65
fsdk::HumanAttributeResult::lowerBodyClothing
Optional< LowerBodyClothingEstimation > lowerBodyClothing
lower body clothing estimation (
Definition: IHumanAttributeEstimator.h:245
fsdk::HumanAttributeResult::ApparentColor
ApparentColor
HumanAttribute estimator simplified color enum. This enum is truncated version of full color palette...
Definition: IHumanAttributeEstimator.h:79
fsdk::HumanAttributeResult::Color
Color
HumanAttribute estimator color enum. This enum contains all possible estimation results.
Definition: IHumanAttributeEstimator.h:26
fsdk::HumanAttributeResult::HatEstimation::hat
float hat
hat probability score
Definition: IHumanAttributeEstimator.h:173
fsdk::HumanAttributeResult::SleeveSizeEstimation::shortSize
float shortSize
short sleeves size probability score
Definition: IHumanAttributeEstimator.h:149
fsdk::HumanAttributeResult::BackpackEstimation::noBackpack
float noBackpack
no backpack probability score
Definition: IHumanAttributeEstimator.h:197
fsdk::HumanAttributeResult::OutwearColorEstimation::isBrown
bool isBrown
outwear is brown
Definition: IHumanAttributeEstimator.h:61
fsdk::RedEyeStatus::Red
Eye is red.
fsdk::HumanAttributeRequest
HumanAttributeRequest
HumanAttributeRequest lists all possible estimation attributes that HumanAttributeEstimator is curren...
Definition: IHumanAttributeEstimator.h:253
fsdk::HumanAttributeResult::HatEstimation::hatColor
ApparentColorEstimation hatColor
hat color estimation (
Definition: IHumanAttributeEstimator.h:176
fsdk::HumanAttributeResult::BackpackEstimation::result
Backpack result
estimation result (
Definition: IHumanAttributeEstimator.h:196
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::ApparentColorEstimation::isUnknown
bool isUnknown
attribute is unknown
Definition: IHumanAttributeEstimator.h:97
fsdk::HumanAttributeResult::HatEstimation::noHat
float noHat
no hat probability score
Definition: IHumanAttributeEstimator.h:172