Skip to content
This repository was archived by the owner on Jan 13, 2023. It is now read-only.

Files

Latest commit

25411af · Nov 19, 2020

History

History

resnet

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
Jan 17, 2020
Sep 9, 2019
Sep 7, 2019
Oct 8, 2019
Oct 9, 2019
Sep 7, 2019
Aug 3, 2019
Sep 17, 2019
Sep 17, 2019
Nov 19, 2020
Sep 17, 2019
Nov 19, 2020
Mar 18, 2020
Nov 19, 2020
Oct 9, 2019
Nov 19, 2020
Mar 18, 2020
Nov 19, 2020
Aug 15, 2019

ResNet

resnet(v1/v1.5/v2).py - academic (idiomatic)
resnet_cifar10(v1/v2).py - academic (idiomatic)
resnet(v1/v1.5/v2)_c.py - production (composable)

Paper

Macro-Architecture

Micro-Architecture

Stem Group

ResNet Block with Identity Shortcut

v2.0

In v2.0, the BatchNormalization and ReLU activation function is moved from after the convolution to before.

ResNet Block with Projection Shortcut

v1.0

v1.5

In v1.5, the strided convolution is moved from the 1x1 convolution to the 3x3 bottleneck convolution.

v2.0

In v2.0, the BatchNormalization and ReLU activation function is moved from after the convolution to before.

Classifier

Composable

Example: Instantiate a stock ResNet model

from resnet_v1_c import ResNetV1

# ResNet50 v1.0 from research paper
resnet = ResNetV1(50)

# ResNet50 v1.0 custom input shape/classes
resnet = ResNetV1(50, input_shape=(128, 128, 3), n_classes=50)

# getter for the tf.keras model
model = resnet.model

Example: Compose and Train a ResNet model

    ''' Example for constructing/training a ResNet V1 model on CIFAR-10
    '''
    # Example of constructing a mini-ResNet
    groups = [ { 'n_filters' : 64, 'n_blocks': 1 },
               { 'n_filters': 128, 'n_blocks': 2 },
               { 'n_filters': 256, 'n_blocks': 2 }]
    resnet = ResNetV1(groups, input_shape=(32, 32, 3), n_classes=10)
    resnet.model.summary()
    resnet.cifar10()
    ```