FPN解析


轉載1:https://blog.csdn.net/WZZ18191171661/article/details/79494534

轉載2:https://zhuanlan.zhihu.com/p/42745788

轉載3:https://github.com/unsky/FPN/blob/master/models/pascal_voc/FPN/FP_Net_end2end/train.prototxt

論文題目:Feature Pyramid Networks for Object Detection

論文鏈接:論文鏈接

論文代碼:Caffe版本代碼鏈接

1. 骨干架構(FPN)

卷積網絡的一個重要特征:深層網絡容易響應語義特征,淺層網絡容易響應圖像特征。但是到了物體檢測領域,這個特征便成了一個重要的問題,高層網絡雖然能響應語義特征,但是由於Feature Map的尺寸較小,含有的幾何信息並不多,不利於物體檢測;淺層網絡雖然包含比較多的幾何信息,但是圖像的語義特征並不多,不利於圖像的分類,這個問題在小尺寸物體檢測上更為顯著和,這也就是為什么物體檢測算法普遍對小物體檢測效果不好的最重要原因之一。很自然地可以想到,使用合並了的深層和淺層特征來同時滿足分類和檢測的需求。

FPN使用的是圖像金字塔的思想以解決物體檢測場景中小尺寸物體檢測困難的問題,傳統的圖像金字塔方法(圖1.a)采用輸入多尺度圖像的方式構建多尺度的特征,該方法的最大問題便是識別時間為單幅圖的k倍,其中k是縮放的尺寸個數。Faster R-CNN等方法為了提升檢測速度,使用了單尺度的Feature Map(圖1.b),但單尺度的特征圖限制了模型的檢測能力,尤其是訓練集中覆蓋率極低的樣本(例如較大和較小樣本)。不同於Faster R-CNN只使用最頂層的Feature Map,SSD[6]利用卷積網絡的層次結構,從VGG的第conv4_3開始,通過網絡的不同層得到了多尺度的Feature Map(圖1.c),該方法雖然能提高精度且基本上沒有增加測試時間,但沒有使用更加低層的Feature Map,然而這些低層次的特征對於檢測小物體是非常有幫助的。

針對上面這些問題,FPN采用了SSD的金字塔內Feature Map的形式。與SSD不同的是,FPN不僅使用了VGG中層次深的Feature Map,並且淺層的Feature Map也被應用到FPN中。並通過自底向上(bottom-up),自頂向下(top-down)以及橫向連接(lateral connection)將這些Feature Map高效的整合起來,在提升精度的同時並沒有大幅增加檢測時間(圖1.d)。

通過將Faster R-CNN的RPN和Fast R-CNN的骨干框架換成FPN,Faster R-CNN的平均精度從51.7%提升到56.9%。

 

 

殘差網絡得到的C1-C5由於經歷了不同的降采樣次數,所以得到的Feature Map的尺寸也不同。為了提升計算效率,首先FPN使用 [公式] 進行了降維,得到P5,然后使用雙線性插值進行上采樣,將P5上采樣到和C4相同的尺寸。

之后,FPN也使用 [公式] 卷積對P4進行了降維,由於降維並不改變尺寸大小,所以P5和P4具有相同的尺寸,FPN直接把P5單位加到P4得到了更新后的P4。基於同樣的策略,我們使用P4更新P3,P3更新P2。這整個過程是從網絡的頂層向下層開始更新的,所以叫做自頂向下路徑。

FPN使用單位加的操作來更新特征,這種單位加操作叫做橫向連接。由於使用了單位加,所以P2,P3,P4,P5應該具有相同數量的Feature Map(源碼中該值為256),所以FPN使用了 [公式] 卷積進行降維。

在更新完Feature Map之后,FPN在P2,P3,P4,P5之后均接了一個 [公式] 卷積操作(通道數為512,代碼片段1第22-25行),該卷積操作是為了減輕上采樣的混疊效應(aliasing effect)。

不同尺度的ROI,使用不同特征層作為ROI pooling層的輸入,大尺度ROI就用后面一些的金字塔層,比如P5;小尺度ROI就用前面一點的特征層,比如P4。那怎么判斷ROI改用那個層的輸出呢?這里作者定義了一個系數Pk,其定義為:

 

224是ImageNet的標准輸入,k0是基准值,設置為5,代表P5層的輸出(原圖大小就用P5層),w和h是ROI區域的長和寬,假設ROI是112 * 112的大小,那么k = k0-1 = 5-1 = 4,意味着該ROI應該使用P4的特征層。k值應該會做取整處理,防止結果不是整數。

FPN的代碼出現在./mrcnn/model.py中,核心代碼如下

# Build the shared convolutional layers.
# Bottom-up Layers
# Returns a list of the last layers of each stage, 5 in total.
# Don't create the thead (stage 5), so we pick the 4th item in the list.
if callable(config.BACKBONE):
    _, C2, C3, C4, C5 = config.BACKBONE(input_image, stage5=True, train_bn=config.TRAIN_BN)
else:
    _, C2, C3, C4, C5 = resnet_graph(input_image, config.BACKBONE, stage5=True, train_bn=config.TRAIN_BN)
# Top-down Layers
# TODO: add assert to varify feature map sizes match what's in config
P5 = KL.Conv2D(config.TOP_DOWN_PYRAMID_SIZE, (1, 1), name='fpn_c5p5')(C5)
P4 = KL.Add(name="fpn_p4add")([
    KL.UpSampling2D(size=(2, 2), name="fpn_p5upsampled")(P5),
    KL.Conv2D(config.TOP_DOWN_PYRAMID_SIZE, (1, 1), name='fpn_c4p4')(C4)])
P3 = KL.Add(name="fpn_p3add")([
    KL.UpSampling2D(size=(2, 2), name="fpn_p4upsampled")(P4),
    KL.Conv2D(config.TOP_DOWN_PYRAMID_SIZE, (1, 1), name='fpn_c3p3')(C3)])
P2 = KL.Add(name="fpn_p2add")([
    KL.UpSampling2D(size=(2, 2), name="fpn_p3upsampled")(P3),
    KL.Conv2D(config.TOP_DOWN_PYRAMID_SIZE, (1, 1), name='fpn_c2p2')(C2)])
# Attach 3x3 conv to all P layers to get the final feature maps.
P2 = KL.Conv2D(config.TOP_DOWN_PYRAMID_SIZE, (3, 3), padding="SAME", name="fpn_p2")(P2)
P3 = KL.Conv2D(config.TOP_DOWN_PYRAMID_SIZE, (3, 3), padding="SAME", name="fpn_p3")(P3)
P4 = KL.Conv2D(config.TOP_DOWN_PYRAMID_SIZE, (3, 3), padding="SAME", name="fpn_p4")(P4)
P5 = KL.Conv2D(config.TOP_DOWN_PYRAMID_SIZE, (3, 3), padding="SAME", name="fpn_p5")(P5)
# P6 is used for the 5th anchor scale in RPN. Generated by
# subsampling from P5 with stride of 2.
P6 = KL.MaxPooling2D(pool_size=(1, 1), strides=2, name="fpn_p6")(P5)

# Note that P6 is used in RPN, but not in the classifier heads.
rpn_feature_maps = [P2, P3, P4, P5, P6]
mrcnn_feature_maps = [P2, P3, P4, P5]

1.1 自底向上路徑

自底向上方法反映在上面代碼的第6行或者第8行,自底向上即是卷積網絡的前向過程,在Mask R-CNN中,用戶可以根據配置文件選擇使用ResNet-50或者ResNet-101。代碼中的resnet_graph就是一個殘差塊網絡,其返回值C2,C3,C4,C5,是每次池化之后得到的Feature Map,該函數也實現在./mrcnn/model.py中(代碼片段2)。需要注意的是在殘差網絡中,C2,C3,C4,C5經過的降采樣次數分別是2,3,4,5即分別對應原圖中的步長分別是4,8,16,32。這里之所以沒有使用C1,是考慮到由於C1的尺寸過大,訓練過程中會消耗很多的顯存。

def resnet_graph(input_image, architecture, stage5=False, train_bn=True):
    """Build a ResNet graph.
        architecture: Can be resnet50 or resnet101
        stage5: Boolean. If False, stage5 of the network is not created
        train_bn: Boolean. Train or freeze Batch Norm layres
    """
    assert architecture in ["resnet50", "resnet101"]
    # Stage 1
    x = KL.ZeroPadding2D((3, 3))(input_image)
    x = KL.Conv2D(64, (7, 7), strides=(2, 2), name='conv1', use_bias=True)(x)
    x = BatchNorm(name='bn_conv1')(x, training=train_bn)
    x = KL.Activation('relu')(x)
    C1 = x = KL.MaxPooling2D((3, 3), strides=(2, 2), padding="same")(x)
    # Stage 2
    x = conv_block(x, 3, [64, 64, 256], stage=2, block='a', strides=(1, 1), train_bn=train_bn)
    x = identity_block(x, 3, [64, 64, 256], stage=2, block='b', train_bn=train_bn)
    C2 = x = identity_block(x, 3, [64, 64, 256], stage=2, block='c', train_bn=train_bn)
    # Stage 3
    x = conv_block(x, 3, [128, 128, 512], stage=3, block='a', train_bn=train_bn)
    x = identity_block(x, 3, [128, 128, 512], stage=3, block='b', train_bn=train_bn)
    x = identity_block(x, 3, [128, 128, 512], stage=3, block='c', train_bn=train_bn)
    C3 = x = identity_block(x, 3, [128, 128, 512], stage=3, block='d', train_bn=train_bn)
    # Stage 4
    x = conv_block(x, 3, [256, 256, 1024], stage=4, block='a', train_bn=train_bn)
    block_count = {"resnet50": 5, "resnet101": 22}[architecture]
    for i in range(block_count):
        x = identity_block(x, 3, [256, 256, 1024], stage=4, block=chr(98 + i), train_bn=train_bn)
    C4 = x
    # Stage 5
    if stage5:
        x = conv_block(x, 3, [512, 512, 2048], stage=5, block='a', train_bn=train_bn)
        x = identity_block(x, 3, [512, 512, 2048], stage=5, block='b', train_bn=train_bn)
        C5 = x = identity_block(x, 3, [512, 512, 2048], stage=5, block='c', train_bn=train_bn)
    else:
        C5 = None
    return [C1, C2, C3, C4, C5]

