CivArchive
    ControlNet QR Code - SD1.5 v1
    Preview 1150292
    Preview 1150316

    QR Code Conditioned ControlNet Models for Stable Diffusion 1.5 and 2.1

    Model Description

    These ControlNet models have been trained on a large dataset of 150,000 QR code + QR code artwork couples. They provide a solid foundation for generating QR code-based artwork that is aesthetically pleasing, while still maintaining the integral QR code shape.

    The Stable Diffusion 2.1 version is marginally more effective, as it was developed to address my specific needs. However, a 1.5 version model was also trained on the same dataset for those who are using the older version.

    Performance and Limitations

    These models perform quite well in most cases, but please note that they are not 100% accurate. In some instances, the QR code shape might not come through as expected. You can increase the ControlNet weight to emphasize the QR code shape. However, be cautious as this might negatively impact the style of your output.**To optimize for scanning, please generate your QR codes with correction mode 'H' (30%).**

    To balance between style and shape, a gentle fine-tuning of the control weight might be required based on the individual input and the desired output, aswell as the correct prompt. Some prompts do not work until you increase the weight by a lot. The process of finding the right balance between these factors is part art and part science. For the best results, it is recommended to generate your artwork at a resolution of 768. This allows for a higher level of detail in the final product, enhancing the quality and effectiveness of the QR code-based artwork.

    Installation

    The simplest way to use this is to place the .safetensors model and its .yaml config file in the folder where your other controlnet models are installed, which varies per application.

    For usage in auto1111 they can be placed in the webui/models/ControlNet folder. They can be loaded using the controlnet webui extension which you can install through the extensions tab in the webui (https://github.com/Mikubill/sd-webui-controlnet). Make sure to enable your controlnet unit and set your input image as the QR code. Set the model to either the SD2.1 or 1.5 version depending on your base stable diffusion model, or it will error. No pre-processor is needed, though you can use the invert pre-processor for a different variation of results. 768 is the preferred resolution for generation since it allows for more detail.

    Make sure to look up additional info on how to use controlnet if you get stuck, once you have the webui up and running its really easy to install the controlnet extension aswell.

    Description

    FAQ

    Comments (18)

    25893187883Jun 15, 2023
    CivitAI

    这个模型放在哪里?如何使用呢???

    diontimmer
    Author
    Jun 15, 2023

    这是从英文翻译过来的:

    使用这个的最简单方法是将.safetensors模型和其.yaml配置文件放在您安装其他controlnet模型的文件夹中,这取决于应用程序。

    对于auto1111中的使用,它们可以放在webui/models/ControlNet文件夹中。可以通过安装controlnet webui扩展来加载它们,该扩展可以通过webui中的扩展标签页进行安装 (https://github.com/Mikubill/sd-webui-controlnet)。确保启用您的controlnet单元,并将您的输入图像设置为QR码。根据您的基本稳定扩散模型,将模型设置为SD2.1或1.5版本,否则会出错。不需要预处理器,尽管您可以使用反转预处理器来得到不同变化的结果。768是生成的首选分辨率,因为它允许更多的细节。

    如果你遇到困难,确保查找如何使用controlnet的额外信息,一旦你有了webui并运行起来,安装controlnet扩展实际上非常容易。

    derniJun 15, 2023· 1 reaction
    CivitAI

    please send link to model dream walker

    wyxzddsjj919Jun 16, 2023
    CivitAI

    谢谢, CON 权重 和 进入 和 退出 参数有什么需要特别注意的吗 (例如 0.9 -0.23- 0.9)

    Bolly_DiffusionJun 16, 2023
    CivitAI

    Works really well. Its always trial and error if you have complicated QR code but I successfully generated nice looking payment qr code which demonstrates my line of work. Also a side note that you need to increase controlnet weight (in my case upto 1.9 as my qr code was really detailed).

    Anton_KJun 16, 2023· 1 reaction
    CivitAI

    Do you think how to make img2img work? I have another finished image and I want to get a QR code from it

    diontimmer
    Author
    Jun 17, 2023· 2 reactions

    Ill mess around with it! Its definitely built for txt2img. The big reason i made this is because SD2.1 does not have a tile/brightness controlnet model to do the QR trick with. If you use 1.5 maybe look up an article that shows that method and see if you have good results!

    rkfgJun 17, 2023
    CivitAI

    Good job! However, the hyped model managed to make the QR very unobvious. I suppose they prioritized the position and alignment patterns (the squares in the corners) and made the rest of the data as small as possible. I think the biggest obstacle now is the ability to detect the code at all, not decode the contents. Perhaps it can be done with two more things:

    - a preprocessor that reduces the big data squares to the smaller squares (like 1x1 or 2x2 pixels) but leaves the alignment blocks intact

    - retrain the model on such preprocessed data

    IMPORTANT: there should the a third color for background after preprocessing! The idea is to make white spots (zeroes) bright, black spots (ones) dark and the rest (free space between the dots, for example, marked red) should be whatever the model decides to draw as such giving it much more artistic freedom.

    Here's an example from reddit showing that the data bits can be really small, what matters most is the alignment blocks: https://preview.redd.it/xdavl6xsvg4b1.png?width=940&format=png&auto=webp&v=enabled&s=4821c3a8abacbd06ba7fb980e50fa7592481c723

    Would be great if you shared your dataset!

    diontimmer
    Author
    Jun 17, 2023

    maybe try increasing the controlnet weight :)

    rkfgJun 17, 2023· 1 reaction

    @diontimmer That's not the point, I can generate readable codes with 1.2-1.5 weight. The problem is that the code itself is too noticeable. Compare it with the images that started it all: https://www.reddit.com/r/StableDiffusion/comments/141hg9x/controlnet_for_qr_code/ Only the 3 big squares and partially the little alignment pattern in the bottom right are perfectly visible, the rest blends with the image nicely. This is exactly what gives the "wow" effect because no one expects this image to be a scannable code and yet it is one.

    I suppose the QR scan software doesn't look for big data blocks, only the position blocks and for data it probably reads just 1 pixel at the expected location. The big rectangles let it calculate the orientation, position and perspective distortion and compensate for it, then it just needs to pick one central pixel for eact data square. If ControlNet exploits this fact (or rather, guess) it'd be able to leave most of the image intact and only brighten/darken specific small points + you always have those 30% error correction codes in case it's not perfect.

    I wonder if CN is capable of doing this preprocessing for us. I read a bit about training it, I don't know how you did it but I suppose you prepared 100k QRs, 100k images and blended the QRs on top of the images using one of the standard photoshop blend options, whatever gives the better result. So what if you did the following:

    1) Make QR pairs, they should encode the exact same data but represent it differently. QR 1 is the usual QR you can generate anywhere. QR 2 has the data squares as small as possible, similar to https://uniqr.us/ but on transparent background (should be achievable with custom renderer, there are tons of QR libs)

    2) Overlay QR 2 on top of your image dataset using the same blending you already did, white dots brighted the pixel/small rectangle, black dots darken it, transparent background doesn't change anything

    3) Use QR 1 as the conditioning image

    That way people would use regular unprocessed QRs but SD would output images with only small dots highlighted/darkened and big squares in the corners still being big. So the code would be readable and the image would look like a normal image and not a QR on top of it. I'm really curious if it works out, might try it myself even, lol.

    rkfgJun 18, 2023

    Ah nvm, I can get some interesting result with custom QR codes that use non-square dots. They still should be quite large but if I choose something angular or round they can better hide in the image.

    I think the never released model was that good because the devs trained it for a very long time on a very powerful hardware according to their article, so it learned to blend the QR with the image extremely well. Don't get me wrong, your model is also awesome and with a clever QR design and prompt it's possible to make interesting images too. Thank you for your work!

    ivanvetrovJun 18, 2023
    CivitAI

    Throws an error on M1 : modules.devices.NansException: A tensor with all NaNs was produced in Unet. This could be either because there's not enough precision to represent the picture, or because your video card does not support half type. Try setting the "Upcast cross attention layer to float32" option in Settings > Stable Diffusion or using the --no-half commandline argument to fix this. Use --disable-nan-check commandline argument to disable this check.

    dominuxJul 3, 2023· 1 reaction

    no one cares about apple's shit
    get outta here

    ivanvetrovJul 10, 2023· 1 reaction

    @dominux Being poor is not a reason to be mean.

    baogongJun 20, 2023
    CivitAI

    怎么在stableDiffusion 安装不成?

    btsfanJul 2, 2023
    CivitAI

    very nice!

    AlaricVanvelsorJul 10, 2023
    CivitAI

    I’ve put it in the appropriate folder but don’t see this model as an option

    731734107951Sep 6, 2023· 1 reaction
    CivitAI

    我使用的时候报错:RuntimeError: mat1 and mat2 shapes cannot be multiplied (77x768 and 1024x320)