JeVoisBase  1.22
JeVois Smart Embedded Machine Vision Toolkit Base Modules
Share this page:
Loading...
Searching...
No Matches

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
 

Detailed Description

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):

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 29 of file PyPreBlob.py.

Constructor & Destructor Documentation

◆ __init__()

PyPreBlob.PyPreBlob.__init__ (   self)

[Optional] Constructor

Definition at line 32 of file PyPreBlob.py.

Member Function Documentation

◆ init()

PyPreBlob.PyPreBlob.init (   self)

[Optional] JeVois parameters initialization

Definition at line 37 of file PyPreBlob.py.

◆ process()

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.

◆ report()

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.

Member Data Documentation

◆ mean

◆ results

◆ scale


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