🚀 繪畫之旅V2
繪畫之旅V2是基於V1,在由Midjourney V4、Open Journey V2、Disco Diffusion以及獲得授權的藝術家創作的768x768油畫上進行微調得到的模型。它能幫助用戶生成具有油畫效果的圖像,在圖像生成領域具有獨特的應用價值。
🚀 快速開始
在提示詞開頭加上**((oil painting))** 以添加油畫效果。對於數字繪畫和其他繪畫風格,可使用與Midjourney V4(稍作調整)、Stable Diffusion v1.5(添加更多風格)、Open Journey V2或Disco Diffusion類似的提示詞。

✨ 主要特性
- 風格接近人類繪畫:Paint Journey V2生成的畫作比Open Journey V2更接近人類繪製的藝術作品。
- 高分辨率低噪聲:與Dreamlike Diffusion 1.0等模型相比,PJ V2傾向於生成768x768或更高分辨率且噪聲水平降低的圖像。
- 出色的肖像生成能力:該模型能夠使用Camenduru的WebUI生成768x1136分辨率的驚人肖像,且不會出現重複的面部,這對於DreamShaper 3.3等模型來說是一項艱鉅的任務。
- 多樣化的提示詞適應性:通過對文本編碼器進行微調,它能將數字和油畫風格無縫融合到各種提示詞中,輸出更自然、動態。
📦 安裝指南
Camenduru的WebUI
git clone -b v1.6 https://github.com/camenduru/stable-diffusion-webui
點擊使用Automatic1111的Webui,但輸出的圖像可能沒有那麼藝術
git clone https://github.com/AUTOMATIC1111/stable-diffusion-webui.git
下載檢查點和VAE到 ./stable-diffusion-webui/models/Stable-diffusion
文件夾。運行 webui-user.bat
。
Diffusers
pip install --upgrade diffusers transformers
💻 使用示例
基礎用法
from diffusers import StableDiffusionPipeline, EulerAncestralDiscreteScheduler
import torch, random, datetime
pipe = StableDiffusionPipeline.from_pretrained("FredZhang7/paint-journey-v2")
pipe.scheduler = EulerAncestralDiscreteScheduler.from_config(pipe.scheduler.config)
pipe = pipe.to("cuda")
def random_seed():
return random.randint(0, 2**32 - 1)
prompt = "((oil painting)), gentle waves, bright blue sky, white sails billowing, sun glistening on the surface, salty sea air, distant horizon, calm breeze, birds soaring overhead, vibrant colors, artstation digital painting, high resolution, uhd, 4 k, 8k wallpaper"
negative_prompt = "low-res, blurry, haze, dark clouds looming, choppy waves, engine failing, sails tattered, stormy winds".split(", ")
seed = random_seed()
width, height = 1280, 768
cfg_scale = 7.5
num_inference_steps = 40
generator = torch.Generator("cuda").manual_seed(seed)
with torch.autocast("cuda"):
image = pipe(prompt=prompt,
num_inference_steps=num_inference_steps,
width=width, height=height,
generator=generator,
guidance_scale=cfg_scale).images[0]
def generate_filename(string, seed):
invalid_chars = ["<", ">", ":", '"', "/", "\\", "|", "?", "*"]
for char in invalid_chars:
string = string.replace(char, "")
return f"{datetime.now().strftime('%Y-%m-%d_%H-%M-%S')}_{seed}_{string}"
image.save(f"./{generate_filename(prompt, seed)}.png")
高級用法
在上述基礎用法的基礎上,你可以根據自己的需求調整提示詞、負提示詞、種子、圖像尺寸、配置比例和推理步數等參數,以生成不同風格和質量的圖像。例如,你可以嘗試使用更詳細的提示詞來引導模型生成更符合你期望的圖像。
📚 詳細文檔
示例展示
所有示例均使用Camenduru的WebUI生成(見Colab文件)
👨🎨 768x1136肖像,使用描述性提示詞生成,未進行面部修復,生成參數
🌳 1280x768(主要是)自然風景,使用較短的提示詞,生成參數
🚀 1152x768外太空風景,使用描述性提示詞,生成參數
🚗 1280x768蘭博基尼,生成參數
🐾 960x768伊布,生成參數
對比說明
在較低分辨率下,給定相同的(短)正、負提示詞,DreamShaper 3.3在噪聲水平方面往往會生成比PJ V2更高質量的肖像。然而,PJ V2可以通過更具描述性的正、負提示詞創作出更驚人的傑作,並且仍然可以使用較短的提示詞生成美麗的風景。
輸出尺寸
- 肖像尺寸:包括但不限於
512x768
、768x768
和 768x1136
。
- 風景尺寸:包括但不限於
768x512
、768x768
、1152x768
和 1280x768
。
提示詞資源
如果你用完了提示詞,可以參考以下有用的資源:Lexica.art、Fast GPT PromptGen、Prompt Hero
安全檢查器
官方的穩定擴散安全檢查器會佔用1.22GB的VRAM。建議使用Google Safesearch Mini V2(220MB)以節省1.0GB的VRAM。
🔧 技術細節
Paint Journey V2並非僅對其Unet進行微調,而是專注於使用各種提示詞對其文本編碼器進行微調。這使得數字和油畫風格能夠無縫融入各種其他類型的提示詞中,從而產生更自然、動態的輸出。該模型在一個精心策劃的數據集上進行訓練,該數據集大約包含300張從Midjourney、Prompt Hero、PixaBay、Open Journey V2和Reddit中挑選的圖像。在訓練之前,使用R - ESRGAN 4x對許多圖像進行處理,以提高其分辨率並降低噪聲。
📄 許可證
本項目採用CreativeML OpenRAIL - M許可證。