nndeploy C++ API  0.2.0
nndeploy C++ API
batch_preprocess.h
Go to the documentation of this file.
1 #ifndef _NNDEPLOY_PREPROCESS_BATCH_PREPROCESS_H_
2 #define _NNDEPLOY_PREPROCESS_BATCH_PREPROCESS_H_
3 
4 #include "nndeploy/base/any.h"
5 #include "nndeploy/base/common.h"
7 #include "nndeploy/base/log.h"
8 #include "nndeploy/base/macro.h"
9 #include "nndeploy/base/object.h"
11 #include "nndeploy/base/status.h"
12 #include "nndeploy/base/string.h"
13 #include "nndeploy/dag/edge.h"
14 #include "nndeploy/dag/node.h"
15 #include "nndeploy/device/buffer.h"
16 #include "nndeploy/device/device.h"
18 #include "nndeploy/device/tensor.h"
22 
23 namespace nndeploy {
24 namespace preprocess {
25 
27  public:
28  BatchPreprocess(const std::string &name) : dag::CompositeNode(name) {
29  key_ = "nndeploy::preprocess::BatchPreprocess";
30  desc_ = "std::vector<cv::Mat> to device::Tensor, support all preprocess nodes[cv::Mat->device::Tensor]";
31  this->setInputTypeInfo<std::vector<cv::Mat>>();
32  this->setOutputTypeInfo<device::Tensor>();
33  }
34  BatchPreprocess(const std::string &name, std::vector<dag::Edge *> inputs,
35  std::vector<dag::Edge *> outputs)
36  : dag::CompositeNode(name, inputs, outputs) {
37  key_ = "nndeploy::preprocess::BatchPreprocess";
38  desc_ = "std::vector<cv::Mat> to device::Tensor, support all preprocess nodes[cv::Mat->device::Tensor]";
39  this->setInputTypeInfo<std::vector<cv::Mat>>();
40  this->setOutputTypeInfo<device::Tensor>();
41  }
42  virtual ~BatchPreprocess() {}
43 
44  base::Status setNodeKey(const std::string &key);
47 
49  virtual base::Status setParamSharedPtr(std::shared_ptr<base::Param> param);
50  virtual base::Param *getParam();
51  virtual std::shared_ptr<base::Param> getParamSharedPtr();
52 
53  virtual base::Status run();
54 
55  virtual base::Status serialize(rapidjson::Value &json,
56  rapidjson::Document::AllocatorType &allocator);
57  // virtual std::string serialize();
58  virtual base::Status deserialize(rapidjson::Value &json);
59  // virtual base::Status deserialize(const std::string &json_str);
60 
61  private:
63  std::string node_key_ = "";
64  dag::Node *node_ = nullptr;
65 };
66 
67 } // namespace preprocess
68 } // namespace nndeploy
69 
70 #endif /* _NNDEPLOY_PREPROCESS_BATCH_PREPROCESS_H_ */
Composite node Composite node is a special type of node in nndeploy that enhances the capabilities of...
Node base class.
Definition: node.h:171
virtual base::Status setParamSharedPtr(std::shared_ptr< base::Param > param)
Set parameter (shared pointer)
virtual base::Status serialize(rapidjson::Value &json, rapidjson::Document::AllocatorType &allocator)
Serialize to JSON.
virtual base::Status run()
Run node (pure virtual function)
virtual base::Param * getParam()
Get parameter.
BatchPreprocess(const std::string &name)
base::Status setNodeKey(const std::string &key)
virtual base::Status setParam(base::Param *param)
Set parameter.
base::Status setDataFormat(base::DataFormat data_format)
virtual std::shared_ptr< base::Param > getParamSharedPtr()
Get parameter (shared pointer)
BatchPreprocess(const std::string &name, std::vector< dag::Edge * > inputs, std::vector< dag::Edge * > outputs)
virtual base::Status deserialize(rapidjson::Value &json)
Deserialize from JSON.
#define NNDEPLOY_CC_API
api
Definition: macro.h:29
@ kDataFormatNCHW
Definition: common.h:146