人工智能绘画尝试
admin
2023-09-06 07:41:13
0

hahakity @ 华中师范大学

下载了最近流行的 Stable Diffusion 文字到图片生成程序,玩疯了。感觉人工智能有无穷无尽的灵感,改变关键词、艺术风格、随机数,可在短时间内创作出大量看上去还不错的艺术画作。

从现在开始,使用文字关键词生成图片,再根据具象化的图片启发灵感,续写文字故事的新创作模式可能会出现,人类的幻想类型( fiction )文化可能会在 AI 的启发下达到新高度、新速度。

下面是使用 Stable diffusion 产生的一系列图片。想要英文关键词的可以在文章的后面寻找。




Beksinski



Chinese ink painting



Wassily Kandinsky



Wassily Kandinsky



Wassily Kandinsky



Wassily Kandinsky



Wassily Kandinsky



Peter Gric



Peter Gric or Sandra Chevrier



Peter Gric or Sandra Chevrier



William-Adolphe Bouguereau

使用心得

提示语要以:艺术品种类 + 主体 + 画家 + 清晰度 + 艺术风格 + 对比度 的形式

比如:A digital illustration of a carton beauty [/with China opera mask by Serge Marshennikov], 4k, detailed, trending in artstation, fantasy vivid colors

艺术品种类:

  1. a digital illustration
  2. an oil painting
  3. a matte painting
  4. 3d render
  5. medieval map

画家:

康定斯基 (Wassily Kandinsky),Serge Marshennikov , Beksinski 等

更详细的列表可以从这个网页上找到:CLIP Artists (backblazeb2.com)

清晰度:4k 或 8k

加细节: detailed

颜色鲜明:vivid colors

生成的图片中间歇性的出现一个男人,跟输入的关键词没有任何关系。这是因为 txt2img.py 脚本中存在安全检查函数 check_safety(),会判断生成的图片中是否有 nsfw (not safe for work) 内容,如果有,就用这张照片替换掉。

高级技巧:使用两个画家的风格分别画图中的背景和前景。下面这个 prompt 好像可以做到这点。如果只用一个画家,画不出小红帽的脸。

python scripts/txt2img.py --prompt "A matte painting of a pretty Little Red Riding Hood [\with clean eyes by William-Adolphe Bouguereau], [\with dark forest by Peter Gric together], 8k, detailed, trending in artstation, fantasy vivid colors" --plms --ddim_steps 100 --H 512 --W 256 --seed 43

img2img.py 使用技巧

在 scripts 目录还有另外一个脚本,img2img.py, 可以使用初始化照片。

!python scripts/img2img.py --prompt "by Wassily Kandinsky, 8k, detailed, trending in artstation, fantasy vivid colors" --init-img "my_img.png" --ddim_steps 100 --strength 0.70 --n_iter 10 --seed 42

下载安装:

  1. 从 github (GitHub - CompVis/stable-diffusion: A latent text-to-image diffusion model) 下载 stable diffusion model
  2. 从上面这个链接里描述的 hugingface 下载预训练参数,需要在 hugingface 注册用户名,密码,下载参数时要用。

安装时 taming-transformer 模块有问题,额外下载了这个包,将里面的 taming 文件夹复制到 stable diffusion 主文件夹才成功。

安装后运行时总显示 GPU 显存不够,想把它改成 CPU 版本,试了几次都出错。只好调小生成图片的大小,使用 --H 512 --W 256 参数将生成图片改成 512 像素高,256 像素宽。

看到除了源代码安装的方式之外,还有直接下载安装 diffuser 这个 python 包,能够设置 pipe("cpu")。我的电脑内存有 64 G,应该妥妥够用。但因为它是直接安装,看不到源代码,所以暂时作罢。

Prompts

python scripts/txt2img.py --prompt "Asia girl, glossy eyes, face, long hair, fantasy, elegant, highly detailed, digital painting, artstation, concept art, smooth, illustration, renaissance, flowy, melting, round moons, rich clouds, very detailed, volumetric light, mist, fine art, textured oil over canvas, epic fantasy art, very colorful, ornate intricate scales, fractal gems, 8 k, hyper realistic, high contrast" --plms --ddim_steps 100 --H 512 --W 256

