JeVoisBase
1.22
JeVois Smart Embedded Machine Vision Toolkit Base Modules
|
|
Simple classification 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, when a pipeline is selected from the model zoo | |
process (self, outs, preproc) | |
[Required] Main processing function: parse network output blobs and store resulting labels and scores locally. | |
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 | |
classmap | |
classes | |
loadClasses | |
cthresh | |
top | |
classoffset | |
Simple classification DNN post-processor written in python.
Compare this code to the C++ PostProcessorClassify (which has more functionality than here):
Definition at line 26 of file PyPostClassify.py.
PyPostClassify.PyPostClassify.__init__ | ( | self | ) |
[Optional] Constructor
Definition at line 29 of file PyPostClassify.py.
PyPostClassify.PyPostClassify.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 58 of file PyPostClassify.py.
References Darknet.classes, Yolo.classes, PyPostClassify.PyPostClassify.classes, PyPostDAMOyolo.PyPostDAMOyolo.classes, PyPostYolo.PyPostYolo.classes, PyPostYOLOv8seg.PyPostYOLOv8seg.classes, PyClassificationDNN.PyClassificationDNN.classes, PyDetectionDNN.PyDetectionDNN.classes, PyEmotion.PyEmotion.classes, and PyPostClassify.PyPostClassify.freeze().
Referenced by PyPostClassify.PyPostClassify.freeze().
PyPostClassify.PyPostClassify.init | ( | self | ) |
[Optional] JeVois parameters initialization
Definition at line 35 of file PyPostClassify.py.
PyPostClassify.PyPostClassify.loadClasses | ( | self, | |
filename | |||
) |
[Optional] Parameter callback: Load class names when 'classes' parameter value is changed, when a pipeline is selected from the model zoo
Definition at line 64 of file PyPostClassify.py.
References PyPostClassify.PyPostClassify.classmap, PyPostDAMOyolo.PyPostDAMOyolo.classmap, PyPostYolo.PyPostYolo.classmap, and PyPostYOLOv8seg.PyPostYOLOv8seg.classmap.
PyPostClassify.PyPostClassify.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 (not used here).
Definition at line 75 of file PyPostClassify.py.
References PyPostClassify.PyPostClassify.classmap, PyPostDAMOyolo.PyPostDAMOyolo.classmap, PyPostYolo.PyPostYolo.classmap, PyPostYOLOv8seg.PyPostYOLOv8seg.classmap, PyPostClassify.PyPostClassify.classoffset, PyPostYolo.PyPostYolo.classoffset, PyPostClassify.PyPostClassify.cthresh, PyPostDAMOyolo.PyPostDAMOyolo.cthresh, PyPostYolo.PyPostYolo.cthresh, PyPostClassify.PyPostClassify.results, PyPostStub.PyPostStub.results, PyPreBlob.PyPreBlob.results, and PyPostClassify.PyPostClassify.top.
PyPostClassify.PyPostClassify.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 125 of file PyPostClassify.py.
References PyPostClassify.PyPostClassify.cthresh, PyPostDAMOyolo.PyPostDAMOyolo.cthresh, PyPostYolo.PyPostYolo.cthresh, PyPostClassify.PyPostClassify.results, PyPostStub.PyPostStub.results, PyPreBlob.PyPreBlob.results, and PyPostClassify.PyPostClassify.top.
PyPostClassify.PyPostClassify.classes |
Definition at line 38 of file PyPostClassify.py.
Referenced by PyPostClassify.PyPostClassify.freeze(), PyPostDAMOyolo.PyPostDAMOyolo.freeze(), PyPostYolo.PyPostYolo.freeze(), PyPostYOLOv8seg.PyPostYOLOv8seg.freeze(), PyDetectionDNN.PyDetectionDNN.postprocess(), and PyClassificationDNN.PyClassificationDNN.process().
PyPostClassify.PyPostClassify.classmap |
Definition at line 31 of file PyPostClassify.py.
Referenced by PyPostDAMOyolo.PyPostDAMOyolo.getLabel(), PyPostYolo.PyPostYolo.getLabel(), PyPostYOLOv8seg.PyPostYOLOv8seg.getLabel(), PyPostClassify.PyPostClassify.loadClasses(), PyPostDAMOyolo.PyPostDAMOyolo.loadClasses(), PyPostYolo.PyPostYolo.loadClasses(), PyPostYOLOv8seg.PyPostYOLOv8seg.loadClasses(), and PyPostClassify.PyPostClassify.process().
PyPostClassify.PyPostClassify.classoffset |
Definition at line 51 of file PyPostClassify.py.
Referenced by PyPostClassify.PyPostClassify.process().
PyPostClassify.PyPostClassify.cthresh |
Definition at line 43 of file PyPostClassify.py.
Referenced by PyPostClassify.PyPostClassify.process(), PyPostDAMOyolo.PyPostDAMOyolo.process(), and PyPostClassify.PyPostClassify.report().
PyPostClassify.PyPostClassify.loadClasses |
Definition at line 41 of file PyPostClassify.py.
PyPostClassify.PyPostClassify.results |
Definition at line 30 of file PyPostClassify.py.
Referenced by PyPreBlob.PyPreBlob.process(), PyPostClassify.PyPostClassify.process(), PyPostStub.PyPostStub.process(), and PyPostClassify.PyPostClassify.report().
PyPostClassify.PyPostClassify.top |
Definition at line 47 of file PyPostClassify.py.
Referenced by PyPostClassify.PyPostClassify.process(), and PyPostClassify.PyPostClassify.report().