示例#1
0
    def summary(self):
        """
        Print network structure
        :return: none
        """
        print('Name:' + self.net_name)
        if torch.cuda.is_available():
            print("GPU: Enabled")

        if self.input_shape_chw is not None:
            print('Input Shape: ' + str(self.input_shape_chw))
            print('Net Structure:')
            summary_layers(self, self.input_shape_chw)
示例#2
0
        self.block6 = nn.Sequential(
            drn_module.layer7,
            drn_module.layer8
        )
        self.block7 = nn.Sequential(
            nn.Conv2d(512, 512, kernel_size=3, stride=2, padding=1, bias=False),
            nn.BatchNorm2d(512),
            nn.ReLU(inplace=True)
        )

    def forward(self, x):
        """
        forward with image & scene feature
        :param image: (N, C, H, W)
        :return:
        """
        x0 = self.block0(x)     # 192x256
        x1 = self.block1(x0)    # 96x128
        x2 = self.block2(x1)    # 48x64
        x3 = self.block3(x2)    # 24x32
        x4 = self.block4(x3)    # 12x16
        x5 = self.block5(x4)    # 6x8
        x6 = self.block6(x5)    # 3x4
        x7 = self.block7(x6)    # 2x2
        return x7, x6, x5, x4, x3, x2, x1, x0

if __name__ == '__main__':
    from core_dl.module_util import summary_layers
    model = CoordNet().cuda()
    summary_layers(model, input_size=(3, 192, 256))