| Face Engine SDK 5.34.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
25 struct HumanAttributeResult {
26
31 enum class Color {
32 Black,
33 Blue,
34 Green,
35 Grey,
36 Orange,
37 Purple,
38 Red,
39 White,
40 Yellow,
41 Pink,
42 Brown,
43 Beige,
44 Khaki,
45 Multicolored,
46 Count
47 };
48
55 struct OutwearColorEstimation {
56 bool isBlack;
57 bool isBlue;
58 bool isGreen;
59 bool isGrey;
60 bool isOrange;
61 bool isPurple;
62 bool isRed;
63 bool isWhite;
64 bool isYellow;
65 bool isPink;
66 bool isBrown;
67 bool isBeige;
68 bool isKhaki;
69 bool isMulticolored;
70 float scores[static_cast<int>(Color::Count)];
71
77 inline float getScore(Color color) const;
78 };
79
84 enum class ApparentColor {
85 Black,
86 White,
87 Other,
88 Unknown,
89 Count
90 };
91
98 struct ApparentColorEstimation {
99 bool isBlack;
100 bool isWhite;
101 bool isOther;
102 bool isUnknown;
103 float scores[static_cast<int>(ApparentColor::Count)];
104
110 inline float getScore(ApparentColor color) const;
111 };
112
117 enum class Gender {
118 Female,
119 Male,
120 Unknown
121 };
122
129 struct GenderEstimation {
130 Gender result;
131 float female;
132 float male;
133 float unknown;
134 };
135
140 enum class SleeveSize {
141 Short,
142 Long,
143 Unknown
144 };
145
152 struct SleeveSizeEstimation {
153 SleeveSize result;
154 float shortSize;
155 float longSize;
156 float unknown;
157 };
158
163 enum class Hat {
164 No, //< there is no headwear
165 Yes, //< there is a headwear
166 Unknown //< headwear state is unknown
167 };
168
175 struct HatEstimation {
176 Hat result;
177 float noHat;
178 float hat;
179 float unknown;
180
181 ApparentColorEstimation hatColor;
182 };
183
188 enum class Backpack {
189 No, //< there is no backpack
190 Yes, //< there is a backpack
191 Unknown //< backpack state is unknown
192 };
193
200 struct BackpackEstimation {
201 Backpack result;
202 float noBackpack;
203 float backpack;
204 float unknown;
205 };
206
211 enum class LowerBodyClothing {
212 Pants, //< there is pants
213 Shorts, //< there is shorts
214 Skirt, //< there is skirt
215 Unknown //< lower body clothing state is unknown
216 };
217
224 struct LowerBodyClothingEstimation {
226 LowerBodyClothing result;
227
229 float pants;
230
232 float shorts;
233
235 float skirt;
236
238 float unknown;
239
241 OutwearColorEstimation lowerBodyClothingColor;
242 };
243
248 Optional<float> age;
249
254 Optional<GenderEstimation> gender;
255
257 Optional<SleeveSizeEstimation> sleeve;
258
260 Optional<HatEstimation> headwear;
261
263 Optional<BackpackEstimation> backpack;
264
266 Optional<OutwearColorEstimation> outwearColor;
267
269 Optional<LowerBodyClothingEstimation> lowerBodyClothing;
270
272 Optional<ApparentColorEstimation> shoeColor;
273 };
274
279 enum class HumanAttributeRequest {
280 EstimateAge = 1 << 0,
281 EstimateGender = 1 << 1,
282 EstimateSleeveSize = 1 << 2,
283 EstimateBackpack = 1 << 3,
284 EstimateOutwearColor = 1 << 4,
285 EstimateHeadwear = 1 << 5,
286 EstimateLowerBodyClothing = 1 << 7,
287 EstimateShoeColor = 1 << 8,
288 EstimateAll = 0xffff
289 };
290
295 struct IHumanAttributeEstimator : IRefCounted {
296
307 virtual Result<FSDKError> estimate(
308 const Image& humanWarp,
309 HumanAttributeRequest request,
310 HumanAttributeResult& result) const noexcept = 0;
311
324 virtual Result<FSDKError> estimate(
325 Span<const Image> humanWarps,
326 HumanAttributeRequest request,
327 Span<HumanAttributeResult> results) const noexcept = 0;
328
341 virtual Result<FSDKError> validate(
342 Span<const Image> humanWarps,
343 HumanAttributeRequest request,
344 Span<Result<FSDKError>> errors) const noexcept = 0;
345
346
359 virtual Result<FSDKError> aggregate(
360 Span<const HumanAttributeResult> estimations,
361 HumanAttributeRequest request,
362 HumanAttributeResult& result) const noexcept = 0;
363 };
364
365 /*
366 Implementation details.
367 */
368 float HumanAttributeResult::OutwearColorEstimation::getScore(HumanAttributeResult::Color color) const {
369 switch(color) {
370 case Color::Black:
371 case Color::Blue:
372 case Color::Green:
373 case Color::Grey:
374 case Color::Orange:
375 case Color::Purple:
376 case Color::Red:
377 case Color::White:
378 case Color::Yellow:
379 case Color::Pink:
380 case Color::Brown:
381 case Color::Beige:
382 case Color::Khaki:
383 case Color::Multicolored:
384 return scores[static_cast<int>(color)];
385 default:
386 return -1.0f;
387 }
388 }
389
390 /*
391 Implementation details.
392 */
393 float
394 HumanAttributeResult::ApparentColorEstimation::getScore(HumanAttributeResult::ApparentColor color) const {
395 switch(color) {
396 case ApparentColor::Black:
397 case ApparentColor::White:
398 case ApparentColor::Other:
399 case ApparentColor::Unknown:
400 return scores[static_cast<int>(color)];
401 default:
402 return -1.0f;
403 }
404 }
405
406 /*
407 Implementation details.
408 */
409 inline HumanAttributeRequest operator|(HumanAttributeRequest lhs, HumanAttributeRequest rhs) {
410 return static_cast<HumanAttributeRequest>(static_cast<int>(lhs) | static_cast<int>(rhs));
411 }
412
413 /*
414 Implementation details.
415 */
416 inline bool operator&(HumanAttributeRequest lhs, HumanAttributeRequest rhs) {
417 return static_cast<int>(lhs) & static_cast<int>(rhs);
418 }
419
421 } // namespace fsdk
fsdk::HumanAttributeResult::ApparentColorEstimation::isBlack
bool isBlack
attribute is black
Definition: IHumanAttributeEstimator.h:99
fsdk::HumanAttributeRequest::EstimateGender
estimate gender
fsdk::HumanAttributeResult::OutwearColorEstimation::isKhaki
bool isKhaki
outwear is khaki
Definition: IHumanAttributeEstimator.h:68
fsdk::HumanAttributeRequest::EstimateAll
estimate all attributes
fsdk::HumanAttributeResult::BackpackEstimation::backpack
float backpack
backpack probability score
Definition: IHumanAttributeEstimator.h:203
fsdk::HumanAttributeResult::LowerBodyClothingEstimation::shorts
float shorts
skirt probability score
Definition: IHumanAttributeEstimator.h:232
fsdk::HumanAttributeResult::OutwearColorEstimation::isOrange
bool isOrange
outwear is orange
Definition: IHumanAttributeEstimator.h:60
fsdk::HumanAttributeResult::headwear
Optional< HatEstimation > headwear
backpack estimation (
Definition: IHumanAttributeEstimator.h:260
DECLARE_SMARTPTR
#define DECLARE_SMARTPTR(X)
Smart ptr declaration helper macro.
Definition: Def.h:70
fsdk
SDK namespace.
Definition: IAGSEstimator.h:8
fsdk::HumanAttributeResult::backpack
Optional< BackpackEstimation > backpack
outwear color estimation (
Definition: IHumanAttributeEstimator.h:263
fsdk::HumanAttributeResult::GenderEstimation
HumanAttribute estimator gender output structure. This structure contains the result of gender estima...
Definition: IHumanAttributeEstimator.h:129
fsdk::Result
A structure that encapsulates an action result enumeration.
Definition: Result.h:27
fsdk::HumanAttributeResult::HatEstimation
HumanAttribute estimator hat output structure. This structure contains the result of hat estimation a...
Definition: IHumanAttributeEstimator.h:175
fsdk::HumanAttributeResult::LowerBodyClothingEstimation::result
LowerBodyClothing result
< estimation result (
Definition: IHumanAttributeEstimator.h:226
fsdk::RedEyeStatus::Red
Eye is red.
fsdk::HumanAttributeResult::ApparentColorEstimation
HumanAttribute estimator simplified color output structure. This structure contains the result of tru...
Definition: IHumanAttributeEstimator.h:98
fsdk::HumanAttributeResult
Unified HumanAttribute estimator output structure.
Definition: IHumanAttributeEstimator.h:25
fsdk::HumanAttributeResult::BackpackEstimation::unknown
float unknown
unknown backpack state probability score
Definition: IHumanAttributeEstimator.h:204
fsdk::HumanAttributeResult::OutwearColorEstimation::isMulticolored
bool isMulticolored
outwear is multicolored
Definition: IHumanAttributeEstimator.h:69
fsdk::HumanAttributeResult::BackpackEstimation
HumanAttribute estimator backpack output structure. This structure contains the result of backpack es...
Definition: IHumanAttributeEstimator.h:200
fsdk::HumanAttributeResult::GenderEstimation::female
float female
female gender probability score
Definition: IHumanAttributeEstimator.h:131
fsdk::HumanAttributeResult::GenderEstimation::result
Gender result
estimation result (
Definition: IHumanAttributeEstimator.h:130
fsdk::HumanAttributeResult::Gender::Male
person&#39;s gender is male
fsdk::HumanAttributeResult::OutwearColorEstimation::isGreen
bool isGreen
outwear is green
Definition: IHumanAttributeEstimator.h:58
fsdk::HumanAttributeResult::SleeveSizeEstimation::longSize
float longSize
long sleeves size probability score
Definition: IHumanAttributeEstimator.h:155
IObject.h
Object system types and interfaces.
fsdk::HumanAttributeResult::OutwearColorEstimation::isBeige
bool isBeige
outwear is beige
Definition: IHumanAttributeEstimator.h:67
fsdk::HumanAttributeResult::Gender
Gender
HumanAttribute estimator gender output enum. This enum contains all possible estimation results...
Definition: IHumanAttributeEstimator.h:117
fsdk::HumanAttributeResult::ApparentColorEstimation::scores
float scores[static_cast< int >(ApparentColor::Count)]
estimation scores
Definition: IHumanAttributeEstimator.h:103
FSDKError.h
Common SDK error codes.
fsdk::HumanAttributeResult::OutwearColorEstimation::getScore
float getScore(Color color) const
Returns score of required outwear color.
Definition: IHumanAttributeEstimator.h:368
fsdk::IHumanAttributeEstimator::aggregate
virtual Result< FSDKError > aggregate(Span< const HumanAttributeResult > estimations, HumanAttributeRequest request, HumanAttributeResult &result) const noexcept=0
Aggregate human body attributes.
fsdk::HumanAttributeRequest::EstimateLowerBodyClothing
estimate lower body clothing state
fsdk::HumanAttributeResult::SleeveSizeEstimation::unknown
float unknown
unknown sleeves size probability score
Definition: IHumanAttributeEstimator.h:156
fsdk::HumanAttributeResult::LowerBodyClothingEstimation
HumanAttribute estimator lower body clothing output structure. This structure contains the result of ...
Definition: IHumanAttributeEstimator.h:224
fsdk::HumanAttributeResult::SleeveSize::Long
sleeves are long
fsdk::HumanAttributeResult::OutwearColorEstimation::isBlue
bool isBlue
outwear is blue
Definition: IHumanAttributeEstimator.h:57
fsdk::HumanAttributeResult::OutwearColorEstimation::isBlack
bool isBlack
outwear is black
Definition: IHumanAttributeEstimator.h:56
fsdk::IRefCounted
Base strong reference counted object interface.
Definition: IRefCounted.h:37
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::HumanAttributeRequest::EstimateSleeveSize
estimate sleeves size
fsdk::HumanAttributeResult::GenderEstimation::unknown
float unknown
unknown gender probability score
Definition: IHumanAttributeEstimator.h:133
fsdk::HumanAttributeResult::OutwearColorEstimation::isPurple
bool isPurple
outwear is purple
Definition: IHumanAttributeEstimator.h:61
fsdk::HumanAttributeRequest::EstimateBackpack
estimate backpack state
fsdk::HumanAttributeResult::Backpack
Backpack
HumanAttribute estimator backpack enum. This enum contains all possible estimation results...
Definition: IHumanAttributeEstimator.h:188
fsdk::HumanAttributeRequest::EstimateShoeColor
estimate shoe color
fsdk::IHumanAttributeEstimator
HumanAttribute estimator interface.
Definition: IHumanAttributeEstimator.h:295
fsdk::HumanAttributeRequest::EstimateOutwearColor
estimate outwear color
fsdk::HumanAttributeRequest
HumanAttributeRequest
HumanAttributeRequest lists all possible estimation attributes that HumanAttributeEstimator is curren...
Definition: IHumanAttributeEstimator.h:279
fsdk::HumanAttributeResult::Gender::Female
person&#39;s gender is female
fsdk::HumanAttributeRequest::EstimateAge
estimate age
fsdk::HumanAttributeResult::OutwearColorEstimation::isPink
bool isPink
outwear is pink
Definition: IHumanAttributeEstimator.h:65
fsdk::IHumanAttributeEstimator::estimate
virtual Result< FSDKError > estimate(const Image &humanWarp, HumanAttributeRequest request, HumanAttributeResult &result) const noexcept=0
Estimate human body attributes.
fsdk::HumanAttributeResult::LowerBodyClothingEstimation::skirt
float skirt
unknown state probability score
Definition: IHumanAttributeEstimator.h:235
fsdk::FaceOcclusionType::Count
Total number of occlusion types.
fsdk::HumanAttributeResult::GenderEstimation::male
float male
male gender probability score
Definition: IHumanAttributeEstimator.h:132
fsdk::HumanAttributeResult::sleeve
Optional< SleeveSizeEstimation > sleeve
headwear estimation (
Definition: IHumanAttributeEstimator.h:257
fsdk::HumanAttributeResult::HatEstimation::result
Hat result
estimation result (
Definition: IHumanAttributeEstimator.h:176
fsdk::HumanAttributeResult::ApparentColorEstimation::isWhite
bool isWhite
attribute is white
Definition: IHumanAttributeEstimator.h:100
fsdk::HumanAttributeResult::LowerBodyClothingEstimation::pants
float pants
shorts probability score
Definition: IHumanAttributeEstimator.h:229
fsdk::HumanAttributeResult::SleeveSize::Unknown
sleeves state is unknown
fsdk::HumanAttributeResult::LowerBodyClothingEstimation::unknown
float unknown
lower body clothing color estimation (
Definition: IHumanAttributeEstimator.h:238
fsdk::HumanAttributeResult::OutwearColorEstimation::isYellow
bool isYellow
outwear is yellow
Definition: IHumanAttributeEstimator.h:64
fsdk::HumanAttributeResult::outwearColor
Optional< OutwearColorEstimation > outwearColor
lower body clothing estimation (
Definition: IHumanAttributeEstimator.h:266
fsdk::HumanAttributeResult::ApparentColorEstimation::getScore
float getScore(ApparentColor color) const
Returns score of required color.
Definition: IHumanAttributeEstimator.h:394
fsdk::HumanAttributeResult::gender
Optional< GenderEstimation > gender
Gender estimation by human body.
Definition: IHumanAttributeEstimator.h:254
fsdk::HumanAttributeResult::SleeveSizeEstimation::result
SleeveSize result
estimation result (
Definition: IHumanAttributeEstimator.h:153
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:59
fsdk::HumanAttributeResult::age
Optional< float > age
Age estimation by human body.
Definition: IHumanAttributeEstimator.h:248
fsdk::HumanAttributeResult::OutwearColorEstimation::isWhite
bool isWhite
outwear is white
Definition: IHumanAttributeEstimator.h:63
fsdk::HumanAttributeResult::LowerBodyClothing
LowerBodyClothing
HumanAttribute estimator lower body clothing enum. This enum contains all possible estimation results...
Definition: IHumanAttributeEstimator.h:211
fsdk::HumanAttributeResult::SleeveSizeEstimation
HumanAttribute estimator sleeves size output structure. This structure contains the result of sleeves...
Definition: IHumanAttributeEstimator.h:152
fsdk::HumanAttributeResult::SleeveSize
SleeveSize
HumanAttribute estimator sleeves size output enum. This enum contains all possible estimation results...
Definition: IHumanAttributeEstimator.h:140
fsdk::HumanAttributeResult::ApparentColorEstimation::isOther
bool isOther
attribute is some other
Definition: IHumanAttributeEstimator.h:101
fsdk::HumanAttributeResult::Hat
Hat
HumanAttribute estimator hat output enum. This enum contains all possible estimation results...
Definition: IHumanAttributeEstimator.h:163
fsdk::HumanAttributeResult::OutwearColorEstimation::isRed
bool isRed
outwear is red
Definition: IHumanAttributeEstimator.h:62
fsdk::HumanAttributeResult::HatEstimation::unknown
float unknown
unknown hat state probability score
Definition: IHumanAttributeEstimator.h:179
fsdk::HumanAttributeResult::OutwearColorEstimation
HumanAttribute estimator outwear color output structure. This structure contains the result of outwea...
Definition: IHumanAttributeEstimator.h:55
fsdk::HumanAttributeResult::OutwearColorEstimation::scores
float scores[static_cast< int >(Color::Count)]
estimation scores
Definition: IHumanAttributeEstimator.h:70
fsdk::HumanAttributeResult::lowerBodyClothing
Optional< LowerBodyClothingEstimation > lowerBodyClothing
shoe color color estimation (
Definition: IHumanAttributeEstimator.h:269
fsdk::HumanAttributeResult::ApparentColor
ApparentColor
HumanAttribute estimator simplified color enum. This enum is truncated version of full color palette...
Definition: IHumanAttributeEstimator.h:84
fsdk::HumanAttributeResult::Color
Color
HumanAttribute estimator color enum. This enum contains all possible estimation results.
Definition: IHumanAttributeEstimator.h:31
fsdk::HumanAttributeResult::HatEstimation::hat
float hat
hat probability score
Definition: IHumanAttributeEstimator.h:178
fsdk::HumanAttributeRequest::EstimateHeadwear
estimate headwear state
fsdk::HumanAttributeResult::SleeveSizeEstimation::shortSize
float shortSize
short sleeves size probability score
Definition: IHumanAttributeEstimator.h:154
fsdk::HumanAttributeResult::BackpackEstimation::noBackpack
float noBackpack
no backpack probability score
Definition: IHumanAttributeEstimator.h:202
fsdk::HumanAttributeResult::OutwearColorEstimation::isBrown
bool isBrown
outwear is brown
Definition: IHumanAttributeEstimator.h:66
fsdk::HumanAttributeResult::HatEstimation::hatColor
ApparentColorEstimation hatColor
hat color estimation (
Definition: IHumanAttributeEstimator.h:181
fsdk::HumanAttributeResult::BackpackEstimation::result
Backpack result
estimation result (
Definition: IHumanAttributeEstimator.h:201
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:102
fsdk::HumanAttributeResult::HatEstimation::noHat
float noHat
no hat probability score
Definition: IHumanAttributeEstimator.h:177