added augment demo images
This commit is contained in:
parent
7292c3575e
commit
e49f0eab20
|
@ -28,4 +28,7 @@ There are 2 APIs (`aug.Compose` and `aug.OneOf`) to compose augmentation methods
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
||||||
|
![transformed images](augment.png)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
BIN
example/augmentation/augment.png
Normal file
BIN
example/augmentation/augment.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 476 KiB |
|
@ -16,8 +16,8 @@ func main() {
|
||||||
panic(err)
|
panic(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
device := gotch.CudaIfAvailable()
|
// device := gotch.CudaIfAvailable()
|
||||||
// device := gotch.CPU
|
device := gotch.CPU
|
||||||
imgTs := img.MustTo(device, true)
|
imgTs := img.MustTo(device, true)
|
||||||
// t, err := aug.Compose(aug.WithResize(512, 512)) // NOTE. WithResize just works on CPU.
|
// t, err := aug.Compose(aug.WithResize(512, 512)) // NOTE. WithResize just works on CPU.
|
||||||
// t, err := aug.Compose(aug.WithRandRotate(0, 360), aug.WithColorJitter(0.3, 0.3, 0.3, 0.4))
|
// t, err := aug.Compose(aug.WithRandRotate(0, 360), aug.WithColorJitter(0.3, 0.3, 0.3, 0.4))
|
||||||
|
@ -37,6 +37,7 @@ func main() {
|
||||||
// t, err := aug.Compose(aug.WithNormalize(aug.WithNormalizeMean([]float64{0.485, 0.456, 0.406}), aug.WithNormalizeStd([]float64{0.229, 0.224, 0.225})))
|
// t, err := aug.Compose(aug.WithNormalize(aug.WithNormalizeMean([]float64{0.485, 0.456, 0.406}), aug.WithNormalizeStd([]float64{0.229, 0.224, 0.225})))
|
||||||
|
|
||||||
t, err := aug.Compose(
|
t, err := aug.Compose(
|
||||||
|
aug.WithResize(200, 200),
|
||||||
aug.WithRandomVFlip(0.5),
|
aug.WithRandomVFlip(0.5),
|
||||||
aug.WithRandomHFlip(0.5),
|
aug.WithRandomHFlip(0.5),
|
||||||
aug.WithRandomCutout(),
|
aug.WithRandomCutout(),
|
||||||
|
|
|
@ -761,7 +761,6 @@ func applyGridTransform(x, gridInput *ts.Tensor, mode string, fillValue []float6
|
||||||
addTs := mask.MustMul1(ts.FloatScalar(-1), false).MustAdd1(ts.FloatScalar(1.0), true).MustMul(fillImg, true)
|
addTs := mask.MustMul1(ts.FloatScalar(-1), false).MustAdd1(ts.FloatScalar(1.0), true).MustMul(fillImg, true)
|
||||||
imgOut := image.MustMul(mask, true).MustAdd(addTs, true)
|
imgOut := image.MustMul(mask, true).MustAdd(addTs, true)
|
||||||
addTs.MustDrop()
|
addTs.MustDrop()
|
||||||
image.MustDrop()
|
|
||||||
mask.MustDrop()
|
mask.MustDrop()
|
||||||
fillImg.MustDrop()
|
fillImg.MustDrop()
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user