How to pick the right layers for ResNet101?

I got this function that builds a DeeplabV3+ model with a ResNet50 backend for semantic segmentation

def DeepLabV3_ResNet50(size, classes):
    input = keras.Input(shape=(size, size, 3))

    resnet50 = keras.applications.ResNet50(weights="imagenet", include_top=False, input_tensor = input)
    x = resnet50.get_layer("conv4_block6_2_relu").output
    x = DSP_pooling(x)

    a = layers.UpSampling2D(size=(size // 4 // x.shape[1], size // 4 // x.shape[2]),interpolation="bilinear",)(x)
    b = resnet50.get_layer("conv2_block3_2_relu").output
    b = block(b, filters = 48, kernel = 1)

    x = layers.Concatenate(axis=-1)([a, b])
    x = block(x)
    x = block(x)
    x = layers.UpSampling2D(size=(size // x.shape[1], size // x.shape[2]),interpolation="bilinear",)(x)

    output = layers.Conv2D(classes, kernel_size=(1, 1), padding="same")(x)

    return keras.Model(inputs = input, outputs = output)

model = DeepLabV3_ResNet50(size = image_size, classes = labels)
model.summary()

To improve my validation accuracy, I figured that switching the backend from ResNet50 to ResNet101 might be a good try. Changing resnet50.get_layer() to resnet101.get_layer() is not enough. How do I know which convolutional blocks I should pick for my resnet101.get_layer() function?

1 Like

Hi @Onur_Ozbek, We cannot directly say that these blocks will be suitable. we have to experiment on different blocks based upon your use case and figure which gives the best result. Thank You.