TenCrop<T>
Models & Types · AiDotNet.Augmentation.Image
Extracts ten crops from an image: five crops plus their horizontal flips.
Inheritance: AugmentationBase<T, ImageTensor<T>> → ImageAugmenterBase<T> → TenCrop<T>
For Beginners
This creates 10 different views of your image: 5 crops (4 corners + center) and their mirror images. By averaging your model’s predictions over all 10 views, you can get more reliable results at test time.
How It Works
TenCrop extends FiveCrop by also flipping each of the five crops
horizontally, yielding 10 total views. This provides more diverse test-time augmentation
for improved classification accuracy.
When to use:
- Test-time augmentation when accuracy is paramount
- Competition settings where every fraction of a percent matters
When NOT to use:
- Training (use RandomCrop + RandomHorizontalFlip instead)
- Real-time applications (10x computation overhead)
Constructors
| Constructor | Summary |
|---|---|
TenCrop(int cropHeight, int cropWidth, bool useVerticalFlip, double probability) |
Creates a new TenCrop augmentation. |
TenCrop(int size, bool useVerticalFlip, double probability) |
Creates a new TenCrop augmentation with square crops. |
Properties
| Property | Summary |
|---|---|
bool UseVerticalFlip { get; } |
Gets whether to use vertical flips instead of horizontal flips. |
int CropHeight { get; } |
Gets the height of each crop. |
int CropWidth { get; } |
Gets the width of each crop. |
Methods
| Method | Summary |
|---|---|
IDictionary<string, object> GetParameters() |
|
List<ImageTensor<T>> GetCrops(ImageTensor<T> data) |
Extracts the ten crops from the image. |