实时语义分割——FPN,PAN,......

实时语义分割——FPN,PAN,......_第1张图片

实时语义分割——FPN,PAN,......_第2张图片

def FPN_s(inputs, stage_chal=(116, 232, 464), is_training=True):
    C3, C4, C5 = inputs
    P5 = Conv2D_BN_ReLU(C5, stage_chal[2], 256, 1, 1, act_type="relu", is_training=is_training)

    P4_1 = Conv2D_BN_ReLU(C4, stage_chal[1], 256, 1, 1, act_type="relu", is_training=is_training)
    in_shape = C4.get_shape().as_list()[1:-1]
    P4_2 = tf.image.resize_images(P5, in_shape, True) # upsampling
    P4 = tf.add(P4_1, P4_2)

    P3_1 = Conv2D_BN_ReLU(C3, stage_chal[0], 256, 1, 1, act_type="relu", is_training=is_training)
    in_shape = C3.get_shape().as_list()[1:-1]
    P3_2 = tf.image.resize_images(P4, in_shape, True) # upsampling
    P3 = tf.add(P3_1, P3_2)
    print("FPN_s: ", P3, P4, P5)
    return P3, P4, P5

def FPN_m(inputs, stage_chal=(116, 232, 464, 1024), is_training=True):
    C2, C3, C4, C5 = inputs
    P5 = Conv2D_BN_ReLU(C5, stage_chal[3], 256, 1, 1, act_type="relu", is_training=is_training)
    P6 = max_pooling2d(P5, 3, 2, padding="same")

    P4_1 = Conv2D_BN_ReLU(C4, stage_chal[2], 256, 1, 1, act_type="relu", is_training=is_training)
    in_shape = C4.get_shape().as_list()[1:-1]
    P4_2 = tf.image.resize_images(P5, in_shape, True) # upsampling
    P4 = tf.add(P4_1, P4_2)

    P3_1 = Conv2D_BN_ReLU(C3, stage_chal[1], 256, 1, 1, act_type="relu", is_training=is_training)
    in_shape = C3.get_shape().as_list()[1:-1]
    P3_2 = tf.image.resize_images(P4, in_shape, True) # upsampling
    P3 = tf.add(P3_1, P3_2)

    P2_1 = Conv2D_BN_ReLU(C2, stage_chal[0], 256, 1, 1, act_type="relu", is_training=is_training)
    in_shape = C2.get_shape().as_list()[1:-1]
    P2_2 = tf.image.resize_images(P3, in_shape, True) # upsampling
    P2 = tf.add(P2_1, P2_2)
    print("FPN_m: ", P2, P3, P4, P5, P6)
    return P2, P3, P4, P5, P6

 

你可能感兴趣的:(#,深度学习,图像分割,深度学习,实时语义分割)