基于keras_Realtime_Multi-Person_Pose_Estimation进行性能分析

keras_Realtime_Multi-Person_Pose_Estimation安装

Realtime_Multi-Person_Pose_Estimation有许多版本,包括keras、tensorflow、pytorch等,几乎涵盖了所有深度学习框架,在这里由于进行性能分析,想用到keras中model.summary()的函数,所以采用了keras版本。
安装过程根据官方安装过程,甚至可以参考原版代码的安装流程,具体自行搜索。

在配置过程中,由于国内网络原因,许多模型无法流畅下载,提供两个caffemodel以及转换成keras格式的model.h5
相应文件格式如下:
/keras_Realtime_Multi-Person_Pose_Estimation/model/caffe/_trained_COCO :pose_iter_440000.caffemodel
/keras_Realtime_Multi-Person_Pose_Estimation/model/caffe/_trained_MPI :pose_iter_146000.caffemodel
/keras_Realtime_Multi-Person_Pose_Estimation/model/keras :model.h5
链接:https://pan.baidu.com/s/1nINVrBmubnqd1ye332YYrA
提取码:kfs0

对Realtime_Multi-Person_Pose_Estimation使用model.summary()

由于主要想看到模型的每一层操作以及相应操作数,采用model.summary()进行,配置完成后,在demo.ipynb中配置代码,定义model后添加,model.summary()

weights_path = "model/keras/model.h5" # orginal weights converted from caffe
#weights_path = "training/weights.best.h5" # weights tarined from scratch 

input_shape = (None,None,3)

img_input = Input(shape=input_shape)

stages = 6
np_branch1 = 38
np_branch2 = 19

img_normalized = Lambda(lambda x: x / 256 - 0.5)(img_input)  # [-0.5, 0.5]

# VGG
stage0_out = vgg_block(img_normalized)

# stage 1
stage1_branch1_out = stage1_block(stage0_out, np_branch1, 1)
stage1_branch2_out = stage1_block(stage0_out, np_branch2, 2)
x = Concatenate()([stage1_branch1_out, stage1_branch2_out, stage0_out])

# stage t >= 2
for sn in range(2, stages + 1):
    stageT_branch1_out = stageT_block(x, np_branch1, sn, 1)
    stageT_branch2_out = stageT_block(x, np_branch2, sn, 2)
    if (sn < stages):
        x = Concatenate()([stageT_branch1_out, stageT_branch2_out, stage0_out])

model = Model(img_input, [stageT_branch1_out, stageT_branch2_out])
model.load_weights(weights_path)

model.summary()

运行后即可输出相应结果。

  • 1
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值