Table of Contents

Class AugmentedSample<T, TData>

Namespace
AiDotNet.Augmentation.Image
Assembly
AiDotNet.dll

Represents a sample with its data and associated spatial targets.

public class AugmentedSample<T, TData>

Type Parameters

T

The numeric type for calculations.

TData

The data type (e.g., ImageTensor).

Inheritance
AugmentedSample<T, TData>
Inherited Members

Remarks

An augmented sample bundles together the data (e.g., image) with all its associated annotations that need to be transformed together when spatial augmentations are applied.

For Beginners: When you rotate an image, you also need to rotate any bounding boxes, keypoints, or segmentation masks associated with it. This class keeps all these elements together so they transform correctly.

Constructors

AugmentedSample(TData)

Creates a new augmented sample with only data.

public AugmentedSample(TData data)

Parameters

data TData

The primary data.

AugmentedSample(TData, Vector<T>?)

Creates a new augmented sample with data and labels.

public AugmentedSample(TData data, Vector<T>? labels)

Parameters

data TData

The primary data.

labels Vector<T>

The labels.

Properties

BoundingBoxes

Gets or sets the bounding boxes for object detection.

public List<BoundingBox<T>>? BoundingBoxes { get; set; }

Property Value

List<BoundingBox<T>>

Data

Gets or sets the primary data (e.g., image).

public TData Data { get; set; }

Property Value

TData

HasBoundingBoxes

Gets whether this sample has any bounding boxes.

public bool HasBoundingBoxes { get; }

Property Value

bool

HasKeypoints

Gets whether this sample has any keypoints.

public bool HasKeypoints { get; }

Property Value

bool

HasMasks

Gets whether this sample has any segmentation masks.

public bool HasMasks { get; }

Property Value

bool

HasSpatialTargets

Gets whether this sample has any spatial targets.

public bool HasSpatialTargets { get; }

Property Value

bool

Keypoints

Gets or sets the keypoints for pose estimation.

public List<Keypoint<T>>? Keypoints { get; set; }

Property Value

List<Keypoint<T>>

Labels

Gets or sets the label(s) for this sample.

public Vector<T>? Labels { get; set; }

Property Value

Vector<T>

Masks

Gets or sets the segmentation masks.

public List<SegmentationMask<T>>? Masks { get; set; }

Property Value

List<SegmentationMask<T>>

Metadata

Gets or sets additional metadata for this sample.

public IDictionary<string, object> Metadata { get; set; }

Property Value

IDictionary<string, object>

Methods

Clone()

Creates a deep copy of this sample including all targets.

public AugmentedSample<T, TData> Clone()

Returns

AugmentedSample<T, TData>

A new sample with deep-copied data and targets.

Remarks

All targets (BoundingBoxes, Keypoints, Masks, Labels) are deep-copied. Data is deep-copied if TData implements ICloneable; otherwise, it is shallow-copied and the caller should handle Data cloning if needed.