DragGAN
DragGAN 模型,是一种革命性交互式图像操作方式,允许用户将图像中的任意点“拖动”到目标位置,以精确控制姿势、形状、表情和布局。
论文
Drag Your GAN: Interactive Point-based Manipulation on the Generative Image Manifold
- https://arxiv.org/abs/2305.10973
- SIGGRAPH 2023
模型结构
DragGAN是一种用于 GAN 的交互式图像处理方法。主要是基于 StyleGAN 模型架构:
StyleGan
算法原理
对于给定的图像,只需要设置几个处理点(红点)、目标点(蓝点),以及可选的表示编辑过程中可移动区域(较亮区域)的掩码。我们的方法迭代地执行运动监督和点跟踪。运动监控步骤驱动手柄点(红点)朝向目标点(蓝点)移动,点跟踪步骤更新手柄点以跟踪图像中的对象。此过程将继续,直到控制点达到其相应的目标点。
DragGAN
环境配置
mv draggan_pytoch draggan # 去框架名后缀
# docker的-v 路径、docker_name和imageID根据实际情况修改
Docker(方法一)
docker pull image.sourcefind.cn:5000/dcu/admin/base/pytorch:2.1.0-ubuntu20.04-dtk24.04.2-py3.10 # 本镜像imageID为:2f1f619d0182
docker run -it -v /path/your_code_data/:/path/your_code_data/ -v /opt/hyhal/:/opt/hyhal/:ro --shm-size=16G --privileged=true --device=/dev/kfd --device=/dev/dri/ --group-add video --network=host --name docker_name imageID bash
cd /your_code_path/draggan
pip install -r requirements.txt
Dockerfile(方法二)
cd /your_code_path/draggan/docker
docker build --no-cache -t codestral:latest .
docker run -it -v /path/your_code_data/:/path/your_code_data/ -v /opt/hyhal/:/opt/hyhal/:ro --shm-size=16G --privileged=true --device=/dev/kfd --device=/dev/dri/ --group-add video --network=host --name docker_name imageID bash
cd /your_code_path/draggan
pip install -r requirements.txt
Anaconda(方法三)
关于本项目DCU显卡所需的特殊深度学习库可从光合开发者社区下载安装。
DTK驱动: dtk24.04.2
python: python3.10
pytorch: 2.1.0
Tips:以上DTK驱动、python、pytorch等DCU相关工具版本需要严格一一对应
其它非深度学习库参照requirements.txt安装:
pip install -r requirements.txt
数据集
无
训练
无
推理
下载模型权重:
python scripts/download_model.py
或者从 SCNet 上快速下载,并放在 /checkpoints 文件夹下。
可视化webui推理:
python visualizer_drag_gradio.py --listen
result
webui界面
输入
输出
精度
无
应用场景
算法类别
AIGC
热点应用行业
零售,制造,电商,医疗,教育