FastDeploy  latest
Fast & Easy to Deploy!
preprocessor.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 #pragma once
15 #include "fastdeploy/vision/common/processors/transform.h"
16 #include "fastdeploy/vision/common/result.h"
17 
18 namespace fastdeploy {
19 namespace vision {
20 namespace segmentation {
23 class FASTDEPLOY_DECL PaddleSegPreprocessor {
24  public:
29  explicit PaddleSegPreprocessor(const std::string& config_file);
30 
38  virtual bool Run(
39  std::vector<FDMat>* images,
40  std::vector<FDTensor>* outputs,
41  std::map<std::string, std::vector<std::array<int, 2>>>* imgs_info);
42 
44  bool GetIsVerticalScreen() const {
45  return is_vertical_screen_;
46  }
47 
49  void SetIsVerticalScreen(bool value) {
50  is_vertical_screen_ = value;
51  }
52 
54  void DisableNormalize();
56  void DisablePermute();
57 
58  private:
59  virtual bool BuildPreprocessPipelineFromConfig();
60  std::vector<std::shared_ptr<Processor>> processors_;
61  std::string config_file_;
62 
65  bool is_vertical_screen_ = false;
66 
67  // for recording the switch of hwc2chw
68  bool disable_permute_ = false;
69  // for recording the switch of normalize
70  bool disable_normalize_ = false;
71 
72  bool is_contain_resize_op_ = false;
73 
74  bool initialized_ = false;
75 };
76 
77 } // namespace segmentation
78 } // namespace vision
79 } // namespace fastdeploy
Preprocessor object for PaddleSeg serials model.
Definition: preprocessor.h:23
void SetIsVerticalScreen(bool value)
Set is_vertical_screen value, bool type required.
Definition: preprocessor.h:49
bool GetIsVerticalScreen() const
Get is_vertical_screen property of PP-HumanSeg model, default is false.
Definition: preprocessor.h:44
All C++ FastDeploy APIs are defined inside this namespace.
Definition: option.h:16