Release 2.7.0

Summary

  • Breaking: bboxes and keypoints must be NumPy arrays of shape (N, K). Lists and tuples now raise TypeError. #715
  • New batch flips for collated PyTorch batches: sample_flip and apply_flip_ flip a random subset of samples in place, on CPU or CUDA. #704
  • GlassBlur no longer raises on images too small to shuffle. #718

Breaking changes

bboxes and keypoints must be NumPy arrays

Previously, Compose accepted lists and tuples of boxes and keypoints, but returned NumPy arrays. That contradicted the documented promise that sequences come back as sequences (#714). Now bboxes and keypoints must be np.ndarray of shape (N, K), and an empty set is shape (0, K). Lists, tuples, and flat (0,) arrays raise TypeError. Label fields are unchanged.

With instance binding, each instance's bbox must be a one-dimensional array and its keypoints an (N, K) array. An instance without keypoints uses shape (0, K).

Migration: wrap annotations once, before calling the pipeline.

# Before
transform(image=image, bboxes=[[10, 20, 50, 80]], labels=["cat"])

# After
transform(image=image, bboxes=np.asarray([[10, 20, 50, 80]], dtype=np.float32), labels=["cat"])

# No annotations
bboxes = np.zeros((0, 4), dtype=np.float32)

#715

New features

  • albumentations.batch gains batch flips for collated PyTorch batches. sample_flip takes one direction (horizontal or vertical) and draws a yes/no flip decision per sample as a FlipPlan. apply_flip_ flips the selected images or volumes in place and reuses the same plan for masks at any resolution. CPU batches flip one sample at a time. CUDA batches use an optional Triton kernel, fall back to PyTorch, and do not synchronize with the host. API reference, #704

Bug fixes

  • GlassBlur: an image with a side of at most 2 * max_delta has no pixels to swap, but sampling computed a negative count and raised, for example on 10×3 images and in fast mode on 7×5. Such images now get only the two Gaussian blur passes. Larger images sample the same values as before. #718
  • Downscale: the docstring summary named the removed scale_min and scale_max arguments. It now names scale_range. #719
  • ImageCompression: docstring fix. #707

Misc

  • Dependency updates: runtime Python dependencies, including pydantic 2.14.4 (#708), GitHub Actions (#712), and development tools (#709, #710, #711).
  • Agent rules moved to .agents. The release-notes skill now links batch helpers to the API reference instead of Explore. #707, #719
  • README licensing now leads with the commercial license. #702

Commits

commitPRdescription
b81c55f#702docs(license): lead README licensing with the commercial license
878b0d6#707docs(agents): move rules to .agents, state channel contract, fix ImageCompression docstring
64dd28b#712fix(deps): bump the github-actions group with 3 updates
9a4259a#708fix(deps): bump the python-dependencies group with 7 updates
9fff204#709fix(deps-dev): bump types-pyyaml from 6.0.12.20261113 to 6.0.12.20261122
c3ea441#711fix(deps-dev): bump cyclonedx-bom from 8.0.1 to 9.0.0
6b0b706#710fix(deps-dev): bump types-setuptools
b69ed4b#715fix(core)!: require NumPy arrays for bboxes and keypoints
950a56c#704feat(batch): flip a random subset of images horizontally or vertically
8dd20b3#718fix(blur): blur GlassBlur images too small to shuffle instead of raising
81d9013#719docs: link batch helpers to API reference, fix Downscale summary
f01c4b7#720chore(release): prepare 2.7.0