FastDeploy  latest
Fast & Easy to Deploy!
centerface.h
1 // Copyright (c) 2022 PaddlePaddle Authors. All Rights Reserved.
2 //
3 // Licensed under the Apache License, Version 2.0 (the "License");
4 // you may not use this file except in compliance with the License.
5 // You may obtain a copy of the License at
6 //
7 // http://www.apache.org/licenses/LICENSE-2.0
8 //
9 // Unless required by applicable law or agreed to in writing, software
10 // distributed under the License is distributed on an "AS IS" BASIS,
11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 // See the License for the specific language governing permissions and
13 // limitations under the License.
14 
15 #pragma once
16 #include "fastdeploy/fastdeploy_model.h"
17 #include "fastdeploy/vision/common/processors/transform.h"
18 #include "fastdeploy/vision/common/result.h"
19 #include "fastdeploy/vision/facedet/contrib/centerface/preprocessor.h"
20 #include "fastdeploy/vision/facedet/contrib/centerface/postprocessor.h"
21 
22 namespace fastdeploy {
23 
24 namespace vision {
25 
26 namespace facedet {
29 class FASTDEPLOY_DECL CenterFace: public FastDeployModel{
30  public:
38  CenterFace(const std::string& model_file, const std::string& params_file = "",
39  const RuntimeOption& custom_option = RuntimeOption(),
40  const ModelFormat& model_format = ModelFormat::ONNX);
41 
42  std::string ModelName() {return "centerface";}
43 
50  virtual bool Predict(const cv::Mat& im, FaceDetectionResult* result);
51 
58  virtual bool BatchPredict(const std::vector<cv::Mat>& images,
59  std::vector<FaceDetectionResult>* results);
60 
62  virtual CenterFacePreprocessor& GetPreprocessor() {
63  return preprocessor_;
64  }
65 
67  virtual CenterFacePostprocessor& GetPostprocessor() {
68  return postprocessor_;
69  }
70 
71  protected:
72  bool Initialize();
73  CenterFacePreprocessor preprocessor_;
74  CenterFacePostprocessor postprocessor_;
75 };
76 
77 } // namespace facedet
78 
79 } // namespace vision
80 
81 } // namespace fastdeploy
Option object used when create a new Runtime object.
Definition: runtime_option.h:40
Base model object for all the vision models.
Definition: fastdeploy_model.h:21
ModelFormat
Definition: enum_variables.h:67
virtual CenterFacePreprocessor & GetPreprocessor()
Get preprocessor reference of CenterFace.
Definition: centerface.h:62
virtual CenterFacePostprocessor & GetPostprocessor()
Get postprocessor reference of CenterFace.
Definition: centerface.h:67
Face detection result structure for all the face detection models.
Definition: result.h:212
CenterFace model object used when to load a CenterFace model exported by CenterFace.
Definition: centerface.h:29
Model with ONNX format.
Definition: enum_variables.h:70
All C++ FastDeploy APIs are defined inside this namespace.
Definition: option.h:16