文本生成3D头部模型

我要开发同款
匿名用户2024年07月31日
38阅读
所属分类ai、text to head、pytorch、三维重建、人脸重建、avatar、Alibaba、文生头部、文生3D模型、text-to-head
开源地址https://modelscope.cn/models/iic/cv_HRN_text-to-head
授权协议Apache License 2.0

作品详情

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

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

prompt: a clown with red nose.

Output1

prompt: a girl with freckles and blue eyes.

Output2

三维视觉系列模型

HRN人脸重建 HRN头部重建

模型描述

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

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

使用方式:

  • 输入文本描述(目前仅支持英文),返回对应符合文本描述的3D模型(.obj文件+纹理贴图)。

模型参数:

  • hair_tex: pipeline参数,可在configuration.json中修改,或者在pipeline初始化中传入,如:

    pipeline(Tasks.text_to_head, model='damo/cv_HRN_text-to-head', model_revision='v0.1', hair_tex=True))
    

    当hair_tex为True时(默认),将输出带头发的纹理,如以上第一个示例。

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

使用范围:

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

目标场景:

  • 影视、娱乐等。

如何使用

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

代码范例

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='v0.1')
result = text_to_head('a clown with red nose')

save_results(result, './text_to_head_results')

预处理

  • 对输入的prompt进行优化,加入后缀描述词,反向描述词等。

后处理

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

引用

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

@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}
}
声明:本文仅代表作者观点,不代表本站立场。如果侵犯到您的合法权益,请联系我们删除侵权资源!如果遇到资源链接失效,请您通过评论或工单的方式通知管理员。未经允许,不得转载,本站所有资源文章禁止商业使用运营!
下载安装【程序员客栈】APP
实时对接需求、及时收发消息、丰富的开放项目需求、随时随地查看项目状态

评论