Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

why code for dataloader is this complicated??? #102

Open
BarCodeReader opened this issue Aug 12, 2020 · 3 comments
Open

why code for dataloader is this complicated??? #102

BarCodeReader opened this issue Aug 12, 2020 · 3 comments

Comments

@BarCodeReader
Copy link

first thanks for your code.

but TBH, why the code for dataloader is so complex and so hard to read???

@FizzerYu
Copy link

Just personal opinion.

Some of the prepossessing code of RCAN is inherit from EDSR . And MDSR(a model proposed with EDSR in the same paper) support multi-scale training.

At each update of training a multi-scale model (MDSR), we construct the minibatch with a randomly selected scale among ×2, ×3 and ×4. (Ref: https://arxiv.org/pdf/1707.02921.pdf)

So when MDSR is training, the data_generator function should randomly select a scale to train the model. This feature need a custom dataloader function(See dataloader.py line 37-45).

By the way, Thanks for the code of RCAN. :)

@BarCodeReader
Copy link
Author

So when MDSR is training, the data_generator function should randomly select a scale to train the model. This feature need a custom dataloader function(See dataloader.py line 37-45).

but why we cannot prepare the DIV2K in scale 2,3,4 then randomly crop a patch and feed into loader?
DRRN is using this approach, though it trains on 291 dataset, it is also multi-scale training.

now the dataloader is so long and hard to read/understand what is going on.

@FizzerYu
Copy link

Sorry, I'm just a fresh man in Super-resolution. And I haven't read the source code of the DRRN.
Maybe it's just author's perference.

I have also face the same problem in dataloader. And it's incompatible with Torch1.6. But if you have some patience and read the
dataloader source code of the PyTorch 0.4.1(The author proposed). Most of the code in dataloader.py is the same.

Besides, the RCAN doesn't use multi-scale training, so you could just replace MSDataLoader with torch.utils.data.dataloader. Also you need to change some Args passed to this Function.(I'm testing this method and it seems that the data could be read properly)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants