---
title: cv_hrnet_image-human-reconstruction
canonical_url: "https://www.modelscope.cn/models/damo/cv_hrnet_image-human-reconstruction"
md_url: "https://www.modelscope.cn/models/damo/cv_hrnet_image-human-reconstruction.md"
repository: damo/cv_hrnet_image-human-reconstruction
chinese_name: "单图人体重建模型"
last_updated: 2024-01-24
license: "Apache License 2.0"
pipeline_tag: human-reconstruction
tasks:
  - human-reconstruction
model_type:
  - human-reconstruction
library_name:
  - pytorch
frameworks:
  - pytorch
domain:
  - cv
downloads: 2090
stars: 67
tags:
  - 3D
  - "3D reconstruction"
  - "human reconstruction"
  - "人体"
  - "重建"
  - "人像"
  - "三维"
  - "单图重建"
  - avatar
  - "人体重建"
---

# cv_hrnet_image-human-reconstruction

> cv_hrnet_image-human-reconstruction - damo 在 ModelScope 开源的模型。输入一张单人图像，生成对应人像的3Dmesh并返回对应信息。

damo/cv_hrnet_image-human-reconstruction 是 ModelScope 魔搭社区上的human-reconstruction模型，采用 Apache License 2.0 许可。

- **Repository**: damo/cv_hrnet_image-human-reconstruction
- **License**: Apache License 2.0
- **Tasks**: human-reconstruction
- **Tags**: 3D, 3D reconstruction, human reconstruction, 人体, 重建, 人像, 三维, 单图重建, avatar, 人体重建
- **Downloads**: 2090
- **Stars**: 67
- **Last updated**: 2024-01-24

Source: https://www.modelscope.cn/models/damo/cv_hrnet_image-human-reconstruction

---

# 基于像素映射的单图人体重建模型

单图人体重建模型使用单张全身人像作为输入，使用生成式模型辅助进行结构恢复与纹理恢复，输出3D人体重建mesh。

纹理渲染效果展示：

<div align=center>
<img src="results/test_1.jpg" height="300px">  <img src="results/test_1.gif" height="300px">  <img src="results/test_2.jpg" height="300px">  <img src="results/test_2.gif" height="300px">
</div>

生成白模效果展示：
<div align=center>
<img src="results/test_bai.jpg" height="300px"> <img src="results/test_bai_1.png" height="300px"> <img src="results/test_bai_2.png" height="300px"> <img src="results/test_woman.jpg" height="300px">        <img src="results/test_woman_1.png" height="300px">  <img src="results/test_woman_2.png" height="300px">
</div>

## 模型描述

改人体重建模型以PIFU原理为基础，进行了以下改进：
- 借助生成式模型辅助产生结构信息，生成细节法向图；
- 在backbone引入多层注意力模块，使图像细节特征可以保留至模型最后，提升重建精度；
- 借助像素映射在多层中提取3D特征并进行整合，提高纹理重建精度；
- 引入相机光照损失和人体pose损失，减少因拍摄引起的畸变；

## 期望模型使用方式以及适用范围

适用方式：
- 可直接使用pipeline进行推理，算法最终会生成一个obj文件并返回相应顶点、面片及纹理信息；

适用范围：
- 包含全身人像的图像，其中人体部分清晰可见且分辨率在500x500以上，整体分辨率小于5000x5000；

### 如何使用

本模型基于pytorch进行训练和推理，安装基础的modelscope环境，提供相应输入图像，即可调用pipeline来重建人体；

#### 环境准备
##### python3.8
```shell
pip install  'numpy<=1.22.0' 'pandas<1.4.0' 
```
##### python3.10
```shell
pip install -U 'numpy<1.24.0' 'pandas<1.4.0' 
```
#### 代码范例

建议在gpu环境进行试用、测试
```python
from modelscope.outputs import OutputKeys
from modelscope.pipelines import pipeline
from modelscope.utils.constant import Tasks

human_reconstruction = pipeline(Tasks.human_reconstruction,model='damo/cv_hrnet_image-human-reconstruction')
result = human_reconstruction('https://modelscope.oss-cn-beijing.aliyuncs.com/test/images/human_reconstruction.jpg')
mesh = result[OutputKeys.OUTPUT]
```

本地运行后，运行目录会产生名为human_color.obj的重建mesh文件，可使用meshlab等3d相关软件打开查看，mesh包含顶点、面片、顶点色信息。

### 模型局限性以及可能的偏差
- 在图像人体模糊、分辨率小的图像上不能正确重建；
- 对于人体存在遮挡的情况，重建效果会有缺失；
- 建议使用A-pose站立在地面的照片进行重建，复杂的pose以及太复杂的衣物重建效果欠佳。
