uavfpy.odcl.inference
Module Contents
Classes
Attributes
- uavfpy.odcl.inference._EDGETPU_SHARED_LIB
- uavfpy.odcl.inference.TENSOR_ORDERS
- class uavfpy.odcl.inference.TargetInterpreter(model_path, label_path, cpu, thresh, order_key='mobilenet')
Bases:
object
- get_labels(self, label_path)
- make_interpreter(self, model_path_or_content, device=None, delegate=None)
Make new TPU interpreter instance given a model path
- Parameters
- model_path_or_contentstr
filepath to model. recommended to use absolute path in ROS scripts
- devicestr, optional
None -> use any TPU “:<n>” -> use nth TPU “usb” -> use USB TPU “usb:<n> -> use nth USB TPU “pci” -> use PCI TPU “pci:<n> -> use nth PCI TPU
- delegateloaded TPU Delegate object, optional
supercedes “device” flag
- Returns
- tflite.Interpreter
the interpreter
- load_edgetpu_delegate(self, options=None)
load edgetpu delegate from _EDGETPU_SHARED_LIB with options
- Parameters
- optionsdict, optional
TPU options, by default None
- Returns
- loaded Delegate object
the TPU
- input_tensor(self)
get input tensor
- Returns
- tensor
the input tensor
- set_input_tensor(self, image, resize=False)
set the input tensor from (cv2) image array of size (h, w c)
- Parameters
- imagenp.array
h, w, c
- output_tensor(self, i)
Return output tensor regardless of quantization parameters
- Parameters
- iint
which output tensor to grab
- Returns
- tensor
output tensor
- input_image_size(self)
Get interpreter input size
- Returns
- tuple of int
(height, width, colors)
- interpret(self, img, resize=True)
- get_output(self, score_threshold)
Return list of detected objects
- Parameters
- score_thresholdfloat
number from 0-1 indicating thresh percentage
- Returns
- list of Target
list of namedtuples containing target info