kaira.models.WynerZivModel

Inheritance diagram for WynerZivModel
- class kaira.models.WynerZivModel(encoder: BaseModel, channel: BaseChannel, decoder: BaseModel, correlation_model: WynerZivCorrelationModel | None = None, quantizer: BaseModel | None = None, syndrome_generator: BaseModel | None = None, constraint: BaseConstraint | None = None, *args: Any, **kwargs: Any)[source]
Bases:
BaseModelA model for Wyner-Ziv coding with decoder side information.
Wyner-Ziv coding is a form of lossy source coding with side information at the decoder. This model implements the complete process including source encoding, quantization, syndrome generation, channel transmission, and decoding with side information.
The model follows these key steps:
The encoder compresses the source without knowledge of side information
The quantizer maps the encoded values to discrete symbols/indices
The syndrome generator creates a compressed representation (syndromes) that will be used for reconstruction when combined with side information
The syndromes are transmitted through a potentially noisy channel
The decoder combines received syndromes with side information to reconstruct the original source with minimal distortion
This implementation can be used for various distributed coding scenarios like distributed image/video compression, sensor networks, etc.
- quantizer
Discretizes the continuous encoded representation
- Type:
nn.Module
- syndrome_generator
Creates syndrome bits for efficient transmission
- Type:
nn.Module
- channel
Models the communication channel characteristics
- Type:
- correlation_model
Models statistical relationship between source and side information (used when side info is not provided)
- Type:
WynerZivCorrelationModel
- constraint
Optional constraint on transmitted data (e.g., power)
- Type:
Methods
Initialize the Wyner-Ziv model.
Process source through the Wyner-Ziv coding system.
- __init__(encoder: BaseModel, channel: BaseChannel, decoder: BaseModel, correlation_model: WynerZivCorrelationModel | None = None, quantizer: BaseModel | None = None, syndrome_generator: BaseModel | None = None, constraint: BaseConstraint | None = None, *args: Any, **kwargs: Any)[source]
Initialize the Wyner-Ziv model.
- Parameters:
encoder – Model that encodes the source data into a latent representation without knowledge of the side information
channel – Channel model that simulates transmission effects such as noise, fading, or packet loss on the syndromes
decoder – Model that reconstructs the source using received syndromes and the side information available at the decoder
correlation_model – Model that generates or simulates the correlation between the source and side information. Optional for subclasses that always expect side_info to be provided.
quantizer – Module that discretizes the encoded representation into a finite set of indices or symbols. Optional for subclasses that don’t require explicit quantization.
syndrome_generator – Module that generates syndromes (parity bits or compressed representation) for error correction or compression. Optional for subclasses that don’t use explicit syndromes.
constraint – Optional constraint (e.g., power, rate) applied to the transmitted syndromes
*args – Variable positional arguments passed to the base class.
**kwargs – Variable keyword arguments passed to the base class.
- forward(source: Tensor, side_info: Tensor | None = None, *args: Any, **kwargs: Any) Tensor[source]
Process source through the Wyner-Ziv coding system.
Implements the full Wyner-Ziv coding model: 1. Encodes source into a latent representation 2. Quantizes the latent representation (if quantizer is present) 3. Generates syndromes (if syndrome_generator is present) 4. Applies optional constraints on syndromes 5. Transmits syndromes through the channel 6. Either uses provided side information or generates it through correlation model 7. Reconstructs source using received syndromes and side information
- Parameters:
source – The source data to encode and transmit efficiently
side_info – Optional pre-generated side information available at decoder. If None, side information is generated using the correlation_model.
*args – Additional positional arguments passed to encoder, quantizer, syndrome_generator, channel, and decoder.
**kwargs – Additional keyword arguments passed to encoder, quantizer, syndrome_generator, channel, and decoder.
- Returns:
The final reconstructed source tensor after decoding.
- Return type:
- Raises:
ValueError – If side_info is None and no correlation_model is available.