Skip to content

Latest commit

 

History

History

augmentation

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Image Augmentation Example

This example demonstrates how to use image augmentation functions. It is implemented as similar as possible to original Pytorch vision/transform.

There are 2 APIs (aug.Compose and aug.OneOf) to compose augmentation methods as shown in the example:

		t, err := aug.Compose(
			aug.WithRandomVFlip(0.5),
			aug.WithRandomHFlip(0.5),
			aug.WithRandomCutout(),
			aug.OneOf(
				0.3,
				aug.WithColorJitter(0.3, 0.3, 0.3, 0.4),
				aug.WithRandomGrayscale(1.0),
			),
			aug.OneOf(
				0.3,
				aug.WithGaussianBlur([]int64{5, 5}, []float64{1.0, 2.0}),
				aug.WithRandomAffine(),
			),
		)
		if err != nil {
			panic(err)
		}

		out := t.Transform(imgTs)

transformed images