Skip to content
Projets

kepengxu/RealRep has 424 GitHub stars and 3 forks. GitHot measured 0 stars in 24 hours. Last checked 2026-11-19 07:54 UTC. Last push 2026-06-17.

Comment ces chiffres sont mesurés

What you can do

  • Generalized SDR-to-HDR conversion. DeCoMix-HDR is designed for SDR inputs generated by different tone-mapping or degradation styles, rather than a single fixed operator.
  • Luma-/chroma-aware negative mining. Semi-hard negatives are selected according to luminance- and chrominance-dominant degradation differences, reducing entanglement between scene content and degradation cues.
  • Rank-guided representation mixing. Mined negatives are mixed with positive keys in representation space to synthesize continuous hard negatives near the contrastive decision boundary.
  • Degradation-Adaptive HDR Mapping (DAHM). Global and local degradation descriptors dynamically modulate HDR reconstruction through dense channel-wise and sparse pixel-wise mappings.

Progression mesurée des étoiles

in 24h
0
in 7 days
Historique en cours
in 15 days
Historique en cours
in 1 month
Historique en cours

Variations nettes sur des périodes qui se chevauchent, pas des totaux quotidiens. Les mesures absentes restent vides. Les étoiles indiquent l’intérêt, pas la qualité.

À propos

Extended from AAAI-26(oral) RealRep: Generalized SDR-to-HDR Conversion via Attribute-Disentangled Representation Learning

Apprentissage

README.md

Original

DeCoMix-HDR

Official implementation of DeCoMix-HDR: Degradation-aware Contrastive Mining and Mixing for Generalized SDR-to-HDR Conversion.

DeCoMix-HDR targets generalized SDR-to-HDR conversion under diverse SDR degradation styles. It learns attribute-disentangled degradation representations with luma-/chroma-aware contrastive supervision and uses the learned representation to guide a lightweight degradation-adaptive HDR mapping network.

The paper link will be added after release.

Project page: https://kepengxu.github.io/projects/decomixhdr/

Highlights

  • Generalized SDR-to-HDR conversion. DeCoMix-HDR is designed for SDR inputs generated by different tone-mapping or degradation styles, rather than a single fixed operator.
  • Luma-/chroma-aware negative mining. Semi-hard negatives are selected according to luminance- and chrominance-dominant degradation differences, reducing entanglement between scene content and degradation cues.
  • Rank-guided representation mixing. Mined negatives are mixed with positive keys in representation space to synthesize continuous hard negatives near the contrastive decision boundary.
  • Degradation-Adaptive HDR Mapping (DAHM). Global and local degradation descriptors dynamically modulate HDR reconstruction through dense channel-wise and sparse pixel-wise mappings.
  • Single-input inference. Negative samples and the momentum encoder are only used during training; inference requires only one SDR image and the trained checkpoint.

News

  • 2026-05: Initial public code release for DeCoMix-HDR.

Method Overview

Real-world SDR content may contain diverse tone curves, exposure shifts, highlight compression, saturation changes, and color casts. These degradation cues are coupled but not identical across luminance and chrominance. DeCoMix-HDR therefore learns a shared degradation representation shaped by luma-/chroma-aware contrastive supervision, instead of using separate restoration branches.

The framework consists of three main components:

  1. Attribute-disentangled representation learning

    • A UNet-based encoder extracts a compact global descriptor and a spatial local descriptor from the SDR input.
    • Projection heads supervise luma-aware and chroma-aware views of the shared representation.
    • Global terms organize image-level tone/color statistics, while local terms constrain spatially varying degradation responses.
  2. Luma-/chroma-aware semi-hard negative mining

    • Candidate negatives are collected from SDR versions sharing the same HDR scene but produced by different degradation styles.
    • Luminance distance is computed in log-luminance space.
    • Chrominance distance is computed in Yxy chromaticity space.
    • Dominance scores select negatives that mainly differ in luminance or chrominance, making contrastive supervision more attribute-selective.
  3. Rank-guided representation mixing and DAHM reconstruction

    • Top-ranked negatives are interpolated toward the positive key in latent space to form harder continuous negatives.
    • The learned global and local descriptors condition DAHM.
    • DAHM first applies global dense modulation for tone/color correction, then local sparse modulation for spatially varying highlight, saturation, and artifact recovery.

