Summary
- New AnnotationArtifacts image-only transform for synthetic scientific markup: text, rectangles, arrows, guide lines, and callouts.
- Distortion transforms regained
map_resolution_range, allowing displacement maps to be generated below full resolution and upscaled before remapping. - Low-resolution distortion maps now preserve full-size output maps, replay/applied-config sampling, identity maps, tiny images, and consistent application across masks, boxes, and keypoints.
- Project version bumped from
2.2.6to2.3.0; no dependency bump. - AI assistant guidance is shared across Cursor, Codex, and Claude entry points.
Breaking changes
None.
New features
AnnotationArtifacts (other)
AnnotationArtifacts adds sparse synthetic annotation artifacts directly onto images. It samples from five artifact types: text, rectangles, arrows, horizontal/vertical guide lines, and zoom-style callout boxes.
The transform is intended for scientific figures, medical images, microscopy screenshots, and datasets where models should be robust to human markup. It is image-only, supports uint8 and float32, and supports arbitrary channel counts. Black and white artifacts affect all channels; red maps to the first channel and pads remaining channels with zero.
Key parameters:
element_types/element_probabilities: artifact type sampling.count_range: number of artifacts drawn per image.text_length_range,font_scale_range,thickness_range: text and stroke controls.size_ratio_range,line_length_ratio_range,tip_length_range: relative geometry controls.corner_prob: bias toward corners and edges.black_white_prob: probability of black/white instead of red.
The generated artifacts are sampled in get_params_dependent_on_data, so seeded Compose, replay, and deterministic pipelines preserve the exact markup.
map_resolution_range restored for distortion transforms
map_resolution_range is available again on BaseDistortion subclasses:
- ElasticTransform
- GridDistortion
- OpticalDistortion
- PiecewiseAffine
- ThinPlateSpline
- WaterRefraction
- PixelSpread
The parameter accepts a tuple in (0, 1], defaults to (1.0, 1.0), samples one scalar per transform application, and records the sampled scalar in applied_config["map_resolution_range"]. Values below 1.0 generate smaller distortion maps and upscale them to the target image size before remapping.
Bug fixes
Low-resolution distortion maps preserve shape and identity (#259)
Reduced-resolution maps now always return full-size float32 map_x / map_y arrays, including tiny images. Upscaling an identity map preserves exact identity coordinates, so no-op configurations remain no-op with map_resolution_range < 1.0.
PixelSpread at low map resolution (#259)
PixelSpread keeps its discrete displacement behavior when map_resolution_range is below full resolution. The restored map-resolution path applies consistently to image, mask, bbox, keypoint, volume, and mask3d targets through the shared distortion machinery.
Misc
README.mdtransform list now includes AnnotationArtifacts.pyproject.tomlanduv.locknow report version2.3.0..codex/skillsnow points at the shared.cursor/skillstree.AGENTS.mdadded;CLAUDE.mdnow delegates todocs/contributing/ai_assistant_guidelines.md.docs/contributing/ai_assistant_guidelines.mdcentralizes AI assistant review and coding guidance.- Pre-commit:
mirrors-mypyupdated fromv1.20.2tov2.0.0.
Commits
| Commit | PR | Description |
|---|---|---|
742abe2 | #254 | feat: add AnnotationArtifacts |
428cf07 | #255 | chore(release): bump version to 2.3.0 |
70f8fe5 | #258 | share AI assistant guidance across platforms |
7db78e7 | #259 | restore map_resolution_range for distortion transforms |