Skip to main content

Scribble Annotation Generator

Programmatically generate semi-realistic scribble annotations for segmentation-style tasks. The project exposes a single CLI entrypoint for two workflows: synthetic crop-field generation and training/inference of the neural scribble generator.

Installation

pip install -e .
# or
pip install scribble-annotation-generator

After installation, the CLI command scribble-annotation-generator becomes available.

Colour Map Specification

Many commands require a colour map that links RGB tuples to class IDs. Provide it in either form:

  • Inline string: R,G,B=class;R,G,B=class (also accepts R,G,B:class)
    • Example: 0,0,0=0;0,128,255=1;124,255,121=2
  • File path: a text file with one entry per line. Each line is R,G,B,class. If the class column is omitted, class IDs are assigned by line order starting at 0.

CLI

1) Crop-field synthesis

Generate synthetic crop-field scribble images using a procedural model.

scribble-annotation-generator crop-field \
  --colour-map "0,0,0=0;0,128,255=1;124,255,121=2" \
  --output-dir ./path/to/output \
  --num-samples 50 \
  --min-rows 4 \
  --max-rows 6

Key flags:

  • --colour-map (required): inline or file as described above
  • --output-dir: where PNGs are written (default ./local/crop_field)
  • --num-samples: number of images to create (default 200)
  • --min-rows, --max-rows: range for rows per sample

2) Train and run neural generator

Train the transformer-based object generator on a dataset of scribble annotations, then render model predictions on the validation set.

scribble-annotation-generator train-nn \
  --train-dir ./local/soybean1/train \
  --val-dir ./local/soybean1/val \
  --colour-map ./colour_map.csv \
  --checkpoint-dir ./local/nn-checkpoints \
  --inference-dir ./local/nn-inference \
  --batch-size 8 \
  --num-workers 4 \
  --max-epochs 50

Key flags:

  • --train-dir, --val-dir (required): directories containing training and validation data
  • --colour-map (required): inline or file form
  • --checkpoint-dir: where PyTorch Lightning checkpoints are stored (default ./local/nn-checkpoints)
  • --inference-dir: where rendered scribbles from validation samples are saved (default ./local/nn-inference)
  • --batch-size, --num-workers, --max-epochs: training configuration
  • --num-classes: override number of classes; by default derived from the colour map

Python API

Instead of calling the CLI, you can call the main functions directly:

  • scribble_annotation_generator.crop_field.generate_crop_field_dataset(output_dir, colour_map, num_samples=..., min_rows=..., max_rows=...)
  • scribble_annotation_generator.nn.train_and_infer(train_dir, val_dir, colour_map, checkpoint_dir=..., inference_dir=..., batch_size=..., num_workers=..., max_epochs=..., num_classes=None)
  • scribble_annotation_generator.bbox_random_generator.BBoxRandomGenerator(num_classes, num_components=..., class_names=..., colour_map=...).fit(dataset)

The bbox generator learns per-class object size distributions from existing annotation masks, then samples a class uniformly at inference time and places one fully contained bounding box at a random location.

License

MIT

Metadata

Release files for scribble-annotation-generator 0.3.3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for scribble-annotation-generator 0.3.3
File Size Uploaded Provenance Actions
scribble_annotation_generator-0.3.3.tar.gz 28.8 kB With provenance Details for scribble_annotation_generator-0.3.3.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for scribble-annotation-generator 0.3.3
File Interpreter ABI Platform Actions
scribble_annotation_generator-0.3.3-py3-none-any.whl Python 3 none any Details for scribble_annotation_generator-0.3.3-py3-none-any.whl

Total release size: 64.3 kB

Release files / scribble_annotation_generator-0.3.3.tar.gz

Download URL scribble_annotation_generator-0.3.3.tar.gz
Size 28.8 kB
Tags Source
SHA-256 checksum
How to use checksums
fa5550285ac38465506291094057df79e16e0138b12ab07f24279a6d8b5f145d
BLAKE2b-256 checksum
How to use checksums
c8ce5bf70ed2017723a4ac2218369ad1ea68bb862b93ef6ad6b6c60f31b0dab0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on May 10, 2026.

Transparency log

Release files / scribble_annotation_generator-0.3.3-py3-none-any.whl

Download URL scribble_annotation_generator-0.3.3-py3-none-any.whl
Size 35.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
6dc5c7d1c437f1d7060020d4bcf749d3b810e9ff6f9f7b919f5c2cfd865f25be
BLAKE2b-256 checksum
How to use checksums
124660d2daf83b42c4e95e40d65a35544ab8ee166042a2362a0839fda7bbfa7d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on May 10, 2026.

Transparency log

Security for scribble-annotation-generator 0.3.3

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for scribble_annotation_generator-0.3.3.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on May 10, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page