类似于 论文实践学习 - Stacked Hourglass Networks for Human Pose Estimation ,基于Docker-Torch,估计人体关节点.
这里只简单进行测试估计结果,由于显存有限,未能加入所有的 scale_search.
1. 图片人体姿态估计 - demo.lua
# 输入参数由两个, 第二个参数默认为 'mean'
th demo.lua imglist.txt 'max'
# or
th demo.lua imglist.txt
require 'paths'
paths.dofile('util.lua')
paths.dofile('img.lua')
--------------------------------------------------------------------------------
-- Initialization
--------------------------------------------------------------------------------
a = loadImageNames(arg[1]) -- 批量读取文件名列表
m = torch.load( '../checkpoints/mpii/crf_parts/model.t7') -- Load pre-trained model
m:cuda()
m:evaluate()
-- Parameters
local isflip = true
local minusmean = tru
local scale_search = {
1.0, 1.1} -- 根据显存情况来选择
-- local scale_search = {0.7,0.8,0.9,1.0,1.1,1.2} -- used in paper with NVIDIA Titan X (12 GB memory).
-- Displays a convenient progress bar
idxs = torch.range(1, a.nsamples)
nsamples = idxs:nElement()
xlua.progress(0,nsamples)
preds = torch.Tensor(nsamples,16,3)
imgs = torch.Tensor(nsamples,3,256,256)
local imgpath = '../data/image/'
--------------------------------------------------------------------------------
-- Main loop
--------------------------------------------------------------------------------
for idx = 1,nsamples