【openMMLab实战营】2.openMMLab环境配置和MMPose学习
windows环境配置
以管理者身份打开powershell,需要将策略Restricted转换为RemoteSigned,输入:
Set-ExecutionPolicy RemoteSigned
创建conda新环境
conda create -n openMMLab python=3.9
下载换源
conda换源 参考:https://mmsig.openmmlab.com/
conda config --add channels defaults
conda config --set show_channel_urls true
# 设置默认channels
conda config --add default_channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main
conda config --add default_channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/r
conda config --add default_channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/msys2
# 设置 custom channels
conda config --set custom_channels.conda-forge https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud
conda config --set custom_channels.msys2 https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud
conda config --set custom_channels.bioconda https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud
conda config --set custom_channels.menpo https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud
conda config --set custom_channels.pytorch https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud
conda config --set custom_channels.pytorch-lts https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud
conda config --set custom_channels.simpleitk https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud
git换源
pip config set global.index-url https://pypi.tuna.tsinghua.edu.cn/simple
下载安装库
安装深度学习框架pytorch,视觉库torchvision,pytorch下载2.0以上;其他的库到需要时再下;
conda install pytorch torchvision torchaudio cpuonly -c pytorch
pip install openmim /*mim 下载*/
mim install "mmcv>=2.0.0" /*mmcv库*/
mim install "mmdet>=3.0.0rc6"
conda install pycocotools -c conda-forge /*coco数据集*/
pip install opencv-python pillow matplotlib seaborn tqdm
MMPose内容学习
人体姿态概述
从给定的图像中识别人脸、手部、身体等关键点
- 人体68关键点
- 手势21关键点
- 人体18关键点
PoseC3D:基于人体姿态识别行为动作
CG 动画
人机交互
动物行为分析
2D姿态估计
基于回归
将关键点检测问题建模成一个回归问题,模型回归关键点坐标;精度不是最优;
分类网络+回归头
DeepPose级联
- 以全身图像为输入,预测所有关键点坐标
- 以预测点为中心,裁剪局部图像送入第二级网络;再次回归坐标点
RLE
- 标准化流估计关键点位置的概率分布
基于热力图
预测关键点位于每个位置的概率;
热力图可以基于原始关键点坐标生成,作为训练网络的监督信息;
可以通过求极大值的方法;
简单;模型精度更高;计算消耗大;
数据标注生成热力图
$H_j(x,y)=exp(-\frac{(x-x_j)^2 +(y-y_j)^2}{\theta^2} $
逐点对比计算损失,二范数或者一范式
- 从热力图还原关键点,argmax
- 求期望,概率 e x p ( H i ) ∑ e x p ( H i ) \frac{exp(H_i)}{\sum{exp(H_i)}} ∑exp(Hi)exp(Hi),优点:可微分,连续,没有量化误差
自顶向下方法
一阶段:目标检测
二阶段:基于单人图像估计每个人的姿态
自底向上方法
基本思路:基于图像同时预测关节位置和四肢走向,利用肢体走向辅助关键点的聚类;
一阶段:关键点模型检测出所有点;
二阶段:基于位置关系将关键点组合成不同的人,关键点聚类;
亲和度:
- K部图最优匹配问题:利用亲和度构成带权重的K部图关键点聚类
- 将K部图匹配分解为K-1个独立的二部图匹配问题,再借助匈牙利算法求解;
单阶段方法
SPM
SPR:structured pose representation
Hierarchical SPR
- 中心
- 颈部 肩部 臀
- 头 肘 膝
- 手腕 脚踝
骨干网络:级联的Hourglass
置信回归分支回归根关节的热力图;
位移回归分支预估身体关节位移图;
基于transformer方法
PRTR二阶段
- 人体检测DETR
- 关键点检测DETR
PRTR单阶段
- Spatial Transformer Network模块
TokenPose
3D姿态估计
获得相对的三维空间坐标
相对坐标:相对于盆骨
直接预测
视频
评估指标
- 肢体检出率
- 关键点的位置精度:PDJ
- 关键点相似度
DensePose
人体表面分为24个部分
标注各身体部分区域后,等距采样<14个点
Mask_RCNN+DenseReg = DensePose-RCNN
产生更密集的监督信号
身体表面网络:混合磨皮技术(blend skinning)
LBS 线性混合磨皮
DQBS
人体参数化模型
SMPL:6890个顶点,23个关节点的身体表面网格
形态参数 10维,姿态参数
θ
=
23
∗
3
+
1
∗
3
\theta=23*3+1*3
θ=23∗3+1∗3
分开训练