Table of Contents

Class TemporalCrop<T>

Namespace
AiDotNet.Augmentation.Video
Assembly
AiDotNet.dll

Randomly crops a temporal segment from video.

public class TemporalCrop<T> : TemporalAugmenterBase<T>, IAugmentation<T, ImageTensor<T>[]>

Type Parameters

T

The numeric type for calculations.

Inheritance
TemporalCrop<T>
Implements
Inherited Members

Remarks

For Beginners: Temporal cropping takes a random consecutive portion of the video. For example, from a 10-second video, it might extract 8 seconds starting at a random point. This helps models learn to recognize actions regardless of when they occur in the video.

When to use:

  • Action recognition where action can occur anywhere in the video
  • Training with variable-length videos
  • Reducing overfitting to specific temporal positions

Constructors

TemporalCrop(double, double, double, double)

Creates a new temporal crop augmentation.

public TemporalCrop(double minCropRatio = 0.7, double maxCropRatio = 0.9, double probability = 0.5, double frameRate = 30)

Parameters

minCropRatio double

Minimum fraction of frames to keep (default: 0.7).

maxCropRatio double

Maximum fraction of frames to keep (default: 0.9).

probability double

Probability of applying this augmentation (default: 0.5).

frameRate double

Frame rate of the video (default: 30).

Properties

MaxCropRatio

Gets the maximum crop ratio (fraction of original length to keep).

public double MaxCropRatio { get; }

Property Value

double

Remarks

Default: 0.9 (keep at most 90% of frames)

MinCropRatio

Gets the minimum crop ratio (fraction of original length to keep).

public double MinCropRatio { get; }

Property Value

double

Remarks

Default: 0.7 (keep at least 70% of frames)

Methods

ApplyAugmentation(ImageTensor<T>[], AugmentationContext<T>)

Implement this method to perform the actual augmentation.

protected override ImageTensor<T>[] ApplyAugmentation(ImageTensor<T>[] data, AugmentationContext<T> context)

Parameters

data ImageTensor<T>[]

The input data.

context AugmentationContext<T>

The augmentation context.

Returns

ImageTensor<T>[]

The augmented data.

GetParameters()

Gets the parameters of this augmentation.

public override IDictionary<string, object> GetParameters()

Returns

IDictionary<string, object>

A dictionary of parameter names to values.