2 #ifndef _NNDEPLOY_SUPER_RESOLUTION_SUPER_RESOLUTION_H_
3 #define _NNDEPLOY_SUPER_RESOLUTION_SUPER_RESOLUTION_H_
28 namespace super_resolution {
33 key_ =
"nndeploy::super_resolution::SuperResolutionPostProcess";
34 this->setInputTypeInfo<device::Tensor>();
35 this->setOutputTypeInfo<std::vector<cv::Mat>>();
38 std::vector<dag::Edge *> inputs,
39 std::vector<dag::Edge *> outputs)
40 : dag::Node(name, inputs, outputs) {
41 key_ =
"nndeploy::super_resolution::SuperResolutionPostProcess";
42 this->setInputTypeInfo<device::Tensor>();
43 this->setOutputTypeInfo<std::vector<cv::Mat>>();
61 key_ =
"nndeploy::super_resolution::SuperResolutionGraph";
62 this->setInputTypeInfo<cv::Mat>();
63 this->setOutputTypeInfo<std::vector<cv::Mat>>();
66 std::vector<dag::Edge *> inputs,
67 std::vector<dag::Edge *> outputs)
68 : dag::Graph(name, inputs, outputs) {
69 key_ =
"nndeploy::super_resolution::SuperResolutionGraph";
70 this->setInputTypeInfo<cv::Mat>();
71 this->setOutputTypeInfo<std::vector<cv::Mat>>();
82 if (pre_ ==
nullptr) {
86 pre_->setNodeKey(
"nndeploy::preprocess::CvtNormTrans");
91 pre_param->
mean_[0] = 0.0;
92 pre_param->
mean_[1] = 0.0;
93 pre_param->
mean_[2] = 0.0;
94 pre_param->
std_[0] = 1.0;
95 pre_param->
std_[1] = 1.0;
96 pre_param->
std_[2] = 1.0;
100 this->createNode<infer::Infer>(infer_desc));
101 if (infer_ ==
nullptr) {
105 infer_->setInferenceType(inference_type);
108 post_ = this->createNode<SuperResolutionPostProcess>(post_desc);
109 if (post_ ==
nullptr) {
120 "preprocess::BatchPreprocess");
121 if (pre_ ==
nullptr) {
125 pre_->setGraph(
this);
126 pre_->setNodeKey(
"nndeploy::preprocess::CvtNormTrans");
129 if (pre_param ==
nullptr) {
130 NNDEPLOY_LOGE(
"Failed to get preprocessing node parameter.\n");
135 pre_param->
mean_[0] = 0.485;
136 pre_param->
mean_[1] = 0.456;
137 pre_param->
mean_[2] = 0.406;
138 pre_param->
std_[0] = 0.229;
139 pre_param->
std_[1] = 0.224;
140 pre_param->
std_[2] = 0.225;
144 this->createNode<infer::Infer>(
"infer::Infer"));
145 if (infer_ ==
nullptr) {
149 infer_->setGraph(
this);
150 infer_->setInferenceType(inference_type);
153 post_ = this->createNode<SuperResolutionPostProcess>(
154 "SuperResolutionPostProcess");
155 if (post_ ==
nullptr) {
159 post_->setGraph(
this);
166 std::vector<std::string> &model_value) {
170 param->model_type_ = model_type;
171 param->is_path_ = is_path;
172 param->model_value_ = model_value;
188 std::vector<dag::Edge *>
forward(std::vector<dag::Edge *> inputs) {
189 inputs = (*pre_)(inputs);
190 inputs = (*infer_)(inputs);
191 std::vector<dag::Edge *> outputs = (*post_)(inputs);
Directed Acyclic Graph Node.
InferenceParam is the base class of all inference param.
base::DeviceType device_type_
base::PixelType dst_pixel_type_
base::PixelType src_pixel_type_
Implementation of ResNet SuperResolution network graph structure.
base::Status setInferParam(base::DeviceType device_type, base::ModelType model_type, bool is_path, std::vector< std::string > &model_value)
SuperResolutionGraph(const std::string &name, std::vector< dag::Edge * > inputs, std::vector< dag::Edge * > outputs)
base::Status setSrcPixelType(base::PixelType pixel_type)
Set preprocessing parameters.
SuperResolutionGraph(const std::string &name)
base::Status make(const dag::NodeDesc &pre_desc, const dag::NodeDesc &infer_desc, base::InferenceType inference_type, const dag::NodeDesc &post_desc)
std::vector< dag::Edge * > forward(std::vector< dag::Edge * > inputs)
base::Status make(base::InferenceType inference_type)
virtual ~SuperResolutionGraph()
SuperResolutionPostProcess(const std::string &name, std::vector< dag::Edge * > inputs, std::vector< dag::Edge * > outputs)
virtual ~SuperResolutionPostProcess()
SuperResolutionPostProcess(const std::string &name)
virtual base::Status run()
Run node (pure virtual function)
#define NNDEPLOY_LOGE(fmt,...)
#define NNDEPLOY_CC_API
api
@ kStatusCodeErrorInvalidParam