---
title: cv_HRN_text-to-head
canonical_url: "https://www.modelscope.cn/models/iic/cv_HRN_text-to-head"
md_url: "https://www.modelscope.cn/models/iic/cv_HRN_text-to-head.md"
repository: iic/cv_HRN_text-to-head
chinese_name: "文本生成3D头部模型"
last_updated: 2025-08-13
license: "Apache License 2.0"
model_type:
  - "text to head"
library_name:
  - pytorch
frameworks:
  - pytorch
language:
  - ch
domain:
  - cv
downloads: 1430
stars: 29
tags:
  - AIGC
  - text-to-3d
  - text-to-head
  - "文生3D模型"
  - "文生头部"
  - Alibaba
  - avatar
  - "人脸重建"
  - "三维重建"
---

# cv_HRN_text-to-head

> cv_HRN_text-to-head - iic 在 ModelScope 开源的模型。基于HRN的text-to-3D head模型，结合了文生图stable diffusion模型和头部重建模型HRN ，以文本为输入，可生成高质量3D头部。

iic/cv_HRN_text-to-head 是 ModelScope 魔搭社区上的机器学习模型，采用 Apache License 2.0 许可。

- **Repository**: iic/cv_HRN_text-to-head
- **License**: Apache License 2.0
- **Tags**: AIGC, text-to-3d, text-to-head, 文生3D模型, 文生头部, Alibaba, avatar, 人脸重建, 三维重建
- **Downloads**: 1430
- **Stars**: 29
- **Last updated**: 2025-08-13

Source: https://www.modelscope.cn/models/iic/cv_HRN_text-to-head

---

# 基于HRN的text-to-3D head模型

基于HRN的text-to-3D head模型，结合了文生图stable diffusion模型和[头部重建模型HRN](https://www.modelscope.cn/models/damo/cv_HRN_head-reconstruction/summary) ，以文本为输入，可生成高质量3D头部。

prompt: a clown with red nose.

![Output1](results/clown.gif)

prompt: a girl with freckles and blue eyes.

![Output2](results/girl.gif)

## 三维视觉系列模型

| [<img src="results/example_face_reconstruction.jpg" height="200px">](https://www.modelscope.cn/models/damo/cv_resnet50_face-reconstruction/summary) | [<img src="results/example_head_reconstruction.jpg" height="200px">](https://www.modelscope.cn/models/damo/cv_HRN_head-reconstruction/summary) |
|:--:|:--:| 
| [HRN人脸重建](https://www.modelscope.cn/models/damo/cv_resnet50_face-reconstruction/summary) | [HRN头部重建](https://www.modelscope.cn/models/damo/cv_HRN_head-reconstruction/summary) |

## 模型描述

该text-to-head模型包含了text-to-image以及head reconstruction两个部分，首先利用sd+controlnet进行文本引导的、姿态可控的人脸图像生成，而后利用HRN算法重建出3D头部，从而实现文生3D头部的功能。

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

使用方式：
- 输入文本描述（目前仅支持英文），返回对应符合文本描述的3D模型（.obj文件+纹理贴图）。

模型参数：
- hair_tex: pipeline参数，可在configuration.json中修改，或者在pipeline初始化中传入，如： 
    ```python
    pipeline(Tasks.text_to_head, model='damo/cv_HRN_text-to-head', model_revision='master', hair_tex=True))
    ```
    当hair_tex为True时（默认），将输出带头发的纹理，如以上第一个示例。  

    当hair_tex为False时，将输出光头的纹理，如以上第二个示例.


使用范围:
- 请输入人物描述词，当输入描述词与人无关时，可能会失败。
- 由于HRN是基于真实人脸的重建模型，所以当目标与真实人头越相近时，效果越好。

目标场景:
- 影视、娱乐等。

### 如何使用

本模型基于pytorch进行训练和推理，在ModelScope框架上，提供输入描述词，即可以通过简单的Pipeline调用来使用text-to-head模型。

#### 代码范例
```python
import os
import cv2
from modelscope.models.cv.face_reconstruction.utils import write_obj
from modelscope.outputs import OutputKeys
from modelscope.pipelines import pipeline
from modelscope.utils.constant import Tasks


def save_results(result, save_root):
    os.makedirs(save_root, exist_ok=True)

    # export obj and texture
    mesh = result[OutputKeys.OUTPUT]['mesh']
    texture_map = result[OutputKeys.OUTPUT_IMG]
    mesh['texture_map'] = texture_map
    write_obj(os.path.join(save_root, 'text_to_head_result.obj'), mesh)

    print(f'Output written to {os.path.abspath(save_root)}')

text_to_head = pipeline(Tasks.text_to_head, model='damo/cv_HRN_text-to-head', model_revision='master')
result = text_to_head('a clown with red nose')

save_results(result, './text_to_head_results')
```

如果遇到报错类似于：
```text
No module named 'transformers.models.qwen3'
```
请考虑卸载awq:
```shell
pip uninstall autoawq
```

### 预处理
- 对输入的prompt进行优化，加入后缀描述词，反向描述词等。

### 后处理
- 将顶点坐标、三角面片、贴图等数据转化为obj等模型文件。

## 引用
如果你觉得这个该模型对有所帮助，请考虑引用下面的相关的论文：

```BibTeX
@inproceedings{lei2023hierarchical,
  title={A Hierarchical Representation Network for Accurate and Detailed Face Reconstruction from In-The-Wild Images},
  author={Lei, Biwen and Ren, Jianqiang and Feng, Mengyang and Cui, Miaomiao and Xie, Xuansong},
  booktitle={Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition},
  pages={394--403},
  year={2023}
}
```
