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
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 
94  };
96 
110  virtual Result<FSDKError> estimate(
111  const Image& warp,
112  HeadWearEstimation& estimation) const noexcept = 0;
113 
124  virtual Result<FSDKError> estimate(
125  Span<const Image> warps,
126  Span<HeadWearEstimation> estimations) const noexcept = 0;
127 
138  virtual Result<FSDKError> validate(
139  Span<const Image> warps,
140  Span<Result<FSDKError>> errors) const noexcept = 0;
141  };
142 
143  /*
144  Implementation details.
145  */
147  switch (state) {
148  case HeadWearState::Yes:
149  case HeadWearState::No:
150  return scores[static_cast<int>(state)];
151  default:
152  return -1.0f;
153  }
154  }
155 
156  /*
157  Implementation details.
158  */
160  switch (type) {
161  case HeadWearType::NoHeadWear:
162  case HeadWearType::BaseballCap:
163  case HeadWearType::Beanie:
164  case HeadWearType::PeakedCap:
165  case HeadWearType::Shawl:
166  case HeadWearType::HatWithEarFlaps:
167  case HeadWearType::Helmet:
168  case HeadWearType::Hood:
169  case HeadWearType::Hat:
170  case HeadWearType::Other:
171  return scores[static_cast<int>(type)];
172  default:
173  return -1.0f;
174  }
175  }
177 } // 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:75
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:73
HeadWearState
HeadWearState estimator output enum. This enum contains all possible estimation results.
Definition: IHeadWearEstimator.h:25
HeadWear estimator interface.
Definition: IHeadWearEstimator.h:101
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: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:146
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:159
Image.
Definition: Image.h:39
HeadWearStateEstimation state
Definition: IHeadWearEstimator.h:91
HeadWearTypeEstimation type
Definition: IHeadWearEstimator.h:93
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