FastDeploy  latest
Fast & Easy to Deploy!
postprocessor.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/vision/common/processors/transform.h"
17 #include "fastdeploy/vision/common/result.h"
18 
19 namespace fastdeploy {
20 namespace vision {
21 
22 namespace detection {
25 class FASTDEPLOY_DECL YOLOv5SegPostprocessor {
26  public:
30 
38  bool Run(const std::vector<FDTensor>& tensors,
39  std::vector<DetectionResult>* results,
40  const std::vector<std::map<std::string, std::array<float, 2>>>& ims_info);
41 
43  void SetConfThreshold(const float& conf_threshold) {
44  conf_threshold_ = conf_threshold;
45  }
46 
48  float GetConfThreshold() const { return conf_threshold_; }
49 
51  void SetNMSThreshold(const float& nms_threshold) {
52  nms_threshold_ = nms_threshold;
53  }
54 
56  float GetNMSThreshold() const { return nms_threshold_; }
57 
59  void SetMultiLabel(bool multi_label) {
60  multi_label_ = multi_label;
61  }
62 
64  bool GetMultiLabel() const { return multi_label_; }
65 
66  protected:
67  float conf_threshold_;
68  float nms_threshold_;
69  bool multi_label_;
70  float max_wh_;
71  // channel nums of masks
72  int mask_nums_;
73  // mask threshold
74  float mask_threshold_;
75 };
76 
77 } // namespace detection
78 } // namespace vision
79 } // namespace fastdeploy
float GetConfThreshold() const
Get conf_threshold, default 0.25.
Definition: postprocessor.h:48
void SetMultiLabel(bool multi_label)
Set multi_label, set true for eval, default true.
Definition: postprocessor.h:59
void SetNMSThreshold(const float &nms_threshold)
Set nms_threshold, default 0.5.
Definition: postprocessor.h:51
bool GetMultiLabel() const
Get multi_label, default true.
Definition: postprocessor.h:64
void SetConfThreshold(const float &conf_threshold)
Set conf_threshold, default 0.25.
Definition: postprocessor.h:43
float GetNMSThreshold() const
Get nms_threshold, default 0.5.
Definition: postprocessor.h:56
Postprocessor object for YOLOv5Seg serials model.
Definition: postprocessor.h:25
All C++ FastDeploy APIs are defined inside this namespace.
Definition: option.h:16