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)

 


免責聲明!

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



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