JeVois  1.17
JeVois Smart Embedded Machine Vision Toolkit
Share this page:
NetworkOpenCV.H
Go to the documentation of this file.
1 // ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////
2 //
3 // JeVois Smart Embedded Machine Vision Toolkit - Copyright (C) 2021 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 #include <jevois/DNN/Network.H>
21 #include <jevois/Types/Enum.H>
22 
23 #include <opencv2/dnn.hpp>
24 
25 namespace jevois
26 {
27  namespace dnn
28  {
29  //! Wrapper around an OpenCV DNN neural network
30  /*! \ingroup dnn */
32  public jevois::Parameter<network::intensors, network::outtensors, network::dataroot,
33  network::config, network::model, network::backend, network::target>
34  {
35  public:
36  //! Inherited constructor ok
37  using jevois::dnn::Network::Network;
38 
39  //! Destructor
40  virtual ~NetworkOpenCV();
41 
42  //! Freeze/unfreeze parameters that users should not change while running
43  void freeze(bool doit) override;
44 
45  //! Get shapes of all input tensors
46  virtual std::vector<vsi_nn_tensor_attr_t> inputShapes() override;
47 
48  //! Get shapes of all output tensors
49  virtual std::vector<vsi_nn_tensor_attr_t> outputShapes() override;
50 
51  protected:
52  //! Load from disk
53  void load() override;
54 
55  //! Process input blobs and obtain output blobs
56  std::vector<cv::Mat> doprocess(std::vector<cv::Mat> const & blobs,
57  std::vector<std::string> & info) override;
58 
59  private:
60  cv::dnn::Net itsNet;
61  std::vector<cv::String> itsOutNames;
62  };
63 
64  } // namespace dnn
65 } // namespace jevois
jevois::dnn::NetworkOpenCV::outputShapes
virtual std::vector< vsi_nn_tensor_attr_t > outputShapes() override
Get shapes of all output tensors.
Definition: NetworkOpenCV.C:44
Network.H
jevois::dnn::NetworkOpenCV
Wrapper around an OpenCV DNN neural network.
Definition: NetworkOpenCV.H:31
jevois
Definition: Concepts.dox:1
jevois::dnn::NetworkOpenCV::load
void load() override
Load from disk.
Definition: NetworkOpenCV.C:50
jevois::dnn::NetworkOpenCV::inputShapes
virtual std::vector< vsi_nn_tensor_attr_t > inputShapes() override
Get shapes of all input tensors.
Definition: NetworkOpenCV.C:38
jevois::dnn::NetworkOpenCV::doprocess
std::vector< cv::Mat > doprocess(std::vector< cv::Mat > const &blobs, std::vector< std::string > &info) override
Process input blobs and obtain output blobs.
Definition: NetworkOpenCV.C:89
jevois::dnn::NetworkOpenCV::freeze
void freeze(bool doit) override
Freeze/unfreeze parameters that users should not change while running.
Definition: NetworkOpenCV.C:26
jevois::dnn::Network
Abstract class to represent a neural network.
Definition: Network.H:115
jevois::dnn::NetworkOpenCV::~NetworkOpenCV
virtual ~NetworkOpenCV()
Destructor.
Definition: NetworkOpenCV.C:22
Enum.H