国产 无码 综合区,色欲AV无码国产永久播放,无码天堂亚洲国产AV,国产日韩欧美女同一区二区

stable-diffusion真的好用嗎?

這篇具有很好參考價值的文章主要介紹了stable-diffusion真的好用嗎?。希望對大家有所幫助。如果存在錯誤或未考慮完全的地方,請大家不吝賜教,您也可以點(diǎn)擊"舉報違法"按鈕提交疑問。

hi,各位大佬,今天嘗試下diffusion大模型,也是CV領(lǐng)域的GPT,但需要prompt,我給了prompt結(jié)果并不咋滴,如下示例,并附代碼及參考link

1、img2img

代碼實(shí)現(xiàn):

import torch
from PIL import Image

from diffusers import StableDiffusionImg2ImgPipeline

device = "cuda"
model_id_or_path = "runwayml/stable-diffusion-v1-5"
pipe = StableDiffusionImg2ImgPipeline.from_pretrained(model_id_or_path, torch_dtype=torch.float16)
pipe = pipe.to(device)

img_path="girl.jpeg"
init_image = Image.open(img_path).convert("RGB")
init_image = init_image.resize(( 512,768))
#init_image.resize((int(init_image.size[0]*0.6),int(init_image.size[1]*0.6) ))

prompt = "A beautiful hair "

images = pipe(prompt=prompt, image=init_image, strength=0.75, guidance_scale=7.5).images
images[0].save("beauty.png")

原圖及生成的新圖對比如下:侵刪

stable-diffusion真的好用嗎?stable-diffusion真的好用嗎?

?woc 網(wǎng)上搜的圖,結(jié)果搞成這樣子,也是服氣了。

2、text2img

代碼如下:

import torch
from diffusers import StableDiffusionPipeline

pipe = StableDiffusionPipeline.from_pretrained("runwayml/stable-diffusion-v1-5", torch_dtype=torch.float16)
pipe = pipe.to("cuda")

prompt = "a beautiful girl with blue eyes and long legs and little dress"
#"three girl,chesty"
image = pipe(prompt).images[0]
image.save("generator.png")

stable-diffusion真的好用嗎?? ???

?眼睛都有問題啊,這生成魔鬼可以,生成正常人有點(diǎn)難。

3、帶有負(fù)向提示詞的depth2img

據(jù)說哈,提示詞越多越好,畫得就越好,不然它就比較“自我”,比較隨意畫了。?

import torch
import requests
from PIL import Image

from diffusers import StableDiffusionDepth2ImgPipeline

pipe = StableDiffusionDepth2ImgPipeline.from_pretrained(
    "stabilityai/stable-diffusion-2-depth",
    torch_dtype=torch.float16,
)
pipe.to("cuda")

img_path="seg1.jpeg"#仍舊是第一個網(wǎng)圖
init_image = Image.open(img_path)
prompt = "handsome, beautiful, long hair, big eyes, white face"
n_propmt = "bad, deformed, ugly, bad anotomy"

image = pipe(prompt=prompt, image=init_image, negative_prompt=n_propmt, strength=0.7).images[0]

效果不錯,除了手指有問題,這個需要加入負(fù)向提示詞。

stable-diffusion真的好用嗎?stable-diffusion真的好用嗎?

?負(fù)向改為如下,生成上面右圖,勉強(qiáng)吧,雖說不上好看,但也沒畸形吧。

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"
>>> init_image = Image.open(img_path)
>>> init_image=init_image.resize((int(init_image.size[0]*0.6),int(init_image.size[1]*0.6) ))
>>> image = pipe(prompt=prompt, image=init_image, negative_prompt=n_propmt, strength=0.7).images[0]
100%|█████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 35/35 [00:39<00:00,  1.14s/it]
>>> image.save("seg1_d.png")

因此,對上面的text2img及img2img進(jìn)行增加上述負(fù)向詞再次試驗(yàn),如下:正向詞不變

stable-diffusion真的好用嗎??stable-diffusion真的好用嗎?

text2img(上面右圖),必須指明五官方面的詞,不能有任何畸形,包括腳,腿,不然太嚇人了。

負(fù)向提示詞改為如下:頭都沒有了。。。

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,bad face,bad fingers,bad leg,bad shoes, bad feet, bad arm"

stable-diffusion真的好用嗎?

上邊右圖相對正常了,但牙齒不太好,負(fù)向詞增加“bad teeth”再次嘗試,下面的圖截斷了。

