Image_Recognition/VGG_Simonyan_Zisserman_2015/driver.py
def make_conv_blocks(self, specs):
        """Make the custom convolutional blocks."""
        conv = []
        krnl = (3, 3)
        strd = (1, 1)
        pdd = (1, 1)
        strd_pool = (2, 2)
        krnl_pool = (2, 2)
        in_channels = self.in_channels

        for spec in specs:

            if isinstance(spec, int):
                conv += [nn.Conv2d(in_channels=in_channels, out_channels=spec,
                                   kernel_size=krnl, stride=strd, padding=pdd),
                         nn.BatchNorm2d(spec),
                         nn.ReLU()]
                in_channels = spec

            elif spec == 'M':
                conv += [nn.MaxPool2d(kernel_size=krnl_pool, stride=strd_pool)]

        return nn.Sequential(*conv)
Make the custom convolutional blocks.
Make the custom convolutional blocks.
Make the custom convolutional blocks .
def make_conv_blocks(self, specs):
        conv = []
        krnl = (3, 3)
        strd = (1, 1)
        pdd = (1, 1)
        strd_pool = (2, 2)
        krnl_pool = (2, 2)
        in_channels = self.in_channels
        for spec in specs:
            if isinstance(spec, int):
                conv += [nn.Conv2d(in_channels=in_channels, out_channels=spec,
                                   kernel_size=krnl, stride=strd, padding=pdd),
                         nn.BatchNorm2d(spec),
                         nn.ReLU()]
                in_channels = spec
            elif spec == 'M':
                conv += [nn.MaxPool2d(kernel_size=krnl_pool, stride=strd_pool)]
        return nn.Sequential(*conv)
def make_conv_blocks ( self , specs ) : conv = [ ] krnl = ( 3 , 3 ) strd = ( 1 , 1 ) pdd = ( 1 , 1 ) strd_pool = ( 2 , 2 ) krnl_pool = ( 2 , 2 ) in_channels = self . in_channels for spec in specs : if isinstance ( spec , int ) : conv += [ nn . Conv2d ( in_channels = in_channels , out_channels = spec , kernel_size = krnl , stride = strd , padding = pdd ) , nn . BatchNorm2d ( spec ) , nn . ReLU ( ) ] in_channels = spec elif spec == 'M' : conv += [ nn . MaxPool2d ( kernel_size = krnl_pool , stride = strd_pool ) ] return nn . Sequential ( * conv )
Make the custom convolutional blocks.
Make the custom convolutional blocks .
"""Make the custom convolutional blocks."""
self
specs