AugmenTory: Fast Vector Polygon Data Augmentation
Open-Source Python Framework for Memory-Efficient Instance Segmentation Pipelines
Project Overview
AugmenTory is an open-source Python library created to solve a common bottleneck in instance segmentation: the memory and speed overhead of rasterizing polygon masks during training. By computing transformations directly on coordinate vertices, AugmenTory delivers significant computational savings.
The Challenge
Standard computer vision augmentation tools rasterize polygon annotations into full-size 2D binary pixel arrays before applying geometric transformations. When training instance segmentation models on high-resolution clinical or industrial images, these pixel masks consume gigabytes of memory and create CPU bottlenecks that slow down training.
The Engineering Solution
I conceived, architected, and released AugmenTory:
- Direct Vector Coordinate Transformations: Calculates affine transforms (rotation, scaling, translation, shearing, reflection) directly on $(x, y)$ coordinate arrays, reducing data storage per object from hundreds of kilobytes to mere bytes.
- Built-In Post-Processing Thresholding: Includes intelligent polygon area filtering and edge-boundary clipping to eliminate invalid or degenerate sliver polygons created during augmentation.
- Framework Compatibility: Fully compatible with YOLO, COCO JSON, PyTorch Dataset loaders, and Albumentations formats.
Vector Transformation Pipeline in Action
The visual flow below illustrates how AugmenTory transforms full radiographic vector annotations directly into rotated and localized training samples without raster pixel bottlenecks:
Computational Efficiency and Results
AugmenTory reduces spatial memory overhead while speeding up batch generation: