JeVoisBase  1.20
JeVois Smart Embedded Machine Vision Toolkit Base Modules
Share this page:
PyPreBlob.PyPreBlob Class Reference

Simple DNN pre-processor written in python. More...

Public Member Functions

def __init__ (self)
 [Optional] Constructor More...
 
def init (self)
 [Optional] JeVois parameters initialization More...
 
def 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. 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 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. More...
 

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__()

def PyPreBlob.PyPreBlob.__init__ (   self)

[Optional] Constructor

Definition at line 32 of file PyPreBlob.py.

Member Function Documentation

◆ init()

def PyPreBlob.PyPreBlob.init (   self)

[Optional] JeVois parameters initialization

Definition at line 37 of file PyPreBlob.py.

◆ process()

def 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 demo.int, mobilenet_v1.MobileNetV1.mean, mobilenet_v2.MobileNetV2.mean, quantize-inc.Dataset.mean, transform.Normalize.mean, PyPreBlob.PyPreBlob.mean, PyPostClassify.PyPostClassify.results, PyPreBlob.PyPreBlob.results, PyPostStub.PyPostStub.results, and PyPreBlob.PyPreBlob.scale.

◆ report()

def 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

PyPreBlob.PyPreBlob.results

Definition at line 33 of file PyPreBlob.py.

Referenced by PyPreBlob.PyPreBlob.process().

◆ scale


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