apairo-transform
Runtime transforms and augmentations for apairo datasets — applied lazily at access time, with no data written to disk.
Unlike apairo-preprocess (offline, disk-bound), transforms are registered on a dataset and executed on every __getitem__ call.
Installation
pip install apairo-transform
pip install "apairo-transform[image]" # Resize, with OpenCV
pip install "apairo-transform[torch]" # to_torch_collate, to_tensors
Requires Python ≥ 3.11, numpy and apairo ≥ 0.9. No other hard dependencies.
Transforms
Point cloud — filter & downsample
| Class | Description |
|---|---|
RangeFilter(min, max) |
Keep points whose distance from the origin is within [min, max] metres |
RandomSubsample(n) |
Randomly subsample to at most n points |
ShufflePoints() |
Randomly permute the point order |
ChannelSelect(channels) |
Select a subset of columns (e.g. [0,1,2] for xyz only) |
VoxelDownsample(voxel_size) |
In-memory voxel-grid downsampling — one representative point per voxel |
Point cloud — temporal accumulation
| Class | Description |
|---|---|
StackByPose(lidar, pose, output, time_channel) |
Reducer for ds.window(): densify the anchor scan by stacking every scan of its window, each placed into the anchor's ego frame via its pose |
ApplyPose(lidar, pose) |
Move one scan into the world frame with its own pose |
Accumulation is a window of frames reduced to one sample. The window is
computed by index, so the result stays correct under shuffling, with several
DataLoader workers, and never mixes two sequences:
from apairo_transform import StackByPose
ds = ds.window(size=5, stride=1, reduce=StackByPose(lidar="lidar", pose="pose"))
On an asynchronous dataset, synchronize the scan and the pose first
(ds.synchronize(reference="lidar", method={"pose": Se3Interp()})).
AccumulateFramesis deprecated (0.3). It kept a rolling buffer, so it only worked on a sequential pass and needed.reset()between sequences. Replaceds.transform(AccumulateFrames(lidar, pose, num_frames=5, stride=1))withds.window(size=5, stride=1, reduce=StackByPose(lidar, pose)): same cloud, no state. It will be removed in a later release.
Point cloud — augmentation
| Class | Description |
|---|---|
RandomRotation(axis, max_angle) |
Rotate xyz by a random angle around "x", "y", "z", or full "so3" |
RandomFlip(axis, p) |
Mirror along "x" or "y" with probability p |
RandomScale(range) |
Scale xyz uniformly by a random factor in range |
RandomTranslation(sigma) |
Translate all points by a random vector drawn from N(0, σ²) |
GaussianNoise(sigma) |
Add independent per-point Gaussian noise to xyz |
RandomPointDrop(p) |
Drop each point independently with probability p |
Pose
| Class | Description |
|---|---|
PoseTo4x4() |
Convert (N,7) [tx ty tz qx qy qz qw] or (N,6) [tx ty tz rx ry rz] to (N,4,4) |
InvertPose() |
Closed-form rigid inverse of a (4,4) or (N,4,4) homogeneous matrix |
Label
| Class | Description |
|---|---|
RemapLabels(mapping) |
Remap integer class IDs via a {old: new} dictionary |
MaskLabels(keep, ignore_value) |
Set any label not in keep to ignore_value (default 255) |
Interpolation — for ds.synchronize()
Value-level strategies implementing the apairo.Interpolator contract:
instead of matching an existing event, the value is synthesized at the
reference instant from its two bracketing events. Continuous signals only.
| Class | Description |
|---|---|
LinearInterp() |
Linear blend between the bracketing values (commands, IMU, scalars) |
Se3Interp() |
SE(3) pose interpolation — lerp translation + shortest-path slerp rotation; accepts (7,) [tx ty tz qx qy qz qw] or (4,4) |
from apairo_transform.interp import LinearInterp, Se3Interp
ds_sync = ds.synchronize(
reference="velodyne_0",
method={
"gicp_poses": Se3Interp(), # pose interpolated at each lidar instant
"cmd": LinearInterp(),
}, # unlisted channels -> "latest"
)
Quickstart
Registering transforms on a dataset
Transforms are registered on a dataset channel and applied lazily on every __getitem__.
from apairo.dataset.rellis import Rellis3DDataset
from apairo_transform import RangeFilter, RandomSubsample, ChannelSelect
ds = Rellis3DDataset("/data/RELLIS/00000", keys=["lidar"])
ds = ds.transform("lidar", RangeFilter(max=50.0))
ds = ds.transform("lidar", RandomSubsample(8192))
ds = ds.transform("lidar", ChannelSelect([0, 1, 2])) # xyz only
sample = ds[0]
# sample.data["lidar"] -> np.ndarray (N, 3), N ≤ 8192, range < 50 m
Multiple calls on the same key compose in order, and each returns the
dataset to use next: assign it (ds = ds.transform(...)).
Chain transform() calls to build a dataset. Use
Compose from apairo core to
name an operation made of several transforms, so it can be reused as one
step, in a dataset or on a bare array:
from apairo.core import Compose
from apairo_transform import RangeFilter, RandomSubsample, ChannelSelect
clean_lidar = Compose([
RangeFilter(max=50.0),
RandomSubsample(8192),
ChannelSelect([0, 1, 2]),
])
ds = ds.transform("lidar", clean_lidar)
points = clean_lidar(raw_points) # the same operation, outside a dataset
Augmentation pipeline for training
from apairo.core import Compose
from apairo.dataset.rellis import Rellis3DDataset
from apairo_transform import (
RangeFilter, RandomRotation, RandomFlip,
RandomScale, GaussianNoise, RandomPointDrop,
)
ds = Rellis3DDataset("/data/RELLIS/00000", keys=["lidar"])
ds = ds.transform("lidar", Compose([
RangeFilter(max=50.0),
RandomRotation(axis="z"), # yaw-only for outdoor LiDAR
RandomFlip(axis="x", p=0.5),
RandomScale(range=(0.95, 1.05)),
GaussianNoise(sigma=0.01),
RandomPointDrop(p=0.05),
]))
Label remapping
from apairo.dataset.rellis import Rellis3DDataset
from apairo_transform import RemapLabels, MaskLabels
ds = Rellis3DDataset("/data/RELLIS/00000", keys=["labels"])
# Collapse 35 Rellis classes to 4 coarse categories
COARSE = {1: 0, 3: 0, 10: 0, 23: 0, # ground
4: 1, 7: 1, 19: 1, # vegetation
8: 2, 12: 2, 15: 2, 18: 2, # obstacle
9: 3} # sky
ds = ds.transform("labels", RemapLabels(COARSE, default=255))
ds = ds.transform("labels", MaskLabels(keep={0, 1, 2, 3}, ignore_value=255))
Pose conversion
from apairo.dataset.rellis import Rellis3DDataset
from apairo_transform import PoseTo4x4, InvertPose
ds = Rellis3DDataset("/data/RELLIS/00000", keys=["poses"])
# poses channel: (3, 4) → pad to (4, 4) and invert
ds = ds.transform("poses", PoseTo4x4())
ds = ds.transform("poses", InvertPose())
Voxel downsampling at access time
Unlike VoxelisePointCloud in apairo-preprocess (which saves to disk once), VoxelDownsample runs in memory on every access — useful for dynamic voxel sizes or when disk space is constrained.
from apairo_transform import VoxelDownsample
ds = ds.transform("lidar", VoxelDownsample(voxel_size=0.1, max_range=50.0))
Examples
Ready-to-run scripts in examples/:
# Filter + subsample a LiDAR channel
python examples/pointcloud.py /data/RELLIS/00000
# Remap or mask semantic labels
python examples/labels.py /data/RELLIS/00000 --mode remap
# Full multi-channel pipeline with Compose
python examples/compose.py /data/RELLIS/00000
# Augmentation pipeline — prints before/after statistics per frame
python examples/augmentation.py /data/RELLIS/00000 --rotation-axis z --drop-p 0.05
Relationship to apairo-preprocess
| apairo-transform | apairo-preprocess | |
|---|---|---|
| When | At access time (lazy) | Offline, once |
| Output | In-memory array | Files on disk |
| Deps | numpy only | numpy, scipy, KISS-ICP, … |
| Use case | Training loops, augmentation | Dataset preparation |
Both packages are complementary: run apairo-preprocess once to produce derived channels (odometry, traversability, voxelised coordinates), then use apairo-transform at training time to augment and normalise the data.
License
MIT
Metadata
Release files for apairo-transform 0.3.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| apairo_transform-0.3.0.tar.gz | 37.7 kB | With provenance | Details for apairo_transform-0.3.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| apairo_transform-0.3.0-py3-none-any.whl | Python 3 | none | any | Details for apairo_transform-0.3.0-py3-none-any.whl |
Total release size: 69.0 kB
Release files / apairo_transform-0.3.0.tar.gz
| Download URL | apairo_transform-0.3.0.tar.gz |
|---|---|
| Size | 37.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
c08d64335a1389506b931bb81865c7aafc8bc34cf7ffe7aaeaabbba49219f3bb
|
|
BLAKE2b-256 checksum How to use checksums |
b80fbec092624cbff9971b9f87d56457ddbf282404cb2787a10c13a87e45ff16
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
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 Nov 9, 2026.
Transparency logRelease files / apairo_transform-0.3.0-py3-none-any.whl
| Download URL | apairo_transform-0.3.0-py3-none-any.whl |
|---|---|
| Size | 31.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
642bc43598abd91cd3269d24fcee7b5ac50e8868e3da735880630239c9dbca36
|
|
BLAKE2b-256 checksum How to use checksums |
8d29d2c0b5a32ef7b2b5a5a367b4ab25b11f4a86ebd6d4a71dc0dd9d5ce72140
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
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 Nov 9, 2026.
Transparency logSecurity for apairo-transform 0.3.0
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.
Attestation for apairo_transform-0.3.0.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 Nov 9, 2026.
Transparency logA 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.