mirror of
https://github.com/PaddlePaddle/FastDeploy.git
synced 2025-10-21 15:49:31 +08:00

* 更正代码格式 * 更正代码格式 * 修复语法错误 * fix rk error * update * update * update * update * update * update * update Co-authored-by: Jason <jiangjiajun@baidu.com>
93 lines
4.2 KiB
C++
93 lines
4.2 KiB
C++
// Copyright (c) 2022 PaddlePaddle Authors. All Rights Reserved.
|
|
//
|
|
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
// you may not use this file except in compliance with the License.
|
|
// You may obtain a copy of the License at
|
|
//
|
|
// http://www.apache.org/licenses/LICENSE-2.0
|
|
//
|
|
// Unless required by applicable law or agreed to in writing, software
|
|
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
// See the License for the specific language governing permissions and
|
|
// limitations under the License.
|
|
|
|
#pragma once
|
|
#include "fastdeploy/vision/detection/contrib/rknpu2/rkyolo.h"
|
|
namespace fastdeploy {
|
|
namespace vision {
|
|
namespace detection {
|
|
|
|
class FASTDEPLOY_DECL RKYOLOV5 : public RKYOLO {
|
|
public:
|
|
/** \brief Set path of model file and configuration file, and the configuration of runtime
|
|
*
|
|
* \param[in] model_file Path of model file, e.g picodet/model.pdmodel
|
|
* \param[in] params_file Path of parameter file, e.g picodet/model.pdiparams, if the model format is ONNX, this parameter will be ignored
|
|
* \param[in] config_file Path of configuration file for deployment, e.g picodet/infer_cfg.yml
|
|
* \param[in] custom_option RuntimeOption for inference, the default will use cpu, and choose the backend defined in `valid_cpu_backends`
|
|
* \param[in] model_format Model format of the loaded model, default is Paddle format
|
|
*/
|
|
RKYOLOV5(const std::string& model_file,
|
|
const RuntimeOption& custom_option = RuntimeOption(),
|
|
const ModelFormat& model_format = ModelFormat::RKNN)
|
|
: RKYOLO(model_file, custom_option, model_format) {
|
|
valid_cpu_backends = {};
|
|
valid_gpu_backends = {};
|
|
valid_rknpu_backends = {Backend::RKNPU2};
|
|
GetPostprocessor().SetModelType(ModelType::RKYOLOV5);
|
|
}
|
|
|
|
virtual std::string ModelName() const { return "RKYOLOV5"; }
|
|
};
|
|
|
|
class FASTDEPLOY_DECL RKYOLOV7 : public RKYOLO {
|
|
public:
|
|
/** \brief Set path of model file and configuration file, and the configuration of runtime
|
|
*
|
|
* \param[in] model_file Path of model file, e.g picodet/model.pdmodel
|
|
* \param[in] params_file Path of parameter file, e.g picodet/model.pdiparams, if the model format is ONNX, this parameter will be ignored
|
|
* \param[in] config_file Path of configuration file for deployment, e.g picodet/infer_cfg.yml
|
|
* \param[in] custom_option RuntimeOption for inference, the default will use cpu, and choose the backend defined in `valid_cpu_backends`
|
|
* \param[in] model_format Model format of the loaded model, default is Paddle format
|
|
*/
|
|
RKYOLOV7(const std::string& model_file,
|
|
const RuntimeOption& custom_option = RuntimeOption(),
|
|
const ModelFormat& model_format = ModelFormat::RKNN)
|
|
: RKYOLO(model_file, custom_option, model_format) {
|
|
valid_cpu_backends = {};
|
|
valid_gpu_backends = {};
|
|
valid_rknpu_backends = {Backend::RKNPU2};
|
|
GetPostprocessor().SetModelType(ModelType::RKYOLOV7);
|
|
}
|
|
|
|
virtual std::string ModelName() const { return "RKYOLOV7"; }
|
|
};
|
|
|
|
class FASTDEPLOY_DECL RKYOLOX : public RKYOLO {
|
|
public:
|
|
/** \brief Set path of model file and configuration file, and the configuration of runtime
|
|
*
|
|
* \param[in] model_file Path of model file, e.g picodet/model.pdmodel
|
|
* \param[in] params_file Path of parameter file, e.g picodet/model.pdiparams, if the model format is ONNX, this parameter will be ignored
|
|
* \param[in] config_file Path of configuration file for deployment, e.g picodet/infer_cfg.yml
|
|
* \param[in] custom_option RuntimeOption for inference, the default will use cpu, and choose the backend defined in `valid_cpu_backends`
|
|
* \param[in] model_format Model format of the loaded model, default is Paddle format
|
|
*/
|
|
RKYOLOX(const std::string& model_file,
|
|
const RuntimeOption& custom_option = RuntimeOption(),
|
|
const ModelFormat& model_format = ModelFormat::RKNN)
|
|
: RKYOLO(model_file, custom_option, model_format) {
|
|
valid_cpu_backends = {};
|
|
valid_gpu_backends = {};
|
|
valid_rknpu_backends = {Backend::RKNPU2};
|
|
GetPostprocessor().SetModelType(ModelType::RKYOLOX);
|
|
}
|
|
|
|
virtual std::string ModelName() const { return "RKYOLOV7"; }
|
|
};
|
|
|
|
} // namespace detection
|
|
} // namespace vision
|
|
} // namespace fastdeploy
|