FastDeploy  latest
Fast & Easy to Deploy!
All Classes Namespaces Files Functions Variables Enumerations Enumerator Pages
model.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/detection/contrib/rknpu2/rkyolo.h"
17 namespace fastdeploy {
18 namespace vision {
19 namespace detection {
20 
21 class FASTDEPLOY_DECL RKYOLOV5 : public RKYOLO {
22  public:
31  RKYOLOV5(const std::string& model_file,
32  const RuntimeOption& custom_option = RuntimeOption(),
33  const ModelFormat& model_format = ModelFormat::RKNN)
34  : RKYOLO(model_file, custom_option, model_format) {
35  valid_cpu_backends = {};
36  valid_gpu_backends = {};
37  valid_rknpu_backends = {Backend::RKNPU2};
38  std::vector<int> anchors = {10, 13, 16, 30, 33, 23, 30, 61, 62,
39  45, 59, 119, 116, 90, 156, 198, 373, 326};
40  int anchor_per_branch_ = 3;
41  GetPostprocessor().SetAnchor(anchors, anchor_per_branch_);
42  }
43 
44  virtual std::string ModelName() const { return "RKYOLOV5"; }
45 };
46 
47 class FASTDEPLOY_DECL RKYOLOV7 : public RKYOLO {
48  public:
57  RKYOLOV7(const std::string& model_file,
58  const RuntimeOption& custom_option = RuntimeOption(),
59  const ModelFormat& model_format = ModelFormat::RKNN)
60  : RKYOLO(model_file, custom_option, model_format) {
61  valid_cpu_backends = {};
62  valid_gpu_backends = {};
63  valid_rknpu_backends = {Backend::RKNPU2};
64  std::vector<int> anchors = {12, 16, 19, 36, 40, 28, 36, 75, 76,
65  55, 72, 146, 142, 110, 192, 243, 459, 401};
66  int anchor_per_branch_ = 3;
67  GetPostprocessor().SetAnchor(anchors, anchor_per_branch_);
68  }
69 
70  virtual std::string ModelName() const { return "RKYOLOV7"; }
71 };
72 
73 class FASTDEPLOY_DECL RKYOLOX : public RKYOLO {
74  public:
83  RKYOLOX(const std::string& model_file,
84  const RuntimeOption& custom_option = RuntimeOption(),
85  const ModelFormat& model_format = ModelFormat::RKNN)
86  : RKYOLO(model_file, custom_option, model_format) {
87  valid_cpu_backends = {};
88  valid_gpu_backends = {};
89  valid_rknpu_backends = {Backend::RKNPU2};
90  std::vector<int> anchors = {10, 13, 16, 30, 33, 23, 30, 61, 62,
91  45, 59, 119, 116, 90, 156, 198, 373, 326};
92  int anchor_per_branch_ = 1;
93  GetPostprocessor().SetAnchor(anchors, anchor_per_branch_);
94  }
95 
96  virtual std::string ModelName() const { return "RKYOLOV7"; }
97 };
98 
99 } // namespace detection
100 } // namespace vision
101 } // namespace fastdeploy
ModelFormat
Definition: enum_variables.h:67
RKNPU2, support RKNN format model, Rockchip NPU only.
Definition: enum_variables.h:39
Model with RKNN format.
Definition: enum_variables.h:71
All C++ FastDeploy APIs are defined inside this namespace.
Definition: option.h:16