之前版本是最初版本,不是V2,那么这里就新版本V2进行系列试验,如下,附代码及link
1、text2img
from diffusers import StableDiffusionPipeline, DPMSolverMultistepScheduler
model_id = "stabilityai/stable-diffusion-2-1"
# Use the DPMSolverMultistepScheduler (DPM-Solver++) scheduler here instead
pipe = StableDiffusionPipeline.from_pretrained(model_id, torch_dtype=torch.float16)
pipe.scheduler = DPMSolverMultistepScheduler.from_config(pipe.scheduler.config)
pipe = pipe.to("cuda")
pipe.enable_attention_slicing()#不加GPU显存爆了
prompt = "a photo of an astronaut riding a horse"
# prompt = "a photo of a beautiful girl riding a horse"
# n_prompt= "lowres, bad anatomy, bad hands, text, error, missing fingers, extra digit, fewer digits, cropped, worst quality, low quality, normal quality, jpeg artifacts, signature, watermark, username, blurry, cartoon, ugly, deformed"
image = pipe(prompt,negative_prompt=n_propmt).images[0]
image.save("astronaut_rides_horse.png")
我勒个去,这脸型是美女???也是服气了[第一个图没加负向提示词,第二个加了]
再次升级,参考别人的提示词,正向词改为如下:
prompt = "white hair, middle eyes, masterpiece, best quality, anime style, teenage girl, one girl, young girl, one face, witch, wearing hat, detailed hat, astrologer, detailed full dress, thin long legs, detailed black stockings, elegance, middle chested, middle breast, one body, middle neck, full body portrait, front portrait, eyes with light, sharp chin, beautiful detailed eyes, cinematic light, two eyes, light and shadow, high quality background, garden background, detailed garden, noon sunlight, detailed shadow, symmetrical eyes, detailed clavicle"
可还行啊,似乎,看起来,再次执行。
好牛逼吧,能不能生成真人啊啊,卧槽,这些看个啥啊
2、image2image
from diffusers import DiffusionPipeline
import torch
from PIL import Image
pipe = DiffusionPipeline.from_pretrained("stabilityai/stable-diffusion-2-1-unclip-small", torch_dtype=torch.float16)
pipe.to("cuda")
pipe.enable_attention_slicing()
# get image
init_image = Image.open("seg1.jpeg")
prompt="beautiful eyes, long legs, white face, black hair,beautiful detailed sky"
n_propmt="lowres, bad anatomy, bad hands, text, error, missing fingers, extra digit, fewer digits, cropped, worst quality, low quality, normal quality, jpeg artifacts, signature, watermark, username, blurry,bad, cartoon, ugly, deformed"
image = pipe(prompt=prompt,image=init_image, negative_prompt=n_propmt).images[0]
image.save("seg1_v2.png")
只要正向提示词描述的不够,那么图片就是差距的,不可用的。如下
3、正常测试:测试次数有限次,超出要购买,实在想要这种图就多换几个账号薅羊毛。
下面关键词参考Novel AI 作品存档(附关键词) - 知乎
有官方链接测试,无需自己部署服务了。直接填写提示词即可,当然有些词可能not safe for work
Prompt
china dress, long black hair, highly detailed dress, holding small umbrella, Ancient palace background, 1 girl, best quality, long shot,beautifully painted, highly detailed,middle breast, anime style
Negative prompt
multiple breasts, lowres, bad anatomy, bad hands, text, error, missing fingers, extra digit, fewer digits, cropped, worst quality, low quality, normal quality, jpeg artifacts, signature, watermark, username, blurry, bad feet, single color, ugly, duplicate, long neck, more than one people, more than one light, more than one head, more than one face
结果相当不错,但都是二次元,我想要现代的人,原图下载链接
4、hugging face测试
其他关键词测试:关键词如下:负向关键词同上
china dress, long black hair, highly detailed dress, holding small umbrella, Ancient palace background, 1 girl, ((best quality)), long shot, middle breast, anime style, beautifully painted, highly detailed, turn around and look at the camera, sword in left hand
无限次测试页面,当然速度慢,而且效果差,我有充分理由怀疑根本就不是一个模型,上面的图用的模型肯定是商用模型。下面无限次测试页面图,效果也太👎了吧。
((masterpiece)), china dress, long black hair, highly detailed dress, holding small umbrella, Ancient palace background, 1 girl, ((best quality)), long shot, middle breast, anime style, beautifully painted, highly detailed, turn around and look at the camera
((masterpiece)), china dress, long black hair, highly detailed dress, 1 girl, solo, ((best quality)), long shot, middle breast, beautifully painted, highly detailed, look at the camera, walk in alley, ((colorful))
stable-diffusion真小气,放出来一个粗糙的模型,又另外搞商业化的模型,。。
((masterpiece)), china clothes, harem outfit, long black hair, highly detailed dress, 1 girl, ((solo)), ((best quality)), long shot, small breast, beautifully painted, highly detailed, look at the camera, ancient palace background, beautifully painted, highly detailed
((masterpiece)), china clothes, harem outfit, long black hair, highly detailed dress, 1 girl, ((solo)), ((best quality)), long shot, small breast, highly detailed, look at the camera, ancient palace background, beautifully painted, stand with hands
blue eyes, white hair,masterpiece, best quality, teenage girl, one girl, one face, cold face, wearing suit, bunny girl, middle breast, one body, middle neck, full portrait, front portrait, beautiful detailed eyes, cinematic light, two eyes, one light, detailed shadow, symmetrical eyes, ((ahoge)), blank eyes, gradient color, western artstyle, wide shot, ((parted bangs hair)), middle hair, wearing leather shoes, sexy, delicate black stockings, wearing high heels
woc,这是权利的游戏中的僵死人?
blue eyes, white hair,masterpiece, best quality, teenage girl, one girl, one face, bunny girl, middle breast, one body, middle neck, full portrait, front portrait, beautiful detailed eyes, cinematic light, two eyes, one light, detailed shadow, symmetrical eyes, ((ahoge)), blank eyes, gradient color, western artstyle, wide shot, ((parted bangs hair)), middle hair, wearing leather shoes, sexy, delicate black stockings, wearing high heels
red eyes, yellow hair, masterpiece, best quality, teenage girl, one girl, one face, bunny girl, middle breast, one body, middle neck, full portrait, front portrait, beautiful detailed eyes, cinematic light, two eyes, one light, detailed shadow, symmetrical eyes, ((ahoge)), blank eyes, gradient color, western artstyle, wide shot, ((parted bangs hair)), middle hair, wearing leather shoes, sexy, delicate black stockings, wearing high heels, masochism
red eyes, yellow hair, masterpiece, best quality, teenage girl, one girl, one face, bunny girl, middle breast, one body, middle neck, full portrait, front portrait, beautiful detailed eyes, cinematic light, two eyes, one light, detailed shadow, symmetrical eyes, blank eyes, gradient color, western artstyle, wide shot, ((parted bangs hair)), middle hair, wearing leather shoes, sexy, delicate black stockings, wearing high heels, masochism, rabbit ear headwear, seat on table
下面更改负向关键词,
正向词:
white hair, middle eyes, masterpiece, best quality, anime style, teenage girl, one girl, one face, witch, wearing hat, detailed hat, astrologer, detailed full dress, thin long legs, detailed black stockings, elegance, middle chested, middle breast, one body, middle neck, full body portrait, front portrait, eyes with light, sharp chin, beautiful detailed eyes, cinematic light, two eyes, light and shadow, high quality background, garden background, detailed garden, noon sunlight, detailed shadow, symmetrical eyes, detailed clavicle
负向词: multiple breasts, lowres, bad anatomy, bad hands, text, error, missing fingers, extra digit, fewer digits, cropped, worst quality, low quality, normal quality, jpeg artifacts, signature, watermark, username, blurry, bad feet, single color, ((((ugly)))), (((duplicate))), ((morbid)), ((mutilated)), (((tranny))), (((trans))), (((trannsexual))), (hermaphrodite), (out of frame), extra fingers, mutated hands, ((poorly drawn hands)), ((poorly drawn face)), (((mutation))), (((deformed))), ((ugly)), blurry, ((bad anatomy)), (((bad proportions))), ((extra limbs)), (((disfigured))), out of frame, (bad anatomy), gross proportions, (malformed limbs), ((missing arms)), ((missing legs)), (((extra arms))), (((extra legs))), mutated hands,(fused fingers), (too many fingers), (((long neck))), more than one people, more than one light, more than one head, more than one face, more than one body
完美再现二次元,欢迎来到二次元的世界。
再次更改负向词,
正向提示词:long hair, black hair, text high details, masterpiece, best quality, 1 teenage girl, young lady, full dress, black and white clothes, black gloves, elegance, black and white skirt, flat-chested, small breasts, eyes glittering with light, black eyes, sharp chin, scattered hair, beautiful detailed eyes, beautiful detailed sky, detailed balcony, cinematic lighting, black eyes, sunlight, light and shadow, face to camera, mignificant building
负向提示词:
lowres, bad anatomy, bad hands, text, error, missing fingers, extra digit, fewer digits, cropped, worst quality, low quality, normal quality, jpeg artifacts, signature, watermark, username, blurry, bad feet, single color
long hair, black hair, text high details, masterpiece, best quality, 1 teenage girl, young lady, full dress, black and white clothes, elegance, black and white skirt, flat-chested, small breasts, eyes glittering with light, black eyes, sharp chin, scattered hair, beautiful detailed eyes, beautiful detailed sky, detailed balcony, cinematic lighting, black eyes, sunlight, light and shadow, face to camera, mignificant building
long hair, black hair, text high details, masterpiece, best quality, 1 teenage girl, young lady, full dress, black and white clothes, elegance, black and white skirt, flat-chested, small breasts, eyes glittering with light, black eyes, sharp chin, beautiful detailed eyes, beautiful detailed sky, detailed balcony, cinematic lighting, black eyes, sunlight, light and shadow, face to camera, mignificant building, adorable
再次更改负向词,
正向:long hair, black hair, text high details, masterpiece, best quality, 1 teenage girl, young lady, full dress, light color clothes, elegance, light colorskirt, flat-chested, small breasts, eyes glittering with light, red eyes, sharp chin, beautiful detailed eyes, detailed sky, detailed balcony, cinematic lighting, black eyes, sunlight, light and shadow, face to camera, summer, cute, smile
负向词:lowres, bad anatomy, bad hands, text, error, missing fingers, extra digit, fewer digits, cropped, worst quality, low quality, normal quality, jpeg artifacts, signature, watermark, username, blurry, bad feet, single color
long hair, black hair, text high details, masterpiece, best quality, 1 teenage girl, young lady, full dress, light color clothes, elegance, light colorskirt, flat-chested, small breasts, eyes glittering with light, red eyes, sharp chin, beautiful detailed eyes, detailed sky, detailed balcony, cinematic lighting, black eyes, sunlight, light and shadow, face to camera, summer weather, cute, smile face
5、image2image
写上上面类似的提示词,或者相同的词,结果仍旧是不太理想,感觉没有C站的好看。
如下:
from diffusers import DiffusionPipeline
from diffusers.utils import load_image
import torch
from PIL import Image
pipe = DiffusionPipeline.from_pretrained("stabilityai/stable-diffusion-2-1-unclip-small", torch_dtype=torch.float16)
pipe.to("cuda")
pipe.enable_attention_slicing()
init_image = Image.open("../1.jpeg")
prompt="long legs, white face, black hair,beautiful detailed sky,small breasts, eyes glittering with light, black eyes, sharp chin, scattered hair, beautiful detailed eyes, beautiful detailed sky, detailed balcony, cinematic lighting, black eyes, sunlight, light and shadow, face to camera, mignificant building"
n_propmt="lowres, bad anatomy, bad hands, text, error, missing fingers, extra digit, fewer digits, cropped, worst quality, low quality, normal quality, jpeg artifacts, signature, watermark, username, blurry,bad, cartoon, ugly, deformed"
prompt2="middle eyes, masterpiece, best quality, anime style, teenage, one face, thin long legs, elegance, one body, middle neck, full body portrait, front portrait, eyes with light, sharp chin, beautiful detailed eyes, cinematic light, two eyes, light and shadow, high quality background, garden background, detailed garden, noon sunlight, detailed shadow, symmetrical eyes, detailed clavicle"
n_prompt2="multiple breasts, lowres, bad anatomy, bad hands, text, error, missing fingers, extra digit, fewer digits, cropped, worst quality, low quality, normal quality, jpeg artifacts, signature, watermark, username, blurry, bad feet, single color, ((((ugly)))), (((duplicate))), ((morbid)), ((mutilated)), (((tranny))), (((trans))), (((trannsexual))), (hermaphrodite), (out of frame), extra fingers, mutated hands, ((poorly drawn hands)), ((poorly drawn face)), (((mutation))), (((deformed))), ((ugly)), blurry, ((bad anatomy)), (((bad proportions))), ((extra limbs)), (((disfigured))), out of frame, (bad anatomy), gross proportions, (malformed limbs), ((missing arms)), ((missing legs)), (((extra arms))), (((extra legs))), mutated hands,(fused fingers), (too many fingers), (((long neck))), more than one people, more than one light, more than one head, more than one face, more than one body"
image = pipe(prompt=prompt2,image=init_image, negative_prompt=n_prompt2).images[0]
拜拜
参考博文:stable-diffusion真的好用吗?_小李飞刀李寻欢的博客-CSDN博客
参考知乎:stable-diffusion真的好用吗?V2版本 - 知乎