Class: AbstractAugmenter

AbstractAugmenter()

new AbstractAugmenter()

All augmenters are following the same pattern

  • First create the augmenter
  • Then run it
    • using augmenter.readFiles([filename1, filename2, ...])
    • using augmenter.run({images: <images>, points: <points per image>})
Source:
Examples
// Create one simple augmenter
const augmenter = ia.blur(0.2)
// Augment using filenames
augmenter.read([filename1, filename2, filename3]).then(({images}) => {
	console.log(images)
	// => 3 images
})
// Run the augmenter 4 times
augmenter.run({images: [img, img, img, img]}).then(({images}) => {
	console.log(images)
	// => 4 images
})
// follow a point in the augmentation workflow
augmenter.run({images: images, points: [[[25, 90], [12, 32]]]}).then(({images, points}) => {
	console.log(points)
	// => 2 points
})

Methods

read(runOpts) → {Promise.<AugmenterFormat>}

Augment images and return the result in a pipeable format

Can be used with different input format :

  • Using or array will be considered as images
  • Full input format is {images: , boxes: [[[x1, y1, w1, h1]]], points:[[[x1, y1]]] }
Parameters:
Name Type Description
runOpts AugmenterFormat | Images
Source:
Returns:

the output is pipeable into other augmenters (format is {images, points, boxes})

Type
Promise.<AugmenterFormat>

toGrid(runOpts) → {Promise.<AugmenterFormat>}

Get a grid image

Parameters:
Name Type Description
runOpts AugmenterFormat | String | Array.<String> | Images

{images}

gridOptions.gridShape Array.<Number>

[n,m] create a grid of n images per row, and m rows

gridOptions.imageShape Array.<Number>

[w,h] each image in the grid is reshaped to [w,h] size

Source:
Returns:

grid a {images} object with only one grid image

Type
Promise.<AugmenterFormat>