zoukankan      html  css  js  c++  java
  • opencv使用openPose实现人体姿态检测

    原文地址:https://www.learnopencv.com/deep-learning-based-human-pose-estimation-using-opencv-cpp-python/

    COCO输出格式:

    鼻子– 0,脖子– 1,右肩– 2,右肘– 3,右腕– 4,左肩– 5,左肘– 6,左腕– 7,右臀部– 8,右膝盖– 9 ,右脚踝– 10,左髋– 11,左膝– 12,LAnkle – 13,右眼– 14,左眼– 15,右耳– 16,左耳– 17,背景– 18 

     模型文件:

    input: "image"
    input_dim: 1
    input_dim: 3
    input_dim: 1 # This value will be defined at runtime
    input_dim: 1 # This value will be defined at runtime
    layer {
      name: "conv1_1"
      type: "Convolution"
      bottom: "image"
      top: "conv1_1"
      param {
        lr_mult: 1.0
        decay_mult: 1
      }
      param {
        lr_mult: 2.0
        decay_mult: 0
      }
      convolution_param {
        num_output: 64
        pad: 1
        kernel_size: 3
        weight_filler {
          type: "gaussian"
          std: 0.01
        }
        bias_filler {
          type: "constant"
        }
      }
    }
    layer {
      name: "relu1_1"
      type: "ReLU"
      bottom: "conv1_1"
      top: "conv1_1"
    }
    layer {
      name: "conv1_2"
      type: "Convolution"
      bottom: "conv1_1"
      top: "conv1_2"
      param {
        lr_mult: 1.0
        decay_mult: 1
      }
      param {
        lr_mult: 2.0
        decay_mult: 0
      }
      convolution_param {
        num_output: 64
        pad: 1
        kernel_size: 3
        weight_filler {
          type: "gaussian"
          std: 0.01
        }
        bias_filler {
          type: "constant"
        }
      }
    }
    layer {
      name: "relu1_2"
      type: "ReLU"
      bottom: "conv1_2"
      top: "conv1_2"
    }
    layer {
      name: "pool1_stage1"
      type: "Pooling"
      bottom: "conv1_2"
      top: "pool1_stage1"
      pooling_param {
        pool: MAX
        kernel_size: 2
        stride: 2
      }
    }
    layer {
      name: "conv2_1"
      type: "Convolution"
      bottom: "pool1_stage1"
      top: "conv2_1"
      param {
        lr_mult: 1.0
        decay_mult: 1
      }
      param {
        lr_mult: 2.0
        decay_mult: 0
      }
      convolution_param {
        num_output: 128
        pad: 1
        kernel_size: 3
        weight_filler {
          type: "gaussian"
          std: 0.01
        }
        bias_filler {
          type: "constant"
        }
      }
    }
    layer {
      name: "relu2_1"
      type: "ReLU"
      bottom: "conv2_1"
      top: "conv2_1"
    }
    layer {
      name: "conv2_2"
      type: "Convolution"
      bottom: "conv2_1"
      top: "conv2_2"
      param {
        lr_mult: 1.0
        decay_mult: 1
      }
      param {
        lr_mult: 2.0
        decay_mult: 0
      }
      convolution_param {
        num_output: 128
        pad: 1
        kernel_size: 3
        weight_filler {
          type: "gaussian"
          std: 0.01
        }
        bias_filler {
          type: "constant"
        }
      }
    }
    layer {
      name: "relu2_2"
      type: "ReLU"
      bottom: "conv2_2"
      top: "conv2_2"
    }
    layer {
      name: "pool2_stage1"
      type: "Pooling"
      bottom: "conv2_2"
      top: "pool2_stage1"
      pooling_param {
        pool: MAX
        kernel_size: 2
        stride: 2
      }
    }
    layer {
      name: "conv3_1"
      type: "Convolution"
      bottom: "pool2_stage1"
      top: "conv3_1"
      param {
        lr_mult: 1.0
        decay_mult: 1
      }
      param {
        lr_mult: 2.0
        decay_mult: 0
      }
      convolution_param {
        num_output: 256
        pad: 1
        kernel_size: 3
        weight_filler {
          type: "gaussian"
          std: 0.01
        }
        bias_filler {
          type: "constant"
        }
      }
    }
    layer {
      name: "relu3_1"
      type: "ReLU"
      bottom: "conv3_1"
      top: "conv3_1"
    }
    layer {
      name: "conv3_2"
      type: "Convolution"
      bottom: "conv3_1"
      top: "conv3_2"
      param {
        lr_mult: 1.0
        decay_mult: 1
      }
      param {
        lr_mult: 2.0
        decay_mult: 0
      }
      convolution_param {
        num_output: 256
        pad: 1
        kernel_size: 3
        weight_filler {
          type: "gaussian"
          std: 0.01
        }
        bias_filler {
          type: "constant"
        }
      }
    }
    layer {
      name: "relu3_2"
      type: "ReLU"
      bottom: "conv3_2"
      top: "conv3_2"
    }
    layer {
      name: "conv3_3"
      type: "Convolution"
      bottom: "conv3_2"
      top: "conv3_3"
      param {
        lr_mult: 1.0
        decay_mult: 1
      }
      param {
        lr_mult: 2.0
        decay_mult: 0
      }
      convolution_param {
        num_output: 256
        pad: 1
        kernel_size: 3
        weight_filler {
          type: "gaussian"
          std: 0.01
        }
        bias_filler {
          type: "constant"
        }
      }
    }
    layer {
      name: "relu3_3"
      type: "ReLU"
      bottom: "conv3_3"
      top: "conv3_3"
    }
    layer {
      name: "conv3_4"
      type: "Convolution"
      bottom: "conv3_3"
      top: "conv3_4"
      param {
        lr_mult: 1.0
        decay_mult: 1
      }
      param {
        lr_mult: 2.0
        decay_mult: 0
      }
      convolution_param {
        num_output: 256
        pad: 1
        kernel_size: 3
        weight_filler {
          type: "gaussian"
          std: 0.01
        }
        bias_filler {
          type: "constant"
        }
      }
    }
    layer {
      name: "relu3_4"
      type: "ReLU"
      bottom: "conv3_4"
      top: "conv3_4"
    }
    layer {
      name: "pool3_stage1"
      type: "Pooling"
      bottom: "conv3_4"
      top: "pool3_stage1"
      pooling_param {
        pool: MAX
        kernel_size: 2
        stride: 2
      }
    }
    layer {
      name: "conv4_1"
      type: "Convolution"
      bottom: "pool3_stage1"
      top: "conv4_1"
      param {
        lr_mult: 1.0
        decay_mult: 1
      }
      param {
        lr_mult: 2.0
        decay_mult: 0
      }
      convolution_param {
        num_output: 512
        pad: 1
        kernel_size: 3
        weight_filler {
          type: "gaussian"
          std: 0.01
        }
        bias_filler {
          type: "constant"
        }
      }
    }
    layer {
      name: "relu4_1"
      type: "ReLU"
      bottom: "conv4_1"
      top: "conv4_1"
    }
    layer {
      name: "conv4_2"
      type: "Convolution"
      bottom: "conv4_1"
      top: "conv4_2"
      param {
        lr_mult: 1.0
        decay_mult: 1
      }
      param {
        lr_mult: 2.0
        decay_mult: 0
      }
      convolution_param {
        num_output: 512
        pad: 1
        kernel_size: 3
        weight_filler {
          type: "gaussian"
          std: 0.01
        }
        bias_filler {
          type: "constant"
        }
      }
    }
    layer {
      name: "relu4_2"
      type: "ReLU"
      bottom: "conv4_2"
      top: "conv4_2"
    }
    layer {
      name: "conv4_3_CPM"
      type: "Convolution"
      bottom: "conv4_2"
      top: "conv4_3_CPM"
      param {
        lr_mult: 1.0
        decay_mult: 1
      }
      param {
        lr_mult: 2.0
        decay_mult: 0
      }
      convolution_param {
        num_output: 256
        pad: 1
        kernel_size: 3
        weight_filler {
          type: "gaussian"
          std: 0.01
        }
        bias_filler {
          type: "constant"
        }
      }
    }
    layer {
      name: "relu4_3_CPM"
      type: "ReLU"
      bottom: "conv4_3_CPM"
      top: "conv4_3_CPM"
    }
    layer {
      name: "conv4_4_CPM"
      type: "Convolution"
      bottom: "conv4_3_CPM"
      top: "conv4_4_CPM"
      param {
        lr_mult: 1.0
        decay_mult: 1
      }
      param {
        lr_mult: 2.0
        decay_mult: 0
      }
      convolution_param {
        num_output: 128
        pad: 1
        kernel_size: 3
        weight_filler {
          type: "gaussian"
          std: 0.01
        }
        bias_filler {
          type: "constant"
        }
      }
    }
    layer {
      name: "relu4_4_CPM"
      type: "ReLU"
      bottom: "conv4_4_CPM"
      top: "conv4_4_CPM"
    }
    layer {
      name: "conv5_1_CPM_L1"
      type: "Convolution"
      bottom: "conv4_4_CPM"
      top: "conv5_1_CPM_L1"
      param {
        lr_mult: 1.0
        decay_mult: 1
      }
      param {
        lr_mult: 2.0
        decay_mult: 0
      }
      convolution_param {
        num_output: 128
        pad: 1
        kernel_size: 3
        weight_filler {
          type: "gaussian"
          std: 0.01
        }
        bias_filler {
          type: "constant"
        }
      }
    }
    layer {
      name: "relu5_1_CPM_L1"
      type: "ReLU"
      bottom: "conv5_1_CPM_L1"
      top: "conv5_1_CPM_L1"
    }
    layer {
      name: "conv5_1_CPM_L2"
      type: "Convolution"
      bottom: "conv4_4_CPM"
      top: "conv5_1_CPM_L2"
      param {
        lr_mult: 1.0
        decay_mult: 1
      }
      param {
        lr_mult: 2.0
        decay_mult: 0
      }
      convolution_param {
        num_output: 128
        pad: 1
        kernel_size: 3
        weight_filler {
          type: "gaussian"
          std: 0.01
        }
        bias_filler {
          type: "constant"
        }
      }
    }
    layer {
      name: "relu5_1_CPM_L2"
      type: "ReLU"
      bottom: "conv5_1_CPM_L2"
      top: "conv5_1_CPM_L2"
    }
    layer {
      name: "conv5_2_CPM_L1"
      type: "Convolution"
      bottom: "conv5_1_CPM_L1"
      top: "conv5_2_CPM_L1"
      param {
        lr_mult: 1.0
        decay_mult: 1
      }
      param {
        lr_mult: 2.0
        decay_mult: 0
      }
      convolution_param {
        num_output: 128
        pad: 1
        kernel_size: 3
        weight_filler {
          type: "gaussian"
          std: 0.01
        }
        bias_filler {
          type: "constant"
        }
      }
    }
    layer {
      name: "relu5_2_CPM_L1"
      type: "ReLU"
      bottom: "conv5_2_CPM_L1"
      top: "conv5_2_CPM_L1"
    }
    layer {
      name: "conv5_2_CPM_L2"
      type: "Convolution"
      bottom: "conv5_1_CPM_L2"
      top: "conv5_2_CPM_L2"
      param {
        lr_mult: 1.0
        decay_mult: 1
      }
      param {
        lr_mult: 2.0
        decay_mult: 0
      }
      convolution_param {
        num_output: 128
        pad: 1
        kernel_size: 3
        weight_filler {
          type: "gaussian"
          std: 0.01
        }
        bias_filler {
          type: "constant"
        }
      }
    }
    layer {
      name: "relu5_2_CPM_L2"
      type: "ReLU"
      bottom: "conv5_2_CPM_L2"
      top: "conv5_2_CPM_L2"
    }
    layer {
      name: "conv5_3_CPM_L1"
      type: "Convolution"
      bottom: "conv5_2_CPM_L1"
      top: "conv5_3_CPM_L1"
      param {
        lr_mult: 1.0
        decay_mult: 1
      }
      param {
        lr_mult: 2.0
        decay_mult: 0
      }
      convolution_param {
        num_output: 128
        pad: 1
        kernel_size: 3
        weight_filler {
          type: "gaussian"
          std: 0.01
        }
        bias_filler {
          type: "constant"
        }
      }
    }
    layer {
      name: "relu5_3_CPM_L1"
      type: "ReLU"
      bottom: "conv5_3_CPM_L1"
      top: "conv5_3_CPM_L1"
    }
    layer {
      name: "conv5_3_CPM_L2"
      type: "Convolution"
      bottom: "conv5_2_CPM_L2"
      top: "conv5_3_CPM_L2"
      param {
        lr_mult: 1.0
        decay_mult: 1
      }
      param {
        lr_mult: 2.0
        decay_mult: 0
      }
      convolution_param {
        num_output: 128
        pad: 1
        kernel_size: 3
        weight_filler {
          type: "gaussian"
          std: 0.01
        }
        bias_filler {
          type: "constant"
        }
      }
    }
    layer {
      name: "relu5_3_CPM_L2"
      type: "ReLU"
      bottom: "conv5_3_CPM_L2"
      top: "conv5_3_CPM_L2"
    }
    layer {
      name: "conv5_4_CPM_L1"
      type: "Convolution"
      bottom: "conv5_3_CPM_L1"
      top: "conv5_4_CPM_L1"
      param {
        lr_mult: 1.0
        decay_mult: 1
      }
      param {
        lr_mult: 2.0
        decay_mult: 0
      }
      convolution_param {
        num_output: 512
        pad: 0
        kernel_size: 1
        weight_filler {
          type: "gaussian"
          std: 0.01
        }
        bias_filler {
          type: "constant"
        }
      }
    }
    layer {
      name: "relu5_4_CPM_L1"
      type: "ReLU"
      bottom: "conv5_4_CPM_L1"
      top: "conv5_4_CPM_L1"
    }
    layer {
      name: "conv5_4_CPM_L2"
      type: "Convolution"
      bottom: "conv5_3_CPM_L2"
      top: "conv5_4_CPM_L2"
      param {
        lr_mult: 1.0
        decay_mult: 1
      }
      param {
        lr_mult: 2.0
        decay_mult: 0
      }
      convolution_param {
        num_output: 512
        pad: 0
        kernel_size: 1
        weight_filler {
          type: "gaussian"
          std: 0.01
        }
        bias_filler {
          type: "constant"
        }
      }
    }
    layer {
      name: "relu5_4_CPM_L2"
      type: "ReLU"
      bottom: "conv5_4_CPM_L2"
      top: "conv5_4_CPM_L2"
    }
    layer {
      name: "conv5_5_CPM_L1"
      type: "Convolution"
      bottom: "conv5_4_CPM_L1"
      top: "conv5_5_CPM_L1"
      param {
        lr_mult: 1.0
        decay_mult: 1
      }
      param {
        lr_mult: 2.0
        decay_mult: 0
      }
      convolution_param {
        num_output: 38
        pad: 0
        kernel_size: 1
        weight_filler {
          type: "gaussian"
          std: 0.01
        }
        bias_filler {
          type: "constant"
        }
      }
    }
    layer {
      name: "conv5_5_CPM_L2"
      type: "Convolution"
      bottom: "conv5_4_CPM_L2"
      top: "conv5_5_CPM_L2"
      param {
        lr_mult: 1.0
        decay_mult: 1
      }
      param {
        lr_mult: 2.0
        decay_mult: 0
      }
      convolution_param {
        num_output: 19
        pad: 0
        kernel_size: 1
        weight_filler {
          type: "gaussian"
          std: 0.01
        }
        bias_filler {
          type: "constant"
        }
      }
    }
    layer {
      name: "concat_stage2"
      type: "Concat"
      bottom: "conv5_5_CPM_L1"
      bottom: "conv5_5_CPM_L2"
      bottom: "conv4_4_CPM"
      top: "concat_stage2"
      concat_param {
        axis: 1
      }
    }
    layer {
      name: "Mconv1_stage2_L1"
      type: "Convolution"
      bottom: "concat_stage2"
      top: "Mconv1_stage2_L1"
      param {
        lr_mult: 4.0
        decay_mult: 1
      }
      param {
        lr_mult: 8.0
        decay_mult: 0
      }
      convolution_param {
        num_output: 128
        pad: 3
        kernel_size: 7
        weight_filler {
          type: "gaussian"
          std: 0.01
        }
        bias_filler {
          type: "constant"
        }
      }
    }
    layer {
      name: "Mrelu1_stage2_L1"
      type: "ReLU"
      bottom: "Mconv1_stage2_L1"
      top: "Mconv1_stage2_L1"
    }
    layer {
      name: "Mconv1_stage2_L2"
      type: "Convolution"
      bottom: "concat_stage2"
      top: "Mconv1_stage2_L2"
      param {
        lr_mult: 4.0
        decay_mult: 1
      }
      param {
        lr_mult: 8.0
        decay_mult: 0
      }
      convolution_param {
        num_output: 128
        pad: 3
        kernel_size: 7
        weight_filler {
          type: "gaussian"
          std: 0.01
        }
        bias_filler {
          type: "constant"
        }
      }
    }
    layer {
      name: "Mrelu1_stage2_L2"
      type: "ReLU"
      bottom: "Mconv1_stage2_L2"
      top: "Mconv1_stage2_L2"
    }
    layer {
      name: "Mconv2_stage2_L1"
      type: "Convolution"
      bottom: "Mconv1_stage2_L1"
      top: "Mconv2_stage2_L1"
      param {
        lr_mult: 4.0
        decay_mult: 1
      }
      param {
        lr_mult: 8.0
        decay_mult: 0
      }
      convolution_param {
        num_output: 128
        pad: 3
        kernel_size: 7
        weight_filler {
          type: "gaussian"
          std: 0.01
        }
        bias_filler {
          type: "constant"
        }
      }
    }
    layer {
      name: "Mrelu2_stage2_L1"
      type: "ReLU"
      bottom: "Mconv2_stage2_L1"
      top: "Mconv2_stage2_L1"
    }
    layer {
      name: "Mconv2_stage2_L2"
      type: "Convolution"
      bottom: "Mconv1_stage2_L2"
      top: "Mconv2_stage2_L2"
      param {
        lr_mult: 4.0
        decay_mult: 1
      }
      param {
        lr_mult: 8.0
        decay_mult: 0
      }
      convolution_param {
        num_output: 128
        pad: 3
        kernel_size: 7
        weight_filler {
          type: "gaussian"
          std: 0.01
        }
        bias_filler {
          type: "constant"
        }
      }
    }
    layer {
      name: "Mrelu2_stage2_L2"
      type: "ReLU"
      bottom: "Mconv2_stage2_L2"
      top: "Mconv2_stage2_L2"
    }
    layer {
      name: "Mconv3_stage2_L1"
      type: "Convolution"
      bottom: "Mconv2_stage2_L1"
      top: "Mconv3_stage2_L1"
      param {
        lr_mult: 4.0
        decay_mult: 1
      }
      param {
        lr_mult: 8.0
        decay_mult: 0
      }
      convolution_param {
        num_output: 128
        pad: 3
        kernel_size: 7
        weight_filler {
          type: "gaussian"
          std: 0.01
        }
        bias_filler {
          type: "constant"
        }
      }
    }
    layer {
      name: "Mrelu3_stage2_L1"
      type: "ReLU"
      bottom: "Mconv3_stage2_L1"
      top: "Mconv3_stage2_L1"
    }
    layer {
      name: "Mconv3_stage2_L2"
      type: "Convolution"
      bottom: "Mconv2_stage2_L2"
      top: "Mconv3_stage2_L2"
      param {
        lr_mult: 4.0
        decay_mult: 1
      }
      param {
        lr_mult: 8.0
        decay_mult: 0
      }
      convolution_param {
        num_output: 128
        pad: 3
        kernel_size: 7
        weight_filler {
          type: "gaussian"
          std: 0.01
        }
        bias_filler {
          type: "constant"
        }
      }
    }
    layer {
      name: "Mrelu3_stage2_L2"
      type: "ReLU"
      bottom: "Mconv3_stage2_L2"
      top: "Mconv3_stage2_L2"
    }
    layer {
      name: "Mconv4_stage2_L1"
      type: "Convolution"
      bottom: "Mconv3_stage2_L1"
      top: "Mconv4_stage2_L1"
      param {
        lr_mult: 4.0
        decay_mult: 1
      }
      param {
        lr_mult: 8.0
        decay_mult: 0
      }
      convolution_param {
        num_output: 128
        pad: 3
        kernel_size: 7
        weight_filler {
          type: "gaussian"
          std: 0.01
        }
        bias_filler {
          type: "constant"
        }
      }
    }
    layer {
      name: "Mrelu4_stage2_L1"
      type: "ReLU"
      bottom: "Mconv4_stage2_L1"
      top: "Mconv4_stage2_L1"
    }
    layer {
      name: "Mconv4_stage2_L2"
      type: "Convolution"
      bottom: "Mconv3_stage2_L2"
      top: "Mconv4_stage2_L2"
      param {
        lr_mult: 4.0
        decay_mult: 1
      }
      param {
        lr_mult: 8.0
        decay_mult: 0
      }
      convolution_param {
        num_output: 128
        pad: 3
        kernel_size: 7
        weight_filler {
          type: "gaussian"
          std: 0.01
        }
        bias_filler {
          type: "constant"
        }
      }
    }
    layer {
      name: "Mrelu4_stage2_L2"
      type: "ReLU"
      bottom: "Mconv4_stage2_L2"
      top: "Mconv4_stage2_L2"
    }
    layer {
      name: "Mconv5_stage2_L1"
      type: "Convolution"
      bottom: "Mconv4_stage2_L1"
      top: "Mconv5_stage2_L1"
      param {
        lr_mult: 4.0
        decay_mult: 1
      }
      param {
        lr_mult: 8.0
        decay_mult: 0
      }
      convolution_param {
        num_output: 128
        pad: 3
        kernel_size: 7
        weight_filler {
          type: "gaussian"
          std: 0.01
        }
        bias_filler {
          type: "constant"
        }
      }
    }
    layer {
      name: "Mrelu5_stage2_L1"
      type: "ReLU"
      bottom: "Mconv5_stage2_L1"
      top: "Mconv5_stage2_L1"
    }
    layer {
      name: "Mconv5_stage2_L2"
      type: "Convolution"
      bottom: "Mconv4_stage2_L2"
      top: "Mconv5_stage2_L2"
      param {
        lr_mult: 4.0
        decay_mult: 1
      }
      param {
        lr_mult: 8.0
        decay_mult: 0
      }
      convolution_param {
        num_output: 128
        pad: 3
        kernel_size: 7
        weight_filler {
          type: "gaussian"
          std: 0.01
        }
        bias_filler {
          type: "constant"
        }
      }
    }
    layer {
      name: "Mrelu5_stage2_L2"
      type: "ReLU"
      bottom: "Mconv5_stage2_L2"
      top: "Mconv5_stage2_L2"
    }
    layer {
      name: "Mconv6_stage2_L1"
      type: "Convolution"
      bottom: "Mconv5_stage2_L1"
      top: "Mconv6_stage2_L1"
      param {
        lr_mult: 4.0
        decay_mult: 1
      }
      param {
        lr_mult: 8.0
        decay_mult: 0
      }
      convolution_param {
        num_output: 128
        pad: 0
        kernel_size: 1
        weight_filler {
          type: "gaussian"
          std: 0.01
        }
        bias_filler {
          type: "constant"
        }
      }
    }
    layer {
      name: "Mrelu6_stage2_L1"
      type: "ReLU"
      bottom: "Mconv6_stage2_L1"
      top: "Mconv6_stage2_L1"
    }
    layer {
      name: "Mconv6_stage2_L2"
      type: "Convolution"
      bottom: "Mconv5_stage2_L2"
      top: "Mconv6_stage2_L2"
      param {
        lr_mult: 4.0
        decay_mult: 1
      }
      param {
        lr_mult: 8.0
        decay_mult: 0
      }
      convolution_param {
        num_output: 128
        pad: 0
        kernel_size: 1
        weight_filler {
          type: "gaussian"
          std: 0.01
        }
        bias_filler {
          type: "constant"
        }
      }
    }
    layer {
      name: "Mrelu6_stage2_L2"
      type: "ReLU"
      bottom: "Mconv6_stage2_L2"
      top: "Mconv6_stage2_L2"
    }
    layer {
      name: "Mconv7_stage2_L1"
      type: "Convolution"
      bottom: "Mconv6_stage2_L1"
      top: "Mconv7_stage2_L1"
      param {
        lr_mult: 4.0
        decay_mult: 1
      }
      param {
        lr_mult: 8.0
        decay_mult: 0
      }
      convolution_param {
        num_output: 38
        pad: 0
        kernel_size: 1
        weight_filler {
          type: "gaussian"
          std: 0.01
        }
        bias_filler {
          type: "constant"
        }
      }
    }
    layer {
      name: "Mconv7_stage2_L2"
      type: "Convolution"
      bottom: "Mconv6_stage2_L2"
      top: "Mconv7_stage2_L2"
      param {
        lr_mult: 4.0
        decay_mult: 1
      }
      param {
        lr_mult: 8.0
        decay_mult: 0
      }
      convolution_param {
        num_output: 19
        pad: 0
        kernel_size: 1
        weight_filler {
          type: "gaussian"
          std: 0.01
        }
        bias_filler {
          type: "constant"
        }
      }
    }
    layer {
      name: "concat_stage3"
      type: "Concat"
      bottom: "Mconv7_stage2_L1"
      bottom: "Mconv7_stage2_L2"
      bottom: "conv4_4_CPM"
      top: "concat_stage3"
      concat_param {
        axis: 1
      }
    }
    layer {
      name: "Mconv1_stage3_L1"
      type: "Convolution"
      bottom: "concat_stage3"
      top: "Mconv1_stage3_L1"
      param {
        lr_mult: 4.0
        decay_mult: 1
      }
      param {
        lr_mult: 8.0
        decay_mult: 0
      }
      convolution_param {
        num_output: 128
        pad: 3
        kernel_size: 7
        weight_filler {
          type: "gaussian"
          std: 0.01
        }
        bias_filler {
          type: "constant"
        }
      }
    }
    layer {
      name: "Mrelu1_stage3_L1"
      type: "ReLU"
      bottom: "Mconv1_stage3_L1"
      top: "Mconv1_stage3_L1"
    }
    layer {
      name: "Mconv1_stage3_L2"
      type: "Convolution"
      bottom: "concat_stage3"
      top: "Mconv1_stage3_L2"
      param {
        lr_mult: 4.0
        decay_mult: 1
      }
      param {
        lr_mult: 8.0
        decay_mult: 0
      }
      convolution_param {
        num_output: 128
        pad: 3
        kernel_size: 7
        weight_filler {
          type: "gaussian"
          std: 0.01
        }
        bias_filler {
          type: "constant"
        }
      }
    }
    layer {
      name: "Mrelu1_stage3_L2"
      type: "ReLU"
      bottom: "Mconv1_stage3_L2"
      top: "Mconv1_stage3_L2"
    }
    layer {
      name: "Mconv2_stage3_L1"
      type: "Convolution"
      bottom: "Mconv1_stage3_L1"
      top: "Mconv2_stage3_L1"
      param {
        lr_mult: 4.0
        decay_mult: 1
      }
      param {
        lr_mult: 8.0
        decay_mult: 0
      }
      convolution_param {
        num_output: 128
        pad: 3
        kernel_size: 7
        weight_filler {
          type: "gaussian"
          std: 0.01
        }
        bias_filler {
          type: "constant"
        }
      }
    }
    layer {
      name: "Mrelu2_stage3_L1"
      type: "ReLU"
      bottom: "Mconv2_stage3_L1"
      top: "Mconv2_stage3_L1"
    }
    layer {
      name: "Mconv2_stage3_L2"
      type: "Convolution"
      bottom: "Mconv1_stage3_L2"
      top: "Mconv2_stage3_L2"
      param {
        lr_mult: 4.0
        decay_mult: 1
      }
      param {
        lr_mult: 8.0
        decay_mult: 0
      }
      convolution_param {
        num_output: 128
        pad: 3
        kernel_size: 7
        weight_filler {
          type: "gaussian"
          std: 0.01
        }
        bias_filler {
          type: "constant"
        }
      }
    }
    layer {
      name: "Mrelu2_stage3_L2"
      type: "ReLU"
      bottom: "Mconv2_stage3_L2"
      top: "Mconv2_stage3_L2"
    }
    layer {
      name: "Mconv3_stage3_L1"
      type: "Convolution"
      bottom: "Mconv2_stage3_L1"
      top: "Mconv3_stage3_L1"
      param {
        lr_mult: 4.0
        decay_mult: 1
      }
      param {
        lr_mult: 8.0
        decay_mult: 0
      }
      convolution_param {
        num_output: 128
        pad: 3
        kernel_size: 7
        weight_filler {
          type: "gaussian"
          std: 0.01
        }
        bias_filler {
          type: "constant"
        }
      }
    }
    layer {
      name: "Mrelu3_stage3_L1"
      type: "ReLU"
      bottom: "Mconv3_stage3_L1"
      top: "Mconv3_stage3_L1"
    }
    layer {
      name: "Mconv3_stage3_L2"
      type: "Convolution"
      bottom: "Mconv2_stage3_L2"
      top: "Mconv3_stage3_L2"
      param {
        lr_mult: 4.0
        decay_mult: 1
      }
      param {
        lr_mult: 8.0
        decay_mult: 0
      }
      convolution_param {
        num_output: 128
        pad: 3
        kernel_size: 7
        weight_filler {
          type: "gaussian"
          std: 0.01
        }
        bias_filler {
          type: "constant"
        }
      }
    }
    layer {
      name: "Mrelu3_stage3_L2"
      type: "ReLU"
      bottom: "Mconv3_stage3_L2"
      top: "Mconv3_stage3_L2"
    }
    layer {
      name: "Mconv4_stage3_L1"
      type: "Convolution"
      bottom: "Mconv3_stage3_L1"
      top: "Mconv4_stage3_L1"
      param {
        lr_mult: 4.0
        decay_mult: 1
      }
      param {
        lr_mult: 8.0
        decay_mult: 0
      }
      convolution_param {
        num_output: 128
        pad: 3
        kernel_size: 7
        weight_filler {
          type: "gaussian"
          std: 0.01
        }
        bias_filler {
          type: "constant"
        }
      }
    }
    layer {
      name: "Mrelu4_stage3_L1"
      type: "ReLU"
      bottom: "Mconv4_stage3_L1"
      top: "Mconv4_stage3_L1"
    }
    layer {
      name: "Mconv4_stage3_L2"
      type: "Convolution"
      bottom: "Mconv3_stage3_L2"
      top: "Mconv4_stage3_L2"
      param {
        lr_mult: 4.0
        decay_mult: 1
      }
      param {
        lr_mult: 8.0
        decay_mult: 0
      }
      convolution_param {
        num_output: 128
        pad: 3
        kernel_size: 7
        weight_filler {
          type: "gaussian"
          std: 0.01
        }
        bias_filler {
          type: "constant"
        }
      }
    }
    layer {
      name: "Mrelu4_stage3_L2"
      type: "ReLU"
      bottom: "Mconv4_stage3_L2"
      top: "Mconv4_stage3_L2"
    }
    layer {
      name: "Mconv5_stage3_L1"
      type: "Convolution"
      bottom: "Mconv4_stage3_L1"
      top: "Mconv5_stage3_L1"
      param {
        lr_mult: 4.0
        decay_mult: 1
      }
      param {
        lr_mult: 8.0
        decay_mult: 0
      }
      convolution_param {
        num_output: 128
        pad: 3
        kernel_size: 7
        weight_filler {
          type: "gaussian"
          std: 0.01
        }
        bias_filler {
          type: "constant"
        }
      }
    }
    layer {
      name: "Mrelu5_stage3_L1"
      type: "ReLU"
      bottom: "Mconv5_stage3_L1"
      top: "Mconv5_stage3_L1"
    }
    layer {
      name: "Mconv5_stage3_L2"
      type: "Convolution"
      bottom: "Mconv4_stage3_L2"
      top: "Mconv5_stage3_L2"
      param {
        lr_mult: 4.0
        decay_mult: 1
      }
      param {
        lr_mult: 8.0
        decay_mult: 0
      }
      convolution_param {
        num_output: 128
        pad: 3
        kernel_size: 7
        weight_filler {
          type: "gaussian"
          std: 0.01
        }
        bias_filler {
          type: "constant"
        }
      }
    }
    layer {
      name: "Mrelu5_stage3_L2"
      type: "ReLU"
      bottom: "Mconv5_stage3_L2"
      top: "Mconv5_stage3_L2"
    }
    layer {
      name: "Mconv6_stage3_L1"
      type: "Convolution"
      bottom: "Mconv5_stage3_L1"
      top: "Mconv6_stage3_L1"
      param {
        lr_mult: 4.0
        decay_mult: 1
      }
      param {
        lr_mult: 8.0
        decay_mult: 0
      }
      convolution_param {
        num_output: 128
        pad: 0
        kernel_size: 1
        weight_filler {
          type: "gaussian"
          std: 0.01
        }
        bias_filler {
          type: "constant"
        }
      }
    }
    layer {
      name: "Mrelu6_stage3_L1"
      type: "ReLU"
      bottom: "Mconv6_stage3_L1"
      top: "Mconv6_stage3_L1"
    }
    layer {
      name: "Mconv6_stage3_L2"
      type: "Convolution"
      bottom: "Mconv5_stage3_L2"
      top: "Mconv6_stage3_L2"
      param {
        lr_mult: 4.0
        decay_mult: 1
      }
      param {
        lr_mult: 8.0
        decay_mult: 0
      }
      convolution_param {
        num_output: 128
        pad: 0
        kernel_size: 1
        weight_filler {
          type: "gaussian"
          std: 0.01
        }
        bias_filler {
          type: "constant"
        }
      }
    }
    layer {
      name: "Mrelu6_stage3_L2"
      type: "ReLU"
      bottom: "Mconv6_stage3_L2"
      top: "Mconv6_stage3_L2"
    }
    layer {
      name: "Mconv7_stage3_L1"
      type: "Convolution"
      bottom: "Mconv6_stage3_L1"
      top: "Mconv7_stage3_L1"
      param {
        lr_mult: 4.0
        decay_mult: 1
      }
      param {
        lr_mult: 8.0
        decay_mult: 0
      }
      convolution_param {
        num_output: 38
        pad: 0
        kernel_size: 1
        weight_filler {
          type: "gaussian"
          std: 0.01
        }
        bias_filler {
          type: "constant"
        }
      }
    }
    layer {
      name: "Mconv7_stage3_L2"
      type: "Convolution"
      bottom: "Mconv6_stage3_L2"
      top: "Mconv7_stage3_L2"
      param {
        lr_mult: 4.0
        decay_mult: 1
      }
      param {
        lr_mult: 8.0
        decay_mult: 0
      }
      convolution_param {
        num_output: 19
        pad: 0
        kernel_size: 1
        weight_filler {
          type: "gaussian"
          std: 0.01
        }
        bias_filler {
          type: "constant"
        }
      }
    }
    layer {
      name: "concat_stage4"
      type: "Concat"
      bottom: "Mconv7_stage3_L1"
      bottom: "Mconv7_stage3_L2"
      bottom: "conv4_4_CPM"
      top: "concat_stage4"
      concat_param {
        axis: 1
      }
    }
    layer {
      name: "Mconv1_stage4_L1"
      type: "Convolution"
      bottom: "concat_stage4"
      top: "Mconv1_stage4_L1"
      param {
        lr_mult: 4.0
        decay_mult: 1
      }
      param {
        lr_mult: 8.0
        decay_mult: 0
      }
      convolution_param {
        num_output: 128
        pad: 3
        kernel_size: 7
        weight_filler {
          type: "gaussian"
          std: 0.01
        }
        bias_filler {
          type: "constant"
        }
      }
    }
    layer {
      name: "Mrelu1_stage4_L1"
      type: "ReLU"
      bottom: "Mconv1_stage4_L1"
      top: "Mconv1_stage4_L1"
    }
    layer {
      name: "Mconv1_stage4_L2"
      type: "Convolution"
      bottom: "concat_stage4"
      top: "Mconv1_stage4_L2"
      param {
        lr_mult: 4.0
        decay_mult: 1
      }
      param {
        lr_mult: 8.0
        decay_mult: 0
      }
      convolution_param {
        num_output: 128
        pad: 3
        kernel_size: 7
        weight_filler {
          type: "gaussian"
          std: 0.01
        }
        bias_filler {
          type: "constant"
        }
      }
    }
    layer {
      name: "Mrelu1_stage4_L2"
      type: "ReLU"
      bottom: "Mconv1_stage4_L2"
      top: "Mconv1_stage4_L2"
    }
    layer {
      name: "Mconv2_stage4_L1"
      type: "Convolution"
      bottom: "Mconv1_stage4_L1"
      top: "Mconv2_stage4_L1"
      param {
        lr_mult: 4.0
        decay_mult: 1
      }
      param {
        lr_mult: 8.0
        decay_mult: 0
      }
      convolution_param {
        num_output: 128
        pad: 3
        kernel_size: 7
        weight_filler {
          type: "gaussian"
          std: 0.01
        }
        bias_filler {
          type: "constant"
        }
      }
    }
    layer {
      name: "Mrelu2_stage4_L1"
      type: "ReLU"
      bottom: "Mconv2_stage4_L1"
      top: "Mconv2_stage4_L1"
    }
    layer {
      name: "Mconv2_stage4_L2"
      type: "Convolution"
      bottom: "Mconv1_stage4_L2"
      top: "Mconv2_stage4_L2"
      param {
        lr_mult: 4.0
        decay_mult: 1
      }
      param {
        lr_mult: 8.0
        decay_mult: 0
      }
      convolution_param {
        num_output: 128
        pad: 3
        kernel_size: 7
        weight_filler {
          type: "gaussian"
          std: 0.01
        }
        bias_filler {
          type: "constant"
        }
      }
    }
    layer {
      name: "Mrelu2_stage4_L2"
      type: "ReLU"
      bottom: "Mconv2_stage4_L2"
      top: "Mconv2_stage4_L2"
    }
    layer {
      name: "Mconv3_stage4_L1"
      type: "Convolution"
      bottom: "Mconv2_stage4_L1"
      top: "Mconv3_stage4_L1"
      param {
        lr_mult: 4.0
        decay_mult: 1
      }
      param {
        lr_mult: 8.0
        decay_mult: 0
      }
      convolution_param {
        num_output: 128
        pad: 3
        kernel_size: 7
        weight_filler {
          type: "gaussian"
          std: 0.01
        }
        bias_filler {
          type: "constant"
        }
      }
    }
    layer {
      name: "Mrelu3_stage4_L1"
      type: "ReLU"
      bottom: "Mconv3_stage4_L1"
      top: "Mconv3_stage4_L1"
    }
    layer {
      name: "Mconv3_stage4_L2"
      type: "Convolution"
      bottom: "Mconv2_stage4_L2"
      top: "Mconv3_stage4_L2"
      param {
        lr_mult: 4.0
        decay_mult: 1
      }
      param {
        lr_mult: 8.0
        decay_mult: 0
      }
      convolution_param {
        num_output: 128
        pad: 3
        kernel_size: 7
        weight_filler {
          type: "gaussian"
          std: 0.01
        }
        bias_filler {
          type: "constant"
        }
      }
    }
    layer {
      name: "Mrelu3_stage4_L2"
      type: "ReLU"
      bottom: "Mconv3_stage4_L2"
      top: "Mconv3_stage4_L2"
    }
    layer {
      name: "Mconv4_stage4_L1"
      type: "Convolution"
      bottom: "Mconv3_stage4_L1"
      top: "Mconv4_stage4_L1"
      param {
        lr_mult: 4.0
        decay_mult: 1
      }
      param {
        lr_mult: 8.0
        decay_mult: 0
      }
      convolution_param {
        num_output: 128
        pad: 3
        kernel_size: 7
        weight_filler {
          type: "gaussian"
          std: 0.01
        }
        bias_filler {
          type: "constant"
        }
      }
    }
    layer {
      name: "Mrelu4_stage4_L1"
      type: "ReLU"
      bottom: "Mconv4_stage4_L1"
      top: "Mconv4_stage4_L1"
    }
    layer {
      name: "Mconv4_stage4_L2"
      type: "Convolution"
      bottom: "Mconv3_stage4_L2"
      top: "Mconv4_stage4_L2"
      param {
        lr_mult: 4.0
        decay_mult: 1
      }
      param {
        lr_mult: 8.0
        decay_mult: 0
      }
      convolution_param {
        num_output: 128
        pad: 3
        kernel_size: 7
        weight_filler {
          type: "gaussian"
          std: 0.01
        }
        bias_filler {
          type: "constant"
        }
      }
    }
    layer {
      name: "Mrelu4_stage4_L2"
      type: "ReLU"
      bottom: "Mconv4_stage4_L2"
      top: "Mconv4_stage4_L2"
    }
    layer {
      name: "Mconv5_stage4_L1"
      type: "Convolution"
      bottom: "Mconv4_stage4_L1"
      top: "Mconv5_stage4_L1"
      param {
        lr_mult: 4.0
        decay_mult: 1
      }
      param {
        lr_mult: 8.0
        decay_mult: 0
      }
      convolution_param {
        num_output: 128
        pad: 3
        kernel_size: 7
        weight_filler {
          type: "gaussian"
          std: 0.01
        }
        bias_filler {
          type: "constant"
        }
      }
    }
    layer {
      name: "Mrelu5_stage4_L1"
      type: "ReLU"
      bottom: "Mconv5_stage4_L1"
      top: "Mconv5_stage4_L1"
    }
    layer {
      name: "Mconv5_stage4_L2"
      type: "Convolution"
      bottom: "Mconv4_stage4_L2"
      top: "Mconv5_stage4_L2"
      param {
        lr_mult: 4.0
        decay_mult: 1
      }
      param {
        lr_mult: 8.0
        decay_mult: 0
      }
      convolution_param {
        num_output: 128
        pad: 3
        kernel_size: 7
        weight_filler {
          type: "gaussian"
          std: 0.01
        }
        bias_filler {
          type: "constant"
        }
      }
    }
    layer {
      name: "Mrelu5_stage4_L2"
      type: "ReLU"
      bottom: "Mconv5_stage4_L2"
      top: "Mconv5_stage4_L2"
    }
    layer {
      name: "Mconv6_stage4_L1"
      type: "Convolution"
      bottom: "Mconv5_stage4_L1"
      top: "Mconv6_stage4_L1"
      param {
        lr_mult: 4.0
        decay_mult: 1
      }
      param {
        lr_mult: 8.0
        decay_mult: 0
      }
      convolution_param {
        num_output: 128
        pad: 0
        kernel_size: 1
        weight_filler {
          type: "gaussian"
          std: 0.01
        }
        bias_filler {
          type: "constant"
        }
      }
    }
    layer {
      name: "Mrelu6_stage4_L1"
      type: "ReLU"
      bottom: "Mconv6_stage4_L1"
      top: "Mconv6_stage4_L1"
    }
    layer {
      name: "Mconv6_stage4_L2"
      type: "Convolution"
      bottom: "Mconv5_stage4_L2"
      top: "Mconv6_stage4_L2"
      param {
        lr_mult: 4.0
        decay_mult: 1
      }
      param {
        lr_mult: 8.0
        decay_mult: 0
      }
      convolution_param {
        num_output: 128
        pad: 0
        kernel_size: 1
        weight_filler {
          type: "gaussian"
          std: 0.01
        }
        bias_filler {
          type: "constant"
        }
      }
    }
    layer {
      name: "Mrelu6_stage4_L2"
      type: "ReLU"
      bottom: "Mconv6_stage4_L2"
      top: "Mconv6_stage4_L2"
    }
    layer {
      name: "Mconv7_stage4_L1"
      type: "Convolution"
      bottom: "Mconv6_stage4_L1"
      top: "Mconv7_stage4_L1"
      param {
        lr_mult: 4.0
        decay_mult: 1
      }
      param {
        lr_mult: 8.0
        decay_mult: 0
      }
      convolution_param {
        num_output: 38
        pad: 0
        kernel_size: 1
        weight_filler {
          type: "gaussian"
          std: 0.01
        }
        bias_filler {
          type: "constant"
        }
      }
    }
    layer {
      name: "Mconv7_stage4_L2"
      type: "Convolution"
      bottom: "Mconv6_stage4_L2"
      top: "Mconv7_stage4_L2"
      param {
        lr_mult: 4.0
        decay_mult: 1
      }
      param {
        lr_mult: 8.0
        decay_mult: 0
      }
      convolution_param {
        num_output: 19
        pad: 0
        kernel_size: 1
        weight_filler {
          type: "gaussian"
          std: 0.01
        }
        bias_filler {
          type: "constant"
        }
      }
    }
    layer {
      name: "concat_stage5"
      type: "Concat"
      bottom: "Mconv7_stage4_L1"
      bottom: "Mconv7_stage4_L2"
      bottom: "conv4_4_CPM"
      top: "concat_stage5"
      concat_param {
        axis: 1
      }
    }
    layer {
      name: "Mconv1_stage5_L1"
      type: "Convolution"
      bottom: "concat_stage5"
      top: "Mconv1_stage5_L1"
      param {
        lr_mult: 4.0
        decay_mult: 1
      }
      param {
        lr_mult: 8.0
        decay_mult: 0
      }
      convolution_param {
        num_output: 128
        pad: 3
        kernel_size: 7
        weight_filler {
          type: "gaussian"
          std: 0.01
        }
        bias_filler {
          type: "constant"
        }
      }
    }
    layer {
      name: "Mrelu1_stage5_L1"
      type: "ReLU"
      bottom: "Mconv1_stage5_L1"
      top: "Mconv1_stage5_L1"
    }
    layer {
      name: "Mconv1_stage5_L2"
      type: "Convolution"
      bottom: "concat_stage5"
      top: "Mconv1_stage5_L2"
      param {
        lr_mult: 4.0
        decay_mult: 1
      }
      param {
        lr_mult: 8.0
        decay_mult: 0
      }
      convolution_param {
        num_output: 128
        pad: 3
        kernel_size: 7
        weight_filler {
          type: "gaussian"
          std: 0.01
        }
        bias_filler {
          type: "constant"
        }
      }
    }
    layer {
      name: "Mrelu1_stage5_L2"
      type: "ReLU"
      bottom: "Mconv1_stage5_L2"
      top: "Mconv1_stage5_L2"
    }
    layer {
      name: "Mconv2_stage5_L1"
      type: "Convolution"
      bottom: "Mconv1_stage5_L1"
      top: "Mconv2_stage5_L1"
      param {
        lr_mult: 4.0
        decay_mult: 1
      }
      param {
        lr_mult: 8.0
        decay_mult: 0
      }
      convolution_param {
        num_output: 128
        pad: 3
        kernel_size: 7
        weight_filler {
          type: "gaussian"
          std: 0.01
        }
        bias_filler {
          type: "constant"
        }
      }
    }
    layer {
      name: "Mrelu2_stage5_L1"
      type: "ReLU"
      bottom: "Mconv2_stage5_L1"
      top: "Mconv2_stage5_L1"
    }
    layer {
      name: "Mconv2_stage5_L2"
      type: "Convolution"
      bottom: "Mconv1_stage5_L2"
      top: "Mconv2_stage5_L2"
      param {
        lr_mult: 4.0
        decay_mult: 1
      }
      param {
        lr_mult: 8.0
        decay_mult: 0
      }
      convolution_param {
        num_output: 128
        pad: 3
        kernel_size: 7
        weight_filler {
          type: "gaussian"
          std: 0.01
        }
        bias_filler {
          type: "constant"
        }
      }
    }
    layer {
      name: "Mrelu2_stage5_L2"
      type: "ReLU"
      bottom: "Mconv2_stage5_L2"
      top: "Mconv2_stage5_L2"
    }
    layer {
      name: "Mconv3_stage5_L1"
      type: "Convolution"
      bottom: "Mconv2_stage5_L1"
      top: "Mconv3_stage5_L1"
      param {
        lr_mult: 4.0
        decay_mult: 1
      }
      param {
        lr_mult: 8.0
        decay_mult: 0
      }
      convolution_param {
        num_output: 128
        pad: 3
        kernel_size: 7
        weight_filler {
          type: "gaussian"
          std: 0.01
        }
        bias_filler {
          type: "constant"
        }
      }
    }
    layer {
      name: "Mrelu3_stage5_L1"
      type: "ReLU"
      bottom: "Mconv3_stage5_L1"
      top: "Mconv3_stage5_L1"
    }
    layer {
      name: "Mconv3_stage5_L2"
      type: "Convolution"
      bottom: "Mconv2_stage5_L2"
      top: "Mconv3_stage5_L2"
      param {
        lr_mult: 4.0
        decay_mult: 1
      }
      param {
        lr_mult: 8.0
        decay_mult: 0
      }
      convolution_param {
        num_output: 128
        pad: 3
        kernel_size: 7
        weight_filler {
          type: "gaussian"
          std: 0.01
        }
        bias_filler {
          type: "constant"
        }
      }
    }
    layer {
      name: "Mrelu3_stage5_L2"
      type: "ReLU"
      bottom: "Mconv3_stage5_L2"
      top: "Mconv3_stage5_L2"
    }
    layer {
      name: "Mconv4_stage5_L1"
      type: "Convolution"
      bottom: "Mconv3_stage5_L1"
      top: "Mconv4_stage5_L1"
      param {
        lr_mult: 4.0
        decay_mult: 1
      }
      param {
        lr_mult: 8.0
        decay_mult: 0
      }
      convolution_param {
        num_output: 128
        pad: 3
        kernel_size: 7
        weight_filler {
          type: "gaussian"
          std: 0.01
        }
        bias_filler {
          type: "constant"
        }
      }
    }
    layer {
      name: "Mrelu4_stage5_L1"
      type: "ReLU"
      bottom: "Mconv4_stage5_L1"
      top: "Mconv4_stage5_L1"
    }
    layer {
      name: "Mconv4_stage5_L2"
      type: "Convolution"
      bottom: "Mconv3_stage5_L2"
      top: "Mconv4_stage5_L2"
      param {
        lr_mult: 4.0
        decay_mult: 1
      }
      param {
        lr_mult: 8.0
        decay_mult: 0
      }
      convolution_param {
        num_output: 128
        pad: 3
        kernel_size: 7
        weight_filler {
          type: "gaussian"
          std: 0.01
        }
        bias_filler {
          type: "constant"
        }
      }
    }
    layer {
      name: "Mrelu4_stage5_L2"
      type: "ReLU"
      bottom: "Mconv4_stage5_L2"
      top: "Mconv4_stage5_L2"
    }
    layer {
      name: "Mconv5_stage5_L1"
      type: "Convolution"
      bottom: "Mconv4_stage5_L1"
      top: "Mconv5_stage5_L1"
      param {
        lr_mult: 4.0
        decay_mult: 1
      }
      param {
        lr_mult: 8.0
        decay_mult: 0
      }
      convolution_param {
        num_output: 128
        pad: 3
        kernel_size: 7
        weight_filler {
          type: "gaussian"
          std: 0.01
        }
        bias_filler {
          type: "constant"
        }
      }
    }
    layer {
      name: "Mrelu5_stage5_L1"
      type: "ReLU"
      bottom: "Mconv5_stage5_L1"
      top: "Mconv5_stage5_L1"
    }
    layer {
      name: "Mconv5_stage5_L2"
      type: "Convolution"
      bottom: "Mconv4_stage5_L2"
      top: "Mconv5_stage5_L2"
      param {
        lr_mult: 4.0
        decay_mult: 1
      }
      param {
        lr_mult: 8.0
        decay_mult: 0
      }
      convolution_param {
        num_output: 128
        pad: 3
        kernel_size: 7
        weight_filler {
          type: "gaussian"
          std: 0.01
        }
        bias_filler {
          type: "constant"
        }
      }
    }
    layer {
      name: "Mrelu5_stage5_L2"
      type: "ReLU"
      bottom: "Mconv5_stage5_L2"
      top: "Mconv5_stage5_L2"
    }
    layer {
      name: "Mconv6_stage5_L1"
      type: "Convolution"
      bottom: "Mconv5_stage5_L1"
      top: "Mconv6_stage5_L1"
      param {
        lr_mult: 4.0
        decay_mult: 1
      }
      param {
        lr_mult: 8.0
        decay_mult: 0
      }
      convolution_param {
        num_output: 128
        pad: 0
        kernel_size: 1
        weight_filler {
          type: "gaussian"
          std: 0.01
        }
        bias_filler {
          type: "constant"
        }
      }
    }
    layer {
      name: "Mrelu6_stage5_L1"
      type: "ReLU"
      bottom: "Mconv6_stage5_L1"
      top: "Mconv6_stage5_L1"
    }
    layer {
      name: "Mconv6_stage5_L2"
      type: "Convolution"
      bottom: "Mconv5_stage5_L2"
      top: "Mconv6_stage5_L2"
      param {
        lr_mult: 4.0
        decay_mult: 1
      }
      param {
        lr_mult: 8.0
        decay_mult: 0
      }
      convolution_param {
        num_output: 128
        pad: 0
        kernel_size: 1
        weight_filler {
          type: "gaussian"
          std: 0.01
        }
        bias_filler {
          type: "constant"
        }
      }
    }
    layer {
      name: "Mrelu6_stage5_L2"
      type: "ReLU"
      bottom: "Mconv6_stage5_L2"
      top: "Mconv6_stage5_L2"
    }
    layer {
      name: "Mconv7_stage5_L1"
      type: "Convolution"
      bottom: "Mconv6_stage5_L1"
      top: "Mconv7_stage5_L1"
      param {
        lr_mult: 4.0
        decay_mult: 1
      }
      param {
        lr_mult: 8.0
        decay_mult: 0
      }
      convolution_param {
        num_output: 38
        pad: 0
        kernel_size: 1
        weight_filler {
          type: "gaussian"
          std: 0.01
        }
        bias_filler {
          type: "constant"
        }
      }
    }
    layer {
      name: "Mconv7_stage5_L2"
      type: "Convolution"
      bottom: "Mconv6_stage5_L2"
      top: "Mconv7_stage5_L2"
      param {
        lr_mult: 4.0
        decay_mult: 1
      }
      param {
        lr_mult: 8.0
        decay_mult: 0
      }
      convolution_param {
        num_output: 19
        pad: 0
        kernel_size: 1
        weight_filler {
          type: "gaussian"
          std: 0.01
        }
        bias_filler {
          type: "constant"
        }
      }
    }
    layer {
      name: "concat_stage6"
      type: "Concat"
      bottom: "Mconv7_stage5_L1"
      bottom: "Mconv7_stage5_L2"
      bottom: "conv4_4_CPM"
      top: "concat_stage6"
      concat_param {
        axis: 1
      }
    }
    layer {
      name: "Mconv1_stage6_L1"
      type: "Convolution"
      bottom: "concat_stage6"
      top: "Mconv1_stage6_L1"
      param {
        lr_mult: 4.0
        decay_mult: 1
      }
      param {
        lr_mult: 8.0
        decay_mult: 0
      }
      convolution_param {
        num_output: 128
        pad: 3
        kernel_size: 7
        weight_filler {
          type: "gaussian"
          std: 0.01
        }
        bias_filler {
          type: "constant"
        }
      }
    }
    layer {
      name: "Mrelu1_stage6_L1"
      type: "ReLU"
      bottom: "Mconv1_stage6_L1"
      top: "Mconv1_stage6_L1"
    }
    layer {
      name: "Mconv1_stage6_L2"
      type: "Convolution"
      bottom: "concat_stage6"
      top: "Mconv1_stage6_L2"
      param {
        lr_mult: 4.0
        decay_mult: 1
      }
      param {
        lr_mult: 8.0
        decay_mult: 0
      }
      convolution_param {
        num_output: 128
        pad: 3
        kernel_size: 7
        weight_filler {
          type: "gaussian"
          std: 0.01
        }
        bias_filler {
          type: "constant"
        }
      }
    }
    layer {
      name: "Mrelu1_stage6_L2"
      type: "ReLU"
      bottom: "Mconv1_stage6_L2"
      top: "Mconv1_stage6_L2"
    }
    layer {
      name: "Mconv2_stage6_L1"
      type: "Convolution"
      bottom: "Mconv1_stage6_L1"
      top: "Mconv2_stage6_L1"
      param {
        lr_mult: 4.0
        decay_mult: 1
      }
      param {
        lr_mult: 8.0
        decay_mult: 0
      }
      convolution_param {
        num_output: 128
        pad: 3
        kernel_size: 7
        weight_filler {
          type: "gaussian"
          std: 0.01
        }
        bias_filler {
          type: "constant"
        }
      }
    }
    layer {
      name: "Mrelu2_stage6_L1"
      type: "ReLU"
      bottom: "Mconv2_stage6_L1"
      top: "Mconv2_stage6_L1"
    }
    layer {
      name: "Mconv2_stage6_L2"
      type: "Convolution"
      bottom: "Mconv1_stage6_L2"
      top: "Mconv2_stage6_L2"
      param {
        lr_mult: 4.0
        decay_mult: 1
      }
      param {
        lr_mult: 8.0
        decay_mult: 0
      }
      convolution_param {
        num_output: 128
        pad: 3
        kernel_size: 7
        weight_filler {
          type: "gaussian"
          std: 0.01
        }
        bias_filler {
          type: "constant"
        }
      }
    }
    layer {
      name: "Mrelu2_stage6_L2"
      type: "ReLU"
      bottom: "Mconv2_stage6_L2"
      top: "Mconv2_stage6_L2"
    }
    layer {
      name: "Mconv3_stage6_L1"
      type: "Convolution"
      bottom: "Mconv2_stage6_L1"
      top: "Mconv3_stage6_L1"
      param {
        lr_mult: 4.0
        decay_mult: 1
      }
      param {
        lr_mult: 8.0
        decay_mult: 0
      }
      convolution_param {
        num_output: 128
        pad: 3
        kernel_size: 7
        weight_filler {
          type: "gaussian"
          std: 0.01
        }
        bias_filler {
          type: "constant"
        }
      }
    }
    layer {
      name: "Mrelu3_stage6_L1"
      type: "ReLU"
      bottom: "Mconv3_stage6_L1"
      top: "Mconv3_stage6_L1"
    }
    layer {
      name: "Mconv3_stage6_L2"
      type: "Convolution"
      bottom: "Mconv2_stage6_L2"
      top: "Mconv3_stage6_L2"
      param {
        lr_mult: 4.0
        decay_mult: 1
      }
      param {
        lr_mult: 8.0
        decay_mult: 0
      }
      convolution_param {
        num_output: 128
        pad: 3
        kernel_size: 7
        weight_filler {
          type: "gaussian"
          std: 0.01
        }
        bias_filler {
          type: "constant"
        }
      }
    }
    layer {
      name: "Mrelu3_stage6_L2"
      type: "ReLU"
      bottom: "Mconv3_stage6_L2"
      top: "Mconv3_stage6_L2"
    }
    layer {
      name: "Mconv4_stage6_L1"
      type: "Convolution"
      bottom: "Mconv3_stage6_L1"
      top: "Mconv4_stage6_L1"
      param {
        lr_mult: 4.0
        decay_mult: 1
      }
      param {
        lr_mult: 8.0
        decay_mult: 0
      }
      convolution_param {
        num_output: 128
        pad: 3
        kernel_size: 7
        weight_filler {
          type: "gaussian"
          std: 0.01
        }
        bias_filler {
          type: "constant"
        }
      }
    }
    layer {
      name: "Mrelu4_stage6_L1"
      type: "ReLU"
      bottom: "Mconv4_stage6_L1"
      top: "Mconv4_stage6_L1"
    }
    layer {
      name: "Mconv4_stage6_L2"
      type: "Convolution"
      bottom: "Mconv3_stage6_L2"
      top: "Mconv4_stage6_L2"
      param {
        lr_mult: 4.0
        decay_mult: 1
      }
      param {
        lr_mult: 8.0
        decay_mult: 0
      }
      convolution_param {
        num_output: 128
        pad: 3
        kernel_size: 7
        weight_filler {
          type: "gaussian"
          std: 0.01
        }
        bias_filler {
          type: "constant"
        }
      }
    }
    layer {
      name: "Mrelu4_stage6_L2"
      type: "ReLU"
      bottom: "Mconv4_stage6_L2"
      top: "Mconv4_stage6_L2"
    }
    layer {
      name: "Mconv5_stage6_L1"
      type: "Convolution"
      bottom: "Mconv4_stage6_L1"
      top: "Mconv5_stage6_L1"
      param {
        lr_mult: 4.0
        decay_mult: 1
      }
      param {
        lr_mult: 8.0
        decay_mult: 0
      }
      convolution_param {
        num_output: 128
        pad: 3
        kernel_size: 7
        weight_filler {
          type: "gaussian"
          std: 0.01
        }
        bias_filler {
          type: "constant"
        }
      }
    }
    layer {
      name: "Mrelu5_stage6_L1"
      type: "ReLU"
      bottom: "Mconv5_stage6_L1"
      top: "Mconv5_stage6_L1"
    }
    layer {
      name: "Mconv5_stage6_L2"
      type: "Convolution"
      bottom: "Mconv4_stage6_L2"
      top: "Mconv5_stage6_L2"
      param {
        lr_mult: 4.0
        decay_mult: 1
      }
      param {
        lr_mult: 8.0
        decay_mult: 0
      }
      convolution_param {
        num_output: 128
        pad: 3
        kernel_size: 7
        weight_filler {
          type: "gaussian"
          std: 0.01
        }
        bias_filler {
          type: "constant"
        }
      }
    }
    layer {
      name: "Mrelu5_stage6_L2"
      type: "ReLU"
      bottom: "Mconv5_stage6_L2"
      top: "Mconv5_stage6_L2"
    }
    layer {
      name: "Mconv6_stage6_L1"
      type: "Convolution"
      bottom: "Mconv5_stage6_L1"
      top: "Mconv6_stage6_L1"
      param {
        lr_mult: 4.0
        decay_mult: 1
      }
      param {
        lr_mult: 8.0
        decay_mult: 0
      }
      convolution_param {
        num_output: 128
        pad: 0
        kernel_size: 1
        weight_filler {
          type: "gaussian"
          std: 0.01
        }
        bias_filler {
          type: "constant"
        }
      }
    }
    layer {
      name: "Mrelu6_stage6_L1"
      type: "ReLU"
      bottom: "Mconv6_stage6_L1"
      top: "Mconv6_stage6_L1"
    }
    layer {
      name: "Mconv6_stage6_L2"
      type: "Convolution"
      bottom: "Mconv5_stage6_L2"
      top: "Mconv6_stage6_L2"
      param {
        lr_mult: 4.0
        decay_mult: 1
      }
      param {
        lr_mult: 8.0
        decay_mult: 0
      }
      convolution_param {
        num_output: 128
        pad: 0
        kernel_size: 1
        weight_filler {
          type: "gaussian"
          std: 0.01
        }
        bias_filler {
          type: "constant"
        }
      }
    }
    layer {
      name: "Mrelu6_stage6_L2"
      type: "ReLU"
      bottom: "Mconv6_stage6_L2"
      top: "Mconv6_stage6_L2"
    }
    layer {
      name: "Mconv7_stage6_L1"
      type: "Convolution"
      bottom: "Mconv6_stage6_L1"
      top: "Mconv7_stage6_L1"
      param {
        lr_mult: 4.0
        decay_mult: 1
      }
      param {
        lr_mult: 8.0
        decay_mult: 0
      }
      convolution_param {
        num_output: 38
        pad: 0
        kernel_size: 1
        weight_filler {
          type: "gaussian"
          std: 0.01
        }
        bias_filler {
          type: "constant"
        }
      }
    }
    layer {
      name: "Mconv7_stage6_L2"
      type: "Convolution"
      bottom: "Mconv6_stage6_L2"
      top: "Mconv7_stage6_L2"
      param {
        lr_mult: 4.0
        decay_mult: 1
      }
      param {
        lr_mult: 8.0
        decay_mult: 0
      }
      convolution_param {
        num_output: 19
        pad: 0
        kernel_size: 1
        weight_filler {
          type: "gaussian"
          std: 0.01
        }
        bias_filler {
          type: "constant"
        }
      }
    }
    layer {
      name: "concat_stage7"
      type: "Concat"
      bottom: "Mconv7_stage6_L2"
      bottom: "Mconv7_stage6_L1"
      # top: "concat_stage7"
      top: "net_output"
      concat_param {
        axis: 1
      }
    }

    下载模型权重

    步骤一:

    我们正在使用在Caffe深度学习框架上训练的模型。Caffe模型具有2个文件–

    1. .prototxt文件,指定了神经网络的体系结构–不同层的排列方式等。
    2. .caffemodel文件,用于存储训练后的模型的权重

    我们将使用这两个文件将网络加载到内存中。

    protoFile = "model/pose_deploy_linevec.prototxt"
    weightsFile = "model/pose_iter_440000.caffemodel"
    net = cv2.dnn.readNetFromCaffe(protoFile, weightsFile)

    步骤二:

    读取图像并准备输入网络

    我们使用OpenCV读取的输入帧应转换为输入Blob(例如Caffe),以便可以将其输入到网络。这是使用blobFromImage函数完成的,该函数将图像从OpenCV格式转换为Caffe blob格式。这些参数将在blobFromImage函数中提供。首先,我们将像素值标准化为(0,1)。然后,我们指定图像的尺寸。接下来,要减去的平均值为(0,0,0)。由于OpenCV和Caffe都使用BGR格式,因此无需交换R和B通道。

    net = cv2.dnn.readNetFromCaffe(protoFile, weightsFile) # 读取caffe模型
    inWidth = 368
    inHeight = 368
    inpBlob = cv2.dnn.blobFromImage(frame, 1.0 / 255, (inWidth, inHeight),
                                    (0, 0, 0), swapRB=False, crop=False) #将输入图片转成相应模型识别的blob数据
    net.setInput(inpBlob) # 放进网络

    步骤三:

    进行预测并解析关键点

    一旦将图像传递到模型,就可以使用单行代码进行预测。OpenCV中DNN类的正向方法通过网络进行正向传递,这只是说它正在做出预测的另一种方式。

    output = net.forward() # 向前传播,进行预测

    输出为4D矩阵:

    1. 第一维是图像ID(如果您将多个图像传递到网络)。
    2. 第二个维度指示关键点的索引。该模型将生成所有连接在一起的置信度图和零件亲和度图。对于COCO模型,它由57个部分组成– 18个关键点置信度图+ 1个背景+ 19 * 2个部分亲和度图。同样,对于MPI,它会产生44点。我们将仅使用与关键点相对应的前几个点。
    3. 第三维是输出图的高度。
    4. 第四个维度是输出图的宽度。

    我们检查图像中是否存在每个关键点。我们通过找到关键点的置信度图的最大值来获得关键点的位置。我们还使用阈值来减少错误检测。

    H = out.shape[2]
    W = out.shape[3]
    # Empty list to store the detected keypoints
    points = []
    for i in range(len()):
        # confidence map of corresponding body's part.
        probMap = output[0, i, :, :]
     
        # Find global maxima of the probMap.
        minVal, prob, minLoc, point = cv2.minMaxLoc(probMap)
     
        # Scale the point to fit on the original image
        x = (frameWidth * point[0]) / W
        y = (frameHeight * point[1]) / H
     
        if prob > threshold :
            cv2.circle(frame, (int(x), int(y)), 15, (0, 255, 255), thickness=-1, lineType=cv.FILLED)
            cv2.putText(frame, "{}".format(i), (int(x), int(y)), cv2.FONT_HERSHEY_SIMPLEX, 1.4, (0, 0, 255), 3, lineType=cv2.LINE_AA)
     
            # Add the point to the list if the probability is greater than the threshold
            points.append((int(x), int(y)))
        else :
            points.append(None)
     
    cv2.imshow("Output-Keypoints",frame)
    cv2.waitKey(0)
    cv2.destroyAllWindows()

    由于我们事先知道了点的索引,因此只要有关键点,我们就可以通过仅加入对来绘制骨架。这是使用下面给出的代码完成的。

    for pair in POSE_PAIRS:
        partA = pair[0]
        partB = pair[1]
     
        if points[partA] and points[partB]:
            cv2.line(frameCopy, points[partA], points[partB], (0, 255, 0), 3)

    完整代码:

    import cv2
    import time
    import numpy as np
    
    MODE = "COCO"
    
    if MODE is "COCO":
        protoFile = "model/pose_deploy_linevec.prototxt"
        weightsFile = "model/pose_iter_440000.caffemodel"
        nPoints = 18
        POSE_PAIRS = [[1, 0], [1, 2], [1, 5], [2, 3], [3, 4], [5, 6], [6, 7], [1, 8], [8, 9], [9, 10], [1, 11], [11, 12],
                      [12, 13], [0, 14], [0, 15], [14, 16], [15, 17]]
    
    frame = cv2.imread("image.jpg")
    frameCopy = np.copy(frame)
    frameWidth = frame.shape[1]
    frameHeight = frame.shape[0]
    threshold = 0.1
    
    net = cv2.dnn.readNetFromCaffe(protoFile, weightsFile) # 读取caffe模型
    
    t = time.time()
    inWidth = 368
    inHeight = 368
    inpBlob = cv2.dnn.blobFromImage(frame, 1.0 / 255, (inWidth, inHeight),
                                    (0, 0, 0), swapRB=False, crop=False) #将输入图片转成相应模型识别的blob数据
    
    net.setInput(inpBlob) # 放进网络
    
    output = net.forward() # 向前传播,进行预测
    print("time taken by network : {:.3f}".format(time.time() - t))
    # print(output.shape, output)
    #输出4D举证:
    # 第一维是图像ID(如果您将多个图像传递到网络)。
    # 第二个维度指示关键点的索引。该模型将生成所有连接在一起的置信度图和零件亲和度图。对于COCO模型,它由57个部分组成– 18个关键点置信度图+ 1个背景+ 19 * 2个部分亲和度图。同样,对于MPI,它会产生44点。我们将仅使用与关键点相对应的前几个点。
    # 第三维是输出图的高度。
    # 第四个维度是输出图的宽度。
    H = output.shape[2] # 输出的图像的高度
    W = output.shape[3] # 输出图像的宽度
    
    # Empty list to store the detected keypoints
    points = []
    
    for i in range(nPoints):
        # confidence map of corresponding body's part.
        probMap = output[0, i, :, :] # 获取关键点
    
        # Find global maxima of the probMap.
        minVal, prob, minLoc, point = cv2.minMaxLoc(probMap) # 通过minMaxLoc得出该矩阵中的最小值、最大值、最小值索引,最大值索引
        print(minVal, prob, minLoc, point)
    
        # Scale the point to fit on the original image将输出图像中的关键点映射到原始图片上
        x = (frameWidth / W) * point[0]
        y = (frameHeight / H) * point[1]
    
        if prob > threshold:
            cv2.circle(frameCopy, (int(x), int(y)), 4, (0, 255, 255), thickness=-1, lineType=cv2.FILLED)
            cv2.putText(frameCopy, "{}".format(i), (int(x), int(y)), cv2.FONT_HERSHEY_SIMPLEX, 0.3, (0, 0, 255),
                        lineType=cv2.LINE_AA)
    
            # Add the point to the list if the probability is greater than the threshold
            points.append((int(x), int(y)))
        else:
            points.append(None)
    
    # Draw Skeleton
    for pair in POSE_PAIRS:
        partA = pair[0]
        partB = pair[1]
    
        if points[partA] and points[partB]:
            cv2.line(frame, points[partA], points[partB], (0, 255, 255), 2)
            cv2.circle(frame, points[partA], 8, (0, 0, 255), thickness=-1, lineType=cv2.FILLED)
    
    cv2.imshow('Output-Keypoints', frameCopy)
    cv2.imshow('Output-Skeleton', frame)
    
    print("Total time taken : {:.3f}".format(time.time() - t))
    
    cv2.waitKey(0)
  • 相关阅读:
    Winget
    全部所学知识
    重装系统
    srs更改端口号导致webrtc播放异常
    .NET性能优化方面的总结(转)
    从自动变换页面背景CSS改写成变换背景图
    网页级在线性能网站测试介绍
    ASP.NET服务器端控件学习(一)
    Nginx源码分析内存池
    使用Memcached提高.NET应用程序的性能
  • 原文地址:https://www.cnblogs.com/answerThe/p/12012276.html
Copyright © 2011-2022 走看看