JeVoisBase  1.20
JeVois Smart Embedded Machine Vision Toolkit Base Modules
Share this page:
PyPostStub.PyPostStub Class Reference

Stub DNN post-processor written in python. More...

Public Member Functions

def __init__ (self)
 [Optional] Constructor More...
 
def init (self)
 [Optional] JeVois parameters initialization More...
 
def freeze (self, doit)
 [Optional] Freeze some parameters that should not be changed at runtime. More...
 
def process (self, outs, preproc)
 [Optional] Parameter callback: Load class names when 'classes' parameter value is changed, when a pipeline is selected from the model zoo def loadClasses(self, filename): if filename: jevois.LINFO(f"Loading {filename}...") f = open(pyjevois.share + '/' + filename, 'rt') # will throw if file not found self.classmap = f.read().rstrip('
').split('
') More...
 
def 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 More...
 

Public Attributes

 results
 

Detailed Description

Stub DNN post-processor written in python.

When importing a network for which you are not sure about the exact output tensors and how to interpret them, you can use this stub first to see what outputs are produced by your network. You can then copy this stub to a new file name and edit it to actually decode the outputs of your network.

You would create an entry like this in your network's YAML file:

MyNet: [...] postproc: Python pypost: "pydnn/post/PyPostStub.py" [...]

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 33 of file PyPostStub.py.

Constructor & Destructor Documentation

◆ __init__()

def PyPostStub.PyPostStub.__init__ (   self)

[Optional] Constructor

Definition at line 36 of file PyPostStub.py.

Member Function Documentation

◆ freeze()

def PyPostStub.PyPostStub.freeze (   self,
  doit 
)

[Optional] Freeze some parameters that should not be changed at runtime.

The JeVois core will call this with doit being either True or False

Definition at line 56 of file PyPostStub.py.

◆ init()

def PyPostStub.PyPostStub.init (   self)

[Optional] JeVois parameters initialization

Definition at line 41 of file PyPostStub.py.

◆ process()

def PyPostStub.PyPostStub.process (   self,
  outs,
  preproc 
)

[Optional] Parameter callback: Load class names when 'classes' parameter value is changed, when a pipeline is selected from the model zoo def loadClasses(self, filename): if filename: jevois.LINFO(f"Loading {filename}...") f = open(pyjevois.share + '/' + filename, 'rt') # will throw if file not found self.classmap = f.read().rstrip('
').split('
')

[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 (not used here).

Definition at line 74 of file PyPostStub.py.

References PyPostClassify.PyPostClassify.results, and PyPostStub.PyPostStub.results.

◆ report()

def PyPostStub.PyPostStub.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 98 of file PyPostStub.py.

Member Data Documentation

◆ results

PyPostStub.PyPostStub.results

Definition at line 37 of file PyPostStub.py.

Referenced by PyPreBlob.PyPreBlob.process(), and PyPostStub.PyPostStub.process().


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