FastDeploy  latest
Fast & Easy to Deploy!
fastestdet.h
1 // Copyright (c) 2022 PaddlePaddle Authors. All Rights Reserved. //NOLINT
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 
17 #include "fastdeploy/fastdeploy_model.h"
18 #include "fastdeploy/vision/detection/contrib/fastestdet/preprocessor.h"
19 #include "fastdeploy/vision/detection/contrib/fastestdet/postprocessor.h"
20 
21 namespace fastdeploy {
22 namespace vision {
23 namespace detection {
26 class FASTDEPLOY_DECL FastestDet : public FastDeployModel {
27  public:
35  FastestDet(const std::string& model_file, const std::string& params_file = "",
36  const RuntimeOption& custom_option = RuntimeOption(),
37  const ModelFormat& model_format = ModelFormat::ONNX);
38 
39  std::string ModelName() const { return "fastestdet"; }
40 
47  virtual bool Predict(const cv::Mat& img, DetectionResult* result);
48 
55  virtual bool BatchPredict(const std::vector<cv::Mat>& imgs,
56  std::vector<DetectionResult>* results);
57 
60  return preprocessor_;
61  }
62 
65  return postprocessor_;
66  }
67 
68  protected:
69  bool Initialize();
70  FastestDetPreprocessor preprocessor_;
71  FastestDetPostprocessor postprocessor_;
72 };
73 
74 } // namespace detection
75 } // namespace vision
76 } // 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
FastestDet model object used when to load a FastestDet model exported by FastestDet.
Definition: fastestdet.h:26
virtual FastestDetPostprocessor & GetPostprocessor()
Get postprocessor reference of FastestDet.
Definition: fastestdet.h:64
Detection result structure for all the object detection models and instance segmentation models...
Definition: result.h:106
std::string ModelName() const
Get model&#39;s name.
Definition: fastestdet.h:39
Model with ONNX format.
Definition: enum_variables.h:70
Postprocessor object for FastestDet serials model.
Definition: postprocessor.h:25
Preprocessor object for FastestDet serials model.
Definition: preprocessor.h:25
virtual FastestDetPreprocessor & GetPreprocessor()
Get preprocessor reference of FastestDet.
Definition: fastestdet.h:59
All C++ FastDeploy APIs are defined inside this namespace.
Definition: option.h:16