Face Engine SDK  5.8.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 
25  enum class Gender {
26  Female,
27  Male,
28  Unknown
29  };
30 
39  float female;
40  float male;
41  float unknown;
42  };
43 
48  enum class SleeveSize {
49  Short,
50  Long,
51  Unknown
52  };
53 
62  float shortSize;
63  float longSize;
64  float unknown;
65  };
66 
71  enum class Hat {
72  No, //< there is no headwear
73  Yes, //< there is a headwear
74  Unknown //< headwear state is unknown
75  };
76 
83  struct HatEstimation {
85  float noHat;
86  float hat;
87  float unknown;
88  };
89 
94  enum class Backpack {
95  No, //< there is no backpack
96  Yes, //< there is a backpack
97  Unknown //< backpack state is unknown
98  };
99 
108  float noBackpack;
109  float backpack;
110  float unknown;
111  };
112 
117  enum class Color {
118  Black,
119  Blue,
120  Green,
121  Grey,
122  Orange,
123  Purple,
124  Red,
125  White,
126  Yellow,
127  Pink,
128  Brown,
129  Beige,
130  Khaki,
131  Multicolored,
132  Count
133  };
134 
142  bool isBlack;
143  bool isBlue;
144  bool isGreen;
145  bool isGrey;
146  bool isOrange;
147  bool isPurple;
148  bool isRed;
149  bool isWhite;
150  bool isYellow;
151  bool isPink;
152  bool isBrown;
153  bool isBeige;
154  bool isKhaki;
156  float scores[static_cast<int>(Color::Count)];
157 
163  inline float getScore(Color color) const;
164  };
165 
170  Optional<float> age;
171 
176  Optional<GenderEstimation> gender;
177 
178  Optional<SleeveSizeEstimation> sleeve;
179  Optional<HatEstimation> headwear;
180  Optional<BackpackEstimation> backpack;
181  Optional<OutwearColorEstimation> outwearColor;
182  };
183 
189  EstimateAge = 1 << 0,
190  EstimateGender = 1 << 1,
191  EstimateSleeveSize = 1 << 2,
192  EstimateBackpack = 1 << 3,
193  EstimateOutwearColor = 1 << 4,
194  EstimateHeadwear = 1 << 5,
195  EstimateAll = 0xffff
196  };
197 
203 
214  virtual Result<FSDKError> estimate(
215  const Image& humanWarp,
216  HumanAttributeRequest request,
217  HumanAttributeResult& result) const noexcept = 0;
218 
231  virtual Result<FSDKError> estimate(
232  Span<const Image> humanWarps,
233  HumanAttributeRequest request,
234  Span<HumanAttributeResult> results) const noexcept = 0;
235 
248  virtual Result<FSDKError> validate(
249  Span<const Image> humanWarps,
250  HumanAttributeRequest request,
251  Span<Result<FSDKError>> errors) const noexcept = 0;
252 
253 
267  HumanAttributeRequest request,
268  HumanAttributeResult& result) const noexcept = 0;
269  };
270 
271  /*
272  Implementation details.
273  */
275  HumanAttributeResult::Color color) const {
276  switch (color) {
277  case Color::Black:
278  case Color::Blue:
279  case Color::Green:
280  case Color::Grey:
281  case Color::Orange:
282  case Color::Purple:
283  case Color::Red:
284  case Color::White:
285  case Color::Yellow:
286  case Color::Pink:
287  case Color::Brown:
288  case Color::Beige:
289  case Color::Khaki:
290  case Color::Multicolored:
291  return scores[static_cast<int>(color)];
292  default:
293  return -1.0f;
294  }
295  }
296 
297  /*
298  Implementation details.
299  */
300  inline HumanAttributeRequest operator|(
302  HumanAttributeRequest rhs) {
303  return static_cast<HumanAttributeRequest>(
304  static_cast<int>(lhs) | static_cast<int>(rhs));
305  }
306 
307  /*
308  Implementation details.
309  */
310  inline bool operator&(HumanAttributeRequest lhs, HumanAttributeRequest rhs) {
311  return static_cast<int>(lhs) & static_cast<int>(rhs);
312  }
313 
314 } // namespace fsdk
bool isKhaki
outwear is khaki
Definition: IHumanAttributeEstimator.h:154
float backpack
backpack probability score
Definition: IHumanAttributeEstimator.h:109
bool isOrange
outwear is orange
Definition: IHumanAttributeEstimator.h:146
Optional< HatEstimation > headwear
headwear estimation (
Definition: IHumanAttributeEstimator.h:179
#define DECLARE_SMARTPTR(X)
Smart ptr declaration helper macro.
Definition: Def.h:59
Optional< BackpackEstimation > backpack
backpack estimation (
Definition: IHumanAttributeEstimator.h:180
HumanAttribute estimator gender output structure. This structure contains the result of gender estima...
Definition: IHumanAttributeEstimator.h:37
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:83
Unified HumanAttribute estimator output structure.
Definition: IHumanAttributeEstimator.h:20
float unknown
unknown backpack state probability score
Definition: IHumanAttributeEstimator.h:110
bool isMulticolored
outwear is multicolored
Definition: IHumanAttributeEstimator.h:155
HumanAttribute estimator backpack output structure. This structure contains the result of backpack es...
Definition: IHumanAttributeEstimator.h:106
float female
female gender probability score
Definition: IHumanAttributeEstimator.h:39
Gender result
estimation result (
Definition: IHumanAttributeEstimator.h:38
person&#39;s gender is male
bool isGreen
outwear is green
Definition: IHumanAttributeEstimator.h:144
float longSize
long sleeves size probability score
Definition: IHumanAttributeEstimator.h:63
Object system types and interfaces.
bool isBeige
outwear is beige
Definition: IHumanAttributeEstimator.h:153
Gender
HumanAttribute estimator gender output enum. This enum contains all possible estimation results...
Definition: IHumanAttributeEstimator.h:25
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:64
bool isBlue
outwear is blue
Definition: IHumanAttributeEstimator.h:143
bool isBlack
outwear is black
Definition: IHumanAttributeEstimator.h:142
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:41
bool isPurple
outwear is purple
Definition: IHumanAttributeEstimator.h:147
float getScore(Color color) const
Returns score of required outwear color.
Definition: IHumanAttributeEstimator.h:274
Backpack
HumanAttribute estimator backpack enum. This enum contains all possible estimation results...
Definition: IHumanAttributeEstimator.h:94
HumanAttribute estimator interface.
Definition: IHumanAttributeEstimator.h:202
person&#39;s gender is female
bool isPink
outwear is pink
Definition: IHumanAttributeEstimator.h:151
virtual Result< FSDKError > estimate(const Image &humanWarp, HumanAttributeRequest request, HumanAttributeResult &result) const noexcept=0
Estimate human body attributes.
float male
male gender probability score
Definition: IHumanAttributeEstimator.h:40
Optional< SleeveSizeEstimation > sleeve
sleeve estimation (
Definition: IHumanAttributeEstimator.h:178
Hat result
estimation result (
Definition: IHumanAttributeEstimator.h:84
bool isYellow
outwear is yellow
Definition: IHumanAttributeEstimator.h:150
Optional< OutwearColorEstimation > outwearColor
outwear color estimation (
Definition: IHumanAttributeEstimator.h:181
Optional< GenderEstimation > gender
Gender estimation by human body.
Definition: IHumanAttributeEstimator.h:176
SleeveSize result
estimation result (
Definition: IHumanAttributeEstimator.h:61
person&#39;s gender is unknown
Image.
Definition: Image.h:38
bool isGrey
outwear is grey
Definition: IHumanAttributeEstimator.h:145
Optional< float > age
Age estimation by human body.
Definition: IHumanAttributeEstimator.h:170
bool isWhite
outwear is white
Definition: IHumanAttributeEstimator.h:149
HumanAttribute estimator sleeves size output structure. This structure contains the result of sleeves...
Definition: IHumanAttributeEstimator.h:60
SleeveSize
HumanAttribute estimator sleeves size output enum. This enum contains all possible estimation results...
Definition: IHumanAttributeEstimator.h:48
Hat
HumanAttribute estimator hat output enum. This enum contains all possible estimation results...
Definition: IHumanAttributeEstimator.h:71
bool isRed
outwear is red
Definition: IHumanAttributeEstimator.h:148
float unknown
unknown hat state probability score
Definition: IHumanAttributeEstimator.h:87
HumanAttribute estimator outwear color output structure. This structure contains the result of outwea...
Definition: IHumanAttributeEstimator.h:141
float scores[static_cast< int >(Color::Count)]
estimation scores
Definition: IHumanAttributeEstimator.h:156
Color
HumanAttribute estimator color enum. This enum contains all possible estimation results.
Definition: IHumanAttributeEstimator.h:117
float hat
hat probability score
Definition: IHumanAttributeEstimator.h:86
float shortSize
short sleeves size probability score
Definition: IHumanAttributeEstimator.h:62
float noBackpack
no backpack probability score
Definition: IHumanAttributeEstimator.h:108
bool isBrown
outwear is brown
Definition: IHumanAttributeEstimator.h:152
HumanAttributeRequest
HumanAttributeRequest lists all possible estimation attributes that HumanAttributeEstimator is curren...
Definition: IHumanAttributeEstimator.h:188
Backpack result
estimation result (
Definition: IHumanAttributeEstimator.h:107
Span. Not owning data view. It incapsulated pointer to the continuous array with one or more T objec...
Definition: Span.h:14
float noHat
no hat probability score
Definition: IHumanAttributeEstimator.h:85