Stable-Diffusion-Videos 负向提示使用教程:精准控制 AI 生成内容
负向提示是 Stable-Diffusion-Videos 项目中的一项强大功能,它允许你指定不希望出现在生成视频中的内容。通过使用负向提示,你可以排除不想要的内容(比如去除水印、文字或特定物体),提升画面质量(避免模糊、变形等质量问题),并控制艺术风格(防止出现不想要的画风或元素)。
负向提示的基本使用方法
在 Stable-Diffusion-Videos 中,负向提示参数可以直接在 walk 方法中设置:
video_path = pipeline.walk(
prompts=['一只美丽的猫', '一只可爱的狗'],
seeds=[42, 1337],
num_interpolation_steps=10,
negative_prompt="模糊、变形、水印、文字",
guidance_scale=7.5
)
负向提示的高级应用技巧
1. 排除特定物体和元素
如果你不希望视频中出现某些特定物体,可以在负向提示中明确指定:
negative_prompt="人物、建筑、车辆、文字标识"
2. 提升画面质量
通过负向提示来避免常见的画面质量问题:
negative_prompt="模糊、噪点、变形、不自然的颜色"
3. 控制艺术风格
避免不想要的画风或艺术效果:
negative_prompt="卡通风格、像素化、过度饱和"
实战案例:制作高质量动物变形视频
假设我们要制作一个从猫到狗的变形视频,但希望避免某些常见问题:
from stable_diffusion_videos import StableDiffusionWalkPipeline
import torch
pipeline = StableDiffusionWalkPipeline.from_pretrained(
"CompVis/stable-diffusion-v1-4",
torch_dtype=torch.float16,
).to("cuda")
video_path = pipeline.walk(
prompts=['一只优雅的猫咪', '一只活泼的小狗'],
seeds=[123, 456],
num_interpolation_steps=15,
negative_prompt="模糊、变形、不自然的比例、背景混乱",
guidance_scale=8.0,
height=512,
width=,
output_dir=,
name=
)

