Image_Recognition/VGG_Simonyan_Zisserman_2015/driver.py
def make_fc_layers(self, specs):
        """Make the custom fully connected layers."""
        fc = []
        in_features = self.in_features*7*7   # 7x7 after 5 max pool on 224x224

        for spec in specs:

            if spec != self.out_channels:
                fc += [nn.Linear(in_features=in_features, out_features=spec),
                       nn.ReLU(),
                       nn.Dropout(p=0.5)]
            else:
                fc += [nn.Linear(in_features=in_features, out_features=spec)]

            in_features = spec

        return nn.Sequential(*fc)
Make the custom fully connected layers.
Make the custom fully connected layers.
Make the custom fully connected layers .
def make_fc_layers(self, specs):
        fc = []
        in_features = self.in_features*7*7   
        for spec in specs:
            if spec != self.out_channels:
                fc += [nn.Linear(in_features=in_features, out_features=spec),
                       nn.ReLU(),
                       nn.Dropout(p=0.5)]
            else:
                fc += [nn.Linear(in_features=in_features, out_features=spec)]
            in_features = spec
        return nn.Sequential(*fc)
def make_fc_layers ( self , specs ) : fc = [ ] in_features = self . in_features * 7 * 7 for spec in specs : if spec != self . out_channels : fc += [ nn . Linear ( in_features = in_features , out_features = spec ) , nn . ReLU ( ) , nn . Dropout ( p = 0.5 ) ] else : fc += [ nn . Linear ( in_features = in_features , out_features = spec ) ] in_features = spec return nn . Sequential ( * fc )
Make the custom fully connected layers.
Make the custom fully connected layers .
"""Make the custom fully connected layers.""" # 7x7 after 5 max pool on 224x224
self
specs