Skip to content

Commit

Permalink
resnet imported w/o Pad layer
Browse files Browse the repository at this point in the history
  • Loading branch information
andreasdominik committed Oct 27, 2023
1 parent 638b284 commit b53d8d9
Showing 1 changed file with 36 additions and 36 deletions.
72 changes: 36 additions & 36 deletions src/pretrained.jl
Original file line number Diff line number Diff line change
Expand Up @@ -211,18 +211,18 @@ function get_resnet50v2(; filters_only=false, trainable=true)
h5 = HDF5.h5open(local_file)

filter_layers = Chain(
Pad(3),
Conv(h5, "conv1_conv", trainable=trainable, stride=2, actf=identity),
Pad(1),
Pool(;window=3, stride=2),
#Pad(3),
Conv(h5, "conv1_conv", trainable=trainable, stride=2, actf=identity, padding=3),
#Pad(1),
Pool(;window=3, stride=2, padding=1),
BatchNorm(h5, "conv2_block1_preact_bn", trainable=trainable, momentum=0.99, ε=1.001e-5),
Relu(),
ResNetBlock([
Conv(h5, "conv2_block1_1_conv", use_bias=false, trainable=trainable, actf=identity),
BatchNorm( h5, "conv2_block1_1_bn", trainable=trainable, momentum=0.99, ε=1.001e-5),
Relu(),
Pad(1),
Conv(h5, "conv2_block1_2_conv", use_bias=false, trainable=trainable, actf=identity),
#Pad(1),
Conv(h5, "conv2_block1_2_conv", use_bias=false, trainable=trainable, actf=identity, padding=1),
BatchNorm( h5, "conv2_block1_2_bn", trainable=trainable, momentum=0.99, ε=1.001e-5),
Relu(),
Conv(h5, "conv2_block1_3_conv", trainable=trainable, actf=identity),
Expand All @@ -236,8 +236,8 @@ function get_resnet50v2(; filters_only=false, trainable=true)
Conv(h5, "conv2_block2_1_conv", use_bias=false, trainable=trainable, actf=identity),
BatchNorm( h5, "conv2_block2_1_bn", trainable=trainable, momentum=0.99, ε=1.001e-5),
Relu(),
Pad(1),
Conv(h5, "conv2_block2_2_conv", use_bias=false, trainable=trainable, actf=identity),
#Pad(1),
Conv(h5, "conv2_block2_2_conv", use_bias=false, trainable=trainable, actf=identity, padding=1),
BatchNorm( h5, "conv2_block2_2_bn", trainable=trainable, momentum=0.99, ε=1.001e-5),
Relu(),
Conv(h5, "conv2_block2_3_conv", trainable=trainable, actf=identity),
Expand All @@ -248,8 +248,8 @@ function get_resnet50v2(; filters_only=false, trainable=true)
Conv(h5, "conv2_block3_1_conv",use_bias=false, trainable=trainable, actf=identity),
BatchNorm( h5, "conv2_block3_1_bn", trainable=trainable, momentum=0.99, ε=1.001e-5),
Relu(),
Pad(1),
Conv(h5, "conv2_block3_2_conv", use_bias=false, stride=2, trainable=trainable, actf=identity),
#Pad(1),
Conv(h5, "conv2_block3_2_conv", use_bias=false, stride=2, trainable=trainable, actf=identity, padding=1),
BatchNorm( h5, "conv2_block3_2_bn", trainable=trainable, momentum=0.99, ε=1.001e-5),
Relu(),
Conv(h5, "conv2_block3_3_conv", trainable=trainable, actf=identity),
Expand All @@ -265,8 +265,8 @@ function get_resnet50v2(; filters_only=false, trainable=true)
Conv(h5, "conv3_block1_1_conv", use_bias=false, trainable=trainable, actf=identity),
BatchNorm(h5, "conv3_block1_1_bn", trainable=trainable, momentum=0.99, ε=1.001e-5),
Relu(),
Pad(1),
Conv(h5, "conv3_block1_2_conv", use_bias=false, trainable=trainable, actf=identity),
#Pad(1),
Conv(h5, "conv3_block1_2_conv", use_bias=false, trainable=trainable, actf=identity, padding=1),
BatchNorm( h5, "conv3_block1_2_bn", trainable=trainable, momentum=0.99, ε=1.001e-5),
Relu(),
Conv(h5, "conv3_block1_3_conv", trainable=trainable, actf=identity),
Expand All @@ -280,8 +280,8 @@ function get_resnet50v2(; filters_only=false, trainable=true)
Conv(h5, "conv3_block2_1_conv"; use_bias=false, trainable=trainable, actf=identity),
BatchNorm(h5, "conv3_block2_1_bn", trainable=trainable, momentum=0.99, ε=1.001e-5),
Relu(),
Pad(1),
Conv(h5, "conv3_block2_2_conv", use_bias=false, trainable=trainable, actf=identity),
#Pad(1),
Conv(h5, "conv3_block2_2_conv", use_bias=false, trainable=trainable, actf=identity, padding=1),
BatchNorm( h5, "conv3_block2_2_bn", trainable=trainable, momentum=0.99, ε=1.001e-5),
Relu(),
Conv(h5, "conv3_block2_3_conv", trainable=trainable, actf=identity),
Expand All @@ -292,8 +292,8 @@ function get_resnet50v2(; filters_only=false, trainable=true)
Conv(h5, "conv3_block3_1_conv", use_bias=false, trainable=trainable, actf=identity),
BatchNorm(h5, "conv3_block3_1_bn", trainable=trainable, momentum=0.99, ε=1.001e-5),
Relu(),
Pad(1),
Conv(h5, "conv3_block3_2_conv", use_bias=false, trainable=trainable, actf=identity),
#Pad(1),
Conv(h5, "conv3_block3_2_conv", use_bias=false, trainable=trainable, actf=identity, padding=1),
BatchNorm( h5, "conv3_block3_2_bn", trainable=trainable, momentum=0.99, ε=1.001e-5),
Relu(),
Conv(h5, "conv3_block3_3_conv", trainable=trainable, actf=identity),
Expand All @@ -304,8 +304,8 @@ function get_resnet50v2(; filters_only=false, trainable=true)
Conv(h5, "conv3_block4_1_conv", use_bias=false, trainable=trainable, actf=identity),
BatchNorm( h5, "conv3_block4_1_bn", trainable=trainable, momentum=0.99, ε=1.001e-5),
Relu(),
Pad(1),
Conv(h5, "conv3_block4_2_conv", use_bias=false, trainable=trainable, stride=2, actf=identity),
#Pad(1),
Conv(h5, "conv3_block4_2_conv", use_bias=false, trainable=trainable, stride=2, actf=identity, padding=1),
BatchNorm( h5, "conv3_block4_2_bn", trainable=trainable, momentum=0.99, ε=1.001e-5),
Relu(),
Conv(h5, "conv3_block4_3_conv", trainable=trainable, actf=identity),
Expand All @@ -321,8 +321,8 @@ function get_resnet50v2(; filters_only=false, trainable=true)
Conv(h5, "conv4_block1_1_conv", use_bias=false, trainable=trainable, actf=identity),
BatchNorm( h5, "conv4_block1_1_bn", trainable=trainable, momentum=0.99, ε=1.001e-5),
Relu(),
Pad(1),
Conv(h5, "conv4_block1_2_conv", use_bias=false, trainable=trainable, actf=identity),
#Pad(1),
Conv(h5, "conv4_block1_2_conv", use_bias=false, trainable=trainable, actf=identity, padding=1),
BatchNorm( h5, "conv4_block1_2_bn", trainable=trainable, momentum=0.99, ε=1.001e-5),
Relu(),
Conv(h5, "conv4_block1_3_conv", trainable=trainable, actf=identity),
Expand All @@ -336,8 +336,8 @@ function get_resnet50v2(; filters_only=false, trainable=true)
Conv(h5, "conv4_block2_1_conv", use_bias=false, trainable=trainable, padding=0, stride=1, actf=identity),
BatchNorm(h5, "conv4_block2_1_bn", trainable=trainable, momentum=0.99, ε=1.001e-5),
Relu(),
Pad(1),
Conv(h5, "conv4_block2_2_conv", use_bias=false, trainable=trainable, actf=identity),
#Pad(1),
Conv(h5, "conv4_block2_2_conv", use_bias=false, trainable=trainable, actf=identity, padding=1),
BatchNorm( h5, "conv4_block2_2_bn", trainable=trainable, momentum=0.99, ε=1.001e-5),
Relu(),
Conv(h5, "conv4_block2_3_conv", trainable=trainable, padding=0, stride=1, actf=identity),
Expand All @@ -348,8 +348,8 @@ function get_resnet50v2(; filters_only=false, trainable=true)
Conv(h5, "conv4_block3_1_conv", use_bias=false, trainable=trainable, actf=identity),
BatchNorm(h5, "conv4_block3_1_bn", trainable=trainable, momentum=0.99, ε=1.001e-5),
Relu(),
Pad(1),
Conv(h5, "conv4_block3_2_conv", use_bias=false, trainable=trainable, actf=identity),
#Pad(1),
Conv(h5, "conv4_block3_2_conv", use_bias=false, trainable=trainable, actf=identity, padding=1),
BatchNorm( h5, "conv4_block3_2_bn", trainable=trainable, momentum=0.99, ε=1.001e-5),
Relu(),
Conv(h5, "conv4_block3_3_conv", trainable=trainable, actf=identity),
Expand All @@ -360,8 +360,8 @@ function get_resnet50v2(; filters_only=false, trainable=true)
Conv(h5, "conv4_block4_1_conv", use_bias=false, trainable=trainable, actf=identity),
BatchNorm(h5, "conv4_block4_1_bn", trainable=trainable, momentum=0.99, ε=1.001e-5),
Relu(),
Pad(1),
Conv(h5, "conv4_block4_2_conv", use_bias=false, trainable=trainable, actf=identity),
#Pad(1),
Conv(h5, "conv4_block4_2_conv", use_bias=false, trainable=trainable, actf=identity, padding=1),
BatchNorm( h5, "conv4_block4_2_bn", trainable=trainable, momentum=0.99, ε=1.001e-5),
Relu(),
Conv(h5, "conv4_block4_3_conv", trainable=trainable, padding=0, stride=1, actf=identity),
Expand All @@ -372,8 +372,8 @@ function get_resnet50v2(; filters_only=false, trainable=true)
Conv(h5, "conv4_block5_1_conv", use_bias=false, trainable=trainable, actf=identity),
BatchNorm(h5, "conv4_block5_1_bn", trainable=trainable, momentum=0.99, ε=1.001e-5),
Relu(),
Pad(1),
Conv(h5, "conv4_block5_2_conv", use_bias=false, trainable=trainable, actf=identity),
#Pad(1),
Conv(h5, "conv4_block5_2_conv", use_bias=false, trainable=trainable, actf=identity, padding=1),
BatchNorm( h5, "conv4_block5_2_bn", trainable=trainable, momentum=0.99, ε=1.001e-5),
Relu(),
Conv(h5, "conv4_block5_3_conv", trainable=trainable, padding=0, stride=1, actf=identity),
Expand All @@ -384,8 +384,8 @@ function get_resnet50v2(; filters_only=false, trainable=true)
Conv(h5, "conv4_block6_1_conv", use_bias=false, trainable=trainable, actf=identity),
BatchNorm( h5, "conv4_block6_1_bn", trainable=trainable, momentum=0.99, ε=1.001e-5),
Relu(),
Pad(1),
Conv(h5, "conv4_block6_2_conv", use_bias=false, trainable=trainable, stride=2, actf=identity),
#Pad(1),
Conv(h5, "conv4_block6_2_conv", use_bias=false, trainable=trainable, stride=2, actf=identity, padding=1),
BatchNorm( h5, "conv4_block6_2_bn", trainable=trainable, momentum=0.99, ε=1.001e-5),
Relu(),
Conv(h5, "conv4_block6_3_conv", trainable=trainable, padding=0, stride=1, actf=identity),
Expand All @@ -401,8 +401,8 @@ function get_resnet50v2(; filters_only=false, trainable=true)
Conv(h5, "conv5_block1_1_conv", use_bias=false, trainable=trainable, actf=identity),
BatchNorm( h5, "conv5_block1_1_bn", trainable=trainable, momentum=0.99, ε=1.001e-5),
Relu(),
Pad(1),
Conv(h5, "conv5_block1_2_conv", use_bias=false, trainable=trainable, actf=identity),
#Pad(1),
Conv(h5, "conv5_block1_2_conv", use_bias=false, trainable=trainable, actf=identity, padding=1),
BatchNorm( h5, "conv5_block1_2_bn", trainable=trainable, momentum=0.99, ε=1.001e-5),
Relu(),
Conv(h5, "conv5_block1_3_conv", trainable=trainable, actf=identity),
Expand All @@ -416,8 +416,8 @@ function get_resnet50v2(; filters_only=false, trainable=true)
Conv(h5, "conv5_block2_1_conv", use_bias=false, trainable=trainable, actf=identity),
BatchNorm(h5, "conv5_block2_1_bn", trainable=trainable, momentum=0.99, ε=1.001e-5),
Relu(),
Pad(1),
Conv(h5, "conv5_block2_2_conv", use_bias=false, trainable=trainable, actf=identity),
#Pad(1),
Conv(h5, "conv5_block2_2_conv", use_bias=false, trainable=trainable, actf=identity, padding=1),
BatchNorm( h5, "conv5_block2_2_bn", trainable=trainable, momentum=0.99, ε=1.001e-5),
Relu(),
Conv(h5, "conv5_block2_3_conv", trainable=trainable, actf=identity),
Expand All @@ -428,8 +428,8 @@ function get_resnet50v2(; filters_only=false, trainable=true)
Conv(h5, "conv5_block3_1_conv", use_bias=false, trainable=trainable, actf=identity),
BatchNorm(h5, "conv5_block3_1_bn", trainable=trainable, momentum=0.99, ε=1.001e-5),
Relu(),
Pad(1),
Conv(h5, "conv5_block3_2_conv", use_bias=false, trainable=trainable, actf=identity),
#Pad(1),
Conv(h5, "conv5_block3_2_conv", use_bias=false, trainable=trainable, actf=identity, padding=1),
BatchNorm( h5, "conv5_block3_2_bn", trainable=trainable, momentum=0.99, ε=1.001e-5),
Relu(),
Conv(h5, "conv5_block3_3_conv", trainable=trainable, actf=identity),
Expand Down

0 comments on commit b53d8d9

Please sign in to comment.