After the release of the second paper on ResNet , the original model presented in the previous section has been known as ResNet v1. The improved ResNet is commonly called ResNet v2. The improvement is mainly found in the arrangement of layers in the residual block as shown in following figure.
The prominent changes in ResNet v2 are:
The use of a stack of 1 × 1 - 3 × 3 - 1 × 1
Batch normalization and ReLU activation come before 2D convolution
def resnet_v2(input_shape, depth, num_classes=10): if (depth - 2) % 9 != 0: raise ValueError('depth should be 9n+2 (eg 56 or 110 in [b])') # Start model definition. num_filters_in = 16 num_res_blocks = int((depth - 2) / 9) inputs = Input(shape=input_shape) # v2 performs Conv2D with BN-ReLU on input # before splitting into 2 paths x = resnet_layer...