python scripts/txt2img.py --prompt "A digital illustration of a Chinese witch reading magical book, vivid colors, 4k, fantasy [,/organic] " --plms --ddim_steps 100 --H 512 --W 256

python scripts/txt2img.py --prompt "A digital illustration of a beauty with China opera mask, vivid colors, 4k, fantasy [,/organic] " --plms --ddim_steps 100 --H 512 --W 256 --seed 42

python scripts/txt2img.py --prompt "A beauty with China opera mask, vivid colors, 4k, oil painting, Johannes Vermeer" --plms --ddim_steps 100 --H 512 --W 256 --seed 42

加了《戴珍珠耳环的少女》画家的名字,画出的画就会自带画框

python scripts/txt2img.py --prompt "A digital illustration of a carton beauty [/with China opera mask by Serge Marshennikov], 4k, detailed, trending in artstation, fantasy vivid colors " --plms --ddim_steps 100 --H 512 --W 256 --seed 42

python scripts/txt2img.py --prompt "A digital illustration [a beauty riding a phenix, by Wassily Kandinsky], 4k, detailed, trending in artstation, fantasy vivid colors " --plms --ddim_steps 100 --H 512 --W 256 --seed 43

python scripts/txt2img.py --prompt "An matte painting of a beauty on a phenix, Maxx Burman, 4k, detailed, trending in artstation, fantasy vivid colors" --plms --ddim_steps 100 --H 512 --W 256 --seed 43

python scripts/txt2img.py --prompt "A digital illustration of artificial neural network, by Wassily Kandinsky, 4k, detailed, trending in artstation, fantasy" --plms --ddim_steps 100 --H 512 --W 256 --seed 43

python scripts/txt2img.py --prompt "A digital illustration of [a Mach cone formed by a jet in lava, by Wassily Kandinsky], 4k, detailed, trending in artstation, fantasy" --plms --ddim_steps 100 --H 512 --W 256 --seed 43

python scripts/txt2img.py --prompt "A digital illustration of a cute and adorable Chinese girl, by Sandra Chevrier, 4k, detailed, trending in artstation, fantasy vivid colors" --plms --ddim_steps 100 --H 512 --W 256 --seed 43

python scripts/txt2img.py --prompt "A digital illustration of a pretty witch, by Peter Gric], 4k, detailed, trending in artstation, fantasy vivid colors" --plms --ddim_steps 100 --H 512 --W 256 --seed 43

python scripts/txt2img.py --prompt "A digital illustration of a pretty witch,lay in lava, red hair, by Peter Gric], 4k, detailed, trending in artstation, fantasy vivid colors" --plms --ddim_steps 100 --H 512 --W 256 --seed 43

python scripts/txt2img.py --prompt "A digital illustration of a beauty, shinning eyes, by William-Adolphe Bouguereau, 4k, detailed, trending in artstation, fantasy vivid colors" --plms --ddim_steps 100 --H 512 --W 256 --seed 43 --n_iter 20

简短但是非常强大的 prompts,出自 stable-diffusion-research/artist_styles.md at main · HarmonicHemispheres/stable-diffusion-research · GitHub

!python scripts/txt2img.py --prompt "path through cavern landscape anton fadeev, 8k, detailed, trending in artstation, fantasy vivid colors" --plms --ddim_steps 100 --H 512 --W 256 --seed 43

prompt: path through cavern landscape Neil Blevins

path through cavern landscape Seb McKinnon

path through cavern landscape Bill Peet

python scripts/txt2img.py --prompt "path through cavern landscape anton fadeev, [\with forest by Peter Gric] 8k, detailed, trending in artstation, fantasy vivid colors" --plms --ddim_steps 100 --H 512 --W 256 --seed 43

windows 下 webui 版本的安装

GitHub - AUTOMATIC1111/stable-diffusion-webui: Stable Diffusion web UI

相关内容