RealRep

kepengxu更新放缓

基于属性解耦表示学习实现通用 SDR 到 HDR 视频转换,来自 AAAI-26 oral 论文,可把普通视频提升为高动态范围画面。

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

暂无版本423star3fork同步于 2026-11-07 07:33 UTC

怎么上手

由 README 提炼,执行前请确认
git clone https://github.com/kepengxu/RealRep.git
cd RealRep/DeCoMix-HDR-open-source
pip install -r requirements.txt
python setup.py develop
硬件要求按 README 说明

README 未说明具体显存需求,仅要求带 CUDA 的 PyTorch 环境;训练配置默认总迭代 40 万步,建议按实际显存调整 batch。

需要 CUDA
下载:源码 zip·GitHub Releases(安装包)本站不镜像安装包

项目说明

由 README 自动翻译提炼

把不同退化风格的 SDR 图统一转成 HDR,靠属性解耦表示做泛化

基于属性解耦表示学习实现通用 SDR 到 HDR 视频转换,来自 AAAI-26 oral 论文,可把普通视频提升为高动态范围画面。

核心能力

  • 用亮度/色度感知对比监督学习退化表示
  • 按亮度与色度差异挖掘半困难负样本
  • 在表示空间做排序引导的负样本混合
  • 用全局稠密与局部稀疏调制做 HDR 重建
  • 推理只需单张 SDR 图和训练好的权重

容易踩的坑

数据集需自行从 HDRTVDM 仓库获取并组织成 LMDB,还要包含 names.pkl 和亮度/色度负样本列表文件;评估需把权重放到 pretrained_models/decomix_hdr_net_g_400000.pth 或改配置路径;训练时须保持 collate_ranked_contrast: true,否则复现不出预期效果。

内容由模型根据 README 生成,可能不完整或不准确,以官方文档为准。看原文 README

最近发版

0 个版本

暂无 release 数据(可能没有发版,或尚未同步)。

用户点评

登录用户的真实使用记录,可按版本和硬件筛选
共 0 条

    还没有人点评。第一个说出真实体验的人最有价值。

    README 原文

    未翻译

    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:

    BenchmarkMetricDeCoMix-HDR
    HDRTV4K known degradationsAverage PSNR / SSIM31.20 / 0.9213
    HDRTV1K unknown degradationPSNR / SSIM29.12 / 0.9412
    HDR-specific perceptual qualityDelta E ITP / HDR-VDP325.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 ComponentCode Location
    DeCoMix-HDR training wrapperbasicsr/models/contrast_yxy_unified_single_model.py
    Main model typeContrastSingleMoCoLatentMixITMModel
    Degradation-Adaptive HDR Mapping (DAHM)basicsr/archs/RealRep_fuse_zero_norm_arch.py, RealRep_fuse_norm_single
    Contrastive representation encoderbasicsr/archs/contrastive.py, MoCoWithUNetDualNegLatentMix
    Luma-/chroma-aware ranked negativesbasicsr/data/hdrtvmix_contrast_dataset.py
    Rank-guided latent alpha-mixMoCoWithUNetDualNegLatentMix._mix_ranked_negs
    Stage-1 / Stage-2 trainingContrastSingleMoCoRankITMModel.optimize_parameters
    Momentum encoder initializationstage2_init_k: copy_q
    Checkpoint save/load keysContrastSingleMoCoBaseITMModel.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.