szagoruyko / wide-residual-networks

3.8% and 18.3% on CIFAR-10 and CIFAR-100
http://arxiv.org/abs/1605.07146
BSD 2-Clause "Simplified" License
1.3k stars 293 forks source link

COCO/ImageNet Implementation #59

Closed matheus-hertzog-deel closed 5 years ago

matheus-hertzog-deel commented 5 years ago

In your wide-resnet.lua, line 95: "--one conv at the beginning (spatial size: 32x32)" I can see your model has input size of 32x32 (Cifar10/100 size) and later on performs an avg_pooling on an 8x8 input. How do you train your models on larger input datasets such as COCO and ImageNet? Do you just modify the avg pooling layer and the first convolutional layer?

xwuShirley commented 5 years ago

HI, @Matheusih Have you figure out imagenet version of wide-resnet?

matheus-hertzog-deel commented 5 years ago

@xwuShirley sadly, no. The author does provide the model object, however, here I tried loading and testing it on the tiny-imagenet dataset but I couldn't get anything close to a desirable performance.

xwuShirley commented 5 years ago

@Matheusih Have you tried input size with 224x224? would it work?

szagoruyko commented 5 years ago

see https://github.com/szagoruyko/wide-residual-networks/tree/master/pretrained for pretrained ImageNet WRN-50-2.

Also, support for WRN was added in torchvision via https://github.com/pytorch/vision/pull/822

To make BasicBlock WRN-18-2 do:

from torchvision.models.resnet import Bottleneck, ResNet, BasicBlock
model = ResNet(BasicBlock, [2,2,2,2], width_per_group=64 * 2)

To make Bottleneck WRN-50-2 do:

model = ResNet(Bottleneck, [3,4,6,3], width_per_group=64 * 2)

(this needs master torchvision)

Also, I plan adding pretrained WRN-18-2, WRN-34-2 and WRN-50-2.

Update: removed WRNBottleneck with modified expansion

xwuShirley commented 5 years ago

@szagoruyko Should the [2,2,2,2] in the model of WRN-50-2 be [3, 4, 6, 3] same as resnet50, the following? model = ResNet(WRNBottleneck, [3, 4, 6, 3], width_per_group=64 * 2) similarly, the resnet-34-2 like following? ResNet(BasicBlock, [3, 4, 6, 3], width_per_group=64 * 2) very appreciate your help.

szagoruyko commented 5 years ago

@xwuShirley yes you're right, it is [3, 4, 6, 4], fixed it in my post. default parameters for ResNet-50 from lua fb.resnet.torch or NVIDIA/apex should do for training.

szagoruyko commented 5 years ago

there was a fix in https://github.com/pytorch/vision/pull/852 so that it is no longer needed to make new Bottleneck class with modified expansion.

szagoruyko commented 5 years ago

pretrained models are now in pytorch hub, see https://pytorch.org/hub/pytorch_vision_wide_resnet/