image_processor
image_processor
¶
Image processor for per-camera resize, augmentation, and normalization.
ImageProcessor
¶
ImageProcessor(color_augmentation=None, spatial_augmentation=None, camera_metadata=None, train=True)
Per-camera image processing: resize, augmentation, normalization, channel reorder.
Note
At training time: resize → color augmentation (RGB only) → spatial augmentation → channel reorder → dtype normalization. At inference time: resize → channel reorder → dtype normalization.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
color_augmentation
|
Compose | None
|
Albumentations compose for color augmentations. |
None
|
spatial_augmentation
|
Compose | None
|
Albumentations compose for spatial augmentations. |
None
|
camera_metadata
|
dict[str, CameraMetadata] | None
|
Per-camera metadata from the observation space. Each camera's image_height/image_width defines the resize target. Single-channel cameras use nearest-neighbor interpolation. |
None
|
train
|
bool
|
Whether in training mode. Augmentations are only applied during training. |
True
|
Source code in src/versatil/data/processing/image_processor.py
normalize_image_tensor
staticmethod
¶
Normalize image tensors to floating point.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
image
|
Tensor
|
Image tensor. |
required |
max_pixel_value
|
float | None
|
Value used to scale the image tensor. |
None
|
Returns:
| Type | Description |
|---|---|
Tensor
|
Float image tensor. |
Source code in src/versatil/data/processing/image_processor.py
begin_sample
¶
Start a new sample, drawing fresh shared spatial parameters.
Call once per sample before processing its cameras; every frame and camera processed until the next call replays the same spatial transform parameters.
Source code in src/versatil/data/processing/image_processor.py
process
¶
Process camera images: resize, augment, normalize, reorder channels.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
images
|
ndarray
|
Array of images (T, H, W, C) as uint8 or float. |
required |
camera_key
|
str
|
Camera key for per-camera processing. |
required |
Returns:
| Type | Description |
|---|---|
Tensor
|
Processed images as (T, C, H, W) float32 tensor. |