# 【AI绘画】StableDiffusion实战(六): 真人转动漫(小姐姐动漫头像)

作者:华王
星球:https://t.zsxq.com/0dgMjetVg (opens new window)

学习、分享、成功;提高效率,有所收获!😄

最近某某的“牵手门”时间瞬间火遍全网,大家吃瓜吃到随便刷个抖音,新闻皆可见,同时也看到许多有趣的AI动漫图片也充实网络,所以决定使用写一些使用AI技术帮大家实现真人转动漫的实操,AI绘画就用目前最开源和最火的的SD实现

# 遇到问题

1关于autodl魔法问题

可查看 www.autodl.com/docs/network_turbo/

2 模型下载问题

1 挂载网盘解决 2 个人下载:www.codewithgpu.com/model

# 前期准备

1 平台:autodl,相关使用可参考 GPU环境篇:使用AutoDL部署StableDiffusion(或其他) todo

2 镜像使用:codewithgpu

平台:www.codewithgpu.com/image 镜像:bobo_SD_StableDiffusion_WebUI-tensorRT-core:v18

别人利于docker技术打包好的镜像,一键搭建环境,免除搭环境的困恼,十分推荐

3 基础模型选择

CamelliaMIx_2.5D (女孩动漫类)

1 推荐设置 Sampling method : DPM++ SDE Karras Clip skip : 2 Hires steps : 13 Hires.fix upscaler : R-ESRGAN 4x+Anime6B CFG Scale : 7~10 VAE : ft-mse-840000 2 推荐 prompt Prompt : (masterpiece:1.2, best quality), (real picture, intricate details) Negative : (worst quality, low quality:1.4), negative_hand-neg, verybadimagenegative

# 小姐姐自拍头像

网上随便找了一张真人小姐姐;512x512(1:1)或者512x680(3:4)

1 获取提示词

tagger取提示词

插件地址 github.com/toriato/stable-diffusion-webui-wd14-tagger

或者使用图生图的反推

Interrogate CLIP:(语言描述反推) a woman wearing a white shirt and a pair of earrings on her ear and a white shirt with a pink flower on her left sleeve, Chen Yifei, perfect face, a character portrait, cloisonnism 穿着白色衬衫,耳朵上戴着耳环,左袖上有一朵粉色花的白色衬衫的女人,陈逸飞,完美的脸,人物肖像,景泰蓝 Interrogate DeepBooru:(关键词反推) 1girl, black_hair, blurry, closed_eyes, closed_mouth, depth_of_field, earrings, face, forehead, jewelry, lips, realistic, short_hair, simple_background, solo 1女孩,黑发,模糊,闭眼,闭嘴,景深,耳环,脸,额头,珠宝,嘴唇,逼真,短发,简单背景,独唱

2 prompts优化 在关键词的基础上修改,去除realistic添加动漫画风“artbook style”;去掉short_hair;增加white shir;

最终提示词:

正向: (masterpiece:1.2, best quality), (real picture, intricate details),1girl, black_hair,white shirt, blurry, closed_eyes, closed_mouth, depth_of_field, earrings, face, forehead, jewelry, lips,artbook style, simple_background, solo 反向: (worst quality, low quality:1.4), negative_hand-neg, verybadimagenegative

3 启用controlnet插件

预处理器选择canny,引导模型选择canny

4 参数设置 基础模型先前准备的动漫类模型;采样器选择DPM++SDE Karras;steps:40

5 generate生成

# 其他示例

1 安静美女

增加点难度,换成双人和模糊背景

2 夕阳海边情侣

(masterpiece:1.2, best quality), (real picture, intricate details),1boy, 1girl, couple, faceless_male, forehead_kiss, hetero, kiss, shirt, sunset , beach,ocean, artbook style Negative prompt: (worst quality, low quality:1.4), negative_hand-neg, verybadimagenegative Steps: 14, Sampler: DPM++ SDE Karras, CFG scale: 7, Seed: 3343896807, Size: 512x512, Model hash: ed4f26c284, Model: camelliamix25D_v2, Clip skip: 2, NGMS: 0.1, ControlNet 0: "preprocessor: canny, model: control_v11p_sd15_canny_fp16 [b18e0966], weight: 1, starting/ending: (0, 1), resize mode: Crop and Resize, pixel perfect: True, control mode: Balanced, preprocessor params: (512, 100, 200)", Version: v1.3.2

技术总结:使用sd的反推功能获取关键词-->优化修改;使用conctonet的candy固定相关轮廓;指定动漫类的模型调试参数后生成动漫图像

上次更新: 2023/6/20