Repository Structure

DeCoMix-HDR-open-source/
├── train.py                                      # training entry
├── test.py                                       # evaluation entry
├── requirements.txt
├── setup.py
├── docs/
│   └── DATASET_ORGANIZATION.md                   # detailed dataset layout guide
├── options/
│   ├── train/
│   │   └── train_decomix_hdr.yml                 # main training config
│   └── test/
│       └── test_decomix_hdr_fullval.yml          # full validation config
├── basicsr/
│   ├── archs/
│   │   ├── RealRep_fuse_zero_norm_arch.py        # DAHM reconstruction network
│   │   └── contrastive.py                        # MoCo encoder + latent mixing
│   ├── data/
│   │   └── hdrtvmix_contrast_dataset.py          # HDRTV datasets + ranked negatives
│   ├── models/
│   │   └── contrast_yxy_unified_single_model.py  # DeCoMix-HDR training/eval logic
│   ├── losses/
│   ├── metrics/
│   └── utils/
└── scripts/
    ├── configure_decomix_data.py                 # dataset symlink/config helper
    ├── dist_train.sh
    ├── dist_test.sh
    ├── data_preparation/
    └── metrics/

Some class and file names still contain historical RealRep identifiers. They are kept for compatibility with model registries and checkpoints and correspond to the DeCoMix-HDR implementation.

Installation

git clone https://github.com/kepengxu/RealRep.git
cd RealRep/DeCoMix-HDR-open-source
pip install -r requirements.txt
python setup.py develop

Recommended environment:

  • Python 3.8+
  • PyTorch with CUDA
  • torchvision
  • kornia
  • lmdb
  • opencv-python

This repository follows a BasicSR-style project structure. If dependency versions conflict, use the versions from your training environment first.

Data Preparation

The main experiments use HDRTV4K/HDRTVDM for training and known-degradation evaluation, and HDRTV1K for unknown-degradation evaluation. Please refer to the official HDRTVDM repository for HDRTV4K dataset access and preparation details:

The released configs assume LMDB datasets with the following default placeholders:

./datasets/HDRTV4K/trainwtiny.lmdb
./datasets/HDRTV4K/test/test.lmdb
./datasets/HDRTV4K/test/sample/test_sample.lmdb
./datasets/HDRTV1K/test_set_ori.lmdb

Each LMDB directory used by the ranked contrastive dataset should contain:

names.pkl
negatives_luma_fullrank.txt   or negatives_luma.txt
negatives_chroma_fullrank.txt or negatives_chroma.txt

The negative-list files are required for luma-/chroma-aware ranked negative mining. They provide the candidate negatives loaded by HDRTVDMDATASET1_RGB_CONTRAST_RANK and related mixed dataset wrappers in:

basicsr/data/hdrtvmix_contrast_dataset.py

For the complete LMDB layout, names.pkl structure, ranked-negative format, and common troubleshooting notes, see:

docs/DATASET_ORGANIZATION.md

The quickest setup is to create dataset symlinks and local configs automatically:

python scripts/configure_decomix_data.py \
  --hdrtv4k-root /path/to/HDRTV4K \
  --hdrtv1k-root /path/to/HDRTV1K

This writes local configs under options/local/ and verifies the required LMDB and ranked-negative files. If you do not use the helper script, update dataset paths in:

options/train/train_decomix_hdr.yml
options/test/test_decomix_hdr_fullval.yml

Training

Single-GPU training:

CUDA_VISIBLE_DEVICES=0 python train.py -opt options/train/train_decomix_hdr.yml

Distributed training:

bash scripts/dist_train.sh 4 options/train/train_decomix_hdr.yml

The main training config uses:

model_type: ContrastSingleMoCoLatentMixITMModel
network_g:
  type: RealRep_fuse_norm_single
network_feat:
  type: MoCoWithUNetDualNegLatentMix
  use_alpha_mix: true
  alpha_dominance: rank
  alpha_rank_reverse: true
  alpha_mix_policy: concat

