chxy95 / HDRUNet

CVPR2021 Workshop - HDRUNet: Single Image HDR Reconstruction with Denoising and Dequantization.
MIT License
157 stars 28 forks source link

[About align ratio] #10

Closed CaptainEven closed 3 years ago

CaptainEven commented 3 years ago

What is [align ratio] used for? I'm confused about the align-ratio... How to set the align ratio in train_HDRUNet.yml if train on custom dataset?

#### datasets
datasets:
  train:
    name: Single_LDR2HDR
    mode: LQGT_condition
    dataroot_LQ: /mnt/diskc/even/Ldr2HdrData/medium_sub
    dataroot_GT: /mnt/diskc/even/Ldr2HdrData/gt_sub
    dataroot_ratio: /data0/NTIRE2021_HDR/000_Train_SingleFrame_FirstStage/alignratio
    use_shuffle: true
    n_workers: 4 #  8
    batch_size: 16
    GT_size: 160
    use_flip: true
    use_rot: true
    condition: image
chxy95 commented 3 years ago

@CaptainEven The alignratio is unique to this dataset provided by the organizer. You should modify the scripts related to data reading to fit your own data.

CaptainEven commented 3 years ago

@chxy95 Thank you for your reply and explanation! I'm very interested in your method! I want to train on my custom dataset(LDR seq and HDR counterpart(generated using MEF methods)), but i don't know the actual meaning of alignratio in your code.

  1. Could you please explain about alignratio, or how i need to provide the alignratio in the training process?
  2. Can alignratio be excluded from the training process? As far as i know, alignration is not necessary in general Single image HDR reconstruction right?
chxy95 commented 3 years ago

@CaptainEven The alignratio is used to normalize the HDR value into [0, 1], since the value range of the provided HDR is [0, +∞) encoded in uint16 data.

CaptainEven commented 3 years ago

@chxy95 Thank you for your explanation!A seqence in my custom dataset is composed of 3 LDR jpg format image, and its GT jpg HDR image, how to set the alignratio value, 255 correct?

As far as i know, the provided HDR GT is a png format image, its RGB range in [0-255] right? I don't understand "HDR is [0, +∞) encoded in uint16 data"...

chxy95 commented 3 years ago

@CaptainEven The provided HDR GT is in uint16 png format of range [0-65535]. You can think that the alignratio for SDR images is 255, so values in [0, 255] can be normalized to [0, 1] divided by 255. For the provided HDR, maximum of an HDR image would be set to 65535 for writing, thus the alignratio is equal to 65535 / image.max(). When read, pixel values should be divided by the alignratio to normalize to [0, maximum]. For example, a nomalized HDR image with range in [0, 500] have an alignration with 65535/500. When saved, the image is in range [0, 65535]. When read, the image is divided by the alignratio to normalize to the range [0, 500]. If you still have any problem, you should check the provided dataset and scripts of data-io carefully to better understand the data.

CaptainEven commented 3 years ago

@chxy95 Thanks for your detailed explanation again! I got it!