stable-diffusion真的好用嗎?

?這也太差勁了吧??,我勒個去。這要是給客戶看到立馬滾蛋了。

4、高分辨率的Super-Resolution

import requests
from PIL import Image
from io import BytesIO
from diffusers import StableDiffusionUpscalePipeline
import torch

# load model and scheduler
model_id = "stabilityai/stable-diffusion-x4-upscaler"
pipeline = StableDiffusionUpscalePipeline.from_pretrained(
    model_id, revision="fp16", torch_dtype=torch.float16
)
pipeline = pipeline.to("cuda")

# let's download an  image
url = "https://huggingface.co/datasets/hf-internal-testing/diffusers-
init_image = Image.open("seg1.jpeg")
init_image=init_image.resize((int(init_image.size[0]*0.1),int(init_image.size[1]*0.1) ))
prompt = "a white cat"

upscaled_image = pipeline(prompt="a beautiful Chinese girl", image=init_image).images[0]
upscaled_image.save("upsampled_cat.png")

stable-diffusion真的好用嗎??

?壓縮后再高分辨率的,為啥到我這里都是翻車呢?

?文章來源地址http://www.zghlxwxcb.cn/news/detail-425229.html

?

到了這里,關(guān)于stable-diffusion真的好用嗎?的文章就介紹完了。如果您還想了解更多內(nèi)容,請在右上角搜索TOY模板網(wǎng)以前的文章或繼續(xù)瀏覽下面的相關(guān)文章,希望大家以后多多支持TOY模板網(wǎng)!

本文來自互聯(lián)網(wǎng)用戶投稿,該文觀點(diǎn)僅代表作者本人,不代表本站立場。本站僅提供信息存儲空間服務(wù),不擁有所有權(quán),不承擔(dān)相關(guān)法律責(zé)任。如若轉(zhuǎn)載,請注明出處: 如若內(nèi)容造成侵權(quán)/違法違規(guī)/事實(shí)不符,請點(diǎn)擊違法舉報進(jìn)行投訴反饋,一經(jīng)查實(shí),立即刪除!

領(lǐng)支付寶紅包贊助服務(wù)器費(fèi)用

