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
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 
20  enum class HeadWearState {
21  Yes = 0, //< there is headwear
22  No, //< there is no headwear
23  Count
24  };
25 
34  float scores[static_cast<int>(HeadWearState::Count)];
35 
41  inline float getScore(HeadWearState state) const;
42  };
43 
48  enum class HeadWearType : uint8_t {
49  NoHeadWear = 0, //< there is no headwear on the head
50  BaseballCap, //< there is baseball cap on the head
51  Beanie, //< there is beanie on the head
52  PeakedCap, //< there is peaked cap on the head
53  Shawl, //< there is shawl on the head
54  HatWithEarFlaps, //< there is hat with ear flaps on the head
55  Helmet, //< there is helmet on the head
56  Hood, //< there is hood on the head
57  Hat, //< there is hat on the head
58  Other, //< something other is on the head
59  Count
60  };
61 
70  float scores[static_cast<int>(HeadWearType::Count)];
71 
77  inline float getScore(HeadWearType type) const;
78  };
79 
89  };
91 
105  virtual Result<FSDKError> estimate(
106  const Image& warp,
107  HeadWearEstimation& estimation) const noexcept = 0;
108 
119  virtual Result<FSDKError> estimate(
120  Span<const Image> warps,
121  Span<HeadWearEstimation> estimations) const noexcept = 0;
122 
133  virtual Result<FSDKError> validate(
134  Span<const Image> warps,
135  Span<Result<FSDKError>> errors) const noexcept = 0;
136  };
137 
138  /*
139  Implementation details.
140  */
142  switch (state) {
143  case HeadWearState::Yes:
144  case HeadWearState::No:
145  return scores[static_cast<int>(state)];
146  default:
147  return -1.0f;
148  }
149  }
150 
151  /*
152  Implementation details.
153  */
155  switch (type) {
156  case HeadWearType::NoHeadWear:
157  case HeadWearType::BaseballCap:
158  case HeadWearType::Beanie:
159  case HeadWearType::PeakedCap:
160  case HeadWearType::Shawl:
161  case HeadWearType::HatWithEarFlaps:
162  case HeadWearType::Helmet:
163  case HeadWearType::Hood:
164  case HeadWearType::Hat:
165  case HeadWearType::Other:
166  return scores[static_cast<int>(type)];
167  default:
168  return -1.0f;
169  }
170  }
171 
172 } // namespace fsdk
#define DECLARE_SMARTPTR(X)
Smart ptr declaration helper macro.
Definition: Def.h:59
float scores[static_cast< int >(HeadWearType::Count)]
estimation scores
Definition: IHeadWearEstimator.h:70
A structure that encapsulates an action result enumeration.
Definition: Result.h:29
HeadWearType estimator output structure. This structure contains the result of estimation (...
Definition: IHeadWearEstimator.h:68
HeadWearState
HeadWearState estimator output enum. This enum contains all possible estimation results.
Definition: IHeadWearEstimator.h:20
HeadWear estimator interface.
Definition: IHeadWearEstimator.h:96
Object system types and interfaces.
HeadWearState result
estimation result (
Definition: IHeadWearEstimator.h:33
Common SDK error codes.
Base strong reference counted object interface.
Definition: IRefCounted.h:36
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:141
float scores[static_cast< int >(HeadWearState::Count)]
estimation scores
Definition: IHeadWearEstimator.h:34
float getScore(HeadWearType type) const
Returns score of required headwear type.
Definition: IHeadWearEstimator.h:154
Image.
Definition: Image.h:38
HeadWearStateEstimation state
Definition: IHeadWearEstimator.h:86
HeadWearTypeEstimation type
Definition: IHeadWearEstimator.h:88
HeadWearType
HeadWearType estimator output enum. This enum contains all possible estimation results.
Definition: IHeadWearEstimator.h:48
HeadWear estimator output structure. This structure contains the result of HeadWearState and HeadWear...
Definition: IHeadWearEstimator.h:85
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:32
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:69