gotch/example/augmentation
Goncalves Henriques, Andre (UG - Computer Science) 9257404edd Move the name of the module 2024-04-21 15:15:00 +01:00
..
output added image augmentation and minor fixed on ts.Lstsq 2021-05-22 21:02:22 +10:00
README.md added augment demo images 2021-05-22 21:49:31 +10:00
augment.png added augment demo images 2021-05-22 21:49:31 +10:00
bb-transformed.jpg reworked on vision/aug 2021-06-30 21:39:40 +10:00
bb.png added image augmentation and minor fixed on ts.Lstsq 2021-05-22 21:02:22 +10:00
bimg.png changed vision/aug input/output tensor dtype to be uint8 2021-06-22 00:03:31 +10:00
main.go Move the name of the module 2024-04-21 15:15:00 +01:00

README.md

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