|
3 | 3 |
|
4 | 4 |
|
5 | 5 | __all__ = ['ResNet', 'resnet18', 'resnet34', 'resnet50', 'resnet101', |
6 | | - 'resnet152', 'resnext50_32x4d', 'resnext101_32x8d'] |
| 6 | + 'resnet152', 'resnext50_32x4d', 'resnext101_32x8d', |
| 7 | + 'wide_resnet50_2', 'wide_resnet101_2'] |
7 | 8 |
|
8 | 9 |
|
9 | 10 | model_urls = { |
|
14 | 15 | 'resnet152': 'https://download.pytorch.org/models/resnet152-b121ed2d.pth', |
15 | 16 | 'resnext50_32x4d': 'https://download.pytorch.org/models/resnext50_32x4d-7cdf4587.pth', |
16 | 17 | 'resnext101_32x8d': 'https://download.pytorch.org/models/resnext101_32x8d-8ba56ff5.pth', |
| 18 | + 'wide_resnet50_2': 'https://download.pytorch.org/models/wide_resnet50_2-95faca4d.pth', |
| 19 | + 'wide_resnet101_2': 'https://download.pytorch.org/models/wide_resnet101_2-32ee1156.pth', |
17 | 20 | } |
18 | 21 |
|
19 | 22 |
|
@@ -294,3 +297,37 @@ def resnext101_32x8d(pretrained=False, progress=True, **kwargs): |
294 | 297 | kwargs['width_per_group'] = 8 |
295 | 298 | return _resnet('resnext101_32x8d', Bottleneck, [3, 4, 23, 3], |
296 | 299 | pretrained, progress, **kwargs) |
| 300 | + |
| 301 | + |
| 302 | +def wide_resnet50_2(pretrained=False, progress=True, **kwargs): |
| 303 | + """Constructs a Wide ResNet-50-2 model. |
| 304 | +
|
| 305 | + The model is the same as ResNet except for the bottleneck number of channels |
| 306 | + which is twice larger in every block. The number of channels in outer 1x1 |
| 307 | + convolutions is the same, e.g. last block in ResNet-50 has 2048-512-2048 |
| 308 | + channels, and in Wide ResNet-50-2 has 2048-1024-2048. |
| 309 | +
|
| 310 | + Args: |
| 311 | + pretrained (bool): If True, returns a model pre-trained on ImageNet |
| 312 | + progress (bool): If True, displays a progress bar of the download to stderr |
| 313 | + """ |
| 314 | + kwargs['width_per_group'] = 64 * 2 |
| 315 | + return _resnet('wide_resnet50_2', Bottleneck, [3, 4, 6, 3], |
| 316 | + pretrained, progress, **kwargs) |
| 317 | + |
| 318 | + |
| 319 | +def wide_resnet101_2(pretrained=False, progress=True, **kwargs): |
| 320 | + """Constructs a Wide ResNet-101-2 model. |
| 321 | +
|
| 322 | + The model is the same as ResNet except for the bottleneck number of channels |
| 323 | + which is twice larger in every block. The number of channels in outer 1x1 |
| 324 | + convolutions is the same, e.g. last block in ResNet-50 has 2048-512-2048 |
| 325 | + channels, and in Wide ResNet-50-2 has 2048-1024-2048. |
| 326 | +
|
| 327 | + Args: |
| 328 | + pretrained (bool): If True, returns a model pre-trained on ImageNet |
| 329 | + progress (bool): If True, displays a progress bar of the download to stderr |
| 330 | + """ |
| 331 | + kwargs['width_per_group'] = 64 * 2 |
| 332 | + return _resnet('wide_resnet101_2', Bottleneck, [3, 4, 23, 3], |
| 333 | + pretrained, progress, **kwargs) |
0 commit comments