JeVoisBase
1.22
JeVois Smart Embedded Machine Vision Toolkit Base Modules
|
|
Simple DNN pre-processor written in python. More...
Public Member Functions | |
__init__ (self) | |
[Optional] Constructor | |
init (self) | |
[Optional] JeVois parameters initialization | |
process (self, img, swaprb, attrs) | |
[Required] Main processing function: extract one or more 4D blobs from an image img is the input image from the camera sensor swaprb is true if we should swap red/blue channels (based on camera grab order vs. | |
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 send to USB) helper is None or a GUIhelper to do OpenGL drawings when in JeVois-Pro mode overlay is True if users 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 | |
scale | |
mean | |
Simple DNN pre-processor written in python.
This version is mainly for tutorial purposes and does not support as many features as the C++ PreProcessorBlob
Compare this code to the C++ PreProcessorBlob (which has more functionality than here):
Definition at line 29 of file PyPreBlob.py.
PyPreBlob.PyPreBlob.__init__ | ( | self | ) |
[Optional] Constructor
Definition at line 32 of file PyPreBlob.py.
PyPreBlob.PyPreBlob.init | ( | self | ) |
[Optional] JeVois parameters initialization
Definition at line 37 of file PyPreBlob.py.
PyPreBlob.PyPreBlob.process | ( | self, | |
img, | |||
swaprb, | |||
attrs | |||
) |
[Required] Main processing function: extract one or more 4D blobs from an image img is the input image from the camera sensor swaprb is true if we should swap red/blue channels (based on camera grab order vs.
network desired order) attrs is a list of string blob specifiers, one per desired blob (see below for format and parsing) We return a tuple with 2 lists: list of blobs, and list of crop rectangles that were used to extract the blobs. The Network will use the blobs, and a PostProcessor may use the crops to, e.g., rescale object detection boxes back to the original image.
Definition at line 57 of file PyPreBlob.py.
References mobilenet_v1.MobileNetV1.mean, mobilenet_v2.MobileNetV2.mean, quantize-inc.Dataset.mean, transform.Normalize.mean, PyPreBlob.PyPreBlob.mean, PyClassificationDNN.PyClassificationDNN.mean, PyDetectionDNN.PyDetectionDNN.mean, PyEmotion.PyEmotion.mean, PyPostClassify.PyPostClassify.results, PyPostStub.PyPostStub.results, PyPreBlob.PyPreBlob.results, PyPreBlob.PyPreBlob.scale, PyClassificationDNN.PyClassificationDNN.scale, PyDetectionDNN.PyDetectionDNN.scale, and PyEmotion.PyEmotion.scale.
PyPreBlob.PyPreBlob.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 send to USB) helper is None or a GUIhelper to do OpenGL drawings when in JeVois-Pro mode overlay is True if users 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 109 of file PyPreBlob.py.
PyPreBlob.PyPreBlob.mean |
Definition at line 45 of file PyPreBlob.py.
Referenced by transform.Normalize.__call__(), quantize-inc.Dataset.__getitem__(), mobilenet_v1.MobileNetV1._preprocess(), mobilenet_v2.MobileNetV2._preprocess(), PyPreBlob.PyPreBlob.process(), PyClassificationDNN.PyClassificationDNN.process(), and PyDetectionDNN.PyDetectionDNN.process().
PyPreBlob.PyPreBlob.results |
Definition at line 33 of file PyPreBlob.py.
Referenced by PyPreBlob.PyPreBlob.process(), PyPostClassify.PyPostClassify.process(), PyPostStub.PyPostStub.process(), and PyPostClassify.PyPostClassify.report().
PyPreBlob.PyPreBlob.scale |
Definition at line 40 of file PyPreBlob.py.
Referenced by PyPreBlob.PyPreBlob.process(), PyClassificationDNN.PyClassificationDNN.process(), and PyDetectionDNN.PyDetectionDNN.process().