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
IHeadWearEstimator.h
1 #pragma once
2 
3 #include <fsdk/IObject.h>
4 #include <fsdk/FSDKError.h>
5 
6 #include <fsdk/Types/Image.h>
7 #include <fsdk/Types/Result.h>
8 #include <fsdk/Types/Span.h>
9 
10 namespace fsdk {
11 
12 #ifndef DOXYGEN_SHOULD_SKIP_THIS
13  DECLARE_SMARTPTR(IHeadWearEstimator);
14 #endif
15 
25  enum class HeadWearState {
26  Yes = 0, //< there is headwear
27  No, //< there is no headwear
28  Count
29  };
30 
39  float scores[static_cast<int>(HeadWearState::Count)];
40 
46  inline float getScore(HeadWearState state) const;
47  };
48 
53  enum class HeadWearType : uint8_t {
54  NoHeadWear = 0, //< there is no headwear on the head
55  BaseballCap, //< there is baseball cap on the head
56  Beanie, //< there is beanie on the head
57  PeakedCap, //< there is peaked cap on the head
58  Shawl, //< there is shawl on the head
59  HatWithEarFlaps, //< there is hat with ear flaps on the head
60  Helmet, //< there is helmet on the head
61  Hood, //< there is hood on the head
62  Hat, //< there is hat on the head
63  Other, //< something other is on the head
64  Count
65  };
66 
75  float scores[static_cast<int>(HeadWearType::Count)];
76 
82  inline float getScore(HeadWearType type) const;
83  };
84 
93  };
94 
108  virtual Result<FSDKError> estimate(const Image& warp, HeadWearEstimation& estimation) const noexcept = 0;
109 
120  virtual Result<FSDKError>
121  estimate(Span<const Image> warps, Span<HeadWearEstimation> estimations) const noexcept = 0;
122 
133  virtual Result<FSDKError>
134  validate(Span<const Image> warps, Span<Result<FSDKError>> errors) const noexcept = 0;
135  };
136 
137  /*
138  Implementation details.
139  */
141  switch(state) {
142  case HeadWearState::Yes:
143  case HeadWearState::No:
144  return scores[static_cast<int>(state)];
145  default:
146  return -1.0f;
147  }
148  }
149 
150  /*
151  Implementation details.
152  */
154  switch(type) {
155  case HeadWearType::NoHeadWear:
156  case HeadWearType::BaseballCap:
157  case HeadWearType::Beanie:
158  case HeadWearType::PeakedCap:
159  case HeadWearType::Shawl:
160  case HeadWearType::HatWithEarFlaps:
161  case HeadWearType::Helmet:
162  case HeadWearType::Hood:
163  case HeadWearType::Hat:
164  case HeadWearType::Other:
165  return scores[static_cast<int>(type)];
166  default:
167  return -1.0f;
168  }
169  }
170 
172 } // namespace fsdk
#define DECLARE_SMARTPTR(X)
Smart ptr declaration helper macro.
Definition: Def.h:56
float scores[static_cast< int >(HeadWearType::Count)]
estimation scores
Definition: IHeadWearEstimator.h:75
A structure that encapsulates an action result enumeration.
Definition: Result.h:27
HeadWearType estimator output structure. This structure contains the result of estimation (...
Definition: IHeadWearEstimator.h:73
HeadWearState
HeadWearState estimator output enum. This enum contains all possible estimation results.
Definition: IHeadWearEstimator.h:25
HeadWear estimator interface.
Definition: IHeadWearEstimator.h:99
Object system types and interfaces.
HeadWearState result
estimation result (
Definition: IHeadWearEstimator.h:38
HeadWearType
HeadWearType estimator output enum. This enum contains all possible estimation results.
Definition: IHeadWearEstimator.h:53
Common SDK error codes.
Base strong reference counted object interface.
Definition: IRefCounted.h:37
virtual Result< FSDKError > estimate(const Image &warp, HeadWearEstimation &estimation) const noexcept=0
Estimate Head Wear probabilities.
float getScore(HeadWearState state) const
Returns score of required headwear state.
Definition: IHeadWearEstimator.h:140
float scores[static_cast< int >(HeadWearState::Count)]
estimation scores
Definition: IHeadWearEstimator.h:39
float getScore(HeadWearType type) const
Returns score of required headwear type.
Definition: IHeadWearEstimator.h:153
Image.
Definition: Image.h:38
HeadWearStateEstimation state
headwear state estimation (
Definition: IHeadWearEstimator.h:91
HeadWearTypeEstimation type
headwear type estimation (
Definition: IHeadWearEstimator.h:92
HeadWear estimator output structure. This structure contains the result of HeadWearState and HeadWear...
Definition: IHeadWearEstimator.h:90
Span. Not owning data view. It incapsulated pointer to the continuous array with one or more T objec...
Definition: Span.h:14
HeadWearState estimator output structure. This structure contains the result of estimation (...
Definition: IHeadWearEstimator.h:37
virtual Result< FSDKError > validate(Span< const Image > warps, Span< Result< FSDKError >> errors) const noexcept=0
Validate input of multiple frames in a single function call.
HeadWearType result
estimation result (
Definition: IHeadWearEstimator.h:74