JeVois  1.22
JeVois Smart Embedded Machine Vision Toolkit
Share this page:
Loading...
Searching...
No Matches
PostProcessorPose.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
23
24#ifdef JEVOIS_PRO
25#include <jevois/DNN/hailo/yolov8pose_postprocess.hpp>
26#endif
27
28namespace jevois
29{
30 namespace dnn
31 {
32 //! Post-Processor for neural network pipeline, for human/animal/other pose detection (skeleton)
33 /*! This is the last step in a deep neural network processing Pipeline. It estimates the pose (skeleton) of humans
34 or animals seen by the camera. \ingroup dnn */
36 public Parameter<postprocessor::nms, postprocessor::nmsperclass,
37 postprocessor::posetype, postprocessor::cthresh,
38 postprocessor::jthresh, postprocessor::skeleton,
39 postprocessor::serialreport, postprocessor::maxnbox,
40 postprocessor::sigmoid, postprocessor::boxclamp,
41 postprocessor::classes, postprocessor::classoffset,
42 postprocessor::namedonly>
43 {
44 public:
45
46 //! Inherited constructor ok
47 using PostProcessor::PostProcessor;
48
49 //! Destructor
50 virtual ~PostProcessorPose();
51
52 //! Freeze/unfreeze parameters that users should not change while running
53 void freeze(bool doit) override;
54
55 //! Process outputs and draw/send some results
56 void process(std::vector<cv::Mat> const & outs, PreProcessor * preproc) override;
57
58 //! Report what happened in last process() to console/output video/GUI
59 void report(jevois::StdModule * mod, jevois::RawImage * outimg = nullptr,
60 jevois::OptGUIhelper * helper = nullptr, bool overlay = true, bool idle = false) override;
61
62 //! Get the latest detections, use with caution, not thread-safe
63 /*! This returns a reference to our internal vector of detections. That vector will get overwritten every time
64 process() is called. It is ok to use this after you have called process() on a given frame, or, if using a
65 Pipeline, after you have called Pipeline::process(). Do not hold this ref past the end of the current video
66 frame. If you need to keep a persistent copy of the data, make a deep copy of the vector. */
67 std::vector<ObjDetect> const & latestDetections() const;
68
69 //! Get the latest skeletons, use with caution, not thread-safe
70 /*! This returns a reference to our internal vector of skeletons. That vector will get overwritten every time
71 process() is called. It is ok to use this after you have called process() on a given frame, or, if using a
72 Pipeline, after you have called Pipeline::process(). Do not hold this ref past the end of the current video
73 frame. If you need to keep a persistent copy of the data, make a deep copy of the vector. */
74 std::vector<PoseSkeleton> const & latestSkeletons() const;
75
76 protected:
77 void onParamChange(postprocessor::classes const & param, std::string const & val) override;
78 void onParamChange(postprocessor::skeleton const & param, std::string const & val) override;
79 std::map<int, std::string> itsLabels; //!< Mapping from object ID to class name
80#ifdef JEVOIS_PRO
81 // This is used by the Hailo decoder code only:
82 HailoROIPtr itsROI = std::make_shared<HailoROI>(HailoROI(HailoBBox(0.0f, 0.0f, 1.0f, 1.0f)));
83 std::pair<std::vector<KeyPt>, std::vector<PairPairs>> itsKeypointsAndPairs;
84#endif
85 std::shared_ptr<jevois::PoseSkeletonDefinition> itsSkeletonDef;
86 cv::Size itsImageSize;
87 std::vector<ObjDetect> itsDetections;
88 std::vector<PoseSkeleton> itsSkeletons;
89 };
90
91 } // namespace dnn
92} // 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, for human/animal/other pose detection (skeleton)
void process(std::vector< cv::Mat > const &outs, PreProcessor *preproc) override
Process outputs and draw/send some results.
void onParamChange(postprocessor::classes const &param, std::string const &val) override
std::vector< PoseSkeleton > const & latestSkeletons() const
Get the latest skeletons, use with caution, not thread-safe.
std::vector< ObjDetect > const & latestDetections() const
Get the latest detections, use with caution, not thread-safe.
std::vector< PoseSkeleton > itsSkeletons
std::shared_ptr< jevois::PoseSkeletonDefinition > itsSkeletonDef
void freeze(bool doit) override
Freeze/unfreeze parameters that users should not change while running.
std::vector< ObjDetect > itsDetections
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.
std::map< int, std::string > itsLabels
Mapping from object ID to class name.
std::pair< std::vector< KeyPt >, std::vector< PairPairs > > itsKeypointsAndPairs
virtual ~PostProcessorPose()
Destructor.
Post-Processor for neural network pipeline.
Pre-Processor for neural network pipeline.
Main namespace for all JeVois classes and functions.
Definition Concepts.dox:2