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 classification {
25 class FASTDEPLOY_DECL PaddleClasPostprocessor {
26  public:
31  explicit PaddleClasPostprocessor(int topk = 1);
32 
39  bool Run(const std::vector<FDTensor>& tensors,
40  std::vector<ClassifyResult>* result);
41 
43  void SetTopk(int topk) { topk_ = topk; }
44 
46  int GetTopk() const { return topk_; }
47 
48  private:
49  int topk_ = 1;
50  bool initialized_ = false;
51 };
52 
53 } // namespace classification
54 } // namespace vision
55 } // namespace fastdeploy
Postprocessor object for PaddleClas serials model.
Definition: postprocessor.h:25
int GetTopk() const
Get topk value.
Definition: postprocessor.h:46
void SetTopk(int topk)
Set topk value.
Definition: postprocessor.h:43
All C++ FastDeploy APIs are defined inside this namespace.
Definition: option.h:16