Face Engine SDK  5.21.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 
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 
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;
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 
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 
131  float female;
132  float male;
133  float unknown;
134  };
135 
140  enum class SleeveSize {
141  Short,
142  Long,
143  Unknown
144  };
145 
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 {
177  float noHat;
178  float hat;
179  float unknown;
180 
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 
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 
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 
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 
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 
361  HumanAttributeRequest request,
362  HumanAttributeResult& result) const noexcept = 0;
363  };
364 
365  /*
366  Implementation details.
367  */
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
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  */
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
bool isBlack
attribute is black
Definition: IHumanAttributeEstimator.h:99
bool isKhaki
outwear is khaki
Definition: IHumanAttributeEstimator.h:68
float backpack
backpack probability score
Definition: IHumanAttributeEstimator.h:203
float shorts
skirt probability score
Definition: IHumanAttributeEstimator.h:232
bool isOrange
outwear is orange
Definition: IHumanAttributeEstimator.h:60
Optional< HatEstimation > headwear
backpack estimation (
Definition: IHumanAttributeEstimator.h:260
#define DECLARE_SMARTPTR(X)
Smart ptr declaration helper macro.
Definition: Def.h:56
Optional< BackpackEstimation > backpack
outwear color estimation (
Definition: IHumanAttributeEstimator.h:263
HumanAttribute estimator gender output structure. This structure contains the result of gender estima...
Definition: IHumanAttributeEstimator.h:129
A structure that encapsulates an action result enumeration.
Definition: Result.h:27
float getScore(ApparentColor color) const
Returns score of required color.
Definition: IHumanAttributeEstimator.h:394
HumanAttribute estimator hat output structure. This structure contains the result of hat estimation a...
Definition: IHumanAttributeEstimator.h:175
LowerBodyClothing result
&lt; estimation result (
Definition: IHumanAttributeEstimator.h:226
HumanAttribute estimator simplified color output structure. This structure contains the result of tru...
Definition: IHumanAttributeEstimator.h:98
Unified HumanAttribute estimator output structure.
Definition: IHumanAttributeEstimator.h:25
float unknown
unknown backpack state probability score
Definition: IHumanAttributeEstimator.h:204
bool isMulticolored
outwear is multicolored
Definition: IHumanAttributeEstimator.h:69
HumanAttribute estimator backpack output structure. This structure contains the result of backpack es...
Definition: IHumanAttributeEstimator.h:200
float female
female gender probability score
Definition: IHumanAttributeEstimator.h:131
Gender result
estimation result (
Definition: IHumanAttributeEstimator.h:130
person&#39;s gender is male
bool isGreen
outwear is green
Definition: IHumanAttributeEstimator.h:58
float longSize
long sleeves size probability score
Definition: IHumanAttributeEstimator.h:155
Object system types and interfaces.
bool isBeige
outwear is beige
Definition: IHumanAttributeEstimator.h:67
Gender
HumanAttribute estimator gender output enum. This enum contains all possible estimation results...
Definition: IHumanAttributeEstimator.h:117
float scores[static_cast< int >(ApparentColor::Count)]
estimation scores
Definition: IHumanAttributeEstimator.h:103
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:156
HumanAttribute estimator lower body clothing output structure. This structure contains the result of ...
Definition: IHumanAttributeEstimator.h:224
bool isBlue
outwear is blue
Definition: IHumanAttributeEstimator.h:57
bool isBlack
outwear is black
Definition: IHumanAttributeEstimator.h:56
Base strong reference counted object interface.
Definition: IRefCounted.h:37
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:133
bool isPurple
outwear is purple
Definition: IHumanAttributeEstimator.h:61
Backpack
HumanAttribute estimator backpack enum. This enum contains all possible estimation results...
Definition: IHumanAttributeEstimator.h:188
HumanAttribute estimator interface.
Definition: IHumanAttributeEstimator.h:295
HumanAttributeRequest
HumanAttributeRequest lists all possible estimation attributes that HumanAttributeEstimator is curren...
Definition: IHumanAttributeEstimator.h:279
person&#39;s gender is female
bool isPink
outwear is pink
Definition: IHumanAttributeEstimator.h:65
virtual Result< FSDKError > estimate(const Image &humanWarp, HumanAttributeRequest request, HumanAttributeResult &result) const noexcept=0
Estimate human body attributes.
float skirt
unknown state probability score
Definition: IHumanAttributeEstimator.h:235
float male
male gender probability score
Definition: IHumanAttributeEstimator.h:132
Optional< SleeveSizeEstimation > sleeve
headwear estimation (
Definition: IHumanAttributeEstimator.h:257
Hat result
estimation result (
Definition: IHumanAttributeEstimator.h:176
bool isWhite
attribute is white
Definition: IHumanAttributeEstimator.h:100
float pants
shorts probability score
Definition: IHumanAttributeEstimator.h:229
float unknown
lower body clothing color estimation (
Definition: IHumanAttributeEstimator.h:238
bool isYellow
outwear is yellow
Definition: IHumanAttributeEstimator.h:64
Optional< OutwearColorEstimation > outwearColor
lower body clothing estimation (
Definition: IHumanAttributeEstimator.h:266
Optional< GenderEstimation > gender
Gender estimation by human body.
Definition: IHumanAttributeEstimator.h:254
SleeveSize result
estimation result (
Definition: IHumanAttributeEstimator.h:153
person&#39;s gender is unknown
float getScore(Color color) const
Returns score of required outwear color.
Definition: IHumanAttributeEstimator.h:368
Image.
Definition: Image.h:38
bool isGrey
outwear is grey
Definition: IHumanAttributeEstimator.h:59
Optional< float > age
Age estimation by human body.
Definition: IHumanAttributeEstimator.h:248
bool isWhite
outwear is white
Definition: IHumanAttributeEstimator.h:63
LowerBodyClothing
HumanAttribute estimator lower body clothing enum. This enum contains all possible estimation results...
Definition: IHumanAttributeEstimator.h:211
HumanAttribute estimator sleeves size output structure. This structure contains the result of sleeves...
Definition: IHumanAttributeEstimator.h:152
SleeveSize
HumanAttribute estimator sleeves size output enum. This enum contains all possible estimation results...
Definition: IHumanAttributeEstimator.h:140
bool isOther
attribute is some other
Definition: IHumanAttributeEstimator.h:101
Hat
HumanAttribute estimator hat output enum. This enum contains all possible estimation results...
Definition: IHumanAttributeEstimator.h:163
bool isRed
outwear is red
Definition: IHumanAttributeEstimator.h:62
float unknown
unknown hat state probability score
Definition: IHumanAttributeEstimator.h:179
HumanAttribute estimator outwear color output structure. This structure contains the result of outwea...
Definition: IHumanAttributeEstimator.h:55
float scores[static_cast< int >(Color::Count)]
estimation scores
Definition: IHumanAttributeEstimator.h:70
Optional< LowerBodyClothingEstimation > lowerBodyClothing
shoe color color estimation (
Definition: IHumanAttributeEstimator.h:269
ApparentColor
HumanAttribute estimator simplified color enum. This enum is truncated version of full color palette...
Definition: IHumanAttributeEstimator.h:84
Color
HumanAttribute estimator color enum. This enum contains all possible estimation results.
Definition: IHumanAttributeEstimator.h:31
float hat
hat probability score
Definition: IHumanAttributeEstimator.h:178
float shortSize
short sleeves size probability score
Definition: IHumanAttributeEstimator.h:154
float noBackpack
no backpack probability score
Definition: IHumanAttributeEstimator.h:202
bool isBrown
outwear is brown
Definition: IHumanAttributeEstimator.h:66
ApparentColorEstimation hatColor
hat color estimation (
Definition: IHumanAttributeEstimator.h:181
Backpack result
estimation result (
Definition: IHumanAttributeEstimator.h:201
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:102
float noHat
no hat probability score
Definition: IHumanAttributeEstimator.h:177