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.

Open-Source Python Library 98.8% Memory Reduction 1.7x Faster Pipeline Native Vector Polygons

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:

Stage 1: Raw Radiograph Original
AugmenTory Dental Original Annotations
Multi-Object Ground Truth
Full field-of-view with raw vector polygon annotations for restorations (blue) and caries (red).
Stage 2: Affine Transform Augmented
AugmenTory Dental Affine Rotation & Crop
Rotation, Scale & Crop
Vector vertices recalculated directly in coordinate space under rotation and translation, automatically clipping boundaries without pixel mask rasterization.
Stage 3: Sub-Pixel Crop Augmented
AugmenTory Dental RoI Tooth Crop
Isolated Tooth Region (RoI)
High-resolution localized zoom preserving exact sub-pixel polygon contours and eliminating degenerate sliver vertices.

Computational Efficiency and Results

AugmenTory reduces spatial memory overhead while speeding up batch generation:

98.8%
Memory Overhead Cut
Operates purely on vector polygon coordinate vertices
1.7x
Faster Batch Generation
Eliminates heavy CPU pixel-mask rasterization step
Zero Loss
Sub-Pixel Precision
Preserves exact polygon contours without aliasing
PyPI
Open-Source Release
Reusable across academic and industrial segmentation projects