JeVoisBase  1.22
JeVois Smart Embedded Machine Vision Toolkit Base Modules
Share this page:
Loading...
Searching...
No Matches

Simple YOLO DNN post-processor written in python. More...

Public Member Functions

 __init__ (self)
 [Optional] Constructor
 
 init (self)
 [Optional] JeVois parameters initialization
 
 freeze (self, doit)
 [Optional] Freeze some parameters that should not be changed at runtime.
 
 loadClasses (self, filename)
 [Optional] Parameter callback: Load class names when 'classes' parameter value is changed by model zoo
 
 setDetectType (self, dt)
 [Optional] Parameter callback: set type of object detector
 
 process (self, outs, preproc)
 [Required] Main processing function: parse network output blobs and store resulting labels and scores locally.
 
 getLabel (self, id, conf)
 Helper to get class name and confidence as a clean string, and a color that varies with class name.
 
 report (self, outimg, helper, overlay, idle)
 [Optional] Report the latest results obtained by process() by drawing them outimg is None or a RawImage to draw into when in Legacy mode (drawing to an image sent to USB) helper is None or a GUIhelper to do OpenGL drawings when in JeVois-Pro GUI mode overlay is True if user wishes to see overlay text idle is true if keyboard/mouse have been idle for a while, which typically would reduce what is displayed
 

Public Attributes

 classIds
 
 confidences
 
 boxes
 
 classmap
 
 yolopp
 
 classoffset
 
 classes
 
 loadClasses
 
 detecttype
 
 setDetectType
 
 nms
 
 maxnbox
 
 cthresh
 
 dthresh
 
 sigmoid
 
 imagew
 
 imageh
 

Detailed Description

Simple YOLO DNN post-processor written in python.

Compare this code to the C++ PostProcessorDetect (which has more functionality than here):

Instead of re-inventing the wheel, this code uses the YOLO post-processor that we have implemented in C++, as that C++ code is quite complex and multi-threaded for speed.

Author
Laurent Itti
Email:
itti@usc.edu
Address:
University of Southern California, HNB-07A, 3641 Watt Way, Los Angeles, CA 90089-2520, USA
Main URL:
http://jevois.org
Support URL:
http://jevois.org/doc
Other URL:
http://iLab.usc.edu
License:
GPL v3
Distribution:
Unrestricted
Restrictions:
None

Definition at line 30 of file PyPostYolo.py.

Constructor & Destructor Documentation

◆ __init__()

PyPostYolo.PyPostYolo.__init__ (   self)

[Optional] Constructor

Definition at line 33 of file PyPostYolo.py.

Member Function Documentation

◆ freeze()

PyPostYolo.PyPostYolo.freeze (   self,
  doit 
)

◆ getLabel()

PyPostYolo.PyPostYolo.getLabel (   self,
  id,
  conf 
)

◆ init()

PyPostYolo.PyPostYolo.init (   self)

[Optional] JeVois parameters initialization

Definition at line 49 of file PyPostYolo.py.

◆ loadClasses()

PyPostYolo.PyPostYolo.loadClasses (   self,
  filename 
)

[Optional] Parameter callback: Load class names when 'classes' parameter value is changed by model zoo

Definition at line 102 of file PyPostYolo.py.

References PyPostClassify.PyPostClassify.classmap, PyPostDAMOyolo.PyPostDAMOyolo.classmap, PyPostYolo.PyPostYolo.classmap, and PyPostYOLOv8seg.PyPostYOLOv8seg.classmap.

◆ process()

PyPostYolo.PyPostYolo.process (   self,
  outs,
  preproc 
)

[Required] Main processing function: parse network output blobs and store resulting labels and scores locally.

outs is a list of numpy arrays for the network's outputs. preproc is a handle to the pre-processor that was used, useful to recover transforms from original image to cropped/resized network inputs.

Definition at line 119 of file PyPostYolo.py.

References PyPostDAMOyolo.PyPostDAMOyolo.boxes, PyPostYolo.PyPostYolo.boxes, PyPostYOLOv8seg.PyPostYOLOv8seg.boxes, PyPostDAMOyolo.PyPostDAMOyolo.classIds, PyPostYolo.PyPostYolo.classIds, PyPostDAMOyolo.PyPostDAMOyolo.confidences, and PyPostYolo.PyPostYolo.confidences.

◆ report()

PyPostYolo.PyPostYolo.report (   self,
  outimg,
  helper,
  overlay,
  idle 
)

[Optional] Report the latest results obtained by process() by drawing them outimg is None or a RawImage to draw into when in Legacy mode (drawing to an image sent to USB) helper is None or a GUIhelper to do OpenGL drawings when in JeVois-Pro GUI mode overlay is True if user wishes to see overlay text idle is true if keyboard/mouse have been idle for a while, which typically would reduce what is displayed

Note that report() is called on every frame even though the network may run slower or take some time to load and initialize, thus you should be prepared for report() being called even before process() has ever been called (i.e., create some class member variables to hold the reported results, initialize them to some defaults in your constructor, report their current values here, and update their values in process()).

Definition at line 194 of file PyPostYolo.py.

References PyPostDAMOyolo.PyPostDAMOyolo.boxes, PyPostYolo.PyPostYolo.boxes, PyPostYOLOv8seg.PyPostYOLOv8seg.boxes, PyPostDAMOyolo.PyPostDAMOyolo.classIds, PyPostYolo.PyPostYolo.classIds, PyPostDAMOyolo.PyPostDAMOyolo.confidences, PyPostYolo.PyPostYolo.confidences, PyPostDAMOyolo.PyPostDAMOyolo.getLabel(), PyPostYolo.PyPostYolo.getLabel(), and PyPostYOLOv8seg.PyPostYOLOv8seg.getLabel().

◆ setDetectType()

PyPostYolo.PyPostYolo.setDetectType (   self,
  dt 
)

[Optional] Parameter callback: set type of object detector

Definition at line 110 of file PyPostYolo.py.

Member Data Documentation

◆ boxes

◆ classes

◆ classIds

◆ classmap

◆ classoffset

PyPostYolo.PyPostYolo.classoffset

Definition at line 52 of file PyPostYolo.py.

Referenced by PyPostClassify.PyPostClassify.process().

◆ confidences

◆ cthresh

◆ detecttype

PyPostYolo.PyPostYolo.detecttype

Definition at line 61 of file PyPostYolo.py.

Referenced by PyPostYolo.PyPostYolo.freeze().

◆ dthresh

PyPostYolo.PyPostYolo.dthresh

Definition at line 79 of file PyPostYolo.py.

◆ imageh

PyPostYolo.PyPostYolo.imageh

Definition at line 128 of file PyPostYolo.py.

◆ imagew

PyPostYolo.PyPostYolo.imagew

Definition at line 128 of file PyPostYolo.py.

◆ loadClasses

PyPostYolo.PyPostYolo.loadClasses

Definition at line 59 of file PyPostYolo.py.

◆ maxnbox

PyPostYolo.PyPostYolo.maxnbox

Definition at line 70 of file PyPostYolo.py.

Referenced by PyPostDAMOyolo.PyPostDAMOyolo.postprocess().

◆ nms

PyPostYolo.PyPostYolo.nms

Definition at line 66 of file PyPostYolo.py.

Referenced by PyPostDAMOyolo.PyPostDAMOyolo.process().

◆ setDetectType

PyPostYolo.PyPostYolo.setDetectType

Definition at line 64 of file PyPostYolo.py.

◆ sigmoid

PyPostYolo.PyPostYolo.sigmoid

Definition at line 86 of file PyPostYolo.py.

◆ yolopp

PyPostYolo.PyPostYolo.yolopp

Definition at line 45 of file PyPostYolo.py.

Referenced by PyPostYolo.PyPostYolo.freeze().


The documentation for this class was generated from the following file: