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

There might be some problem for your SRResNet model #6

Open
jiaxue-ai opened this issue Feb 9, 2017 · 3 comments
Open

There might be some problem for your SRResNet model #6

jiaxue-ai opened this issue Feb 9, 2017 · 3 comments

Comments

@jiaxue-ai
Copy link

jiaxue-ai commented Feb 9, 2017

As titled, your SRResNet might has some problem

  1. you forget the skip connection
  2. after pixelshuffle, the number of channels should be divided by 2 instead of 4
    this might be correct one

function defineSRResNet()

local SRResNet = nn.Sequential()

local residualPart = nn.Sequential() 

residualPart:add(layer(basicblock,64,5,1))

residualPart:add(nn.SpatialConvolution(64, 64, 3, 3, 1, 1, 1, 1))

residualPart:add(nn.SpatialBatchNormalization(64))

SRResNet:add(nn.SpatialConvolution(3, 64, 3, 3, 1, 1, 1, 1)) 

SRResNet:add(nn.ReLU(true)) 

SRResNet:add(nn.ConcatTabel()
	:add(residualPart)
	:add(shortcut(64,64,1)))

SRResNet:add(nn.CAddTable(true))

SRResNet:add(nn.SpatialConvolution(64, 256, 3, 3, 1, 1, 1, 1))

SRResNet:add(nn.PixelShuffle(2))

SRResNet:add(nn.ReLU(true)) 

SRResNet:add(nn.SpatialConvolution(128, 256, 3, 3, 1, 1, 1, 1))

SRResNet:add(nn.PixelShuffle(2))

SRResNet:add(nn.ReLU(true))

SRResNet:add(nn.SpatialConvolution(128, 3, 3, 3, 1, 1, 1, 1))

return SRResNet

end

@huangzehao
Copy link
Owner

Hi, thanks for your carefully review.
(1) This implementation is based on the the v2 version of paper srgan, and there is not skip-connection. I also have not time to update this repo.
(2) Pixelshuffle(scale) convert (B, C * scale * scale, H, W) to (B, C, H * scale, W * scale), So I think it's no problem in my implementation.

@jiaxue-ai
Copy link
Author

please look at torch official website
https://github.com/torch/nn/blob/master/doc/simple.md#nn.PixelShuffle
screen shot 2017-02-09 at 10 58 09 pm

@huangzehao
Copy link
Owner

huangzehao commented Feb 10, 2017

Hi, there maybe a typo in the readme of PixelShuffle.
You can not convert a tensor of shape [C * r, H, W] to a tensor of shape [C, H * r, W * r]. The number of elements in [C * r, H, W] is C * H * W * r while it is C * H * W * r * r in [C, H * r, W * r].
Check this https://github.com/torch/nn/blob/master/PixelShuffle.lua#L4.
Thanks.

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