JeVois  1.21
JeVois Smart Embedded Machine Vision Toolkit
Share this page:
Loading...
Searching...
No Matches
NetworkHailo.H
Go to the documentation of this file.
1// ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////
2//
3// JeVois Smart Embedded Machine Vision Toolkit - Copyright (C) 2022 by Laurent Itti, the University of Southern
4// California (USC), and iLab at USC. See http://iLab.usc.edu and http://jevois.org for information about this project.
5//
6// This file is part of the JeVois Smart Embedded Machine Vision Toolkit. This program is free software; you can
7// redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software
8// Foundation, version 2. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
9// without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
10// License for more details. You should have received a copy of the GNU General Public License along with this program;
11// if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
12//
13// Contact information: Laurent Itti - 3641 Watt Way, HNB-07A - Los Angeles, CA 90089-2520 - USA.
14// Tel: +1 213 740 3527 - itti@pollux.usc.edu - http://iLab.usc.edu - http://jevois.org
15// ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////
16/*! \file */
17
18#pragma once
19
20#ifdef JEVOIS_PRO
21
22#include <jevois/DNN/Network.H>
23
24namespace hailort
25{ class Device; class ConfiguredNetworkGroup; class InputVStream; class OutputVStream; class ActivatedNetworkGroup; }
26
27namespace jevois
28{
29 namespace dnn
30 {
31 //! Wrapper around an DNN neural network running on the Hailo8 neural accelerator
32 /*! Note that this network type does not support setting intensors or outtensors externally, these are fixed in the
33 HEF file. \ingroup dnn */
35 public jevois::Parameter<network::dataroot, network::model, network::dequant, network::turbo>
36 {
37 public:
38 //! Constructor
39 NetworkHailo(std::string const & instance);
40
41 //! Destructor
42 virtual ~NetworkHailo();
43
44 //! Freeze/unfreeze parameters that users should not change while running
45 void freeze(bool doit) override;
46
47 //! Get shapes of all input tensors
48 virtual std::vector<vsi_nn_tensor_attr_t> inputShapes() override;
49
50 //! Get shapes of all output tensors
51 virtual std::vector<vsi_nn_tensor_attr_t> outputShapes() override;
52
53 protected:
54 //! Load from disk
55 void load() override;
56
57 //! Process input blobs and obtain output blobs
58 std::vector<cv::Mat> doprocess(std::vector<cv::Mat> const & blobs,
59 std::vector<std::string> & info) override;
60
61 void onParamChange(network::turbo const & par, bool const & newval) override;
62
63 private:
64 std::unique_ptr<hailort::Device> itsDevice;
65 std::shared_ptr<hailort::ConfiguredNetworkGroup> itsNetGroup;
66 std::vector<hailort::InputVStream> itsInStreams;
67 std::vector<hailort::OutputVStream> itsOutStreams;
68 std::unique_ptr<hailort::ActivatedNetworkGroup> itsActiveNetGroup;
69 std::vector<vsi_nn_tensor_attr_t> itsInAttrs, itsOutAttrs;
70 std::vector<cv::Mat> itsRawOutMats, itsOutMats;
71 };
72
73 } // namespace dnn
74} // namespace jevois
75
76#endif // JEVOIS_PRO
Wrapper around an DNN neural network running on the Hailo8 neural accelerator.
std::vector< cv::Mat > doprocess(std::vector< cv::Mat > const &blobs, std::vector< std::string > &info) override
Process input blobs and obtain output blobs.
void load() override
Load from disk.
virtual ~NetworkHailo()
Destructor.
void onParamChange(network::turbo const &par, bool const &newval) override
void freeze(bool doit) override
Freeze/unfreeze parameters that users should not change while running.
virtual std::vector< vsi_nn_tensor_attr_t > inputShapes() override
Get shapes of all input tensors.
virtual std::vector< vsi_nn_tensor_attr_t > outputShapes() override
Get shapes of all output tensors.
Abstract class to represent a neural network.
Definition Network.H:162
Main namespace for all JeVois classes and functions.
Definition Concepts.dox:2