Important training settings:

train:
  total_iter: 400000
  stage1_iters: 40000
  stage2_init_k: copy_q
  latentmix_alpha_schedule_iter: 80000
  latentmix_alpha_min_early: 0.25
  latentmix_alpha_max_early: 0.50
  latentmix_alpha_min_late: 0.25
  latentmix_alpha_max_late: 0.50

Training outputs are saved under:

experiments/decomix_hdr_main/

The model checkpoint produced at 400K iterations is expected at:

experiments/decomix_hdr_main/models/net_g_400000.pth

Evaluation

The released evaluation config loads the checkpoint from pretrained_models/ by default:

options/test/test_decomix_hdr_fullval.yml

Default checkpoint configuration:

path:
  pretrain_network_g: ./pretrained_models/decomix_hdr_net_g_400000.pth
  strict_load_g: true
  param_key_g: params_ema
  param_key_feat_single_moco_base: feat_params_single_moco_base

The checkpoint is saved as a single file containing both the HDR mapping network and the contrastive feature extractor:

  • params: generator parameters
  • params_ema: EMA generator parameters used by default for evaluation
  • feat_params_single_moco_base: feature extractor parameters used to compute degradation descriptors

Run full validation:

CUDA_VISIBLE_DEVICES=0 python test.py -opt options/test/test_decomix_hdr_fullval.yml

Distributed evaluation:

bash scripts/dist_test.sh 4 options/test/test_decomix_hdr_fullval.yml

Evaluation outputs are saved under:

results/decomix_hdr_fullval/

The default metrics include:

  • PSNR
  • SSIM
  • Delta E ITP

Main Results

The paper evaluates DeCoMix-HDR on HDRTV4K known degradations and HDRTV1K unknown degradations. Representative results from the current paper version are:

Benchmark Metric DeCoMix-HDR
HDRTV4K known degradations Average PSNR / SSIM 31.20 / 0.9213
HDRTV1K unknown degradation PSNR / SSIM 29.12 / 0.9412
HDR-specific perceptual quality Delta E ITP / HDR-VDP3 25.9897 / 9.38

These numbers are reported for reference and may depend on the exact dataset preparation, checkpoint, and evaluation environment.

Paper-to-Code Mapping

Paper Component Code Location
DeCoMix-HDR training wrapper basicsr/models/contrast_yxy_unified_single_model.py
Main model type ContrastSingleMoCoLatentMixITMModel
Degradation-Adaptive HDR Mapping (DAHM) basicsr/archs/RealRep_fuse_zero_norm_arch.py, RealRep_fuse_norm_single
Contrastive representation encoder basicsr/archs/contrastive.py, MoCoWithUNetDualNegLatentMix
Luma-/chroma-aware ranked negatives basicsr/data/hdrtvmix_contrast_dataset.py
Rank-guided latent alpha-mix MoCoWithUNetDualNegLatentMix._mix_ranked_negs
Stage-1 / Stage-2 training ContrastSingleMoCoRankITMModel.optimize_parameters
Momentum encoder initialization stage2_init_k: copy_q
Checkpoint save/load keys ContrastSingleMoCoBaseITMModel.save and model initialization

Notes for Users

  • Ablation configs, training logs, paper sources, figures, PDFs, local datasets, and experiment outputs are intentionally excluded from the public package.
  • Keep collate_ranked_contrast: true for training with ranked luma/chroma negatives.
  • If negative-list files are missing, the rank-aware contrastive path will not reproduce the intended DeCoMix-HDR behavior.
  • If you train from scratch, keep pretrain_network_g: ~ and resume_state: ~ in train_decomix_hdr.yml.
  • If you evaluate a released checkpoint, keep it at pretrained_models/decomix_hdr_net_g_400000.pth or update pretrain_network_g in the test config.
  • Do not rename historical RealRep registry names unless you also update YAML configs and checkpoint keys.

Citation

The paper is currently under review. Citation information will be updated after publication.

Acknowledgement

This project is implemented in a BasicSR-style codebase and uses HDRTV4K/HDRTV1K resources for SDR-to-HDR research. We thank the authors of the related datasets and open-source projects.