Interface TensorFromImageDataOptions

interface TensorFromImageDataOptions {
    dataType?: "float32" | "uint8";
    norm?: {
        bias?: number | [number, number, number] | [number, number, number, number];
        mean?: number | [number, number, number] | [number, number, number, number];
    };
    resizedHeight?: number;
    resizedWidth?: number;
    tensorFormat?: ImageFormat;
    tensorLayout?: ImageTensorLayout;
}

Hierarchy (view full)

Properties

dataType?: "float32" | "uint8"

Describes the data type of the tensor.

norm?: {
    bias?: number | [number, number, number] | [number, number, number, number];
    mean?: number | [number, number, number] | [number, number, number, number];
}

Describes normalization parameters when preprocessing the image as model input.

Data element are ranged from 0 to 255.

Type declaration

  • Optional bias?: number | [number, number, number] | [number, number, number, number]

    The 'bias' value for image normalization.

    • If omitted, use default value 0.
    • If it's a single number, apply to each channel
    • If it's an array of 3 or 4 numbers, apply element-wise. Number of elements need to match the number of channels for the corresponding image format
  • Optional mean?: number | [number, number, number] | [number, number, number, number]

    The 'mean' value for image normalization.

    • If omitted, use default value 255.
    • If it's a single number, apply to each channel
    • If it's an array of 3 or 4 numbers, apply element-wise. Number of elements need to match the number of channels for the corresponding image format
resizedHeight?: number

Describes the resized height. If omitted, original height will be used.

resizedWidth?: number

Describes resized width - can be accessed via tensor dimensions as well

tensorFormat?: ImageFormat

Describes the image format of the tensor.

NOTE: this is different from option 'format'. While option 'format' represents the original image, 'tensorFormat' represents the target format of the tensor. A transpose will be performed if they are different.

tensorLayout?: ImageTensorLayout

Describes the tensor layout when representing data of one or more image(s).

Generated using TypeDoc