﻿# Deep EXR for learning pipelines: preserve per-pixel samples before choosing a flat target

Handle ragged deep OpenEXR data explicitly, keeping sample counts, depth intervals and opacity semantics before constructing dense tensors for GPU training.

Author: Retrivium editorial team
Updated: 2026-11-04
Canonical URL: https://retrivium.ai/journal/fg2-openexr-deep-pixels-ragged-training-input/
Language: en

## Identify whether the input is deep

An EXR extension does not imply a dense image tensor with a fixed number of values at every pixel. Deep images can store several samples along a viewing direction, including no samples at some pixels. A learning pipeline must decide whether those samples are useful structured input or whether the task requires a particular flattened image. Make that decision before allocating a dense GPU batch or silently selecting a sample.

## Preserve ragged sample alignment

The [OpenEXR Python documentation](https://openexr.com/en/latest/python.html) describes deep channels represented through object arrays containing per-pixel sample arrays. A dense image shape therefore does not describe the full amount of sample data or its memory footprint. Preserve sample counts and cross-channel alignment during conversion. If packing samples into contiguous buffers, keep offsets and validity information sufficient to reconstruct each pixel's associated measurements rather than padding values without a recorded interpretation.

## Understand depths and opacity

The [deep-pixel interpretation guide](https://openexr.com/en/latest/InterpretingDeepPixels.html) distinguishes surface-like point samples from volume samples with depth intervals and defines associated alpha semantics. A deep sample is not necessarily a separate visible object or an independent measurement. Sorting, overlapping intervals and opacity affect compositing. Taking a nearest stored value, averaging samples and compositing them answer different questions, so name the chosen output quantity in the dataset specification.

## Separate file access from reduction policy

The [image I/O documentation](https://openexr.com/en/latest/ReadingAndWritingImageFiles.html) provides interfaces for deep and multipart storage. Reading a valid file does not establish the application's desired reduction. For example, an RGB training target may require compositing, while a geometric target may require a specifically defined visible-surface depth. Implement and check those policies independently of the container reader. Preserve raw deep data when a later experiment may need a different target definition.

## Test transparent and empty regions

Use an example containing an empty pixel, overlapping transparent surfaces and a volume interval. Verify that the conversion handles each case without confusing absence, transparency and a numerical zero. The guides to [renderer compatibility](/journal/gpu-llm-renderer-compatibility-matrix/) and [dataset identity](/journal/data-guide-coco-instance-caption-identities/) supply adjacent context. Record the packing or compositing method with the exported tensor so downstream training can distinguish an intentional target from an accidental loss of deep structure.
