EDSR-PyTorch icon indicating copy to clipboard operation
EDSR-PyTorch copied to clipboard

Question about Patch size

Open dongxijia opened this issue 5 years ago • 7 comments

Dear author, I find that --patch_size intensively influence the memory occupied in train or test. For instance, when I set --patch_size=192 for baseline, the process occupy 6GB+ Memory, when it was changed to 96, the process occupy 3GB+ Memory. And I would like to konw whether patch_size would change the final performance of train or test. it seems like patch_size would change the speed of running. I am looking forward for your reply, thank you!

dongxijia avatar Feb 28 '19 03:02 dongxijia

Hello.

You are right, --patch_size is a very important option to control your GPU memory usage and training time.

We found that larger training patch can increase the final performance a bit (~0.05dB).

If you have trouble increasing --patch_size, use smaller --batch_size or increase --epochs to get similar results.

Just avoid very small patches (ex. 12x12 input training patches - --patch_size 48 for --scale 4), and you can get desirable results.

Thank you.

sanghyun-son avatar Mar 04 '19 23:03 sanghyun-son

Your reply is very helpful ! Thank you very much. And I got another problem about reference time. I would like to know if there is any way to reduce the scale time in your code. If I want to use only Y channel (yuv format) to scale up images, do I need to change the architecture of network ?

dongxijia avatar Mar 05 '19 03:03 dongxijia

Just use a --n_colors 1 argument to train/test your model on Y channel (Actually, it is a YCbCr format. You can change it here if necessary.)

You do not need to change the architecture if they are well-defined.

In EDSR code, you can find that I did not hard-code 3 for input RGB channels.

For your first question, please make it clear.

Does it mean that you want to accelerate the inference time?

In that case, you can make your model smaller by changing --n_resblocks or --n_feats if you can sacrifice the performance a little bit.

Otherwise, you have to implement more fancy acceleration algorithms by yourself.

If you have any question about this, feel free to ask me.

Thank you.

sanghyun-son avatar Mar 05 '19 03:03 sanghyun-son

It's really kind of you ! The code you shared is really helpful! I find there are some codes need to change in sub_mean function for Y channel, then I changed it. Then I used --n_colors 1 to train the model , and I got amazing result that about 1 PSNR improvement in Validation set. And yes, I want to accelerate the inference time when the network is immovability. Is there any trick in your code to accelerate, such like use --chop or --precison

dongxijia avatar Mar 06 '19 02:03 dongxijia

It's really kind of you ! The code you shared is really helpful! I find there are some codes need to change in sub_mean function for Y channel, then I changed it. Then I used --n_colors 1 to train the model , and I got amazing result that about 1 PSNR improvement in Validation set. And yes, I want to accelerate the inference time when the network is immovability. Is there any trick in your code to accelerate, such like use --chop or --precison

Hey, I want to know how you changed the sub_mean function for Y channel. And, you said there was an about 1 psnr improvement by using --n_colors=1, could you tell me which model you trained. I'm training my own model recently by using n_colors=3 , but the psnr seems to be bad

Achhhe avatar Mar 12 '19 16:03 Achhhe

It's really kind of you ! The code you shared is really helpful! I find there are some codes need to change in sub_mean function for Y channel, then I changed it. Then I used --n_colors 1 to train the model , and I got amazing result that about 1 PSNR improvement in Validation set. And yes, I want to accelerate the inference time when the network is immovability. Is there any trick in your code to accelerate, such like use --chop or --precison

Hey, I want to know how you changed the sub_mean function for Y channel. And, you said there was an about 1 psnr improvement by using --n_colors=1, could you tell me which model you trained. I'm training my own model recently by using n_colors=3 , but the psnr seems to be bad

Excuseme, do you solve this problem? I also want to train on the Ychannel

sureJ0824 avatar Jan 14 '20 14:01 sureJ0824

It's really kind of you ! The code you shared is really helpful! I find there are some codes need to change in sub_mean function for Y channel, then I changed it. Then I used --n_colors 1 to train the model , and I got amazing result that about 1 PSNR improvement in Validation set. And yes, I want to accelerate the inference time when the network is immovability. Is there any trick in your code to accelerate, such like use --chop or --precison

Hey, I want to know how you changed the sub_mean function for Y channel. And, you said there was an about 1 psnr improvement by using --n_colors=1, could you tell me which model you trained. I'm training my own model recently by using n_colors=3 , but the psnr seems to be bad

Excuse me do you solve this problem? I also want to train on the Ychannel,but there is also an error on the sub_mean, how do you change the related codes? Thanks a lot any way.

sureJ0824 avatar Jan 14 '20 14:01 sureJ0824