JeVois  1.22
JeVois Smart Embedded Machine Vision Toolkit
Share this page:
Loading...
Searching...
No Matches
PostProcessorDetect.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
22
23namespace jevois
24{
25 namespace dnn
26 {
27 class PostProcessorDetectYOLO;
28
29 //! Post-Processor for neural network pipeline
30 /*! This is the last step in a deep neural network processing Pipeline. \ingroup dnn */
32 public Parameter<postprocessor::classoffset, postprocessor::classes, postprocessor::nms,
33 postprocessor::nmsperclass, postprocessor::detecttype,
34 postprocessor::maxnbox, postprocessor::cthresh,
35 postprocessor::dthresh, postprocessor::sigmoid,
36 postprocessor::boxclamp, postprocessor::namedonly,
37 postprocessor::serialreport, postprocessor::masksmooth>
38 {
39 public:
40
41 //! Inherited constructor ok
42 using PostProcessor::PostProcessor;
43
44 //! Destructor
45 virtual ~PostProcessorDetect();
46
47 //! Freeze/unfreeze parameters that users should not change while running
48 void freeze(bool doit) override;
49
50 //! Process outputs and draw/send some results
51 void process(std::vector<cv::Mat> const & outs, PreProcessor * preproc) override;
52
53 //! Report what happened in last process() to console/output video/GUI
54 void report(jevois::StdModule * mod, jevois::RawImage * outimg = nullptr,
55 jevois::OptGUIhelper * helper = nullptr, bool overlay = true, bool idle = false) override;
56
57 //! Get the latest detections, use with caution, not thread-safe
58 /*! This returns a reference to our internal vector of detections. That vector will get overwritten every time
59 process() is called. It is ok to use this after you have called process() on a given frame, or, if using a
60 Pipeline, after you have called Pipeline::process(). Do not hold this ref past the end of the current video
61 frame. If you need to keep a persistent copy of the data, make a deep copy of the vector. */
62 std::vector<ObjDetect> const & latestDetections() const;
63
64 protected:
65 void onParamChange(postprocessor::detecttype const & param, postprocessor::DetectType const & val) override;
66 void onParamChange(postprocessor::classes const & param, std::string const & val) override;
67 std::map<int, std::string> itsLabels; //!< Mapping from object ID to class name
68 std::vector<ObjDetect> itsDetections;
69 cv::Size itsImageSize;
70 std::shared_ptr<PostProcessorDetectYOLO> itsYOLO;
71 };
72
73 } // namespace dnn
74} // namespace jevois
Helper class to assist modules in creating graphical and GUI elements.
Definition GUIhelper.H:133
A raw image as coming from a V4L2 Camera and/or being sent out to a USB Gadget.
Definition RawImage.H:111
Base class for a module that supports standardized serial messages.
Definition Module.H:234
Post-Processor for neural network pipeline.
std::vector< ObjDetect > itsDetections
void onParamChange(postprocessor::detecttype const &param, postprocessor::DetectType const &val) override
std::map< int, std::string > itsLabels
Mapping from object ID to class name.
void report(jevois::StdModule *mod, jevois::RawImage *outimg=nullptr, jevois::OptGUIhelper *helper=nullptr, bool overlay=true, bool idle=false) override
Report what happened in last process() to console/output video/GUI.
void process(std::vector< cv::Mat > const &outs, PreProcessor *preproc) override
Process outputs and draw/send some results.
std::shared_ptr< PostProcessorDetectYOLO > itsYOLO
void freeze(bool doit) override
Freeze/unfreeze parameters that users should not change while running.
virtual ~PostProcessorDetect()
Destructor.
std::vector< ObjDetect > const & latestDetections() const
Get the latest detections, use with caution, not thread-safe.
Post-Processor for neural network pipeline.
Pre-Processor for neural network pipeline.
Main namespace for all JeVois classes and functions.
Definition Concepts.dox:2