TensorParameters Class Reference

Class containing the parameters of a Tensor. More...

Functions

Resolution target_size (self)
 Target size for the input image (Width, Height). More...
 
TENSOR_PIXEL_TYPE pixel_type (self)
 Pixel data type for the Tensor elements. More...
 
list[float] mean (self)
 Normalization parameter: Mean. More...
 
list[float] std (self)
 Normalization parameter: Standard Deviation. More...
 
bool stretch (self)
 If true, stretches the image to target_size. More...
 
list[float] scale (self)
 Scale factor applied to the pixel values before normalization.
 
TENSOR_COLOR_FORMAT color_format (self)
 Desired color format for the output Tensor.
 
TENSOR_LAYOUT layout (self)
 Desired memory layout for the output Tensor. More...
 
int batch_size (self)
 Number of images in the batch.
 
MEM memory_type (self)
 Where the Tensor should be stored (CPU or GPU).
 
int get_pixel_size (self)
 Returns the size in bytes of a single pixel element based on pixel_type. More...
 
int get_requested_channels (self)
 Returns the number of channels associated with the color_format. More...
 

Detailed Description

Class containing the parameters of a Tensor.

Functions

◆ target_size()

Resolution target_size (   self)

Target size for the input image (Width, Height).

Default: (640,640).

◆ pixel_type()

TENSOR_PIXEL_TYPE pixel_type (   self)

Pixel data type for the Tensor elements.

Note
Specifies the underlying data type: UCHAR (8-bit), FLOAT (32-bit), or HALF (16-bit). Default: TENSOR_PIXEL_TYPE.FLOAT.

◆ mean()

list[float] mean (   self)

Normalization parameter: Mean.

Note
Pixel = (Pixel * Scale - Mean) / Std. Default: ImageNet Standard [0.485, 0.456, 0.406].

◆ std()

list[float] std (   self)

Normalization parameter: Standard Deviation.

Note
Pixel = (Pixel * Scale - Mean) / Std. Default: ImageNet Standard [0.229, 0.224, 0.225].

◆ stretch()

bool stretch (   self)

If true, stretches the image to target_size.

If false, keeps aspect ratio and applies letterboxing (padding).

◆ layout()

TENSOR_LAYOUT layout (   self)

Desired memory layout for the output Tensor.

Note
NCHW (planar) is common for PyTorch models.
NHWC (interleaved) is common for TensorFlow models.

◆ get_pixel_size()

int get_pixel_size (   self)

Returns the size in bytes of a single pixel element based on pixel_type.

Returns
The size in bytes (1 for UCHAR, 2 for HALF, 4 for FLOAT).

◆ get_requested_channels()

int get_requested_channels (   self)

Returns the number of channels associated with the color_format.

Returns
The number of channels.