DragGAN在Windows11中下载安装

  • DragGAN是一种颠覆性的新型图像生成和编辑技术,它实现了前所未有的用户对图像创作过程的控制能力。
  • 使用DragGAN,用户可以用鼠标拖放的方式在空白画布上概括构思图像,系统会自动生成图像细节。例如,用户可以拖拽画一个矩形作为“汽车”,拖拽一个圆作为“轮胎”,DragGAN会补全逼真的汽车图像细节。
  • DragGAN系统由生成对抗网络(GAN)提供技术支持,可以学习正确渲染各类对象及场景的细节。用户拖放的组成部分及布局会作为条件输入,指导GAN生成符合构思的图像。
  • 相比传统编辑工具,DragGAN使任何人都可以直接进行图像创作,避免了置入对象及精确调整所需的大量专业技能。相比纯生成式GAN,DragGAN给用户提供了前所未有的创作控制力。
  • DragGAN开创了“拖放式图像创作”这一全新范式,有潜力降低图像内容产出的门槛,探索了人机合作的新方向。它或将推动计算机图形学、艺术创作等领域的进一步发展。

下载

环境

需要用到pythonconda等工具。
python不用说了,这里conda可以到这里https://docs.conda.io/en/latest/miniconda.html只下载mini版,放弃官方Anaconda预打包的上百个科学计算工具包。

也可以到此处下载:20230712简化版conda(Miniconda3-latest-Windows-x86-64)

在这里插入图片描述
使用说明:https://conda.io/projects/conda/en/latest/user-guide/getting-started.html

打开终端执行初始化命令,这样以后在cmd中就能直接调用conda命令了

conda init

在这里插入图片描述

主程序

官方网站下载:https://github.com/XingangPan/DragGAN

在这里插入图片描述
找个目录解压缩。

模型文件

打开\scripts\download_models.json,找一个模型用迅雷等工具下载。
比如https://storage.googleapis.com/self-distilled-stylegan/dogs_1024_pytorch.pkl

{
    
    
  "https://storage.googleapis.com/self-distilled-stylegan/lions_512_pytorch.pkl": "stylegan2_lions_512_pytorch.pkl",
  "https://storage.googleapis.com/self-distilled-stylegan/dogs_1024_pytorch.pkl": "stylegan2_dogs_1024_pytorch.pkl",
  "https://storage.googleapis.com/self-distilled-stylegan/horses_256_pytorch.pkl": "stylegan2_horses_256_pytorch.pkl",
  "https://storage.googleapis.com/self-distilled-stylegan/elephants_512_pytorch.pkl": "stylegan2_elephants_512_pytorch.pkl",
  "https://api.ngc.nvidia.com/v2/models/nvidia/research/stylegan2/versions/1/files/stylegan2-ffhq-512x512.pkl": "stylegan2-ffhq-512x512.pkl",
  "https://api.ngc.nvidia.com/v2/models/nvidia/research/stylegan2/versions/1/files/stylegan2-afhqcat-512x512.pkl": "stylegan2-afhqcat-512x512.pkl",
  "http://d36zk2xti64re0.cloudfront.net/stylegan2/networks/stylegan2-car-config-f.pkl": "stylegan2-car-config-f.pkl",
  "http://d36zk2xti64re0.cloudfront.net/stylegan2/networks/stylegan2-cat-config-f.pkl": "stylegan2-cat-config-f.pkl"
}

创建目录checkpoints,将下载的模型放入其中并更名,在其前加上stylegan2_,比如stylegan2_lions_512_pytorch.pkl

在这里插入图片描述

安装

python

创建独立的Python环境,python后面可加上版本号

conda create -n draggan python
conda create -n draggan python=3.10.6

在这里插入图片描述
创建成功之后,激活虚拟环境:

conda activate draggan

在这里插入图片描述

安装依赖

pip install -r requirements.txt

在这里插入图片描述

执行

出错闪退

使用以下方式,会闪现后退出

python visualizer_drag.py checkpoints/stylegan2_lions_512_pytorch.pkl

在这里插入图片描述
在这里插入图片描述

正常执行

用这个命令可以正常执行

python visualizer_drag_gradio.py

在这里插入图片描述
在浏览器里输入:http://127.0.0.1:7860/ 打开页面,左上角可选择模型。

在这里插入图片描述

操作

在这里插入图片描述
在这里插入图片描述
在这里插入图片描述

参考:
DragGAN:简介,安装,使用!
Anaconda官网
Conda使用指南

猜你喜欢

转载自blog.csdn.net/snans/article/details/131678824