Stable Diffusion QR Code

起源

上个月就有看到用AI生成可扫描的二维码的文章(AI 生成可扫码图像 — 新 ControlNet 模型展示),但是没有说具体的制作细节,当时还在reddit上搜了半天,但是制作出来的效果都差强人意。

昨天看到宝玉转发了一个用 Stable Diffusion 制作可扫描二维码的推特,里面有详细的制作过程,昨晚研究了下,制作出来的二维码感觉还不错。

先看一下上个月微信的那篇公众号里的图吧,确实很不错:

图片

图片

图片

图片

那篇公众号里有好几个图,以上是选取了几个自己觉得很好看的图。

好了说一下具体的制作过程吧

制作过程

首先是显卡,这个东西我当然是没有的,使用的云平台, AutoDL 这家,感觉很便宜了,RTX 3090 也就才不到 2 RMB/h,这里我选的是 Tesla V100-SXM2-32GB 这个GPU。

镜像的话用的是AUTOMATIC1111/stable-diffusion-webui/NovelAI-Consolidation-Package-3.1:v10这个,害其实都是 github 上那个。

image-20230709160408658

安装啥的就不具体说了,网上教程一堆。

使用了一个扩展:QR Toolkit,这个用来生成二维码和其他的一些操作。

image-20230709164551543

这里我直接是用的微信的二维码,最开始我使用纠错码是H,想着这样生成出来的图容错率更高一些,但是二维码的图size直接从29变成37了,之后生成的图效果不是很好,并且不能正确扫描识别。(这里我种子直接写的8086 :sweat_smile:)

对了关于扫描这块,其实我也不是很懂,网上搜了一圈发现,说是iphone的二维码识别是比Android更好的,很多图Android识别不出来,iphone就可以正确识别,这又是另一个话题了,不是很了解,过。

模型使用的是MeinaMix,ControlNetd的模型是 controlnet-qr-pattern-v2

这里有几个Controlnet QR Pattern 的prompt:

cloud, 1girl, sky, water, ocean, cloudy sky, blue eyes, blue sky, halo, window, solo, white hair, horizon, planet, constellation, day
Negative prompt: ng_deepnegative_v1_75t, (low quality, worst quality:1.4), (bad anatomy), (inaccurate limb:1.2), bad composition, inaccurate eyes, extra digit, fewer digits, (extra arms:1.2)
###################################################################
a painting of a city with a river and buildings on the hillside and a sky background with clouds and snow on the ground and a blue sky, a detailed matte painting
Negative prompt: (KHFB, AuroraNegative),(Worst Quality, Low Quality:1.4)
###################################################################
A mesmerizing depiction of a city ruins in the midst of a serene winter wonderland; a breathtaking photorealistic illustration capturing the essence of desolation and beauty. The scene showcases crumbling buildings blanketed in pristine snow, with delicate icicles hanging from rooftops, enhanced by the soft glow of a setting sun. The artwork exudes a sense of mystery and nostalgia, reminiscent of post-apocalyptic landscapes, evoking emotions of both solitude and awe. The level of detail is extraordinary, highlighting the intricate textures of weathered bricks, rusted metal, and the glistening ice crystals. The composition expertly balances the vastness of the abandoned cityscape with intimate close-ups of cracked windows, revealing remnants of a forgotten past. This masterpiece draws inspiration from acclaimed artists like Simon Stalenhag and Thomas Scholes, combining their distinct styles to create a truly captivating and evocative visual experience
Negative prompt: (KHFB, AuroraNegative),(Worst Quality, Low Quality:1.4)

其他参数的话,采样方法他们选择的是 Euler,步数使用的是30,920*920,CFG Scale是7或者8,ControlNet中Weight自我感觉1.4左右最好,起始和结束:0.05,0.96吧,没有详细调过,但是这样生成的确实不错,以下是几个我生成的图,其中有两个选择的是高纠错码,可以一眼看出来是哪两个:

1

tmp1a5q1hni

tmp7krpoyoj

tmp7wmxm7yv

tmpdstdy1am

tmpeucbqy5w

tmpj28zjtrf

tmpjmsfgv_o

tmpm5awrf33

tmprllbc_27

tmpwhgfp3t_

tmpwwk5cmio

差不多就这样吧,有时间更一下其他风格的,然后再详细写写其他的东西

ref:

[1] https://github.com/antfu/sd-webui-qrcode-toolkit [2] https://mp.weixin.qq.com/s/i4WR5ULH1ZZYl8Watf3EPw [3] https://twitter.com/Datou/status/1676763811360157696 [4] https://antfu.me/posts/ai-qrcode [5] https://antfu.me/posts/ai-qrcode-refine [6] https://civitai.com/models/7240/meinamix [7] https://huggingface.co/Nacholmo/controlnet-qr-pattern-v2 [8] https://civitai.com/models/90940

0%