FastDeploy  latest
Fast & Easy to Deploy!
cls_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 #include "fastdeploy/vision/ocr/ppocr/utils/ocr_postprocess_op.h"
19 
20 namespace fastdeploy {
21 namespace vision {
22 
23 namespace ocr {
26 class FASTDEPLOY_DECL ClassifierPostprocessor {
27  public:
35  bool Run(const std::vector<FDTensor>& tensors,
36  std::vector<int32_t>* cls_labels, std::vector<float>* cls_scores);
37 
38  bool Run(const std::vector<FDTensor>& tensors,
39  std::vector<int32_t>* cls_labels, std::vector<float>* cls_scores,
40  size_t start_index, size_t total_size);
41 
43  void SetClsThresh(float cls_thresh) { cls_thresh_ = cls_thresh; }
44 
46  float GetClsThresh() const { return cls_thresh_; }
47 
48  private:
49  float cls_thresh_ = 0.9;
50 };
51 
52 } // namespace ocr
53 } // namespace vision
54 } // namespace fastdeploy
float GetClsThresh() const
Get threshold value of the classification postprocess.
Definition: cls_postprocessor.h:46
void SetClsThresh(float cls_thresh)
Set threshold for the classification postprocess, default is 0.9.
Definition: cls_postprocessor.h:43
Postprocessor object for Classifier serials model.
Definition: cls_postprocessor.h:26
All C++ FastDeploy APIs are defined inside this namespace.
Definition: option.h:16