Caffe網絡結構圖,可以使用netron工具查看進一步細節(https://github.com/unsky/FPN/blob/master/models/pascal_voc/FPN/FP_Net_end2end/train.prototxt):

name: "ResNet-50"
layer {
  name: 'input-data'
  type: 'Python'
  top: 'data'
  top: 'im_info'
  top: 'gt_boxes'
  python_param {
    module: 'roi_data_layer.layer'
    layer: 'RoIDataLayer'
    param_str: "'num_classes': 21"
  }
}
layer {
    bottom: "data"
    top: "conv1"
    name: "conv1"
    type: "Convolution"
    convolution_param {
        num_output: 64
        kernel_size: 7
        pad: 3
        stride: 2
    }
}

layer {
    bottom: "conv1"
    top: "conv1"
    name: "bn_conv1"
    type: "BatchNorm"
    batch_norm_param {
        use_global_stats: true
    }
}

layer {
    bottom: "conv1"
    top: "conv1"
    name: "scale_conv1"
    type: "Scale"
    scale_param {
        bias_term: true
    }
}

layer {
    bottom: "conv1"
    top: "conv1"
    name: "conv1_relu"
    type: "ReLU"
}

layer {
    bottom: "conv1"
    top: "pool1"
    name: "pool1"
    type: "Pooling"
    pooling_param {
        kernel_size: 3
        stride: 2
        pool: MAX
    }
}

layer {
    bottom: "pool1"
    top: "res2a_branch1"
    name: "res2a_branch1"
    type: "Convolution"
    convolution_param {
        num_output: 256
        kernel_size: 1
        pad: 0
        stride: 1
        bias_term: false
    }
}

layer {
    bottom: "res2a_branch1"
    top: "res2a_branch1"
    name: "bn2a_branch1"
    type: "BatchNorm"
    batch_norm_param {
        use_global_stats: true
    }
}

layer {
    bottom: "res2a_branch1"
    top: "res2a_branch1"
    name: "scale2a_branch1"
    type: "Scale"
    scale_param {
        bias_term: true
    }
}

layer {
    bottom: "pool1"
    top: "res2a_branch2a"
    name: "res2a_branch2a"
    type: "Convolution"
    convolution_param {
        num_output: 64
        kernel_size: 1
        pad: 0
        stride: 1
        bias_term: false
    }
}

layer {
    bottom: "res2a_branch2a"
    top: "res2a_branch2a"
    name: "bn2a_branch2a"
    type: "BatchNorm"
    batch_norm_param {
        use_global_stats: true
    }
}

layer {
    bottom: "res2a_branch2a"
    top: "res2a_branch2a"
    name: "scale2a_branch2a"
    type: "Scale"
    scale_param {
        bias_term: true
    }
}

layer {
    bottom: "res2a_branch2a"
    top: "res2a_branch2a"
    name: "res2a_branch2a_relu"
    type: "ReLU"
}

layer {
    bottom: "res2a_branch2a"
    top: "res2a_branch2b"
    name: "res2a_branch2b"
    type: "Convolution"
    convolution_param {
        num_output: 64
        kernel_size: 3
        pad: 1
        stride: 1
        bias_term: false
    }
}

layer {
    bottom: "res2a_branch2b"
    top: "res2a_branch2b"
    name: "bn2a_branch2b"
    type: "BatchNorm"
    batch_norm_param {
        use_global_stats: true
    }
}

layer {
    bottom: "res2a_branch2b"
    top: "res2a_branch2b"
    name: "scale2a_branch2b"
    type: "Scale"
    scale_param {
        bias_term: true
    }
}

layer {
    bottom: "res2a_branch2b"
    top: "res2a_branch2b"
    name: "res2a_branch2b_relu"
    type: "ReLU"
}

layer {
    bottom: "res2a_branch2b"
    top: "res2a_branch2c"
    name: "res2a_branch2c"
    type: "Convolution"
    convolution_param {
        num_output: 256
        kernel_size: 1
        pad: 0
        stride: 1
        bias_term: false
    }
}

layer {
    bottom: "res2a_branch2c"
    top: "res2a_branch2c"
    name: "bn2a_branch2c"
    type: "BatchNorm"
    batch_norm_param {
        use_global_stats: true
    }
}

layer {
    bottom: "res2a_branch2c"
    top: "res2a_branch2c"
    name: "scale2a_branch2c"
    type: "Scale"
    scale_param {
        bias_term: true
    }
}

layer {
    bottom: "res2a_branch1"
    bottom: "res2a_branch2c"
    top: "res2a"
    name: "res2a"
    type: "Eltwise"
}

layer {
    bottom: "res2a"
    top: "res2a"
    name: "res2a_relu"
    type: "ReLU"
}

layer {
    bottom: "res2a"
    top: "res2b_branch2a"
    name: "res2b_branch2a"
    type: "Convolution"
    convolution_param {
        num_output: 64
        kernel_size: 1
        pad: 0
        stride: 1
        bias_term: false
    }
}

layer {
    bottom: "res2b_branch2a"
    top: "res2b_branch2a"
    name: "bn2b_branch2a"
    type: "BatchNorm"
    batch_norm_param {
        use_global_stats: true
    }
}

layer {
    bottom: "res2b_branch2a"
    top: "res2b_branch2a"
    name: "scale2b_branch2a"
    type: "Scale"
    scale_param {
        bias_term: true
    }
}

layer {
    bottom: "res2b_branch2a"
    top: "res2b_branch2a"
    name: "res2b_branch2a_relu"
    type: "ReLU"
}

layer {
    bottom: "res2b_branch2a"
    top: "res2b_branch2b"
    name: "res2b_branch2b"
    type: "Convolution"
    convolution_param {
        num_output: 64
        kernel_size: 3
        pad: 1
        stride: 1
        bias_term: false
    }
}

layer {
    bottom: "res2b_branch2b"
    top: "res2b_branch2b"
    name: "bn2b_branch2b"
    type: "BatchNorm"
    batch_norm_param {
        use_global_stats: true
    }
}

layer {
    bottom: "res2b_branch2b"
    top: "res2b_branch2b"
    name: "scale2b_branch2b"
    type: "Scale"
    scale_param {
        bias_term: true
    }
}

layer {
    bottom: "res2b_branch2b"
    top: "res2b_branch2b"
    name: "res2b_branch2b_relu"
    type: "ReLU"
}

layer {
    bottom: "res2b_branch2b"
    top: "res2b_branch2c"
    name: "res2b_branch2c"
    type: "Convolution"
    convolution_param {
        num_output: 256
        kernel_size: 1
        pad: 0
        stride: 1
        bias_term: false
    }
}

layer {
    bottom: "res2b_branch2c"
    top: "res2b_branch2c"
    name: "bn2b_branch2c"
    type: "BatchNorm"
    batch_norm_param {
        use_global_stats: true
    }
}

layer {
    bottom: "res2b_branch2c"
    top: "res2b_branch2c"
    name: "scale2b_branch2c"
    type: "Scale"
    scale_param {
        bias_term: true
    }
}

layer {
    bottom: "res2a"
    bottom: "res2b_branch2c"
    top: "res2b"
    name: "res2b"
    type: "Eltwise"
}

layer {
    bottom: "res2b"
    top: "res2b"
    name: "res2b_relu"
    type: "ReLU"
}

layer {
    bottom: "res2b"
    top: "res2c_branch2a"
    name: "res2c_branch2a"
    type: "Convolution"
    convolution_param {
        num_output: 64
        kernel_size: 1
        pad: 0
        stride: 1
        bias_term: false
    }
}

layer {
    bottom: "res2c_branch2a"
    top: "res2c_branch2a"
    name: "bn2c_branch2a"
    type: "BatchNorm"
    batch_norm_param {
        use_global_stats: true
    }
}

layer {
    bottom: "res2c_branch2a"
    top: "res2c_branch2a"
    name: "scale2c_branch2a"
    type: "Scale"
    scale_param {
        bias_term: true
    }
}

layer {
    bottom: "res2c_branch2a"
    top: "res2c_branch2a"
    name: "res2c_branch2a_relu"
    type: "ReLU"
}

layer {
    bottom: "res2c_branch2a"
    top: "res2c_branch2b"
    name: "res2c_branch2b"
    type: "Convolution"
    convolution_param {
        num_output: 64
        kernel_size: 3
        pad: 1
        stride: 1
        bias_term: false
    }
}

layer {
    bottom: "res2c_branch2b"
    top: "res2c_branch2b"
    name: "bn2c_branch2b"
    type: "BatchNorm"
    batch_norm_param {
        use_global_stats: true
    }
}

layer {
    bottom: "res2c_branch2b"
    top: "res2c_branch2b"
    name: "scale2c_branch2b"
    type: "Scale"
    scale_param {
        bias_term: true
    }
}

layer {
    bottom: "res2c_branch2b"
    top: "res2c_branch2b"
    name: "res2c_branch2b_relu"
    type: "ReLU"
}

layer {
    bottom: "res2c_branch2b"
    top: "res2c_branch2c"
    name: "res2c_branch2c"
    type: "Convolution"
    convolution_param {
        num_output: 256
        kernel_size: 1
        pad: 0
        stride: 1
        bias_term: false
    }
}

layer {
    bottom: "res2c_branch2c"
    top: "res2c_branch2c"
    name: "bn2c_branch2c"
    type: "BatchNorm"
    batch_norm_param {
        use_global_stats: true
    }
}

layer {
    bottom: "res2c_branch2c"
    top: "res2c_branch2c"
    name: "scale2c_branch2c"
    type: "Scale"
    scale_param {
        bias_term: true
    }
}

layer {
    bottom: "res2b"
    bottom: "res2c_branch2c"
    top: "res2c"
    name: "res2c"
    type: "Eltwise"
}

layer {
    bottom: "res2c"
    top: "res2c"
    name: "res2c_relu"
    type: "ReLU"
}

layer {
    bottom: "res2c"
    top: "res3a_branch1"
    name: "res3a_branch1"
    type: "Convolution"
    convolution_param {
        num_output: 512
        kernel_size: 1
        pad: 0
        stride: 2
        bias_term: false
    }
}

layer {
    bottom: "res3a_branch1"
    top: "res3a_branch1"
    name: "bn3a_branch1"
    type: "BatchNorm"
    batch_norm_param {
        use_global_stats: true
    }
}

layer {
    bottom: "res3a_branch1"
    top: "res3a_branch1"
    name: "scale3a_branch1"
    type: "Scale"
    scale_param {
        bias_term: true
    }
}

layer {
    bottom: "res2c"
    top: "res3a_branch2a"
    name: "res3a_branch2a"
    type: "Convolution"
    convolution_param {
        num_output: 128
        kernel_size: 1
        pad: 0
        stride: 2
        bias_term: false
    }
}

layer {
    bottom: "res3a_branch2a"
    top: "res3a_branch2a"
    name: "bn3a_branch2a"
    type: "BatchNorm"
    batch_norm_param {
        use_global_stats: true
    }
}

layer {
    bottom: "res3a_branch2a"
    top: "res3a_branch2a"
    name: "scale3a_branch2a"
    type: "Scale"
    scale_param {
        bias_term: true
    }
}

layer {
    bottom: "res3a_branch2a"
    top: "res3a_branch2a"
    name: "res3a_branch2a_relu"
    type: "ReLU"
}

layer {
    bottom: "res3a_branch2a"
    top: "res3a_branch2b"
    name: "res3a_branch2b"
    type: "Convolution"
    convolution_param {
        num_output: 128
        kernel_size: 3
        pad: 1
        stride: 1
        bias_term: false
    }
}

layer {
    bottom: "res3a_branch2b"
    top: "res3a_branch2b"
    name: "bn3a_branch2b"
    type: "BatchNorm"
    batch_norm_param {
        use_global_stats: true
    }
}

layer {
    bottom: "res3a_branch2b"
    top: "res3a_branch2b"
    name: "scale3a_branch2b"
    type: "Scale"
    scale_param {
        bias_term: true
    }
}

layer {
    bottom: "res3a_branch2b"
    top: "res3a_branch2b"
    name: "res3a_branch2b_relu"
    type: "ReLU"
}

layer {
    bottom: "res3a_branch2b"
    top: "res3a_branch2c"
    name: "res3a_branch2c"
    type: "Convolution"
    convolution_param {
        num_output: 512
        kernel_size: 1
        pad: 0
        stride: 1
        bias_term: false
    }
}

layer {
    bottom: "res3a_branch2c"
    top: "res3a_branch2c"
    name: "bn3a_branch2c"
    type: "BatchNorm"
    batch_norm_param {
        use_global_stats: true
    }
}

layer {
    bottom: "res3a_branch2c"
    top: "res3a_branch2c"
    name: "scale3a_branch2c"
    type: "Scale"
    scale_param {
        bias_term: true
    }
}

layer {
    bottom: "res3a_branch1"
    bottom: "res3a_branch2c"
    top: "res3a"
    name: "res3a"
    type: "Eltwise"
}

layer {
    bottom: "res3a"
    top: "res3a"
    name: "res3a_relu"
    type: "ReLU"
}

layer {
    bottom: "res3a"
    top: "res3b_branch2a"
    name: "res3b_branch2a"
    type: "Convolution"
    convolution_param {
        num_output: 128
        kernel_size: 1
        pad: 0
        stride: 1
        bias_term: false
    }
}

layer {
    bottom: "res3b_branch2a"
    top: "res3b_branch2a"
    name: "bn3b_branch2a"
    type: "BatchNorm"
    batch_norm_param {
        use_global_stats: true
    }
}

layer {
    bottom: "res3b_branch2a"
    top: "res3b_branch2a"
    name: "scale3b_branch2a"
    type: "Scale"
    scale_param {
        bias_term: true
    }
}

layer {
    bottom: "res3b_branch2a"
    top: "res3b_branch2a"
    name: "res3b_branch2a_relu"
    type: "ReLU"
}

layer {
    bottom: "res3b_branch2a"
    top: "res3b_branch2b"
    name: "res3b_branch2b"
    type: "Convolution"
    convolution_param {
        num_output: 128
        kernel_size: 3
        pad: 1
        stride: 1
        bias_term: false
    }
}

layer {
    bottom: "res3b_branch2b"
    top: "res3b_branch2b"
    name: "bn3b_branch2b"
    type: "BatchNorm"
    batch_norm_param {
        use_global_stats: true
    }
}

layer {
    bottom: "res3b_branch2b"
    top: "res3b_branch2b"
    name: "scale3b_branch2b"
    type: "Scale"
    scale_param {
        bias_term: true
    }
}

layer {
    bottom: "res3b_branch2b"
    top: "res3b_branch2b"
    name: "res3b_branch2b_relu"
    type: "ReLU"
}

layer {
    bottom: "res3b_branch2b"
    top: "res3b_branch2c"
    name: "res3b_branch2c"
    type: "Convolution"
    convolution_param {
        num_output: 512
        kernel_size: 1
        pad: 0
        stride: 1
        bias_term: false
    }
}

layer {
    bottom: "res3b_branch2c"
    top: "res3b_branch2c"
    name: "bn3b_branch2c"
    type: "BatchNorm"
    batch_norm_param {
        use_global_stats: true
    }
}

layer {
    bottom: "res3b_branch2c"
    top: "res3b_branch2c"
    name: "scale3b_branch2c"
    type: "Scale"
    scale_param {
        bias_term: true
    }
}

layer {
    bottom: "res3a"
    bottom: "res3b_branch2c"
    top: "res3b"
    name: "res3b"
    type: "Eltwise"
}

layer {
    bottom: "res3b"
    top: "res3b"
    name: "res3b_relu"
    type: "ReLU"
}

layer {
    bottom: "res3b"
    top: "res3c_branch2a"
    name: "res3c_branch2a"
    type: "Convolution"
    convolution_param {
        num_output: 128
        kernel_size: 1
        pad: 0
        stride: 1
        bias_term: false
    }
}

layer {
    bottom: "res3c_branch2a"
    top: "res3c_branch2a"
    name: "bn3c_branch2a"
    type: "BatchNorm"
    batch_norm_param {
        use_global_stats: true
    }
}

layer {
    bottom: "res3c_branch2a"
    top: "res3c_branch2a"
    name: "scale3c_branch2a"
    type: "Scale"
    scale_param {
        bias_term: true
    }
}

layer {
    bottom: "res3c_branch2a"
    top: "res3c_branch2a"
    name: "res3c_branch2a_relu"
    type: "ReLU"
}

layer {
    bottom: "res3c_branch2a"
    top: "res3c_branch2b"
    name: "res3c_branch2b"
    type: "Convolution"
    convolution_param {
        num_output: 128
        kernel_size: 3
        pad: 1
        stride: 1
        bias_term: false
    }
}

layer {
    bottom: "res3c_branch2b"
    top: "res3c_branch2b"
    name: "bn3c_branch2b"
    type: "BatchNorm"
    batch_norm_param {
        use_global_stats: true
    }
}

layer {
    bottom: "res3c_branch2b"
    top: "res3c_branch2b"
    name: "scale3c_branch2b"
    type: "Scale"
    scale_param {
        bias_term: true
    }
}

layer {
    bottom: "res3c_branch2b"
    top: "res3c_branch2b"
    name: "res3c_branch2b_relu"
    type: "ReLU"
}

layer {
    bottom: "res3c_branch2b"
    top: "res3c_branch2c"
    name: "res3c_branch2c"
    type: "Convolution"
    convolution_param {
        num_output: 512
        kernel_size: 1
        pad: 0
        stride: 1
        bias_term: false
    }
}

layer {
    bottom: "res3c_branch2c"
    top: "res3c_branch2c"
    name: "bn3c_branch2c"
    type: "BatchNorm"
    batch_norm_param {
        use_global_stats: true
    }
}

layer {
    bottom: "res3c_branch2c"
    top: "res3c_branch2c"
    name: "scale3c_branch2c"
    type: "Scale"
    scale_param {
        bias_term: true
    }
}

layer {
    bottom: "res3b"
    bottom: "res3c_branch2c"
    top: "res3c"
    name: "res3c"
    type: "Eltwise"
}

layer {
    bottom: "res3c"
    top: "res3c"
    name: "res3c_relu"
    type: "ReLU"
}

layer {
    bottom: "res3c"
    top: "res3d_branch2a"
    name: "res3d_branch2a"
    type: "Convolution"
    convolution_param {
        num_output: 128
        kernel_size: 1
        pad: 0
        stride: 1
        bias_term: false
    }
}

layer {
    bottom: "res3d_branch2a"
    top: "res3d_branch2a"
    name: "bn3d_branch2a"
    type: "BatchNorm"
    batch_norm_param {
        use_global_stats: true
    }
}

layer {
    bottom: "res3d_branch2a"
    top: "res3d_branch2a"
    name: "scale3d_branch2a"
    type: "Scale"
    scale_param {
        bias_term: true
    }
}

layer {
    bottom: "res3d_branch2a"
    top: "res3d_branch2a"
    name: "res3d_branch2a_relu"
    type: "ReLU"
}

layer {
    bottom: "res3d_branch2a"
    top: "res3d_branch2b"
    name: "res3d_branch2b"
    type: "Convolution"
    convolution_param {
        num_output: 128
        kernel_size: 3
        pad: 1
        stride: 1
        bias_term: false
    }
}

layer {
    bottom: "res3d_branch2b"
    top: "res3d_branch2b"
    name: "bn3d_branch2b"
    type: "BatchNorm"
    batch_norm_param {
        use_global_stats: true
    }
}

layer {
    bottom: "res3d_branch2b"
    top: "res3d_branch2b"
    name: "scale3d_branch2b"
    type: "Scale"
    scale_param {
        bias_term: true
    }
}

layer {
    bottom: "res3d_branch2b"
    top: "res3d_branch2b"
    name: "res3d_branch2b_relu"
    type: "ReLU"
}

layer {
    bottom: "res3d_branch2b"
    top: "res3d_branch2c"
    name: "res3d_branch2c"
    type: "Convolution"
    convolution_param {
        num_output: 512
        kernel_size: 1
        pad: 0
        stride: 1
        bias_term: false
    }
}

layer {
    bottom: "res3d_branch2c"
    top: "res3d_branch2c"
    name: "bn3d_branch2c"
    type: "BatchNorm"
    batch_norm_param {
        use_global_stats: true
    }
}

layer {
    bottom: "res3d_branch2c"
    top: "res3d_branch2c"
    name: "scale3d_branch2c"
    type: "Scale"
    scale_param {
        bias_term: true
    }
}

layer {
    bottom: "res3c"
    bottom: "res3d_branch2c"
    top: "res3d"
    name: "res3d"
    type: "Eltwise"
}

layer {
    bottom: "res3d"
    top: "res3d"
    name: "res3d_relu"
    type: "ReLU"
}

layer {
    bottom: "res3d"
    top: "res4a_branch1"
    name: "res4a_branch1"
    type: "Convolution"
    convolution_param {
        num_output: 1024
        kernel_size: 1
        pad: 0
        stride: 2
        bias_term: false
    }
}

layer {
    bottom: "res4a_branch1"
    top: "res4a_branch1"
    name: "bn4a_branch1"
    type: "BatchNorm"
    batch_norm_param {
        use_global_stats: true
    }
}

layer {
    bottom: "res4a_branch1"
    top: "res4a_branch1"
    name: "scale4a_branch1"
    type: "Scale"
    scale_param {
        bias_term: true
    }
}

layer {
    bottom: "res3d"
    top: "res4a_branch2a"
    name: "res4a_branch2a"
    type: "Convolution"
    convolution_param {
        num_output: 256
        kernel_size: 1
        pad: 0
        stride: 2
        bias_term: false
    }
}

layer {
    bottom: "res4a_branch2a"
    top: "res4a_branch2a"
    name: "bn4a_branch2a"
    type: "BatchNorm"
    batch_norm_param {
        use_global_stats: true
    }
}

layer {
    bottom: "res4a_branch2a"
    top: "res4a_branch2a"
    name: "scale4a_branch2a"
    type: "Scale"
    scale_param {
        bias_term: true
    }
}

layer {
    bottom: "res4a_branch2a"
    top: "res4a_branch2a"
    name: "res4a_branch2a_relu"
    type: "ReLU"
}

layer {
    bottom: "res4a_branch2a"
    top: "res4a_branch2b"
    name: "res4a_branch2b"
    type: "Convolution"
    convolution_param {
        num_output: 256
        kernel_size: 3
        pad: 1
        stride: 1
        bias_term: false
    }
}

layer {
    bottom: "res4a_branch2b"
    top: "res4a_branch2b"
    name: "bn4a_branch2b"
    type: "BatchNorm"
    batch_norm_param {
        use_global_stats: true
    }
}

layer {
    bottom: "res4a_branch2b"
    top: "res4a_branch2b"
    name: "scale4a_branch2b"
    type: "Scale"
    scale_param {
        bias_term: true
    }
}

layer {
    bottom: "res4a_branch2b"
    top: "res4a_branch2b"
    name: "res4a_branch2b_relu"
    type: "ReLU"
}

layer {
    bottom: "res4a_branch2b"
    top: "res4a_branch2c"
    name: "res4a_branch2c"
    type: "Convolution"
    convolution_param {
        num_output: 1024
        kernel_size: 1
        pad: 0
        stride: 1
        bias_term: false
    }
}

layer {
    bottom: "res4a_branch2c"
    top: "res4a_branch2c"
    name: "bn4a_branch2c"
    type: "BatchNorm"
    batch_norm_param {
        use_global_stats: true
    }
}

layer {
    bottom: "res4a_branch2c"
    top: "res4a_branch2c"
    name: "scale4a_branch2c"
    type: "Scale"
    scale_param {
        bias_term: true
    }
}

layer {
    bottom: "res4a_branch1"
    bottom: "res4a_branch2c"
    top: "res4a"
    name: "res4a"
    type: "Eltwise"
}

layer {
    bottom: "res4a"
    top: "res4a"
    name: "res4a_relu"
    type: "ReLU"
}

layer {
    bottom: "res4a"
    top: "res4b_branch2a"
    name: "res4b_branch2a"
    type: "Convolution"
    convolution_param {
        num_output: 256
        kernel_size: 1
        pad: 0
        stride: 1
        bias_term: false
    }
}

layer {
    bottom: "res4b_branch2a"
    top: "res4b_branch2a"
    name: "bn4b_branch2a"
    type: "BatchNorm"
    batch_norm_param {
        use_global_stats: true
    }
}

layer {
    bottom: "res4b_branch2a"
    top: "res4b_branch2a"
    name: "scale4b_branch2a"
    type: "Scale"
    scale_param {
        bias_term: true
    }
}

layer {
    bottom: "res4b_branch2a"
    top: "res4b_branch2a"
    name: "res4b_branch2a_relu"
    type: "ReLU"
}

layer {
    bottom: "res4b_branch2a"
    top: "res4b_branch2b"
    name: "res4b_branch2b"
    type: "Convolution"
    convolution_param {
        num_output: 256
        kernel_size: 3
        pad: 1
        stride: 1
        bias_term: false
    }
}

layer {
    bottom: "res4b_branch2b"
    top: "res4b_branch2b"
    name: "bn4b_branch2b"
    type: "BatchNorm"
    batch_norm_param {
        use_global_stats: true
    }
}

layer {
    bottom: "res4b_branch2b"
    top: "res4b_branch2b"
    name: "scale4b_branch2b"
    type: "Scale"
    scale_param {
        bias_term: true
    }
}

layer {
    bottom: "res4b_branch2b"
    top: "res4b_branch2b"
    name: "res4b_branch2b_relu"
    type: "ReLU"
}

layer {
    bottom: "res4b_branch2b"
    top: "res4b_branch2c"
    name: "res4b_branch2c"
    type: "Convolution"
    convolution_param {
        num_output: 1024
        kernel_size: 1
        pad: 0
        stride: 1
        bias_term: false
    }
}

layer {
    bottom: "res4b_branch2c"
    top: "res4b_branch2c"
    name: "bn4b_branch2c"
    type: "BatchNorm"
    batch_norm_param {
        use_global_stats: true
    }
}

layer {
    bottom: "res4b_branch2c"
    top: "res4b_branch2c"
    name: "scale4b_branch2c"
    type: "Scale"
    scale_param {
        bias_term: true
    }
}

layer {
    bottom: "res4a"
    bottom: "res4b_branch2c"
    top: "res4b"
    name: "res4b"
    type: "Eltwise"
}

layer {
    bottom: "res4b"
    top: "res4b"
    name: "res4b_relu"
    type: "ReLU"
}

layer {
    bottom: "res4b"
    top: "res4c_branch2a"
    name: "res4c_branch2a"
    type: "Convolution"
    convolution_param {
        num_output: 256
        kernel_size: 1
        pad: 0
        stride: 1
        bias_term: false
    }
}

layer {
    bottom: "res4c_branch2a"
    top: "res4c_branch2a"
    name: "bn4c_branch2a"
    type: "BatchNorm"
    batch_norm_param {
        use_global_stats: true
    }
}

layer {
    bottom: "res4c_branch2a"
    top: "res4c_branch2a"
    name: "scale4c_branch2a"
    type: "Scale"
    scale_param {
        bias_term: true
    }
}

layer {
    bottom: "res4c_branch2a"
    top: "res4c_branch2a"
    name: "res4c_branch2a_relu"
    type: "ReLU"
}

layer {
    bottom: "res4c_branch2a"
    top: "res4c_branch2b"
    name: "res4c_branch2b"
    type: "Convolution"
    convolution_param {
        num_output: 256
        kernel_size: 3
        pad: 1
        stride: 1
        bias_term: false
    }
}

layer {
    bottom: "res4c_branch2b"
    top: "res4c_branch2b"
    name: "bn4c_branch2b"
    type: "BatchNorm"
    batch_norm_param {
        use_global_stats: true
    }
}

layer {
    bottom: "res4c_branch2b"
    top: "res4c_branch2b"
    name: "scale4c_branch2b"
    type: "Scale"
    scale_param {
        bias_term: true
    }
}

layer {
    bottom: "res4c_branch2b"
    top: "res4c_branch2b"
    name: "res4c_branch2b_relu"
    type: "ReLU"
}

layer {
    bottom: "res4c_branch2b"
    top: "res4c_branch2c"
    name: "res4c_branch2c"
    type: "Convolution"
    convolution_param {
        num_output: 1024
        kernel_size: 1
        pad: 0
        stride: 1
        bias_term: false
    }
}

layer {
    bottom: "res4c_branch2c"
    top: "res4c_branch2c"
    name: "bn4c_branch2c"
    type: "BatchNorm"
    batch_norm_param {
        use_global_stats: true
    }
}

layer {
    bottom: "res4c_branch2c"
    top: "res4c_branch2c"
    name: "scale4c_branch2c"
    type: "Scale"
    scale_param {
        bias_term: true
    }
}

layer {
    bottom: "res4b"
    bottom: "res4c_branch2c"
    top: "res4c"
    name: "res4c"
    type: "Eltwise"
}

layer {
    bottom: "res4c"
    top: "res4c"
    name: "res4c_relu"
    type: "ReLU"
}

layer {
    bottom: "res4c"
    top: "res4d_branch2a"
    name: "res4d_branch2a"
    type: "Convolution"
    convolution_param {
        num_output: 256
        kernel_size: 1
        pad: 0
        stride: 1
        bias_term: false
    }
}

layer {
    bottom: "res4d_branch2a"
    top: "res4d_branch2a"
    name: "bn4d_branch2a"
    type: "BatchNorm"
    batch_norm_param {
        use_global_stats: true
    }
}

layer {
    bottom: "res4d_branch2a"
    top: "res4d_branch2a"
    name: "scale4d_branch2a"
    type: "Scale"
    scale_param {
        bias_term: true
    }
}

layer {
    bottom: "res4d_branch2a"
    top: "res4d_branch2a"
    name: "res4d_branch2a_relu"
    type: "ReLU"
}

layer {
    bottom: "res4d_branch2a"
    top: "res4d_branch2b"
    name: "res4d_branch2b"
    type: "Convolution"
    convolution_param {
        num_output: 256
        kernel_size: 3
        pad: 1
        stride: 1
        bias_term: false
    }
}

layer {
    bottom: "res4d_branch2b"
    top: "res4d_branch2b"
    name: "bn4d_branch2b"
    type: "BatchNorm"
    batch_norm_param {
        use_global_stats: true
    }
}

layer {
    bottom: "res4d_branch2b"
    top: "res4d_branch2b"
    name: "scale4d_branch2b"
    type: "Scale"
    scale_param {
        bias_term: true
    }
}

layer {
    bottom: "res4d_branch2b"
    top: "res4d_branch2b"
    name: "res4d_branch2b_relu"
    type: "ReLU"
}

layer {
    bottom: "res4d_branch2b"
    top: "res4d_branch2c"
    name: "res4d_branch2c"
    type: "Convolution"
    convolution_param {
        num_output: 1024
        kernel_size: 1
        pad: 0
        stride: 1
        bias_term: false
    }
}

layer {
    bottom: "res4d_branch2c"
    top: "res4d_branch2c"
    name: "bn4d_branch2c"
    type: "BatchNorm"
    batch_norm_param {
        use_global_stats: true
    }
}

layer {
    bottom: "res4d_branch2c"
    top: "res4d_branch2c"
    name: "scale4d_branch2c"
    type: "Scale"
    scale_param {
        bias_term: true
    }
}

layer {
    bottom: "res4c"
    bottom: "res4d_branch2c"
    top: "res4d"
    name: "res4d"
    type: "Eltwise"
}

layer {
    bottom: "res4d"
    top: "res4d"
    name: "res4d_relu"
    type: "ReLU"
}

layer {
    bottom: "res4d"
    top: "res4e_branch2a"
    name: "res4e_branch2a"
    type: "Convolution"
    convolution_param {
        num_output: 256
        kernel_size: 1
        pad: 0
        stride: 1
        bias_term: false
    }
}

layer {
    bottom: "res4e_branch2a"
    top: "res4e_branch2a"
    name: "bn4e_branch2a"
    type: "BatchNorm"
    batch_norm_param {
        use_global_stats: true
    }
}

layer {
    bottom: "res4e_branch2a"
    top: "res4e_branch2a"
    name: "scale4e_branch2a"
    type: "Scale"
    scale_param {
        bias_term: true
    }
}

layer {
    bottom: "res4e_branch2a"
    top: "res4e_branch2a"
    name: "res4e_branch2a_relu"
    type: "ReLU"
}

layer {
    bottom: "res4e_branch2a"
    top: "res4e_branch2b"
    name: "res4e_branch2b"
    type: "Convolution"
    convolution_param {
        num_output: 256
        kernel_size: 3
        pad: 1
        stride: 1
        bias_term: false
    }
}

layer {
    bottom: "res4e_branch2b"
    top: "res4e_branch2b"
    name: "bn4e_branch2b"
    type: "BatchNorm"
    batch_norm_param {
        use_global_stats: true
    }
}

layer {
    bottom: "res4e_branch2b"
    top: "res4e_branch2b"
    name: "scale4e_branch2b"
    type: "Scale"
    scale_param {
        bias_term: true
    }
}

layer {
    bottom: "res4e_branch2b"
    top: "res4e_branch2b"
    name: "res4e_branch2b_relu"
    type: "ReLU"
}

layer {
    bottom: "res4e_branch2b"
    top: "res4e_branch2c"
    name: "res4e_branch2c"
    type: "Convolution"
    convolution_param {
        num_output: 1024
        kernel_size: 1
        pad: 0
        stride: 1
        bias_term: false
    }
}

layer {
    bottom: "res4e_branch2c"
    top: "res4e_branch2c"
    name: "bn4e_branch2c"
    type: "BatchNorm"
    batch_norm_param {
        use_global_stats: true
    }
}

layer {
    bottom: "res4e_branch2c"
    top: "res4e_branch2c"
    name: "scale4e_branch2c"
    type: "Scale"
    scale_param {
        bias_term: true
    }
}

layer {
    bottom: "res4d"
    bottom: "res4e_branch2c"
    top: "res4e"
    name: "res4e"
    type: "Eltwise"
}

layer {
    bottom: "res4e"
    top: "res4e"
    name: "res4e_relu"
    type: "ReLU"
}

layer {
    bottom: "res4e"
    top: "res4f_branch2a"
    name: "res4f_branch2a"
    type: "Convolution"
    convolution_param {
        num_output: 256
        kernel_size: 1
        pad: 0
        stride: 1
        bias_term: false
    }
}

layer {
    bottom: "res4f_branch2a"
    top: "res4f_branch2a"
    name: "bn4f_branch2a"
    type: "BatchNorm"
    batch_norm_param {
        use_global_stats: true
    }
}

layer {
    bottom: "res4f_branch2a"
    top: "res4f_branch2a"
    name: "scale4f_branch2a"
    type: "Scale"
    scale_param {
        bias_term: true
    }
}

layer {
    bottom: "res4f_branch2a"
    top: "res4f_branch2a"
    name: "res4f_branch2a_relu"
    type: "ReLU"
}

layer {
    bottom: "res4f_branch2a"
    top: "res4f_branch2b"
    name: "res4f_branch2b"
    type: "Convolution"
    convolution_param {
        num_output: 256
        kernel_size: 3
        pad: 1
        stride: 1
        bias_term: false
    }
}

layer {
    bottom: "res4f_branch2b"
    top: "res4f_branch2b"
    name: "bn4f_branch2b"
    type: "BatchNorm"
    batch_norm_param {
        use_global_stats: true
    }
}

layer {
    bottom: "res4f_branch2b"
    top: "res4f_branch2b"
    name: "scale4f_branch2b"
    type: "Scale"
    scale_param {
        bias_term: true
    }
}

layer {
    bottom: "res4f_branch2b"
    top: "res4f_branch2b"
    name: "res4f_branch2b_relu"
    type: "ReLU"
}

layer {
    bottom: "res4f_branch2b"
    top: "res4f_branch2c"
    name: "res4f_branch2c"
    type: "Convolution"
    convolution_param {
        num_output: 1024
        kernel_size: 1
        pad: 0
        stride: 1
        bias_term: false
    }
}

layer {
    bottom: "res4f_branch2c"
    top: "res4f_branch2c"
    name: "bn4f_branch2c"
    type: "BatchNorm"
    batch_norm_param {
        use_global_stats: true
    }
}

layer {
    bottom: "res4f_branch2c"
    top: "res4f_branch2c"
    name: "scale4f_branch2c"
    type: "Scale"
    scale_param {
        bias_term: true
    }
}

layer {
    bottom: "res4e"
    bottom: "res4f_branch2c"
    top: "res4f"
    name: "res4f"
    type: "Eltwise"
}

layer {
    bottom: "res4f"
    top: "res4f"
    name: "res4f_relu"
    type: "ReLU"
}

layer {
    bottom: "res4f"
    top: "res5a_branch1"
    name: "res5a_branch1"
    type: "Convolution"
    convolution_param {
        num_output: 2048
        kernel_size: 1
        pad: 0
        stride: 2
        bias_term: false
    }
}

layer {
    bottom: "res5a_branch1"
    top: "res5a_branch1"
    name: "bn5a_branch1"
    type: "BatchNorm"
    batch_norm_param {
        use_global_stats: true
    }
}

layer {
    bottom: "res5a_branch1"
    top: "res5a_branch1"
    name: "scale5a_branch1"
    type: "Scale"
    scale_param {
        bias_term: true
    }
}

layer {
    bottom: "res4f"
    top: "res5a_branch2a"
    name: "res5a_branch2a"
    type: "Convolution"
    convolution_param {
        num_output: 512
        kernel_size: 1
        pad: 0
        stride: 2
        bias_term: false
    }
}

layer {
    bottom: "res5a_branch2a"
    top: "res5a_branch2a"
    name: "bn5a_branch2a"
    type: "BatchNorm"
    batch_norm_param {
        use_global_stats: true
    }
}

layer {
    bottom: "res5a_branch2a"
    top: "res5a_branch2a"
    name: "scale5a_branch2a"
    type: "Scale"
    scale_param {
        bias_term: true
    }
}

layer {
    bottom: "res5a_branch2a"
    top: "res5a_branch2a"
    name: "res5a_branch2a_relu"
    type: "ReLU"
}

layer {
    bottom: "res5a_branch2a"
    top: "res5a_branch2b"
    name: "res5a_branch2b"
    type: "Convolution"
    convolution_param {
        num_output: 512
        kernel_size: 3
        pad: 1
        stride: 1
        bias_term: false
    }
}

layer {
    bottom: "res5a_branch2b"
    top: "res5a_branch2b"
    name: "bn5a_branch2b"
    type: "BatchNorm"
    batch_norm_param {
        use_global_stats: true
    }
}

layer {
    bottom: "res5a_branch2b"
    top: "res5a_branch2b"
    name: "scale5a_branch2b"
    type: "Scale"
    scale_param {
        bias_term: true
    }
}

layer {
    bottom: "res5a_branch2b"
    top: "res5a_branch2b"
    name: "res5a_branch2b_relu"
    type: "ReLU"
}

layer {
    bottom: "res5a_branch2b"
    top: "res5a_branch2c"
    name: "res5a_branch2c"
    type: "Convolution"
    convolution_param {
        num_output: 2048
        kernel_size: 1
        pad: 0
        stride: 1
        bias_term: false
    }
}

layer {
    bottom: "res5a_branch2c"
    top: "res5a_branch2c"
    name: "bn5a_branch2c"
    type: "BatchNorm"
    batch_norm_param {
        use_global_stats: true
    }
}

layer {
    bottom: "res5a_branch2c"
    top: "res5a_branch2c"
    name: "scale5a_branch2c"
    type: "Scale"
    scale_param {
        bias_term: true
    }
}

layer {
    bottom: "res5a_branch1"
    bottom: "res5a_branch2c"
    top: "res5a"
    name: "res5a"
    type: "Eltwise"
}

layer {
    bottom: "res5a"
    top: "res5a"
    name: "res5a_relu"
    type: "ReLU"
}

layer {
    bottom: "res5a"
    top: "res5b_branch2a"
    name: "res5b_branch2a"
    type: "Convolution"
    convolution_param {
        num_output: 512
        kernel_size: 1
        pad: 0
        stride: 1
        bias_term: false
    }
}

layer {
    bottom: "res5b_branch2a"
    top: "res5b_branch2a"
    name: "bn5b_branch2a"
    type: "BatchNorm"
    batch_norm_param {
        use_global_stats: true
    }
}

layer {
    bottom: "res5b_branch2a"
    top: "res5b_branch2a"
    name: "scale5b_branch2a"
    type: "Scale"
    scale_param {
        bias_term: true
    }
}

layer {
    bottom: "res5b_branch2a"
    top: "res5b_branch2a"
    name: "res5b_branch2a_relu"
    type: "ReLU"
}

layer {
    bottom: "res5b_branch2a"
    top: "res5b_branch2b"
    name: "res5b_branch2b"
    type: "Convolution"
    convolution_param {
        num_output: 512
        kernel_size: 3
        pad: 1
        stride: 1
        bias_term: false
    }
}

layer {
    bottom: "res5b_branch2b"
    top: "res5b_branch2b"
    name: "bn5b_branch2b"
    type: "BatchNorm"
    batch_norm_param {
        use_global_stats: true
    }
}

layer {
    bottom: "res5b_branch2b"
    top: "res5b_branch2b"
    name: "scale5b_branch2b"
    type: "Scale"
    scale_param {
        bias_term: true
    }
}

layer {
    bottom: "res5b_branch2b"
    top: "res5b_branch2b"
    name: "res5b_branch2b_relu"
    type: "ReLU"
}

layer {
    bottom: "res5b_branch2b"
    top: "res5b_branch2c"
    name: "res5b_branch2c"
    type: "Convolution"
    convolution_param {
        num_output: 2048
        kernel_size: 1
        pad: 0
        stride: 1
        bias_term: false
    }
}

layer {
    bottom: "res5b_branch2c"
    top: "res5b_branch2c"
    name: "bn5b_branch2c"
    type: "BatchNorm"
    batch_norm_param {
        use_global_stats: true
    }
}

layer {
    bottom: "res5b_branch2c"
    top: "res5b_branch2c"
    name: "scale5b_branch2c"
    type: "Scale"
    scale_param {
        bias_term: true
    }
}

layer {
    bottom: "res5a"
    bottom: "res5b_branch2c"
    top: "res5b"
    name: "res5b"
    type: "Eltwise"
}

layer {
    bottom: "res5b"
    top: "res5b"
    name: "res5b_relu"
    type: "ReLU"
}

layer {
    bottom: "res5b"
    top: "res5c_branch2a"
    name: "res5c_branch2a"
    type: "Convolution"
    convolution_param {
        num_output: 512
        kernel_size: 1
        pad: 0
        stride: 1
        bias_term: false
    }
}

layer {
    bottom: "res5c_branch2a"
    top: "res5c_branch2a"
    name: "bn5c_branch2a"
    type: "BatchNorm"
    batch_norm_param {
        use_global_stats: true
    }
}

layer {
    bottom: "res5c_branch2a"
    top: "res5c_branch2a"
    name: "scale5c_branch2a"
    type: "Scale"
    scale_param {
        bias_term: true
    }
}

layer {
    bottom: "res5c_branch2a"
    top: "res5c_branch2a"
    name: "res5c_branch2a_relu"
    type: "ReLU"
}

layer {
    bottom: "res5c_branch2a"
    top: "res5c_branch2b"
    name: "res5c_branch2b"
    type: "Convolution"
    convolution_param {
        num_output: 512
        kernel_size: 3
        pad: 1
        stride: 1
        bias_term: false
    }
}

layer {
    bottom: "res5c_branch2b"
    top: "res5c_branch2b"
    name: "bn5c_branch2b"
    type: "BatchNorm"
    batch_norm_param {
        use_global_stats: true
    }
}

layer {
    bottom: "res5c_branch2b"
    top: "res5c_branch2b"
    name: "scale5c_branch2b"
    type: "Scale"
    scale_param {
        bias_term: true
    }
}

layer {
    bottom: "res5c_branch2b"
    top: "res5c_branch2b"
    name: "res5c_branch2b_relu"
    type: "ReLU"
}

layer {
    bottom: "res5c_branch2b"
    top: "res5c_branch2c"
    name: "res5c_branch2c"
    type: "Convolution"
    convolution_param {
        num_output: 2048
        kernel_size: 1
        pad: 0
        stride: 1
        bias_term: false
    }
}

layer {
    bottom: "res5c_branch2c"
    top: "res5c_branch2c"
    name: "bn5c_branch2c"
    type: "BatchNorm"
    batch_norm_param {
        use_global_stats: true
    }
}

layer {
    bottom: "res5c_branch2c"
    top: "res5c_branch2c"
    name: "scale5c_branch2c"
    type: "Scale"
    scale_param {
        bias_term: true
    }
}

layer {
    bottom: "res5b"
    bottom: "res5c_branch2c"
    top: "res5c"
    name: "res5c"
    type: "Eltwise"
}

layer {
    bottom: "res5c"
    top: "res5c"
    name: "res5c_relu"
    type: "ReLU"
}
layer {
    bottom: "res5c"
    top: "res6"
    name: "pool_res6"
    type: "Pooling"
    pooling_param {
        kernel_size: 3
        stride: 2
        pool: MAX
    }
}
####lateral

layer {
    bottom: "res6"
    top: "p6"
    name: "p6"
    param {
        lr_mult: 1.0
    }
    param {
        lr_mult: 2.0
    }
    type: "Convolution"
    convolution_param {
        num_output: 256
        kernel_size: 1
    weight_filler { type: "gaussian" std: 0.001 }
    bias_filler { type: "constant" value: 0 }
        
    }
}

layer {
    bottom: "res5c"
    top: "p5"
    name: "p5"
    param {
        lr_mult: 1.0
    }
    param {
        lr_mult: 2.0
    }
    type: "Convolution"
    convolution_param {
        num_output: 256
        kernel_size: 1
    weight_filler { type: "gaussian" std: 0.001 }
    bias_filler { type: "constant" value: 0 }
        
    }
}

layer {
    name: "upP5"
    type: "Deconvolution"
    bottom: "p5" 
    top: "upP5"
    convolution_param {
    kernel_h : 4
    kernel_w : 4
    stride_h: 2
    stride_w: 2
    pad_h: 1
    pad_w: 1
    num_output: 256
    group: 256
    bias_term: false
     weight_filler {
      type: "bilinear"
    }
  }
  param { lr_mult: 0 decay_mult: 0 } 
}

layer {
    bottom: "res4f"
    top: "c4"
    name: "newC4"
    param {
        lr_mult: 1.0
    }
    param {
        lr_mult: 2.0
    }
    type: "Convolution"
    convolution_param {
        num_output: 256
        kernel_size: 1
    weight_filler { type: "gaussian" std: 0.001 }
    bias_filler { type: "constant" value: 0.0 }
        
    }
}

layer {
    name: "p4"
    type: "Eltwise"
    bottom: "c4"
    bottom: "upP5"
    top: "p4"
    eltwise_param {
        operation: SUM
    }
}


layer {
    bottom: "p4"
    top: "p4_lateral"
    name: "p4_lateral"
    param {
        lr_mult: 1.0
    }
    param {
        lr_mult: 2.0
    }
    type: "Convolution"
    convolution_param {
        num_output: 256
        kernel_size: 1
    weight_filler { type: "gaussian" std: 0.001 }
    bias_filler { type: "constant" value: 0.0 }
        
    }
}
layer {
    name: "upP4"
    type: "Deconvolution"
    bottom: "p4_lateral" 
    top: "upP4"
    convolution_param {
    kernel_h : 4
    kernel_w : 4
    stride_h: 2
    stride_w: 2
    pad_h: 1
    pad_w: 1
    num_output: 256
    group: 256
    bias_term: false
     weight_filler {
      type: "bilinear"
    }
  }
  param { lr_mult: 0 decay_mult: 0 } 
}


layer {
    bottom: "res3d"
    top: "c3"
    name: "newC3"
    param {
        lr_mult: 1.0
    }
    param {
        lr_mult: 2.0
    }
    type: "Convolution"
    convolution_param {
        num_output: 256
        kernel_size: 1
    weight_filler { type: "gaussian" std: 0.001 }
    bias_filler { type: "constant" value: 0.0 }
        
    }
}
layer {
    name: "p3"
    type: "Eltwise"
    bottom: "c3"
    bottom: "upP4"
    top: "p3"
    eltwise_param {
        operation: SUM
    }
}


layer {
    bottom: "p3"
    top: "p3_lateral"
    name: "p3_lateral"
    param {
        lr_mult: 1.0
    }
    param {
        lr_mult: 2.0
    }
    type: "Convolution"
    convolution_param {
        num_output: 256
        kernel_size: 1
    weight_filler { type: "gaussian" std: 0.001 }
    bias_filler { type: "constant" value: 0.0 }
        
    }
}

layer {
    bottom: "res2c"
    top: "c2"
    name: "newC2"
    param {
        lr_mult: 1.0
    }
    param {
        lr_mult: 2.0
    }
    type: "Convolution"
    convolution_param {
        num_output: 256
        kernel_size: 1
    weight_filler { type: "gaussian" std: 0.001 }
    bias_filler { type: "constant" value: 0.0 }
        
    }
}
layer {
    name: "upP2"
    type: "Deconvolution"
    bottom: "p3_lateral" 
    top: "upP2"
    convolution_param {
    kernel_h : 4
    kernel_w : 4
    stride_h: 2
    stride_w: 2
    pad_h: 1
    pad_w: 1
    num_output: 256
    group: 256
    bias_term: false
     weight_filler {
      type: "bilinear"
    }
  }
  param { lr_mult: 0 decay_mult: 0 } 
}
layer {
    name: "p2"
    type: "Eltwise"
    bottom: "c2"
    bottom: "upP2"
    top: "p2"
    eltwise_param {
        operation: SUM
    }
}




####

#========= RPN/p2 ============

layer {
  name: "rpn_conv/3x3/p2"
  type: "Convolution"
  bottom: "p2"
  top: "rpn/output/p2"
  param { lr_mult: 1.0
            name: "rpn_conv_3x3_w"
          }
  param { lr_mult: 2.0
            name: "rpn_conv_3x3_b"
          }
  convolution_param {
    num_output: 512
    kernel_size: 3 pad: 1 stride: 1
    weight_filler { type: "gaussian" std: 0.01 }
    bias_filler { type: "constant" value: 0 }
  }
}
layer {
  name: "rpn_relu/3x3/p2"
  type: "ReLU"
  bottom: "rpn/output/p2"
  top: "rpn/output/p2"
}

layer {
  name: "rpn_cls_score/p2"
  type: "Convolution"
  bottom: "rpn/output/p2"
  top: "rpn_cls_score/p2"
  param { lr_mult: 1.0
          name: "rpn_cls_score_w" }
  param { lr_mult: 2.0
         name: "rpn_cls_score_b"
        }
  convolution_param {
    num_output: 12   # 2(bg/fg) * 9(anchors)
    kernel_size: 1 pad: 0 stride: 1
    weight_filler { type: "gaussian" std: 0.01 }
    bias_filler { type: "constant" value: 0 }
  }
}

layer {
  name: "rpn_bbox_pred/p2"
  type: "Convolution"
  bottom: "rpn/output/p2"
  top: "rpn_bbox_pred/p2"
  param { lr_mult: 1.0
          name: "rpn_bbox_pred_w"
        }
  param { lr_mult: 2.0
  name: "rpn_bbox_pred_b"
  }
  convolution_param {
    num_output: 24   # 4 * 9(anchors)
    kernel_size: 1 pad: 0 stride: 1
    weight_filler { type: "gaussian" std: 0.01 }
    bias_filler { type: "constant" value: 0 }
  }
}

######

layer {
   bottom: "rpn_cls_score/p2"
   top: "rpn_cls_score_reshape_/p2"
   name: "rpn_cls_score_reshape_/p2"
   type: "Reshape"
   reshape_param { shape {dim: 0 dim: 2 dim: -1 dim:0} }
}


layer {
   bottom: "rpn_bbox_pred/p2"
   top: "rpn_bbox_pred_reshape/p2"
   name: "rpn_bbox_pred_reshape/p2"
   type: "Reshape"
   reshape_param { shape { dim: 0 dim: 0 dim: -1 } }
}

layer {
   bottom: "rpn_cls_score_reshape_/p2"
   top: "rpn_cls_score_reshape/p2"
   name: "rpn_cls_score_reshape/p2"
   type: "Reshape"
   reshape_param { shape {dim: 0 dim: 2 dim: -1 } }
}




#####CLS out


layer {
  name: "fpn_out/p2"
  type: "Softmax"
  bottom: "rpn_cls_score_reshape_/p2"
  top: "fpn_out/p2"
}

layer {
   bottom: "fpn_out/p2"
   top: "fpn_out_reshape/p2"
   name: "fpn_out_reshape/p2"
   type: "Reshape"
   reshape_param { shape {dim: 0 dim: 12 dim: -1 dim: 0  } }
}


#========= RPN/p3 ============

layer {
  name: "rpn_conv/3x3/p3"
  type: "Convolution"
  bottom: "p3"
  top: "rpn/output/p3"
  param { lr_mult: 1.0
        name: "rpn_conv_3x3_w"
  }
  param { lr_mult: 2.0 
   name: "rpn_conv_3x3_b"
  }
  convolution_param {
    num_output: 512
    kernel_size: 3 pad: 1 stride: 1
    weight_filler { type: "gaussian" std: 0.001 }
    bias_filler { type: "constant" value: 0 }
  }
}
layer {
  name: "rpn_relu/3x3/p3"
  type: "ReLU"
  bottom: "rpn/output/p3"
  top: "rpn/output/p3"
}

layer {
  name: "rpn_cls_score/p3"
  type: "Convolution"
  bottom: "rpn/output/p3"
  top: "rpn_cls_score/p3"
  param { lr_mult: 1.0 
  name: "rpn_cls_score_w"
  }
  param { lr_mult: 2.0
    name: "rpn_cls_score_b"
    }
  convolution_param {
    num_output: 12   # 2(bg/fg) * 9(anchors)
    kernel_size: 1 pad: 0 stride: 1
    weight_filler { type: "gaussian" std: 0.001 }
    bias_filler { type: "constant" value: 0 }
  }
}

layer {
  name: "rpn_bbox_pred/p3"
  type: "Convolution"
  bottom: "rpn/output/p3"
  top: "rpn_bbox_pred/p3"
  param { lr_mult: 1.0
  name:"rpn_bbox_pred_w"
  }
  param { lr_mult: 2.0
   name:"rpn_bbox_pred_b" 
  }
  convolution_param {
    num_output: 24   # 4 * 9(anchors)
    kernel_size: 1 pad: 0 stride: 1
    weight_filler { type: "gaussian" std: 0.001 }
    bias_filler { type: "constant" value: 0 }
  }
}

######

layer {
   bottom: "rpn_cls_score/p3"
   top: "rpn_cls_score_reshape_/p3"
   name: "rpn_cls_score_reshape_/p3"
   type: "Reshape"
   reshape_param { shape {dim: 0 dim: 2 dim: -1 dim:0} }
}


layer {
   bottom: "rpn_bbox_pred/p3"
   top: "rpn_bbox_pred_reshape/p3"
   name: "rpn_bbox_pred_reshape/p3"
   type: "Reshape"
   reshape_param { shape { dim: 0 dim: 0 dim: -1 } }
}

layer {
   bottom: "rpn_cls_score_reshape_/p3"
   top: "rpn_cls_score_reshape/p3"
   name: "rpn_cls_score_reshape/p3"
   type: "Reshape"
   reshape_param { shape {dim: 0 dim: 2 dim: -1 } }
}




#####CLS out


layer {
  name: "fpn_out/p3"
  type: "Softmax"
  bottom: "rpn_cls_score_reshape_/p3"
  top: "fpn_out/p3"
}

layer {
   bottom: "fpn_out/p3"
   top: "fpn_out_reshape/p3"
   name: "fpn_out_reshape/p3"
   type: "Reshape"
   reshape_param { shape {dim: 0 dim: 12 dim: -1 dim: 0  } }
}



#========= RPN/p4 ============

layer {
  name: "rpn_conv/3x3/p4"
  type: "Convolution"
  bottom: "p4"
  top: "rpn/output/p4"
  param { lr_mult: 1.0
  name: "rpn_conv_3x3_w"
  }
  param { lr_mult: 2.0 
    name: "rpn_conv_3x3_b"
  }
  convolution_param {
    num_output: 512
    kernel_size: 3 pad: 1 stride: 1
    weight_filler { type: "gaussian" std: 0.001 }
    bias_filler { type: "constant" value: 0 }
  }
}
layer {
  name: "rpn_relu/3x3/p4"
  type: "ReLU"
  bottom: "rpn/output/p4"
  top: "rpn/output/p4"
}

layer {
  name: "rpn_cls_score/p4"
  type: "Convolution"
  bottom: "rpn/output/p4"
  top: "rpn_cls_score/p4"
  param { lr_mult: 1.0 
  name:"rpn_cls_score_w"
  }
  param { lr_mult: 2.0
  name:"rpn_cls_score_b"
    }
  convolution_param {
    num_output: 12   # 2(bg/fg) * 9(anchors)
    kernel_size: 1 pad: 0 stride: 1
    weight_filler { type: "gaussian" std: 0.001 }
    bias_filler { type: "constant" value: 0 }
  }
}

layer {
  name: "rpn_bbox_pred/p4"
  type: "Convolution"
  bottom: "rpn/output/p4"
  top: "rpn_bbox_pred/p4"
  param { lr_mult: 1.0
  name:"rpn_bbox_pred_w"
  }
  param { lr_mult: 2.0
    name:"rpn_bbox_pred_b"
  }
  convolution_param {
    num_output: 24   # 4 * 9(anchors)
    kernel_size: 1 pad: 0 stride: 1
    weight_filler { type: "gaussian" std: 0.001 }
    bias_filler { type: "constant" value: 0 }
  }
}

######

layer {
   bottom: "rpn_cls_score/p4"
   top: "rpn_cls_score_reshape_/p4"
   name: "rpn_cls_score_reshape_/p4"
   type: "Reshape"
   reshape_param { shape {dim: 0 dim: 2 dim: -1 dim:0} }
}


layer {
   bottom: "rpn_bbox_pred/p4"
   top: "rpn_bbox_pred_reshape/p4"
   name: "rpn_bbox_pred_reshape/p4"
   type: "Reshape"
   reshape_param { shape { dim: 0 dim: 0 dim: -1 } }
}

layer {
   bottom: "rpn_cls_score_reshape_/p4"
   top: "rpn_cls_score_reshape/p4"
   name: "rpn_cls_score_reshape/p4"
   type: "Reshape"
   reshape_param { shape {dim: 0 dim: 2 dim: -1 } }
}




#####CLS out


layer {
  name: "fpn_out/p4"
  type: "Softmax"
  bottom: "rpn_cls_score_reshape_/p4"
  top: "fpn_out/p4"
}

layer {
   bottom: "fpn_out/p4"
   top: "fpn_out_reshape/p4"
   name: "fpn_out_reshape/p4"
   type: "Reshape"
   reshape_param { shape {dim: 0 dim: 12 dim: -1 dim: 0  } }
}




#========= RPN/p5 ============

layer {
  name: "rpn_conv/3x3/p5"
  type: "Convolution"
  bottom: "p5"
  top: "rpn/output/p5"
  param { lr_mult: 1.0
  name:"rpn_conv_3x3_w"
  }
  param { lr_mult: 2.0
    name:"rpn_conv_3x3_b"
  }
  convolution_param {
    num_output: 512
    kernel_size: 3 pad: 1 stride: 1
    weight_filler { type: "gaussian" std: 0.01 }
    bias_filler { type: "constant" value: 0 }
  }
}
layer {
  name: "rpn_relu/3x3/p5"
  type: "ReLU"
  bottom: "rpn/output/p5"
  top: "rpn/output/p5"
}

layer {
  name: "rpn_cls_score/p5"
  type: "Convolution"
  bottom: "rpn/output/p5"
  top: "rpn_cls_score/p5"
  param { lr_mult: 1.0
  name:"rpn_cls_score_w"
  
  }
  param { lr_mult: 2.0
  name:"rpn_cls_score_b"
  }
  convolution_param {
    num_output: 12   # 2(bg/fg) * 9(anchors)
    kernel_size: 1 pad: 0 stride: 1
    weight_filler { type: "gaussian" std: 0.01 }
    bias_filler { type: "constant" value: 0 }
  }
}

layer {
  name: "rpn_bbox_pred/p5"
  type: "Convolution"
  bottom: "rpn/output/p5"
  top: "rpn_bbox_pred/p5"
  param { lr_mult: 1.0 
  name:"rpn_bbox_pred_w"
  }
  param { lr_mult: 2.0
    name:"rpn_bbox_pred_b"
    }
  convolution_param {
    num_output: 24  # 4 * 9(anchors)
    kernel_size: 1 pad: 0 stride: 1
    weight_filler { type: "gaussian" std: 0.01 }
    bias_filler { type: "constant" value: 0 }
  }
}

######

layer {
   bottom: "rpn_cls_score/p5"
   top: "rpn_cls_score_reshape_/p5"
   name: "rpn_cls_score_reshape_/p5"
   type: "Reshape"
   reshape_param { shape {dim: 0 dim: 2 dim: -1 dim:0} }
}


layer {
   bottom: "rpn_bbox_pred/p5"
   top: "rpn_bbox_pred_reshape/p5"
   name: "rpn_bbox_pred_reshape/p5"
   type: "Reshape"
   reshape_param { shape { dim: 0 dim: 0 dim: -1 } }
}

layer {
   bottom: "rpn_cls_score_reshape_/p5"
   top: "rpn_cls_score_reshape/p5"
   name: "rpn_cls_score_reshape/p5"
   type: "Reshape"
   reshape_param { shape {dim: 0 dim: 2 dim: -1 } }
}




#####CLS out


layer {
  name: "fpn_out/p5"
  type: "Softmax"
  bottom: "rpn_cls_score_reshape_/p5"
  top: "fpn_out/p5"
}

layer {
   bottom: "fpn_out/p5"
   top: "fpn_out_reshape/p5"
   name: "fpn_out_reshape/p5"
   type: "Reshape"
   reshape_param { shape {dim: 0 dim: 12 dim: -1 dim: 0  } }
}

#========= RPN/p6 ============

layer {
  name: "rpn_conv/3x3/p6"
  type: "Convolution"
  bottom: "p6"
  top: "rpn/output/p6"
  param { lr_mult: 1.0
  name:"rpn_conv_3x3_w"
  }
  param { lr_mult: 2.0
    name:"rpn_conv_3x3_b"
  }
  convolution_param {
    num_output: 512
    kernel_size: 3 pad: 1 stride: 1
    weight_filler { type: "gaussian" std: 0.01 }
    bias_filler { type: "constant" value: 0 }
  }
}
layer {
  name: "rpn_relu/3x3/p6"
  type: "ReLU"
  bottom: "rpn/output/p6"
  top: "rpn/output/p6"
}

layer {
  name: "rpn_cls_score/p6"
  type: "Convolution"
  bottom: "rpn/output/p6"
  top: "rpn_cls_score/p6"
  param { lr_mult: 1.0
  name:"rpn_cls_score_w"
  
  }
  param { lr_mult: 2.0
  name:"rpn_cls_score_b"
  }
  convolution_param {
    num_output: 12   # 2(bg/fg) * 9(anchors)
    kernel_size: 1 pad: 0 stride: 1
    weight_filler { type: "gaussian" std: 0.01 }
    bias_filler { type: "constant" value: 0 }
  }
}

layer {
  name: "rpn_bbox_pred/p6"
  type: "Convolution"
  bottom: "rpn/output/p6"
  top: "rpn_bbox_pred/p6"
  param { lr_mult: 1.0 
  name:"rpn_bbox_pred_w"
  }
  param { lr_mult: 2.0
    name:"rpn_bbox_pred_b"
    }
  convolution_param {
    num_output: 24  # 4 * 9(anchors)
    kernel_size: 1 pad: 0 stride: 1
    weight_filler { type: "gaussian" std: 0.01 }
    bias_filler { type: "constant" value: 0 }
  }
}


######

layer {
   bottom: "rpn_cls_score/p6"
   top: "rpn_cls_score_reshape_/p6"
   name: "rpn_cls_score_reshape_/p6"
   type: "Reshape"
   reshape_param { shape {dim: 0 dim: 2 dim: -1 dim:0} }
}


layer {
   bottom: "rpn_bbox_pred/p6"
   top: "rpn_bbox_pred_reshape/p6"
   name: "rpn_bbox_pred_reshape/p6"
   type: "Reshape"
   reshape_param { shape { dim: 0 dim: 0 dim: -1 } }
}

layer {
   bottom: "rpn_cls_score_reshape_/p6"
   top: "rpn_cls_score_reshape/p6"
   name: "rpn_cls_score_reshape/p6"
   type: "Reshape"
   reshape_param { shape {dim: 0 dim: 2 dim: -1 } }
}




#####CLS out


layer {
  name: "fpn_out/p6"
  type: "Softmax"
  bottom: "rpn_cls_score_reshape_/p6"
  top: "fpn_out/p6"
}

layer {
   bottom: "fpn_out/p6"
   top: "fpn_out_reshape/p6"
   name: "fpn_out_reshape/p6"
   type: "Reshape"
   reshape_param { shape {dim: 0 dim: 12 dim: -1 dim: 0  } }
}

########rpn loss#####################

layer {
  name: "rpn_cls_score_reshapee"
  type: "Concat"
  bottom: "rpn_cls_score_reshape/p2"
  bottom: "rpn_cls_score_reshape/p3"
  bottom: "rpn_cls_score_reshape/p4"
  bottom: "rpn_cls_score_reshape/p5"
  bottom: "rpn_cls_score_reshape/p6"
  top: "rpn_cls_score_reshape"
  concat_param {
    axis: 2
  }
}



layer {
  name: "rpn_bbox_pred"
  type: "Concat"
  bottom: "rpn_bbox_pred_reshape/p2"
  bottom: "rpn_bbox_pred_reshape/p3"
  bottom: "rpn_bbox_pred_reshape/p4"
  bottom: "rpn_bbox_pred_reshape/p5"
  bottom: "rpn_bbox_pred_reshape/p6"
  top: "rpn_bbox_pred"
  concat_param {
    axis: 2
  }
}



layer {
  name: 'rpn-data'
  type: 'Python'
  bottom: 'rpn_cls_score/p2'
  bottom: 'rpn_cls_score/p3'
  bottom: 'rpn_cls_score/p4'
  bottom: 'rpn_cls_score/p5'
  bottom: 'rpn_cls_score/p6'
  bottom: 'gt_boxes'
  bottom: 'im_info'
  top: 'rpn_labels'
  top: 'rpn_bbox_targets'
  top: 'rpn_bbox_inside_weights'
  top: 'rpn_bbox_outside_weights'
  python_param {
    module: 'rpn.anchor_target_layer'
    layer: 'AnchorTargetLayer'
    param_str: "'feat_stride': 4,8,16,32,64"
  }
}

layer {
  name: "fpn_loss_cls"
  type: "SoftmaxWithLoss"
  bottom: "rpn_cls_score_reshape"
  bottom: "rpn_labels"
  propagate_down: 1
  propagate_down: 0
  top: "FPNClsLoss"
  loss_weight: 1
  loss_param {
    ignore_label: -1
    normalization: VALID
  }
}

layer {
  name: "rpn_loss_bbox"
  type: "SmoothL1Loss"
  bottom: "rpn_bbox_pred"
  bottom: "rpn_bbox_targets"
  bottom: 'rpn_bbox_inside_weights'
  bottom: 'rpn_bbox_outside_weights'
  top: "FPNLossBBox"
  loss_weight: 1
  smooth_l1_loss_param { sigma: 3.0 }
}

#========= RoI Proposal ============



 

layer {
  name: 'proposal'
  type: 'Python'
    bottom: 'im_info'
    bottom: 'rpn_bbox_pred/p2'
    bottom: 'rpn_bbox_pred/p3'
    bottom: 'rpn_bbox_pred/p4'
    bottom: 'rpn_bbox_pred/p5'
    bottom: 'rpn_bbox_pred/p6'
     bottom: 'fpn_out_reshape/p2'
    bottom: 'fpn_out_reshape/p3'
    bottom: 'fpn_out_reshape/p4'
    bottom: 'fpn_out_reshape/p5'
    bottom: 'fpn_out_reshape/p6'
  top: 'rpn_rois'
  python_param {
    module: 'rpn.proposal_layer'
    layer: 'ProposalLayer'
    param_str: "'feat_stride': 4,8,16,32,64"

  }
}



#================rois process======================

layer {
  name: 'roi-data'
  type: 'Python'
  bottom: 'rpn_rois'
  bottom: 'gt_boxes'
    bottom: 'data'
  top: 'rois/h2'
  top: 'rois/h3'
  top: 'rois/h4'
  top: 'rois/h5'
  top: 'labels'
  top: 'bbox_targets'
  top: 'bbox_inside_weights'
  top: 'bbox_outside_weights'
  python_param {
    module: 'rpn.proposal_target_layer'
    layer: 'ProposalTargetLayer'
    param_str: "'num_classes': 21"
  }
}

#========= RCNN ============

######POOLING=======
layer {
  name: "roi_pool/h2"
  type: "ROIPooling"
  bottom: "p2"
  bottom: "rois/h2"
  top: "roi_pool/h2"
  roi_pooling_param {
    pooled_w: 7
    pooled_h: 7
    spatial_scale: 0.25 # 1/4
  }
}


layer {
  name: "roi_pool/h3"
  type: "ROIPooling"
  bottom: "p3"
  bottom: "rois/h3"
  top: "roi_pool/h3"
  roi_pooling_param {
    pooled_w: 7
    pooled_h: 7
    spatial_scale: 0.125 # 1/8
  }
}
layer {
  name: "roi_pool/h4"
  type: "ROIPooling"
  bottom: "p4"
  bottom: "rois/h4"
  top: "roi_pool/h4"
  roi_pooling_param {
    pooled_w: 7
    pooled_h: 7
    spatial_scale: 0.0625 # 1/16
  }
}

layer {
  name: "roi_pool/h5"
  type: "ROIPooling"
  bottom: "p5"
  bottom: "rois/h5"
  top: "roi_pool/h5"
  roi_pooling_param {
    pooled_w: 7
    pooled_h: 7
    spatial_scale: 0.03125 # 1/32
  }
}




#h2
layer {
  name: "rcnn_fc6/h2"
  type: "InnerProduct"
  bottom: "roi_pool/h2"
  top: "rcnn_fc6/h2"
  param {
    lr_mult: 1
    name: "rcnn_fc6_w"
  }
  param {
    lr_mult: 2
    name: "rcnn_fc6_b"
  }
  inner_product_param {
    num_output: 4096
    weight_filler {
      type: "xavier"
    }
    bias_filler {
      type: "constant"
    }
  }
}
layer {
  name: "relu6/h2"
  type: "ReLU"
  bottom: "rcnn_fc6/h2"
  top: "rcnn_fc6/h2"
}
layer {
  name: "drop6/h2"
  type: "Dropout"
  bottom: "rcnn_fc6/h2"
  top: "rcnn_fc6/h2"
  dropout_param {
    dropout_ratio: 0.5
  }
}
layer {
  name: "fc7/h2"
  type: "InnerProduct"
  bottom: "rcnn_fc6/h2"
  top: "fc7/h2"
  param {
    lr_mult: 1
    name:"fc7_w"
  }
  param {
    lr_mult: 2
    name: "fc7_b"
  }
  inner_product_param {
    num_output: 4096
    weight_filler {  
    type: "xavier"  
    }  
    bias_filler {  
      type: "constant"  
    } 
  }
}
layer {
  name: "relu7/h2"
  type: "ReLU"
  bottom: "fc7/h2"
  top: "fc7/h2"
}
layer {
  name: "drop7/h2"
  type: "Dropout"
  bottom: "fc7/h2"
  top: "fc7/h2"
  dropout_param {
    dropout_ratio: 0.5
  }
}
layer {
  name: "cls_score/h2"
  type: "InnerProduct"
  bottom: "fc7/h2"
  top: "cls_score/h2"
  param {
    lr_mult: 1
    name:"cls_score_w"
  }
  param {
    lr_mult: 2
    name:"cls_score_b"
  }
  inner_product_param {
    num_output: 21
    weight_filler {
      type: "gaussian"
      std: 0.01
    }
    bias_filler {
      type: "constant"
      value: 0
    }
  }
}
layer {
  name: "bbox_pred/h2"
  type: "InnerProduct"
  bottom: "fc7/h2"
  top: "bbox_pred/h2"
  param {
    lr_mult: 1
    name:"bbox_pred_w"
  }
  param {
    lr_mult: 2
    name:"bbox_pred_b"
  }
  inner_product_param {
    num_output: 84
    weight_filler {
      type: "gaussian"
      std: 0.001
    }
    bias_filler {
      type: "constant"
      value: 0
    }
  }
}




#h3
layer {
  name: "rcnn_fc6/h3"
  type: "InnerProduct"
  bottom: "roi_pool/h3"
  top: "rcnn_fc6/h3"
  param {
    lr_mult: 1
    name: "rcnn_fc6_w"
  }
  param {
    lr_mult: 2
    name: "rcnn_fc6_b"
  }
  inner_product_param {
    num_output: 4096
    weight_filler {
      type: "xavier"
    }
    bias_filler {
      type: "constant"
    }
  }
}
layer {
  name: "relu6/h3"
  type: "ReLU"
  bottom: "rcnn_fc6/h3"
  top: "rcnn_fc6/h3"
}
layer {
  name: "drop6/h3"
  type: "Dropout"
  bottom: "rcnn_fc6/h3"
  top: "rcnn_fc6/h3"
  dropout_param {
    dropout_ratio: 0.5
  }
}
layer {
  name: "fc7/h3"
  type: "InnerProduct"
  bottom: "rcnn_fc6/h3"
  top: "fc7/h3"
  param {
    lr_mult: 1
    name:"fc7_w"
  }
  param {
    lr_mult: 2
    name: "fc7_b"
  }
  inner_product_param {
    num_output: 4096
    weight_filler {  
    type: "xavier"  
    }  
    bias_filler {  
      type: "constant"  
    } 
  }
}
layer {
  name: "relu7/h3"
  type: "ReLU"
  bottom: "fc7/h3"
  top: "fc7/h3"
}
layer {
  name: "drop7/h3"
  type: "Dropout"
  bottom: "fc7/h3"
  top: "fc7/h3"
  dropout_param {
    dropout_ratio: 0.5
  }
}
layer {
  name: "cls_score/h3"
  type: "InnerProduct"
  bottom: "fc7/h3"
  top: "cls_score/h3"
  param {
    lr_mult: 1
    name:"cls_score_w"
  }
  param {
    lr_mult: 2
    name:"cls_score_b"
  }
  inner_product_param {
    num_output: 21
    weight_filler {
      type: "gaussian"
      std: 0.01
    }
    bias_filler {
      type: "constant"
      value: 0
    }
  }
}
layer {
  name: "bbox_pred/h3"
  type: "InnerProduct"
  bottom: "fc7/h3"
  top: "bbox_pred/h3"
  param {
    lr_mult: 1
    name:"bbox_pred_w"
  }
  param {
    lr_mult: 2
    name:"bbox_pred_b"
  }
  inner_product_param {
    num_output: 84
    weight_filler {
      type: "gaussian"
      std: 0.001
    }
    bias_filler {
      type: "constant"
      value: 0
    }
  }
}





#h4
layer {
  name: "rcnn_fc6/h4"
  type: "InnerProduct"
  bottom: "roi_pool/h4"
  top: "rcnn_fc6/h4"
  param {
    lr_mult: 1
    name: "rcnn_fc6_w"
  }
  param {
    lr_mult: 2
    name: "rcnn_fc6_b"
  }
  inner_product_param {
    num_output: 4096
    weight_filler {
      type: "xavier"
    }
    bias_filler {
      type: "constant"
    }
  }
}
layer {
  name: "relu6/h4"
  type: "ReLU"
  bottom: "rcnn_fc6/h4"
  top: "rcnn_fc6/h4"
}
layer {
  name: "drop6/h4"
  type: "Dropout"
  bottom: "rcnn_fc6/h4"
  top: "rcnn_fc6/h4"
  dropout_param {
    dropout_ratio: 0.5
  }
}
layer {
  name: "fc7/h4"
  type: "InnerProduct"
  bottom: "rcnn_fc6/h4"
  top: "fc7/h4"
  param {
    lr_mult: 1
    name:"fc7_w"
  }
  param {
    lr_mult: 2
    name: "fc7_b"
  }
  inner_product_param {
    num_output: 4096
    weight_filler {  
    type: "xavier"  
    }  
    bias_filler {  
      type: "constant"  
    } 
  }
}
layer {
  name: "relu7/h4"
  type: "ReLU"
  bottom: "fc7/h4"
  top: "fc7/h4"
}
layer {
  name: "drop7/h4"
  type: "Dropout"
  bottom: "fc7/h4"
  top: "fc7/h4"
  dropout_param {
    dropout_ratio: 0.5
  }
}
layer {
  name: "cls_score/h4"
  type: "InnerProduct"
  bottom: "fc7/h4"
  top: "cls_score/h4"
  param {
    lr_mult: 1
    name:"cls_score_w"
  }
  param {
    lr_mult: 2
    name:"cls_score_b"
  }
  inner_product_param {
    num_output: 21
    weight_filler {
      type: "gaussian"
      std: 0.01
    }
    bias_filler {
      type: "constant"
      value: 0
    }
  }
}
layer {
  name: "bbox_pred/h4"
  type: "InnerProduct"
  bottom: "fc7/h4"
  top: "bbox_pred/h4"
  param {
    lr_mult: 1
    name:"bbox_pred_w"
  }
  param {
    lr_mult: 2
    name:"bbox_pred_b"
  }
  inner_product_param {
    num_output: 84
    weight_filler {
      type: "gaussian"
      std: 0.001
    }
    bias_filler {
      type: "constant"
      value: 0
    }
  }
}

#h5
layer {
  name: "rcnn_fc6/h5"
  type: "InnerProduct"
  bottom: "roi_pool/h5"
  top: "rcnn_fc6/h5"
  param {
    lr_mult: 1
    name: "rcnn_fc6_w"
  }
  param {
    lr_mult: 2
    name: "rcnn_fc6_b"
  }
  inner_product_param {
    num_output: 4096
    weight_filler {
      type: "xavier"
    }
    bias_filler {
      type: "constant"
    }
  }
}
layer {
  name: "relu6/h5"
  type: "ReLU"
  bottom: "rcnn_fc6/h5"
  top: "rcnn_fc6/h5"
}
layer {
  name: "drop6/h5"
  type: "Dropout"
  bottom: "rcnn_fc6/h5"
  top: "rcnn_fc6/h5"
  dropout_param {
    dropout_ratio: 0.5
  }
}
layer {
  name: "fc7/h5"
  type: "InnerProduct"
  bottom: "rcnn_fc6/h5"
  top: "fc7/h5"
  param {
    lr_mult: 1
    name:"fc7_w"
  }
  param {
    lr_mult: 2
    name: "fc7_b"
  }
  inner_product_param {
    num_output: 4096
    weight_filler {  
    type: "xavier"  
    }  
    bias_filler {  
      type: "constant"  
    } 
  }
}
layer {
  name: "relu7/h5"
  type: "ReLU"
  bottom: "fc7/h5"
  top: "fc7/h5"
}
layer {
  name: "drop7/h5"
  type: "Dropout"
  bottom: "fc7/h5"
  top: "fc7/h5"
  dropout_param {
    dropout_ratio: 0.5
  }
}
layer {
  name: "cls_score/h5"
  type: "InnerProduct"
  bottom: "fc7/h5"
  top: "cls_score/h5"
  param {
    lr_mult: 1
    name:"cls_score_w"
  }
  param {
    lr_mult: 2
    name:"cls_score_b"
  }
  inner_product_param {
    num_output: 21
    weight_filler {
      type: "gaussian"
      std: 0.01
    }
    bias_filler {
      type: "constant"
      value: 0
    }
  }
}
layer {
  name: "bbox_pred/h5"
  type: "InnerProduct"
  bottom: "fc7/h5"
  top: "bbox_pred/h5"
  param {
    lr_mult: 1
    name:"bbox_pred_w"
  }
  param {
    lr_mult: 2
    name:"bbox_pred_b"
  }
  inner_product_param {
    num_output: 84
    weight_filler {
      type: "gaussian"
      std: 0.001
    }
    bias_filler {
      type: "constant"
      value: 0
    }
  }
}



layer {
  name: "cls_score_concat"
  type: "Concat"
  bottom: "cls_score/h2"
  bottom: "cls_score/h3"
  bottom: "cls_score/h4"
  bottom: "cls_score/h5"
  top: "cls_score"
  concat_param {
    axis: 0
  }
}

layer {
  name: "bbox_pred_concat"
  type: "Concat"
  bottom: "bbox_pred/h2"
  bottom: "bbox_pred/h3"
  bottom: "bbox_pred/h4"
  bottom: "bbox_pred/h5"
  top: "bbox_pred"
  concat_param {
    axis: 0
  }
}

layer {
  name: "loss_cls"
  type: "SoftmaxWithLoss"
  bottom: "cls_score"
  bottom: "labels"
  propagate_down: 1
  propagate_down: 0
  top: "RcnnLossCls"
  loss_weight: 1
    loss_param{
  ignore_label: -1
    normalization: VALID
}
}
layer {
  name: "loss_bbox"
  type: "SmoothL1Loss"
  bottom: "bbox_pred"
  bottom: "bbox_targets"
  bottom: "bbox_inside_weights"
  bottom: "bbox_outside_weights"
  top: "RcnnLossBBox"
  loss_weight: 1
}

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM