image-augment
Augment images (geometric, noise, ...) for visual machine learning data augmentation.
This library has been freely inspired from imgaug
This library is intend to work
- with hasard for randomness
- with 2 different backends :
Installation
npm install image-augment
Simple example
// First you need a backend for image processing// this can be one of the following :// * @tensorflow/tfjs// * @tensorflow/tfjs-node// * @tensorflow/tfjs-node-gpu// * opencv4nodejs const tf = ; // Then initialize with the backend const ia = tf; // Create an augmentation pipelineconst basicAugmentation = ia; // tensorflow backend needs Tensor4d <-> filename function// see test/examples/simple-example.js for full implementation of those helpers (fileToTensor and tensorToFile) ;
Output is :

Grid example with opencv4nodejs
const h = ;const cv = ;const ia = cv; // Random example imagesconst sometimes = hvalueaug ia; const seq = ia;const image = cv; seq;
Output :

Grid Example with tensorflowjs
const h = ;const tf = ;const ia = tf; // Random example imagesconst sometimes = hvalueaug ia; const seq = ia; // tensorflow backend needs Tensor4d <-> filename function// see test/helpers/files-to-images for full implementation of those helpers (fileToTensor and tensorToFile)const filenames = 8;
Output :

API documentation
See documentation
Discussion
Opencv4nodejs vs Tensorflowjs
Both librairies have advantages, this is what you need to know
Why opencv4nodejs :
- easier to manipulate files in node.js (cv.imread ...)
- Using different image sizes with no impact on performance
Why tensorflowjs :
- Browser support
- integrate with DL training
- Fast Noise image generation (truncatedNormal)
See benchmark for more info about performance
Todo list
Help appreciated, please open an issue if you have any question.
- Add benchmark test to measure the speed
- Faster random generator using tensorflow js truncated normal
- Get affine transform to work with tensorflow backend
- add examples/explanations/benchmark in the README.md
- Run all unit tests on Travis
- Implement perspective Transform using tensorflowjs backend
- Put documentation on github pages
- Remove jimp deps
- create a demo app running in the browser with tfjs + webgl
- Speed up all non-batch implemented tensorflow augmenters
- Add more augmenters
- Add unit test and examples for cropToBox and DrawBoxes
- Stream API
- Faster gaussian and poisson noise generators