Face Engine SDK  5.11.0
A face detection, recognition and tracking engine.
 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 
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 
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;
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 
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 
126  float female;
127  float male;
128  float unknown;
129  };
130 
135  enum class SleeveSize {
136  Short,
137  Long,
138  Unknown
139  };
140 
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 {
172  float noHat;
173  float hat;
174  float unknown;
175 
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 
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 
221  float pants;
222  float shorts;
223  float skirt;
224  float unknown;
225 
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 
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 
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 
334  HumanAttributeRequest request,
335  HumanAttributeResult& result) const noexcept = 0;
336  };
337 
338  /*
339  Implementation details.
340  */
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  */
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|(
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
bool isBlack
attribute is black
Definition: IHumanAttributeEstimator.h:94
bool isKhaki
outwear is khaki
Definition: IHumanAttributeEstimator.h:63
float backpack
backpack probability score
Definition: IHumanAttributeEstimator.h:198
float shorts
shorts probability score
Definition: IHumanAttributeEstimator.h:222
bool isOrange
outwear is orange
Definition: IHumanAttributeEstimator.h:55
Optional< HatEstimation > headwear
headwear estimation (
Definition: IHumanAttributeEstimator.h:242
#define DECLARE_SMARTPTR(X)
Smart ptr declaration helper macro.
Definition: Def.h:59
Optional< BackpackEstimation > backpack
backpack estimation (
Definition: IHumanAttributeEstimator.h:243
HumanAttribute estimator gender output structure. This structure contains the result of gender estima...
Definition: IHumanAttributeEstimator.h:124
A structure that encapsulates an action result enumeration.
Definition: Result.h:29
HumanAttribute estimator hat output structure. This structure contains the result of hat estimation a...
Definition: IHumanAttributeEstimator.h:170
LowerBodyClothing result
estimation result (
Definition: IHumanAttributeEstimator.h:220
HumanAttribute estimator simplified color output structure. This structure contains the result of tru...
Definition: IHumanAttributeEstimator.h:93
Unified HumanAttribute estimator output structure.
Definition: IHumanAttributeEstimator.h:20
float unknown
unknown backpack state probability score
Definition: IHumanAttributeEstimator.h:199
bool isMulticolored
outwear is multicolored
Definition: IHumanAttributeEstimator.h:64
HumanAttribute estimator backpack output structure. This structure contains the result of backpack es...
Definition: IHumanAttributeEstimator.h:195
Optional< ApparentColorEstimation > shoeColor
shoe color color estimation (
Definition: IHumanAttributeEstimator.h:246
float female
female gender probability score
Definition: IHumanAttributeEstimator.h:126
Gender result
estimation result (
Definition: IHumanAttributeEstimator.h:125
person&#39;s gender is male
bool isGreen
outwear is green
Definition: IHumanAttributeEstimator.h:53
float longSize
long sleeves size probability score
Definition: IHumanAttributeEstimator.h:150
Object system types and interfaces.
bool isBeige
outwear is beige
Definition: IHumanAttributeEstimator.h:62
Gender
HumanAttribute estimator gender output enum. This enum contains all possible estimation results...
Definition: IHumanAttributeEstimator.h:112
float scores[static_cast< int >(ApparentColor::Count)]
estimation scores
Definition: IHumanAttributeEstimator.h:98
Common SDK error codes.
virtual Result< FSDKError > aggregate(Span< const HumanAttributeResult > estimations, HumanAttributeRequest request, HumanAttributeResult &result) const noexcept=0
Aggregate human body attributes.
float unknown
unknown sleeves size probability score
Definition: IHumanAttributeEstimator.h:151
HumanAttribute estimator lower body clothing output structure. This structure contains the result of ...
Definition: IHumanAttributeEstimator.h:219
bool isBlue
outwear is blue
Definition: IHumanAttributeEstimator.h:52
bool isBlack
outwear is black
Definition: IHumanAttributeEstimator.h:51
Base strong reference counted object interface.
Definition: IRefCounted.h:36
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.
float unknown
unknown gender probability score
Definition: IHumanAttributeEstimator.h:128
bool isPurple
outwear is purple
Definition: IHumanAttributeEstimator.h:56
float getScore(Color color) const
Returns score of required outwear color.
Definition: IHumanAttributeEstimator.h:341
Backpack
HumanAttribute estimator backpack enum. This enum contains all possible estimation results...
Definition: IHumanAttributeEstimator.h:183
HumanAttribute estimator interface.
Definition: IHumanAttributeEstimator.h:269
person&#39;s gender is female
bool isPink
outwear is pink
Definition: IHumanAttributeEstimator.h:60
virtual Result< FSDKError > estimate(const Image &humanWarp, HumanAttributeRequest request, HumanAttributeResult &result) const noexcept=0
Estimate human body attributes.
OutwearColorEstimation lowerBodyClothingColor
lower body clothing color estimation (
Definition: IHumanAttributeEstimator.h:226
float skirt
skirt probability score
Definition: IHumanAttributeEstimator.h:223
float male
male gender probability score
Definition: IHumanAttributeEstimator.h:127
Optional< SleeveSizeEstimation > sleeve
sleeve estimation (
Definition: IHumanAttributeEstimator.h:241
Hat result
estimation result (
Definition: IHumanAttributeEstimator.h:171
bool isWhite
attribute is white
Definition: IHumanAttributeEstimator.h:95
float pants
pants probability score
Definition: IHumanAttributeEstimator.h:221
float unknown
unknown state probability score
Definition: IHumanAttributeEstimator.h:224
bool isYellow
outwear is yellow
Definition: IHumanAttributeEstimator.h:59
Optional< OutwearColorEstimation > outwearColor
outwear color estimation (
Definition: IHumanAttributeEstimator.h:244
Optional< GenderEstimation > gender
Gender estimation by human body.
Definition: IHumanAttributeEstimator.h:239
SleeveSize result
estimation result (
Definition: IHumanAttributeEstimator.h:148
person&#39;s gender is unknown
Image.
Definition: Image.h:38
bool isGrey
outwear is grey
Definition: IHumanAttributeEstimator.h:54
Optional< float > age
Age estimation by human body.
Definition: IHumanAttributeEstimator.h:233
bool isWhite
outwear is white
Definition: IHumanAttributeEstimator.h:58
LowerBodyClothing
HumanAttribute estimator lower body clothing enum. This enum contains all possible estimation results...
Definition: IHumanAttributeEstimator.h:206
HumanAttribute estimator sleeves size output structure. This structure contains the result of sleeves...
Definition: IHumanAttributeEstimator.h:147
SleeveSize
HumanAttribute estimator sleeves size output enum. This enum contains all possible estimation results...
Definition: IHumanAttributeEstimator.h:135
bool isOther
attribute is some other
Definition: IHumanAttributeEstimator.h:96
Hat
HumanAttribute estimator hat output enum. This enum contains all possible estimation results...
Definition: IHumanAttributeEstimator.h:158
bool isRed
outwear is red
Definition: IHumanAttributeEstimator.h:57
float unknown
unknown hat state probability score
Definition: IHumanAttributeEstimator.h:174
HumanAttribute estimator outwear color output structure. This structure contains the result of outwea...
Definition: IHumanAttributeEstimator.h:50
float scores[static_cast< int >(Color::Count)]
estimation scores
Definition: IHumanAttributeEstimator.h:65
Optional< LowerBodyClothingEstimation > lowerBodyClothing
lower body clothing estimation (
Definition: IHumanAttributeEstimator.h:245
ApparentColor
HumanAttribute estimator simplified color enum. This enum is truncated version of full color palette...
Definition: IHumanAttributeEstimator.h:79
Color
HumanAttribute estimator color enum. This enum contains all possible estimation results.
Definition: IHumanAttributeEstimator.h:26
float hat
hat probability score
Definition: IHumanAttributeEstimator.h:173
float shortSize
short sleeves size probability score
Definition: IHumanAttributeEstimator.h:149
float noBackpack
no backpack probability score
Definition: IHumanAttributeEstimator.h:197
bool isBrown
outwear is brown
Definition: IHumanAttributeEstimator.h:61
HumanAttributeRequest
HumanAttributeRequest lists all possible estimation attributes that HumanAttributeEstimator is curren...
Definition: IHumanAttributeEstimator.h:253
float getScore(ApparentColor color) const
Returns score of required color.
Definition: IHumanAttributeEstimator.h:367
ApparentColorEstimation hatColor
hat color estimation (
Definition: IHumanAttributeEstimator.h:176
Backpack result
estimation result (
Definition: IHumanAttributeEstimator.h:196
Span. Not owning data view. It incapsulated pointer to the continuous array with one or more T objec...
Definition: Span.h:14
bool isUnknown
attribute is unknown
Definition: IHumanAttributeEstimator.h:97
float noHat
no hat probability score
Definition: IHumanAttributeEstimator.h:172