14
14
'vgg13' : 'https://download.pytorch.org/models/vgg13-c768596a.pth' ,
15
15
'vgg16' : 'https://download.pytorch.org/models/vgg16-397923af.pth' ,
16
16
'vgg19' : 'https://download.pytorch.org/models/vgg19-dcbb9e9d.pth' ,
17
+ 'vgg11_bn' : 'https://download.pytorch.org/models/vgg11_bn-6002323d.pth' ,
18
+ 'vgg13_bn' : 'https://download.pytorch.org/models/vgg13_bn-abd245e5.pth' ,
19
+ 'vgg16_bn' : 'https://download.pytorch.org/models/vgg16_bn-6c64b313.pth' ,
20
+ 'vgg19_bn' : 'https://download.pytorch.org/models/vgg19_bn-c79401a0.pth' ,
17
21
}
18
22
19
23
@@ -91,9 +95,16 @@ def vgg11(pretrained=False, **kwargs):
91
95
return model
92
96
93
97
94
- def vgg11_bn (** kwargs ):
95
- """VGG 11-layer model (configuration "A") with batch normalization"""
96
- return VGG (make_layers (cfg ['A' ], batch_norm = True ), ** kwargs )
98
+ def vgg11_bn (pretrained = False , ** kwargs ):
99
+ """VGG 11-layer model (configuration "A") with batch normalization
100
+
101
+ Args:
102
+ pretrained (bool): If True, returns a model pre-trained on ImageNet
103
+ """
104
+ model = VGG (make_layers (cfg ['A' ], batch_norm = True ), ** kwargs )
105
+ if pretrained :
106
+ model .load_state_dict (model_zoo .load_url (model_urls ['vgg11_bn' ]))
107
+ return model
97
108
98
109
99
110
def vgg13 (pretrained = False , ** kwargs ):
@@ -108,9 +119,16 @@ def vgg13(pretrained=False, **kwargs):
108
119
return model
109
120
110
121
111
- def vgg13_bn (** kwargs ):
112
- """VGG 13-layer model (configuration "B") with batch normalization"""
113
- return VGG (make_layers (cfg ['B' ], batch_norm = True ), ** kwargs )
122
+ def vgg13_bn (pretrained = False , ** kwargs ):
123
+ """VGG 13-layer model (configuration "B") with batch normalization
124
+
125
+ Args:
126
+ pretrained (bool): If True, returns a model pre-trained on ImageNet
127
+ """
128
+ model = VGG (make_layers (cfg ['B' ], batch_norm = True ), ** kwargs )
129
+ if pretrained :
130
+ model .load_state_dict (model_zoo .load_url (model_urls ['vgg13_bn' ]))
131
+ return model
114
132
115
133
116
134
def vgg16 (pretrained = False , ** kwargs ):
@@ -125,9 +143,16 @@ def vgg16(pretrained=False, **kwargs):
125
143
return model
126
144
127
145
128
- def vgg16_bn (** kwargs ):
129
- """VGG 16-layer model (configuration "D") with batch normalization"""
130
- return VGG (make_layers (cfg ['D' ], batch_norm = True ), ** kwargs )
146
+ def vgg16_bn (pretrained = False , ** kwargs ):
147
+ """VGG 16-layer model (configuration "D") with batch normalization
148
+
149
+ Args:
150
+ pretrained (bool): If True, returns a model pre-trained on ImageNet
151
+ """
152
+ model = VGG (make_layers (cfg ['D' ], batch_norm = True ), ** kwargs )
153
+ if pretrained :
154
+ model .load_state_dict (model_zoo .load_url (model_urls ['vgg16_bn' ]))
155
+ return model
131
156
132
157
133
158
def vgg19 (pretrained = False , ** kwargs ):
@@ -142,6 +167,13 @@ def vgg19(pretrained=False, **kwargs):
142
167
return model
143
168
144
169
145
- def vgg19_bn (** kwargs ):
146
- """VGG 19-layer model (configuration 'E') with batch normalization"""
147
- return VGG (make_layers (cfg ['E' ], batch_norm = True ), ** kwargs )
170
+ def vgg19_bn (pretrained = False , ** kwargs ):
171
+ """VGG 19-layer model (configuration 'E') with batch normalization
172
+
173
+ Args:
174
+ pretrained (bool): If True, returns a model pre-trained on ImageNet
175
+ """
176
+ model = VGG (make_layers (cfg ['E' ], batch_norm = True ), ** kwargs )
177
+ if pretrained :
178
+ model .load_state_dict (model_zoo .load_url (model_urls ['vgg19_bn' ]))
179
+ return model
0 commit comments