KAIR icon indicating copy to clipboard operation
KAIR copied to clipboard

Patch size in `dataset_blindsr.py`

Open pcuenca opened this issue 2 years ago • 0 comments

Thanks for this terrific repository!

I'm confused about the configuration of patches when using the blindsr dataset type.

The H and L patch sizes are extracted from the configuration here: https://github.com/cszn/KAIR/blob/75375ce9fc7c2ee7eecd4a932386dbe099d3b4de/data/dataset_blindsr.py#L23 https://github.com/cszn/KAIR/blob/75375ce9fc7c2ee7eecd4a932386dbe099d3b4de/data/dataset_blindsr.py#L24

Note that the size of H is taken from the configuration, if the key exists. However, it is later unconditionally replaced here: https://github.com/cszn/KAIR/blob/75375ce9fc7c2ee7eecd4a932386dbe099d3b4de/data/dataset_blindsr.py#L70

So there are two parameters that control the definition of patch sizes, both are optional but lq_patchsize takes precedence. For example, when I just enter "H_size": 288 in my configuration (no lq_patchsize), I end up with L patches of size 64 (the default) and H patches of size 128 (I'm using a scale factor of 2), which is not what I was expecting.

The behavior is different in other datasets. For example, when using sr the size of H is the only one that is read from the configuration file, and the size of L is computed from it: https://github.com/cszn/KAIR/blob/75375ce9fc7c2ee7eecd4a932386dbe099d3b4de/data/dataset_sr.py#L23

I could easily solve my problem by defining a lq_patchsize of 144, but it took me a while to understand what was going on. I ran an experiment using sr degradation first, and then tried to repeat the same thing with blindsr – I just changed the dataset type and the degradations expecting the sizes to remain the same.

The lq_patchsize option is only used in the bsrgan_x4 configuration files, but they also happen to use an H_size that is not consistent with lq_patchsize * scale.

Is there a reason for the different configuration styles? If there is not and you are interested in keeping the consistency with other datasets, I can submit a PR that computes the L size from H as in the other places.

pcuenca avatar Feb 11 '22 01:02 pcuenca