24 #include <ovxlib/vsi_nn_pub.h>
43 "If not absolute, it is relative to this module's path",
44 JEVOIS_SHARE_PATH
"/dnn", ParamCateg);
48 "If not absolute, it is relative to zooroot",
49 "models.yml", ParamCateg);
55 "the 'pipe' parameter some class of models from the zoo",
56 Filter::All, Filter_Values, ParamCateg);
60 "top-level entry in the zoo file. Network execution types are: OpenCV: "
61 "on CPU, NPU: on JeVois NPU accelerator, TPU: on Coral Edge TPU if "
62 "available, VPU: on MyriadX VPU if available, NPUX: on NPU via TimVX "
63 "OpenCV extension, VPUX: on CPU via ARM-Compute OpenVino emulation "
64 "of VPU, and SPU: on Hailo8 SPU if available.",
72 "by selecting a pipeline from the zoo file",
73 PreProc::Blob, PreProc_Values, ParamCateg);
83 "automatically by selecting a pipeline from the zoo file",
84 NetType::OpenCV, NetType_Values, ParamCateg);
90 "by selecting a pipeline from the zoo file",
91 PostProc::Classify, PostProc_Values, ParamCateg);
97 "network, and post-processing sequentially for every frame. Use for fast "
98 "networks only, otherwise it will slow down the GUI... Async runs the network in "
99 "a thread and should be used for networks slower than the camera framerate.",
100 Processing::Async, Processing_Values, ParamCateg);
108 "a pipeline, but the pipeline's component is not using them. Warnings appear "
109 "in the console when the pipeline is loaded.",
114 "to the specified file if not empty. If path is relative, it is to " JEVOIS_SHARE_PATH,
119 "for each, run it for a while and append pre/net/post timing statistics "
120 "in HTML table format to " JEVOIS_SHARE_PATH
"/benchmark.html",
134 public jevois::Parameter<pipeline::zooroot, pipeline::zoo, pipeline::filter, pipeline::pipe,
135 pipeline::processing, pipeline::preproc, pipeline::nettype,
136 pipeline::postproc, pipeline::overlay, pipeline::paramwarn,
137 pipeline::statsfile, pipeline::benchmark>
141 Pipeline(std::string
const & instance);
188 void reloadZoo(std::string
const & root, std::string
const & filt, std::string
const & zoofile);
193 bool itsZooChanged =
false;
194 void onParamChange(pipeline::zooroot
const & param, std::string
const & val)
override;
195 void onParamChange(pipeline::zoo
const & param, std::string
const & val)
override;
196 void onParamChange(pipeline::filter
const & param, pipeline::Filter
const & val)
override;
197 void onParamChange(pipeline::pipe
const & param, std::string
const & val)
override;
198 void onParamChange(pipeline::nettype
const & param, pipeline::NetType
const & val)
override;
199 void onParamChange(pipeline::preproc
const & param, pipeline::PreProc
const & val)
override;
200 void onParamChange(pipeline::postproc
const & param, pipeline::PostProc
const & val)
override;
201 void onParamChange(pipeline::benchmark
const & param,
bool const & val)
override;
203 std::future<std::vector<cv::Mat>> itsNetFut;
204 std::array<std::string, 3> itsProcTimes {
"PreProc: -",
"Network: -",
"PstProc: -" };
205 std::array<double, 3> itsProcSecs { 0.0, 0.0, 0.0 };
206 std::vector<cv::Mat> itsBlobs, itsOuts;
207 std::vector<vsi_nn_tensor_attr_t> itsInputAttrs;
208 std::vector<std::string> itsNetInfo, itsAsyncNetInfo;
209 std::string itsAsyncNetworkTime =
"Network: -";
210 double itsAsyncNetworkSecs = 0.0;
214 bool checkAsyncNetComplete();
215 double itsSecsSum = 0.0, itsSecsAvg = 0.0;
216 int itsSecsSumNum = 0;
217 bool itsPipeThrew =
false;
218 void scanZoo(std::filesystem::path
const & zoofile, std::string
const & filt, std::vector<std::string> & pipes,
219 std::string
const & indent);
220 bool selectPipe(std::string
const & zoofile, std::vector<std::string>
const & tok);
221 void setZooParam(std::string
const & name, std::string
const & value, std::string
const & zf,
222 cv::FileNode
const & node);
225 std::map<std::string, size_t> itsAccelerators;
226 std::vector<double> itsPreStats, itsNetStats, itsPstStats;
227 bool itsStatsWarmup =
true;