2if pyjevois.pro:
import libjevoispro
as jevois
3else:
import libjevois
as jevois
34 self.
dataroot = jevois.Parameter(self,
'dataroot',
'str',
35 "Root directory to use when config or model parameters are relative paths.",
38 self.
intensors = jevois.Parameter(self,
'intensors',
'str',
39 "Specification of input tensors",
42 self.
outtensors = jevois.Parameter(self,
'outtensors',
'str',
43 "Specification of output tensors (optional)",
46 self.
config = jevois.Parameter(self,
'config',
'str',
47 "Path to a text file that contains network configuration. " +
48 "Can have extension .prototxt (Caffe), .pbtxt (TensorFlow), or .cfg (Darknet). " +
49 "If path is relative, it will be prefixed by dataroot.",
52 self.
model = jevois.Parameter(self,
'model',
'str',
53 "Path to a binary file of model contains trained weights. " +
54 "Can have extension .caffemodel (Caffe), .pb (TensorFlow), .t7 or .net (Torch), " +
55 ".tflite (TensorFlow Lite), or .weights (Darknet). If path is relative, it will be " +
56 "prefixed by dataroot.",
73 self.
net.setPreferableBackend(cv2.dnn.DNN_BACKEND_OPENCV)
74 self.
net.setPreferableTarget(cv2.dnn.DNN_TARGET_CPU)
82 if self.
net is None:
raise RuntimeError(
"Cannot process because no loaded network")
83 if len(blobs) != 1:
raise ValueError(
"Only one input blob is supported")
86 self.
net.setInput(blobs[0])
87 outs = self.
net.forward()
90 if self.
gflops is None: self.
gflops = int(self.
net.getFLOPS(blobs[0].shape) * 1.0e-9)
94 "{}GFLOPS".format(self.
gflops),
Simple DNN network invoked from OpenCV in python.
freeze(self, doit)
[Optional] Freeze some parameters that should not be changed at runtime
load(self)
[Required] Load the network from disk
init(self)
[Optional] JeVois parameters initialization
__init__(self)
[Optional] Constructor
process(self, blobs)
[Required] Main processing function: process input blobs through network and return output blobs blob...