Face Engine SDK  5.14.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 
226  float pants;
227  float shorts;
228  float skirt;
229  float unknown;
230 
232  };
233 
238  Optional<float> age;
239 
244  Optional<GenderEstimation> gender;
245 
246  Optional<SleeveSizeEstimation> sleeve;
247  Optional<HatEstimation> headwear;
248  Optional<BackpackEstimation> backpack;
249  Optional<OutwearColorEstimation> outwearColor;
250  Optional<LowerBodyClothingEstimation> lowerBodyClothing;
251  Optional<ApparentColorEstimation> shoeColor;
252  };
253 
259  EstimateAge = 1 << 0,
260  EstimateGender = 1 << 1,
261  EstimateSleeveSize = 1 << 2,
262  EstimateBackpack = 1 << 3,
263  EstimateOutwearColor = 1 << 4,
264  EstimateHeadwear = 1 << 5,
265  EstimateLowerBodyClothing = 1 << 7,
266  EstimateShoeColor = 1 << 8,
267  EstimateAll = 0xffff
268  };
269 
275 
286  virtual Result<FSDKError> estimate(
287  const Image& humanWarp,
288  HumanAttributeRequest request,
289  HumanAttributeResult& result) const noexcept = 0;
290 
303  virtual Result<FSDKError> estimate(
304  Span<const Image> humanWarps,
305  HumanAttributeRequest request,
306  Span<HumanAttributeResult> results) const noexcept = 0;
307 
320  virtual Result<FSDKError> validate(
321  Span<const Image> humanWarps,
322  HumanAttributeRequest request,
323  Span<Result<FSDKError>> errors) const noexcept = 0;
324 
325 
339  HumanAttributeRequest request,
340  HumanAttributeResult& result) const noexcept = 0;
341  };
342 
343  /*
344  Implementation details.
345  */
347  HumanAttributeResult::Color color) const {
348  switch (color) {
349  case Color::Black:
350  case Color::Blue:
351  case Color::Green:
352  case Color::Grey:
353  case Color::Orange:
354  case Color::Purple:
355  case Color::Red:
356  case Color::White:
357  case Color::Yellow:
358  case Color::Pink:
359  case Color::Brown:
360  case Color::Beige:
361  case Color::Khaki:
362  case Color::Multicolored:
363  return scores[static_cast<int>(color)];
364  default:
365  return -1.0f;
366  }
367  }
368 
369  /*
370  Implementation details.
371  */
374  switch (color) {
375  case ApparentColor::Black:
376  case ApparentColor::White:
377  case ApparentColor::Other:
378  case ApparentColor::Unknown:
379  return scores[static_cast<int>(color)];
380  default:
381  return -1.0f;
382  }
383  }
384 
385  /*
386  Implementation details.
387  */
388  inline HumanAttributeRequest operator|(
390  HumanAttributeRequest rhs) {
391  return static_cast<HumanAttributeRequest>(
392  static_cast<int>(lhs) | static_cast<int>(rhs));
393  }
394 
395  /*
396  Implementation details.
397  */
398  inline bool operator&(HumanAttributeRequest lhs, HumanAttributeRequest rhs) {
399  return static_cast<int>(lhs) & static_cast<int>(rhs);
400  }
402 } // 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
shorts probability score
Definition: IHumanAttributeEstimator.h:227
bool isOrange
outwear is orange
Definition: IHumanAttributeEstimator.h:60
Optional< HatEstimation > headwear
headwear estimation (
Definition: IHumanAttributeEstimator.h:247
#define DECLARE_SMARTPTR(X)
Smart ptr declaration helper macro.
Definition: Def.h:59
Optional< BackpackEstimation > backpack
backpack estimation (
Definition: IHumanAttributeEstimator.h:248
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:29
float getScore(ApparentColor color) const
Returns score of required color.
Definition: IHumanAttributeEstimator.h:372
HumanAttribute estimator hat output structure. This structure contains the result of hat estimation a...
Definition: IHumanAttributeEstimator.h:175
LowerBodyClothing result
estimation result (
Definition: IHumanAttributeEstimator.h:225
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
Optional< ApparentColorEstimation > shoeColor
shoe color color estimation (
Definition: IHumanAttributeEstimator.h:251
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: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: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:274
HumanAttributeRequest
HumanAttributeRequest lists all possible estimation attributes that HumanAttributeEstimator is curren...
Definition: IHumanAttributeEstimator.h:258
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.
OutwearColorEstimation lowerBodyClothingColor
lower body clothing color estimation (
Definition: IHumanAttributeEstimator.h:231
float skirt
skirt probability score
Definition: IHumanAttributeEstimator.h:228
float male
male gender probability score
Definition: IHumanAttributeEstimator.h:132
Optional< SleeveSizeEstimation > sleeve
sleeve estimation (
Definition: IHumanAttributeEstimator.h:246
Hat result
estimation result (
Definition: IHumanAttributeEstimator.h:176
bool isWhite
attribute is white
Definition: IHumanAttributeEstimator.h:100
float pants
pants probability score
Definition: IHumanAttributeEstimator.h:226
float unknown
unknown state probability score
Definition: IHumanAttributeEstimator.h:229
bool isYellow
outwear is yellow
Definition: IHumanAttributeEstimator.h:64
Optional< OutwearColorEstimation > outwearColor
outwear color estimation (
Definition: IHumanAttributeEstimator.h:249
Optional< GenderEstimation > gender
Gender estimation by human body.
Definition: IHumanAttributeEstimator.h:244
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:346
Image.
Definition: Image.h:39
bool isGrey
outwear is grey
Definition: IHumanAttributeEstimator.h:59
Optional< float > age
Age estimation by human body.
Definition: IHumanAttributeEstimator.h:238
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
lower body clothing estimation (
Definition: IHumanAttributeEstimator.h:250
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