Polygon topology augmentation CLI for segmentation datasets.
Project description
PolyAug
PolyAug is a Python package and CLI for topology-aware polygon augmentation for segmentation datasets.
Generating augmented datasets is common with existing libraries such as Albumentations and Augmentor; however, they do not reliably preserve polygon structure when the polygon forms a ring or path-like shape. Such structures are common in raster-to-vector tasks and datasets such as floorplans.
See the paper for more details: Topology-Preserving Data Augmentation for Ring-Type Polygon Annotations.
This package addresses this gap by mitigating the topology inconsistency in such processes.
For installation, usage, and development instructions, see the sections below.
Features
- Augments images and LabelMe JSON together
- Choose augmentation parameters and ranges, or use defaults
- Supports cropping, rotation, scaling, translation, brightness, contrast
- CLI and Python API for flexibility
- Generates LabelMe JSON annotations in standard and indexed formats
Installation
We recommend installing inside a virtual environment to avoid dependency conflicts.
Supports windows, macOS, and Linux.
Install from PyPI
python3 -m venv .venv
source .venv/bin/activate
pip install --upgrade pip
pip install polyaug
Quick CLI Check
After installation, verify the CLI is available:
polyaug --help
Basic CLI Usage
polyaug \
--img-dir ./dataset/images \
--json-dir ./dataset/json \
--save-dir ./output \
--num-per-image 2 \
--crop 0.8 0.9 \
--rotation -30 30 \
--scale 0.7 1.3 \
--translate -0.1 0.1 \
--brightness -0.1 0.1 \
--contrast -0.1 0.1
Inputs
--img-dir: directory containing source images--json-dir: directory containing matching LabelMe JSON files
Outputs
Inside --save-dir, PolyAug writes:
images/→ augmented imagesjson/→ standard LabelMe JSON annotationsaugmented_index_json/→ indexed/debug JSON annotations
CLI Arguments
Required
--img-dir--json-dir
Optional
--save-dir--index-json-dir--num-per-image--crop MIN MAX--rotation MIN MAX--scale MIN MAX--translate MIN MAX--brightness MIN MAX--contrast MIN MAX--p-rotate--p-flip-h--p-flip-v--p-affine--p-crop--p-brightness--contour-simplify-epsilon--min-component-area--min-mask-pixel-area--random-aug-per-image--debug
To see the latest CLI options:
polyaug --help
Project Structure for Building the Package
A clean structure for the package is:
polyaug/
├── LICENSE
├── README.md
├── pyproject.toml
├── src/
│ └── polyaug/
│ ├── __init__.py
│ ├── augmentor.py
│ ├── cli.py
│ └── helper.py
└── tests/
└── test_imports.py
Citation / Research Use
You can cite PolyAug as:
@software{laudari2026polyaug,
title={PolyAug: Topology-Aware Polygon Augmentation for Segmentation Datasets},
author={Laudari, Sudip},
year={2026},
version={0.1.4},
url={https://pypi.org/project/polyaug/}
}
License
MIT License. See LICENSE for details.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file polyaug-0.1.4.tar.gz.
File metadata
- Download URL: polyaug-0.1.4.tar.gz
- Upload date:
- Size: 20.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
67d48acda1bfec14851c88750492b112c03ff7e1c654ec7f748cdef739b8527b
|
|
| MD5 |
38d0b10cd241276afd587b5bacd00d03
|
|
| BLAKE2b-256 |
0d1c34240318f2f8609d1603c7520ddaa3e6cf8c4db6ae6baa4b5d6befa0955a
|
Provenance
The following attestation bundles were made for polyaug-0.1.4.tar.gz:
Publisher:
publish.yml on Laudarisd/polyaug
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
polyaug-0.1.4.tar.gz -
Subject digest:
67d48acda1bfec14851c88750492b112c03ff7e1c654ec7f748cdef739b8527b - Sigstore transparency entry: 1077478282
- Sigstore integration time:
-
Permalink:
Laudarisd/polyaug@f3cf4bfbe0fb93891f5d550408454dead7bd5503 -
Branch / Tag:
refs/tags/v0.1.4 - Owner: https://github.com/Laudarisd
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@f3cf4bfbe0fb93891f5d550408454dead7bd5503 -
Trigger Event:
push
-
Statement type:
File details
Details for the file polyaug-0.1.4-py3-none-any.whl.
File metadata
- Download URL: polyaug-0.1.4-py3-none-any.whl
- Upload date:
- Size: 19.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0977d88bf0a8f04b4f2f384a98aa46452944d17f55ceff5868b467ad0e4e00b8
|
|
| MD5 |
afab37e90bb3c211dce28114225b95a4
|
|
| BLAKE2b-256 |
cc7b4ad035b056b6b0aeca452e7b5e58911264b088098386528fae3c7a2469b3
|
Provenance
The following attestation bundles were made for polyaug-0.1.4-py3-none-any.whl:
Publisher:
publish.yml on Laudarisd/polyaug
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
polyaug-0.1.4-py3-none-any.whl -
Subject digest:
0977d88bf0a8f04b4f2f384a98aa46452944d17f55ceff5868b467ad0e4e00b8 - Sigstore transparency entry: 1077478331
- Sigstore integration time:
-
Permalink:
Laudarisd/polyaug@f3cf4bfbe0fb93891f5d550408454dead7bd5503 -
Branch / Tag:
refs/tags/v0.1.4 - Owner: https://github.com/Laudarisd
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@f3cf4bfbe0fb93891f5d550408454dead7bd5503 -
Trigger Event:
push
-
Statement type: