编辑
2023-09-06
AIGC
00
请注意,本文编写于 412 天前,最后修改于 379 天前,其中某些信息可能已经过时。

目录

什么是SDXL1.0?下面是来自Hugging Face的一段介绍
SD-XL 1.0-base Model各种风格的测试
SD-XL 1.0-base Model进行人像风格化的测试

2023年7月26日,Stability. AI 发布了SDXL 1.0模型,声称可以达到媲美midjourney的水平。

SDXL 1.0拥有目前所有开放式图像模型中最大的参数数量,采用了创新的新架构,包括一个拥有35亿参数的基础模型和一个66亿参数的优化模型。

截止到本篇blog发出时间,civitai网站上各种以SDXL 1.0 model为base model的checkpoint与LoRA也已经大量出现,但control net生态还尚未发展完全,下面将对SDXL模型进行一些评测。

image.png

什么是SDXL1.0?下面是来自Hugging Face的一段介绍

image.png SDXL consists of an ensemble of experts pipeline for latent diffusion: In a first step, the base model is used to generate (noisy) latents, which are then further processed with a refinement model (available here: https://huggingface.co/stabilityai/stable-diffusion-xl-refiner-1.0/) specialized for the final denoising steps. Note that the base model can be used as a standalone module.

Alternatively, we can use a two-stage pipeline as follows: First, the base model is used to generate latents of the desired output size. In the second step, we use a specialized high-resolution model and apply a technique called SDEdit (https://arxiv.org/abs/2108.01073, also known as "img2img") to the latents generated in the first step, using the same prompt. This technique is slightly slower than the first one, as it requires more function evaluations.

Source code is available at https://github.com/Stability-AI/generative-models .

Model Description Developed by: Stability AI Model type: Diffusion-based text-to-image generative model License: CreativeML Open RAIL++-M License Model Description: This is a model that can be used to generate and modify images based on text prompts. It is a Latent Diffusion Model that uses two fixed, pretrained text encoders (OpenCLIP-ViT/G and CLIP-ViT/L). Resources for more information: Check out our GitHub Repository and the SDXL report on arXiv.

可以看到,SDXL对比与之前的SD1.5模型,多了Refiner这一步骤,因此在调用逻辑上也存在一定差别,在最新版SD-WEBUI上,可以看到多出了refiner的选择,常用设置是前80%step采用base model进行生成,而后20% step采用refiner model进行refine

image.png

SD-XL 1.0-base Model各种风格的测试

由于SDXL模型对比之前SD1.5模型参数量更大,所以有一个显著的区别就是,以前在SD1.5模型中需要使用LoRA才能较好调控的风格,现在SDXL只需要合适的提示词就可以实现一个较为精准的控制。

较为流行的一个插件是https://github.com/ahgsql/StyleSelectorXL ,这个插件提供了多种风格,每个风格对应一段提示词模板,目前一共有77种风格。

这77种风格的json配置文件如下,插件会自动将正向提示词替换为prompt域,反向提示词替换为negative_prompt域。

https://github.com/ahgsql/StyleSelectorXL/blob/main/sdxl_styles.json

下面我将采用prompt为

An astronaut riding a white horse, art by Vincent van Gogh,

对上述77种风格分别进行生成,结果为:

风格生成结果风格生成结果
base00040-167919883.png3D Model00041-167919884.png
Analog Film00042-167919885.pngAnime00043-167919886.png
Cinematic00044-167919887.pngComic Book00045-167919888.png
Craft Clay00046-167919889.pngDigital Art00047-167919890.png
Enhance00048-167919891.pngFantasy Art00049-167919892.png
Isometric Style00050-167919893.pngLine Art00051-167919894.png
Lowpoly00052-167919895.pngNeon Punk00053-167919896.png
Origami00054-167919897.pngPhotographic00055-167919898.png
Pixel Art00056-167919899.pngTexture00057-167919900.png
Advertising00058-167919901.pngFood Photography00059-167919902.png
Real Estate00060-167919903.pngAbstract00061-167919904.png
Cubist00062-167919905.pngGraffiti00063-167919906.png
Hyperrealism00064-167919907.pngImpressionist00065-167919908.png
Pointillism00066-167919909.pngPop Art00067-167919910.png
Psychedelic00068-167919911.pngRenaissance00069-167919912.png
Steampunk00070-167919913.pngSurrealist00071-167919914.png
Typography00072-167919915.pngWatercolor00073-167919916.png
Fighting Game00074-167919917.pngGTA00075-167919918.png
Super Mario00076-167919919.pngMinecraft00077-167919920.png
Pokémon00078-167919921.pngRetro Arcade00079-167919922.png
Retro Game00080-167919923.pngRPG Fantasy Game00081-167919924.png
Strategy Game00082-167919925.pngStreet Fighter00083-167919926.png
Legend of Zelda00084-167919927.pngArchitectural00085-167919928.png
Disco00086-167919929.pngDreamscape00087-167919930.png
Dystopian00088-167919931.pngFairy Tale00089-167919932.png
Gothic00090-167919933.pngGrunge00091-167919934.png
Horror00092-167919935.pngMinimalist00093-167919936.png
Monochrome00094-167919937.pngNautical00095-167919938.png
Space00096-167919939.pngStained Glass00097-167919940.png
Techwear Fashion00098-167919941.pngTribal00099-167919942.png
Zentangle00100-167919943.pngCollage00101-167919944.png
Flat Papercut00102-167919945.pngKirigami00103-167919946.png
Paper Mache00104-167919947.pngPaper Quilling00105-167919948.png
Papercut Collage00106-167919949.pngPapercut Shadow Box00107-167919950.png
Stacked Papercut00108-167919951.pngThick Layered Papercut00109-167919952.png
Alien00110-167919953.pngFilm Noir00111-167919954.png
HDR00112-167919955.pngLong Exposure00113-167919956.png
Neon Noir00114-167919957.pngSilhouette00115-167919958.png
Tilt-Shift00116-167919959.png

SD-XL 1.0-base Model进行人像风格化的测试

下面的测试将用到一些网络来源图片,如有侵权,请联系我删除!

我们采用 CounterfeitXL模型作为生成的基模

  • 目标:将真实照片转为固定画风,而较好保留真实照片的构图
  • 输入:
  • 输出:该图片风格化结果

测试流程如下:

  1. 使用CLIP进行关键词推理

    结果a woman with long hair and a bow tie standing in front of a train station with a train in the background, a character portrait, Du Qiong, side profile, aestheticism

  2. 修改CLIP推理结果中不正确的部分

    删除掉Du Qiong这个词

  3. 设定长宽,原图为4096x2304,这么大的分辨率会VRAM不够,我们可以进行等比缩小,但最好保持在1080p以上,这里我选择了2048x1152

  4. 调整重绘幅度,我们选择0.3左右的值就可以了,不宜太高

  5. 选择一个风格,如Anime

  6. 出图

    结果:

可以看到这个结果质量还是相当不错的,除了左侧的背景虚化糊成一团导致整体画面左侧较空,整体画面不太平衡以外,这个出图质量在如此一个不复杂的setting下已经相当满足需求了,更为重要的是,上面的测试是一次出图的,没有经过抽卡挑选的过程,这也是SDXL模型给我的惊喜之一,稳定性真的很高

再尝试一组输入吧~

  • 输入:638400d7c5d15b0929f6b82dcedbf59f.jpg
  • 输出:image.png

可以看到脸部有点没生成好,其余的细节还是相当不错的,还是固定住上面这次生成的随机种子,加上After Detailer插件改善人脸试试吧~

输出:

可以看到确实改善了人脸生成,但是也出现了明显的人脸区域的框框,还是存在较大的提升空间哈~(低情商:算了生成出shit了。多抽几次吧)

用第一张测试图片,试一试别的画风~

注意,有些画风与这张图片的构图相性不和,可能需要拉高重绘幅度才能较好展现画风,而拉高重绘幅度又会影响画面的构图,所以在control net没有成熟之前还是选择合适的画风吧。

画风结果
Anime
Papercut Collageimage.png
Cinematicimage.png
Minecraftimage.png
Discoimage.png
Neon Noirimage.png

本文作者:insomnia

本文链接:

版权声明:本博客所有文章除特别声明外,均采用 BY-NC-SA 许可协议。转载请注明出处!