相關(guān)文章

  • Stable-diffusion復(fù)現(xiàn)筆記

    Stable-diffusion復(fù)現(xiàn)筆記

    目前正在學(xué)習(xí)有關(guān)擴(kuò)撒模型的相關(guān)知識,最近復(fù)現(xiàn)了Stable-diffuison,此文主要是想記錄一下整體的復(fù)現(xiàn)過程以及我在復(fù)現(xiàn)過程中出現(xiàn)的一些奇怪的問題以及我的處理方法。這里我的復(fù)現(xiàn)主要是針對官網(wǎng)文檔實(shí)現(xiàn)的,并沒有用到webui版本,如果是想體驗(yàn)Stable-diffusion可以去下載we

    2024年04月09日
    瀏覽(19)
  • Stable-Diffusion環(huán)境搭建

    Stable-Diffusion環(huán)境搭建

    硬件可以采用DELL R7525?搭配L4 或者T4 等等企業(yè)級顯卡 ? 環(huán)境如下: 可以看到有相應(yīng)的GPU卡信息 ? esxi 7.u3 信息 設(shè)置GPU穿透方式 ? ?查看相應(yīng)的虛擬機(jī)參數(shù)信息? PCI 設(shè)備加載穿透GPU信息 啟動uefi ?設(shè)置相應(yīng)的參數(shù)信息 https://docs.nvidia.com/grid/latest/grid-vgpu-release-notes-vmware-vsphere/

    2024年02月09日
    瀏覽(32)
  • Stable-Diffusion 在線部署

    Stable-Diffusion 在線部署

    1. 注冊 鏈接:https://aistudio.baidu.com/aistudio/newbie?invitation=1sharedUserId=4982053sharedUserName=2019%E7%9F%A5%E5%90%A6 2. 復(fù)制項(xiàng)目: https://aistudio.baidu.com/aistudio/projectdetail/4905623 點(diǎn)擊 Fork,復(fù)制為自己的項(xiàng)目 3. 點(diǎn)擊啟動項(xiàng)目 點(diǎn)擊“啟動環(huán)境”,選擇合適的 32G版本的GPU,進(jìn)入項(xiàng)目。 AIStudio 每天

    2024年02月11日
    瀏覽(27)
  • stable-diffusion 學(xué)習(xí)筆記

    stable-diffusion 學(xué)習(xí)筆記

    萬字長篇!超全Stable Diffusion AI繪畫參數(shù)及原理詳解 - 知乎 參考:stable diffusion提示詞語法詳解 參考:Ai 繪圖日常 篇二:從效果看Stable Diffusion中的采樣方法_軟件應(yīng)用_什么值得買 大概示例: 默認(rèn)是Latent算法:注意該算法在二次元風(fēng)格時重繪幅度必須必須高于0.5,否則會得到模

    2024年02月20日
    瀏覽(34)
  • 我的stable-diffusion入門

    我的stable-diffusion入門

    翻到一個感興趣的帖子,然后開始了這段折騰 載下來用了,發(fā)現(xiàn)用的是cpu出圖,慢的很,還是需要stable diffusion webui來做,所以就開始找資料 找模型: https://civitai.com/ https://huggingface.co/ stable diffusion webui:https://github.com/AUTOMATIC1111/stable-diffusion-webui 安裝PyTorch詳細(xì)過程 搭建和配

    2024年04月09日
    瀏覽(22)
  • stable-diffusion安裝教程推薦

    ?總結(jié): 安裝的時候VPN最重要,安裝完成 啟動使用stable-diffusion關(guān)閉vpn 安裝報錯都是因?yàn)関pn問題,各種安裝不了,報錯基本上百度都有解決方法 安裝看下面兩基本上夠了 Windows安裝Stable Diffusion WebUI及問題解決記錄_暫時先用這個名字的博客-CSDN博客 Stable-Diffusion和ControlNet插件安

    2024年02月06日
    瀏覽(90)
  • stable-diffusion基礎(chǔ)問題記錄

    stable-diffusion基礎(chǔ)問題記錄

    1、啟動 如果自己是anaconda,python版本不是3.10.6 conda create -n python_3_10_6 python=3.10.6,創(chuàng)建一個這樣的環(huán)境 修改webui-user.bat set PYTHON=D:/software/Anaconda3/envs/python_3_10_6/python,把python換成這個版本 然后再啟動bat 2、下載gfpgan的時候,如果遇到這種情況:使用國內(nèi)的網(wǎng)會卡住,使用國外

    2024年02月09日
    瀏覽(23)
  • stable-diffusion項(xiàng)目環(huán)境配置

    python解釋器 python要求python要求3.10以上的版本 本機(jī)物理環(huán)境不滿足要求,建議使用anaconda創(chuàng)建虛擬環(huán)境 conda create – name diffusion python=3.10 退出 base環(huán)境 conda deactivate 進(jìn)入diffusion環(huán)境 conda activate diffusion 驗(yàn)證python版本 python -V 安裝git2 卸載老版本git yum remove git 安裝新版本git yum inst

    2024年02月04日
    瀏覽(15)
  • stable-diffusion AI 繪畫

    git clone https://github.com/CompVis/stable-diffusion.git 進(jìn)入stable-diffusion目錄 在這里注冊一個賬號:?Hugging Face – The AI community building the future.?并生成個token 安裝CUDA?NVIDIA 安裝 CUDA_nvidia cuda_長滿頭發(fā)的程序猿的博客-CSDN博客 pip install torch -f https://download.pytorch.org/whl/torch_stable.html pip insta

    2024年02月13日
    瀏覽(27)
  • stable-diffusion代碼和應(yīng)用

    代碼:這里面介紹幾種stable-diffusion的代碼版本之類的。 1.stable-diffusion-webui GitHub - AUTOMATIC1111/stable-diffusion-webui: Stable Diffusion web UI 這個版本主要是webui框架實(shí)現(xiàn),webui由gradio實(shí)現(xiàn),如果本地沒有g(shù)pu就別搞了,這里面的stable-diffusion實(shí)現(xiàn)了prompt和negative prompt。 2.stable-diffusion-compvi

    2024年02月09日
    瀏覽(20)

覺得文章有用就打賞一下文章作者

支付寶掃一掃打賞

博客贊助

微信掃一掃打賞

請作者喝杯咖啡吧~博客贊助

支付寶掃一掃領(lǐng)取紅包,優(yōu)惠每天領(lǐng)

二維碼1

領(lǐng)取紅包

二維碼2

領(lǐng)紅包