Skip to content

Commit

Permalink
Added ResNet to the list of validated models
Browse files Browse the repository at this point in the history
  • Loading branch information
Saumitro Dasgupta committed May 24, 2016
1 parent efeacf6 commit 5ce432a
Show file tree
Hide file tree
Showing 3 changed files with 1,200 additions and 27 deletions.
6 changes: 5 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,12 @@ See the [examples](examples/) folder for more details.

## Verification

The following converted models have been verified on the ILSVRC2012 validation set.
The following converted models have been verified on the ILSVRC2012 validation set using
[validate.py](examples/imagenet/validate.py).

| Model | Top 5 Accuracy |
|:------------------------------------------------------|---------------:|
| [ResNet 50](http://arxiv.org/abs/1512.03385) | 92.02% |
| [VGG 16](http://arxiv.org/abs/1409.1556) | 89.88% |
| [GoogLeNet](http://arxiv.org/abs/1409.4842) | 89.06% |
| [Network in Network](http://arxiv.org/abs/1312.4400) | 81.21% |
Expand All @@ -46,3 +48,5 @@ The following converted models have been verified on the ILSVRC2012 validation s
- Image rescaling can affect the ILSVRC2012 top 5 accuracy listed above slightly. VGG16 expects isotropic rescaling (anisotropic reduces accuracy to 88.45%) whereas BVLC's implementation of GoogLeNet expects anisotropic (isotropic reduces accuracy to 87.7%).

- The support class `kaffe.tensorflow.Network` has no internal dependencies. It can be safely extracted and deployed without the rest of this library.

- The ResNet model uses 1x1 convolutions with a stride of 2. This is currently only supported in the master branch of TensorFlow (the latest release at time of writing being v0.8.0, which does not support it).
51 changes: 25 additions & 26 deletions examples/imagenet/models/helper.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
from alexnet import AlexNet
from caffenet import CaffeNet
from nin import NiN

from resnet import ResNet50, ResNet101, ResNet152

class DataSpec(object):
'''Input data specifications for an ImageNet model.'''
Expand All @@ -32,38 +32,37 @@ def __init__(self, batch_size, scale_size, crop_size, isotropic, channels=3, mea
# However, using just the per-channel mean values instead doesn't affect things too much.
self.mean = mean if mean is not None else np.array([104., 117., 124.])

def alexnet_spec(batch_size=500):
'''Parameters used by AlexNet and its variants.'''
return DataSpec(batch_size=batch_size, scale_size=256, crop_size=227, isotropic=False)

def std_spec(batch_size, isotropic=True):
'''Parameters commonly used by "post-AlexNet" architectures.'''
return DataSpec(batch_size=batch_size, scale_size=256, crop_size=224, isotropic=isotropic)

# Collection of sample auto-generated models
MODELS = (AlexNet, CaffeNet, GoogleNet, NiN, VGG16)
MODELS = (AlexNet, CaffeNet, GoogleNet, NiN, ResNet50, ResNet101, ResNet152, VGG16)

# The corresponding data specifications for the sample models
# These specifications are based on how the models were trained.
# The recommended batch size is based on a Titan X (12GB).
MODEL_DATA_SPECS = {

AlexNet: DataSpec(batch_size=500,
scale_size=256,
crop_size=227,
isotropic=False),

CaffeNet: DataSpec(batch_size=500,
scale_size=256,
crop_size=227,
isotropic=False),

GoogleNet: DataSpec(batch_size=200,
scale_size=256,
crop_size=224,
isotropic=False),

NiN: DataSpec(batch_size=500,
scale_size=256,
crop_size=224,
isotropic=True),

VGG16: DataSpec(batch_size=25,
scale_size=256,
crop_size=224,
isotropic=True),
AlexNet: alexnet_spec(),

CaffeNet: alexnet_spec(),

GoogleNet: std_spec(batch_size=200, isotropic=False),

ResNet50: std_spec(batch_size=25),

ResNet101: std_spec(batch_size=25),

ResNet152: std_spec(batch_size=25),

NiN: std_spec(batch_size=500),

VGG16: std_spec(batch_size=224)
}


Expand Down
Loading

0 comments on commit 5ce432a

Please sign in to comment.