GStreamer Video Analytics (GVA) Plugin
Public Member Functions | List of all members
gstgva.region_of_interest.RegionOfInterest Class Reference

This class represents region of interest - object describing detection result (bounding box) and containing multiple Tensor objects (inference results) attached by multiple models. More...

Inheritance diagram for gstgva.region_of_interest.RegionOfInterest:
Inheritance graph
[legend]
Collaboration diagram for gstgva.region_of_interest.RegionOfInterest:
Collaboration graph
[legend]

Public Member Functions

def rect (self)
 Get bounding box of the RegionOfInterest as pixel coordinates in original image. More...
 
def normalized_rect (self)
 Get bounding box of the RegionOfInterest as normalized coordinates in the range [0, 1]. More...
 
str label (self)
 Get class label of this RegionOfInterest. More...
 
float confidence (self)
 Get confidence from detection Tensor, last added to this RegionOfInterest. More...
 
int object_id (self)
 Get object id. More...
 
def tensors (self)
 Get all Tensor instances added to this RegionOfInterest. More...
 
Tensor detection (self)
 Returns detection Tensor, last added to this RegionOfInterest. More...
 
int label_id (self)
 Get label_id from detection Tensor, last added to this RegionOfInterest. More...
 
Tensor add_tensor (self, str name="")
 Add new Tensor (inference result) to the RegionOfInterest. More...
 
VideoRegionOfInterestMeta meta (self)
 Get VideoRegionOfInterestMeta containing bounding box information and tensors (inference results). More...
 
def __init__ (self, VideoRegionOfInterestMeta roi_meta)
 Construct RegionOfInterest instance from VideoRegionOfInterestMeta. More...
 

Detailed Description

This class represents region of interest - object describing detection result (bounding box) and containing multiple Tensor objects (inference results) attached by multiple models.

For example, it can be region of interest with detected face and recognized age and sex of a person. It can be produced by a pipeline with gvadetect with detection model and two gvaclassify elements with two classification models. Such RegionOfInterest will have bounding box coordinates filled and will have 3 Tensor objects attached - 1 Tensor object with detection result and 2 Tensor objects with classification results coming from 2 classifications

Constructor & Destructor Documentation

◆ __init__()

def gstgva.region_of_interest.RegionOfInterest.__init__ (   self,
VideoRegionOfInterestMeta  roi_meta 
)

Construct RegionOfInterest instance from VideoRegionOfInterestMeta.

After this, RegionOfInterest will obtain all tensors (detection & inference results) from VideoRegionOfInterestMeta

Parameters
roi_metaVideoRegionOfInterestMeta containing bounding box information and tensors

Member Function Documentation

◆ add_tensor()

Tensor gstgva.region_of_interest.RegionOfInterest.add_tensor (   self,
str   name = "" 
)

Add new Tensor (inference result) to the RegionOfInterest.

Parameters
nameName for the tensor. This function does not take ownership of tensor passed, but only copies its contents
Returns
just created Tensor object, which can be filled with tensor information further

◆ confidence()

float gstgva.region_of_interest.RegionOfInterest.confidence (   self)

Get confidence from detection Tensor, last added to this RegionOfInterest.

Returns
last added detection Tensor confidence if exists, otherwise None

◆ detection()

Tensor gstgva.region_of_interest.RegionOfInterest.detection (   self)

Returns detection Tensor, last added to this RegionOfInterest.

As any other Tensor, returned detection Tensor can contain arbitrary information. If you use RegionOfInterest based on VideoRegionOfInterestMeta attached by gvadetect by default, then this Tensor will contain "label_id", "confidence", "x_min", "x_max", "y_min", "y_max" fields. If RegionOfInterest doesn't have detection Tensor, it will be created in-place

Returns
detection Tensor, empty if there were no detection Tensor objects added to this RegionOfInterest when this method was called

◆ label()

str gstgva.region_of_interest.RegionOfInterest.label (   self)

Get class label of this RegionOfInterest.

Returns
Class label of this RegionOfInterest

◆ label_id()

int gstgva.region_of_interest.RegionOfInterest.label_id (   self)

Get label_id from detection Tensor, last added to this RegionOfInterest.

Returns
last added detection Tensor label_id if exists, otherwise None

◆ meta()

VideoRegionOfInterestMeta gstgva.region_of_interest.RegionOfInterest.meta (   self)

Get VideoRegionOfInterestMeta containing bounding box information and tensors (inference results).

Tensors are represented as GstStructures added to GstVideoRegionOfInterestMeta.params

Returns
VideoRegionOfInterestMeta containing bounding box and tensors (inference results)

◆ normalized_rect()

def gstgva.region_of_interest.RegionOfInterest.normalized_rect (   self)

Get bounding box of the RegionOfInterest as normalized coordinates in the range [0, 1].

Returns
Bounding box coordinates of the RegionOfInterest

◆ object_id()

int gstgva.region_of_interest.RegionOfInterest.object_id (   self)

Get object id.

Returns
object id as an int, None if failed to get

◆ rect()

def gstgva.region_of_interest.RegionOfInterest.rect (   self)

Get bounding box of the RegionOfInterest as pixel coordinates in original image.

Returns
Bounding box coordinates of the RegionOfInterest

◆ tensors()

def gstgva.region_of_interest.RegionOfInterest.tensors (   self)

Get all Tensor instances added to this RegionOfInterest.

Returns
list of Tensor instances added to this RegionOfInterest

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