JeVois  1.20
JeVois Smart Embedded Machine Vision Toolkit
Share this page:
PostProcessorYuNet.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 
21 #include <jevois/Types/ObjDetect.H>
22 
23 namespace jevois
24 {
25  namespace dnn
26  {
27  namespace yunet
28  {
29  //! A face box for YuNet \relates PostProcessorYuNet
30  typedef cv::Rect2f Box;
31 
32  //! Face landmarks for YuNet \relates PostProcessorYuNet
33  struct Landmarks_5
34  {
35  cv::Point2f right_eye;
36  cv::Point2f left_eye;
37  cv::Point2f nose_tip;
38  cv::Point2f mouth_right;
39  cv::Point2f mouth_left;
40  };
41 
42  //! A YuNet face detection \relates PostProcessorYuNet
43  struct Face
44  {
47  float score;
48  };
49 
50  class PriorBox;
51  } // namespace yunet
52 
53  //! Post-Processor for YuNet face landmarks detector
54  /*! This is the last step in a deep neural network processing Pipeline. Code derived from
55  https://github.com/khadas/OpenCV_NPU_Demo.git
56  \ingroup dnn */
58  public Parameter<postprocessor::nms, postprocessor::top, postprocessor::cthresh,
59  postprocessor::dthresh>
60  {
61  public:
62 
63  //! Inherited constructor ok
64  using PostProcessor::PostProcessor;
65 
66  //! Destructor
67  virtual ~PostProcessorYuNet();
68 
69  //! Freeze/unfreeze parameters that users should not change while running
70  virtual void freeze(bool doit) override;
71 
72  //! Process outputs and draw/send some results
73  void process(std::vector<cv::Mat> const & outs, PreProcessor * preproc) override;
74 
75  //! Report what happened in last process() to console/output video/GUI
76  void report(jevois::StdModule * mod, jevois::RawImage * outimg = nullptr,
77  jevois::OptGUIhelper * helper = nullptr, bool overlay = true, bool idle = false) override;
78 
79  protected:
80  std::vector<yunet::Face> itsDetections;
81  cv::Size itsImageSize;
82  std::shared_ptr<yunet::PriorBox> itsPriorBox;
83  };
84 
85  } // namespace dnn
86 } // namespace jevois
jevois::dnn::PostProcessorYuNet::freeze
virtual void freeze(bool doit) override
Freeze/unfreeze parameters that users should not change while running.
Definition: PostProcessorYuNet.C:173
jevois::dnn::PostProcessorYuNet::~PostProcessorYuNet
virtual ~PostProcessorYuNet()
Destructor.
Definition: PostProcessorYuNet.C:169
Box
cv::Rect2f Box
A face box for YuNet.
Definition: PostProcessorYuNet.H:30
jevois::dnn::yunet::PriorBox
Definition: PostProcessorYuNet.C:33
jevois::dnn::yunet::Face::landmarks
Landmarks_5 landmarks
Definition: PostProcessorYuNet.H:46
jevois::RawImage
A raw image as coming from a V4L2 Camera and/or being sent out to a USB Gadget.
Definition: RawImage.H:110
jevois::dnn::PostProcessorYuNet::report
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.
Definition: PostProcessorYuNet.C:234
ObjDetect.H
jevois::dnn::yunet::Face
A YuNet face detection.
Definition: PostProcessorYuNet.H:43
jevois::dnn::yunet::Landmarks_5::mouth_right
cv::Point2f mouth_right
Definition: PostProcessorYuNet.H:38
jevois::dnn::PostProcessorYuNet::itsImageSize
cv::Size itsImageSize
Definition: PostProcessorYuNet.H:81
jevois::GUIhelper
Helper class to assist modules in creating graphical and GUI elements.
Definition: GUIhelper.H:128
jevois::dnn::yunet::Landmarks_5::right_eye
cv::Point2f right_eye
Definition: PostProcessorYuNet.H:35
jevois::dnn::yunet::Face::score
float score
Definition: PostProcessorYuNet.H:47
jevois
Definition: Concepts.dox:1
jevois::dnn::yunet::Landmarks_5::nose_tip
cv::Point2f nose_tip
Definition: PostProcessorYuNet.H:37
jevois::dnn::PreProcessor
Pre-Processor for neural network pipeline.
Definition: PreProcessor.H:108
jevois::dnn::yunet::Landmarks_5::mouth_left
cv::Point2f mouth_left
Definition: PostProcessorYuNet.H:39
jevois::dnn::PostProcessorYuNet::itsPriorBox
std::shared_ptr< yunet::PriorBox > itsPriorBox
Definition: PostProcessorYuNet.H:82
jevois::dnn::yunet::Landmarks_5
Face landmarks for YuNet.
Definition: PostProcessorYuNet.H:33
PostProcessor.H
jevois::dnn::yunet::Landmarks_5::left_eye
cv::Point2f left_eye
Definition: PostProcessorYuNet.H:36
jevois::dnn::PostProcessorYuNet::process
void process(std::vector< cv::Mat > const &outs, PreProcessor *preproc) override
Process outputs and draw/send some results.
Definition: PostProcessorYuNet.C:177
jevois::dnn::PostProcessor
Post-Processor for neural network pipeline.
Definition: PostProcessor.H:146
jevois::dnn::PostProcessorYuNet
Post-Processor for YuNet face landmarks detector.
Definition: PostProcessorYuNet.H:57
jevois::dnn::yunet::Face::bbox_tlwh
Box bbox_tlwh
Definition: PostProcessorYuNet.H:45
jevois::StdModule
Base class for a module that supports standardized serial messages.
Definition: Module.H:232
jevois::dnn::PostProcessorYuNet::itsDetections
std::vector< yunet::Face > itsDetections
Definition: PostProcessorYuNet.H:80