-
-
Notifications
You must be signed in to change notification settings - Fork 617
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
Add the example of super_resolution #2885
Conversation
Hey @vfdev-5 , thanks for assigning the issue and since I had my mid-terms I could not work on this earlier so I apologise for the delay |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the PR @guptaaryan16
I left few comments.
Can you share execution logs, how much time it takes to run one epoch ?
Were you be able to train a simple SR model and share inference example ?
examples/super_resolution/dataset.py
Outdated
|
||
def __getitem__(self, index): | ||
input = load_img(self.image_filenames[index]) | ||
target = input.copy() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems like in this application we are using input image as target, so we can replace BSD data by another built-in torchvision dataset instead of manually code how to download/extract the data
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah I think it will be better (it was implemented this way in pytorch/examples
)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Although it is working well as shown in Colab notebook
I think this colab notebook will be able to cover this example |
A lot of things covered in this example were directly present in |
@guptaaryan16 code in pytorch/examples seems a bit outdated and rather bulky. For ignite, I think it would worth to provide up to date code and with interesting outcome. First question about the results from the colab, how super-resolved image differs from an image upsampled with bicubic mode ? Maybe, it worth to include PSNR for bicubic upsampled image for reference when doing validation stage. |
Hey @vfdev-5 I have made suggested changes in the colab notebook. Also I was exploring the link https://github.com/Coloquinte/torchSR and I think it will be better to adapt a train script from here rather than |
Hey @vfdev-5 I have made all suggested changes including adding the torchvision dataset. Please review |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the update @guptaaryan16
I left few comments in the code. I think we can keep this model and the training script but change the training dataset and use additionally CIFAR10 for inference only.
Hey @vfdev-5 please review |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the updates @guptaaryan16
I left few more comments concerning the code.
Please try to train a model and share training logs and run super_resolve script on a cifar10 image then compare it with the same image upsampled with bicubic interp mode.
examples/super_resolution/main.py
Outdated
dim = self.crop_size // self.scale_factor | ||
lr_image = resize(lr_image, [dim, dim]) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
dim = self.crop_size // self.scale_factor | |
lr_image = resize(lr_image, [dim, dim]) | |
size = self.crop_size // self.scale_factor | |
lr_image = resize(lr_image, [size, size]) |
examples/super_resolution/main.py
Outdated
|
||
training_data_loader = DataLoader(dataset=trainset_sr, num_workers=opt.threads, batch_size=opt.batch_size, shuffle=True) | ||
testing_data_loader = DataLoader( | ||
dataset=testset_sr, num_workers=opt.threads, batch_size=opt.test_batch_size, shuffle=False |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
dataset=testset_sr, num_workers=opt.threads, batch_size=opt.test_batch_size, shuffle=False | |
dataset=testset_sr, num_workers=opt.threads, batch_size=opt.test_batch_size |
model = model.cuda() | ||
input = input.cuda() | ||
|
||
out = model(input) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
out = model(input) | |
model.eval() | |
with torch.no_grad(): | |
out = model(input) |
Hey @vfdev-5 I have updated the colab link with the necessary training logs and updates along with the cifar-10 example |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, thanks @guptaaryan16
I approve this PR. Next step would be to integrate it into the CI and use other ignite tools like progress bar to show sort of best practices
Related to #2878
Description: I have added the example for the super resolution in the
PyTorch/examples
Check list: