Class SpeedChange<T>
- Namespace
- AiDotNet.Augmentation.Video
- Assembly
- AiDotNet.dll
Changes the playback speed of video by resampling frames.
public class SpeedChange<T> : TemporalAugmenterBase<T>, IAugmentation<T, ImageTensor<T>[]>
Type Parameters
TThe numeric type for calculations.
- Inheritance
-
AugmentationBase<T, ImageTensor<T>[]>SpeedChange<T>
- Implements
-
IAugmentation<T, ImageTensor<T>[]>
- Inherited Members
Remarks
For Beginners: Speed change makes video play faster or slower by keeping/skipping/duplicating frames. This simulates different action speeds and helps models recognize actions regardless of how fast they're performed.
Speed factors:
- 2.0 = double speed (skip every other frame)
- 1.0 = normal speed
- 0.5 = half speed (duplicate frames)
Constructors
SpeedChange(double, double, double, double)
Creates a new speed change augmentation.
public SpeedChange(double minSpeed = 0.8, double maxSpeed = 1.2, double probability = 0.5, double frameRate = 30)
Parameters
minSpeeddoubleMinimum speed factor (default: 0.8).
maxSpeeddoubleMaximum speed factor (default: 1.2).
probabilitydoubleProbability of applying this augmentation (default: 0.5).
frameRatedoubleFrame rate of the video (default: 30).
Properties
MaxSpeed
Gets the maximum speed factor.
public double MaxSpeed { get; }
Property Value
Remarks
Default: 1.2 (20% faster)
MinSpeed
Gets the minimum speed factor.
public double MinSpeed { get; }
Property Value
Remarks
Default: 0.8 (20% slower)
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
dataImageTensor<T>[]The input data.
contextAugmentationContext<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.