JeVoisBase
1.22
JeVois Smart Embedded Machine Vision Toolkit Base Modules
|
|
Stub 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. | |
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(' ') | |
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 | |
results | |
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" [...]
Definition at line 33 of file PyPostStub.py.
PyPostStub.PyPostStub.__init__ | ( | self | ) |
[Optional] Constructor
Definition at line 36 of file PyPostStub.py.
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.
PyPostStub.PyPostStub.init | ( | self | ) |
[Optional] JeVois parameters initialization
Definition at line 41 of file PyPostStub.py.
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, PyPostStub.PyPostStub.results, and PyPreBlob.PyPreBlob.results.
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.
PyPostStub.PyPostStub.results |
Definition at line 37 of file PyPostStub.py.
Referenced by PyPreBlob.PyPreBlob.process(), PyPostClassify.PyPostClassify.process(), PyPostStub.PyPostStub.process(), and PyPostClassify.PyPostClassify.report().