twtygqyy / pytorch-SRResNet

pytorch implementation for Photo-Realistic Single Image Super-Resolution Using a Generative Adversarial Network arXiv:1609.04802
MIT License
481 stars 130 forks source link

Question about discriminating the size of the network output #17

Open Alxemade opened 5 years ago

Alxemade commented 5 years ago

Hi, @twtygqyy Thank you very much for the work. I read your code, but I feel confused about your annotation in srresnet.py.

class _NetD(nn.Module):
    def __init__(self):
        super(_NetD, self).__init__()

        self.features = nn.Sequential(

            # input is (3) x 96 x 96
            nn.Conv2d(in_channels=3, out_channels=64, kernel_size=3, stride=1, padding=1, bias=False),
            nn.LeakyReLU(0.2, inplace=True),

            # state size. (64) x 96 x 96
            nn.Conv2d(in_channels=64, out_channels=64, kernel_size=4, stride=2, padding=1, bias=False),            
            nn.BatchNorm2d(64),
            nn.LeakyReLU(0.2, inplace=True),
           ... 

The second annotation is right? I know the input size is 96 96, but after the second Conv2d which stride is 2, so output size might be 48 48.

Thank you

twtygqyy commented 5 years ago

Hi @Alxemade state size. (64) x 96 x 96 is for the size after first Conv2d, which stride equals to 1. If you look at the first comment, it saids the input size is (3) x 96 x 96.

Alxemade commented 5 years ago

OK, Thank you !

HPL123 commented 5 years ago

@Alxemade ,你好(我就说中文了哈),你在测试的时候碰到显存不够用的问题么?我训练时候正常,测试的时候就显示了下面这个问题 :: RuntimeError: cuda runtime error (2) : out of memory at /opt/conda/conda-bld/pytorch_1501969512886/work/pytorch-0.1.12/torch/lib/THC/generic/THCStorage.cu:66