BaseAttributeModelOutputConverter

Inheritance diagram of BaseAttributeModelOutputConverter

BaseAttributeModelOutputConverter inheritance diagram

class savant.base.converter.BaseAttributeModelOutputConverter(**kwargs)

Base attribute model output converter.

abstract __call__(*output_layers, model, roi)

Converts raw model output tensors to a list of values in several formats:

  • classification
    • string label

    • int or float value

  • ReID
    • extracted descriptor as a vector of values

and so on, depending on the task.

Parameters:
  • output_layers (ndarray | cupy.ndarray) – Model output layer tensors

  • model (AttributeModel) – Attribute model

  • roi (Tuple[float, float, float, float]) – [top, left, width, height] of the rectangle on which the model infers

Returns:

list of attributes values with confidences (attr_name, value, confidence)

Return type:

List[Tuple[str, Any, float]] | None

tensor_format: TensorFormat = 0

Set to CuPy to get the output_layers tensors in the converter call on the GPU as a cupy.ndarray. Or set to NumPy to get tensors on the host as a numpy.ndarray.