JeVoisBase
1.20
JeVois Smart Embedded Machine Vision Toolkit Base Modules
|
|
Simple YOLO 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 | loadClasses (self, filename) |
[Optional] Parameter callback: Load class names when 'classes' parameter value is changed by model zoo More... | |
def | setDetectType (self, dt) |
[Optional] Parameter callback: set type of object detector More... | |
def | process (self, outs, preproc) |
[Required] Main processing function: parse network output blobs and store resulting labels and scores locally. More... | |
def | getLabel (self, id, conf) |
Helper to get class name and confidence as a clean string, and a color that varies with class name. 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 | |
classIds | |
confidences | |
boxes | |
classmap | |
yolopp | |
classoffset | |
classes | |
detecttype | |
nms | |
maxnbox | |
cthresh | |
dthresh | |
imageh | |
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.
Definition at line 30 of file PyPostYolo.py.
def PyPostYolo.PyPostYolo.__init__ | ( | self | ) |
[Optional] Constructor
Definition at line 33 of file PyPostYolo.py.
def PyPostYolo.PyPostYolo.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 91 of file PyPostYolo.py.
References PyPostClassify.PyPostClassify.classes, PyPostDAMOyolo.PyPostDAMOyolo.classes, PyPostYolo.PyPostYolo.classes, Darknet.classes, Yolo.classes, PyPostYolo.PyPostYolo.detecttype, and PyPostYolo.PyPostYolo.yolopp.
def PyPostYolo.PyPostYolo.getLabel | ( | self, | |
id, | |||
conf | |||
) |
Helper to get class name and confidence as a clean string, and a color that varies with class name.
Definition at line 170 of file PyPostYolo.py.
References PyPostClassify.PyPostClassify.classmap, PyPostDAMOyolo.PyPostDAMOyolo.classmap, and PyPostYolo.PyPostYolo.classmap.
Referenced by PyPostYolo.PyPostYolo.report().
def PyPostYolo.PyPostYolo.init | ( | self | ) |
[Optional] JeVois parameters initialization
Definition at line 49 of file PyPostYolo.py.
def PyPostYolo.PyPostYolo.loadClasses | ( | self, | |
filename | |||
) |
[Optional] Parameter callback: Load class names when 'classes' parameter value is changed by model zoo
Definition at line 98 of file PyPostYolo.py.
References PyPostClassify.PyPostClassify.classmap, PyPostDAMOyolo.PyPostDAMOyolo.classmap, PyPostYolo.PyPostYolo.classmap, and split().
def 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 115 of file PyPostYolo.py.
References PyPostDAMOyolo.PyPostDAMOyolo.boxes, PyPostYolo.PyPostYolo.boxes, PyPostDAMOyolo.PyPostDAMOyolo.classIds, PyPostYolo.PyPostYolo.classIds, PyPostDAMOyolo.PyPostDAMOyolo.confidences, and PyPostYolo.PyPostYolo.confidences.
def 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 189 of file PyPostYolo.py.
References PyPostDAMOyolo.PyPostDAMOyolo.boxes, PyPostYolo.PyPostYolo.boxes, PyPostDAMOyolo.PyPostDAMOyolo.classIds, PyPostYolo.PyPostYolo.classIds, PyPostDAMOyolo.PyPostDAMOyolo.confidences, PyPostYolo.PyPostYolo.confidences, PyPostDAMOyolo.PyPostDAMOyolo.getLabel(), and PyPostYolo.PyPostYolo.getLabel().
def PyPostYolo.PyPostYolo.setDetectType | ( | self, | |
dt | |||
) |
[Optional] Parameter callback: set type of object detector
Definition at line 106 of file PyPostYolo.py.
PyPostYolo.PyPostYolo.boxes |
Definition at line 37 of file PyPostYolo.py.
Referenced by PyPostYolo.PyPostYolo.process(), and PyPostYolo.PyPostYolo.report().
PyPostYolo.PyPostYolo.classes |
Definition at line 56 of file PyPostYolo.py.
Referenced by PyPostYolo.PyPostYolo.freeze(), PyDetectionDNN.PyDetectionDNN.postprocess(), and PyClassificationDNN.PyClassificationDNN.process().
PyPostYolo.PyPostYolo.classIds |
Definition at line 35 of file PyPostYolo.py.
Referenced by PyPostYolo.PyPostYolo.process(), and PyPostYolo.PyPostYolo.report().
PyPostYolo.PyPostYolo.classmap |
Definition at line 40 of file PyPostYolo.py.
Referenced by PyPostYolo.PyPostYolo.getLabel(), and PyPostYolo.PyPostYolo.loadClasses().
PyPostYolo.PyPostYolo.classoffset |
Definition at line 52 of file PyPostYolo.py.
PyPostYolo.PyPostYolo.confidences |
Definition at line 36 of file PyPostYolo.py.
Referenced by PyPostYolo.PyPostYolo.process(), and PyPostYolo.PyPostYolo.report().
PyPostYolo.PyPostYolo.cthresh |
Definition at line 75 of file PyPostYolo.py.
PyPostYolo.PyPostYolo.detecttype |
Definition at line 61 of file PyPostYolo.py.
Referenced by PyPostYolo.PyPostYolo.freeze().
PyPostYolo.PyPostYolo.dthresh |
Definition at line 79 of file PyPostYolo.py.
PyPostYolo.PyPostYolo.imageh |
Definition at line 124 of file PyPostYolo.py.
PyPostYolo.PyPostYolo.maxnbox |
Definition at line 70 of file PyPostYolo.py.
PyPostYolo.PyPostYolo.nms |
Definition at line 66 of file PyPostYolo.py.
PyPostYolo.PyPostYolo.yolopp |
Definition at line 45 of file PyPostYolo.py.
Referenced by PyPostYolo.PyPostYolo.freeze().