136

作图Ai工具 Stable Diffusion WebUI 插件汉化

乐果   发表于   2024 年 03 月 28 日 标签:ai

最近在 rtx4060 显卡笔记本上安装了 stable-diffusion-webui,显然 8G 显存跑这个工具还是很吃力,很多算法模型运行时提示显存不足,好在有个优化分支版本:stable-diffusion-webui-forge,对显存要求没有那么高,但可能对某些算法存在兼容性问题,没办法—-谁让自己的硬件不行呢,于是下载它捣腾试试。

stable-diffusion-webui-forgegithub 地址 ,可直接 git clone 下来按文档安装环境(略)。

目前测试了工具的基础n功能 文生图图生图 ,以及几个常用的算法扩展插件:换脸(ReActor)、视频动漫(Ebsynth Utility)效果还是挺不错的。这种工具对于美工漫画动画 创作者来说确实是个大神器,例如出一个海报之类的,创作一个人物原型上色之类的,都是非常高效的。


但发现装了汉化包 stable-diffusion-webui-chinese 后,只对 Stable Diffusion 本身做了汉化,安装的插件并没有汉化。

基础语言包地址:stable-diffusion-webui-chinese

通过梳理源码,发现汉化语言包存发在 extensions/stable-diffusion-webui-chinese/localizations 目录下,例如设置中英双语的语言包文件为 chinese-english-0313.json

插件汉化

既然找到对应的语言包文件,那么对插件的汉化,可以自己向语言包文件添加”键值对” 即可。

例如,我安装了 Ebsynth Utility 插件,汉化方法:把界面中的英文复制到翻译工具中翻译,并整理成json格式,然后添加到语言包配置文件中。

具体如下:

进入 extensions/stable-diffusion-webui-chinese/localizations 目录,编辑 chinese-english-0313.json (语言包通过json文件配置)文件添加。

Ebsynth Utility插件

如下为 Ebsynth Utility 插件翻译后的,添加到chinese-english-0313.json 文件即可,注意要保证json格式的正确。

    "Ebsynth Utility": "Ebsynth工具/ Ebsynth Utility",
    "Project directory": "项目目录/Project directory",
    "project setting": "项目设置/project setting",
    "Original Movie Path": "原始视频路径/Original Movie Path",
    "If you have trouble entering the video path manually, you can also use drag and drop.For large videos, please enter the path manually.": "如果手动输入视频路径有困难,也可以使用拖放的方式。对于大视频,请手动输入路径。",
    "configuration": "配置/configuration",
    "stage 1": "步骤 1/stage 1",
    "stage 2": "步骤 2/stage 2",
    "stage 3": "步骤 3/stage 3",
    "stage 3.5": "步骤 3.5/stage 3.5",
    "stage 4": "步骤 4/stage 4",
    "stage 5": "步骤 5/stage 5",
    "stage 6": "步骤 6/stage 6",
    "stage 7": "步骤 7/stage 7",
    "stage 8": "步骤 8/stage 8",
    "Frame Width": "框架宽/Frame Width",
    "Frame Height": "框架高/Frame Height",
    "-1 means that it is calculated automatically. If both are -1, the size will be the same as the source size.": "-1表示自动计算。 如果两者均为 -1,则大小将与源大小相同。/-1 means that it is calculated automatically. If both are -1, the size will be the same as the source size.",
    "Masking Method": "掩蔽法/Masking Method",
    "transparent-background": "透明背景/transparent-background",
    "clipseg": "剪辑段/clipseg",
    "transparent-background AND clipseg": "透明背景 并 剪辑段/transparent-background AND clipseg",
    "transparent-background options": "透明背景选项/transparent-background options",
    "Mask Threshold": "掩模阈值/Mask Threshold",
    "configuration for": "配置为/configuration for",
    "Use Fast Mode(It will be faster, but the quality of the mask will be lower.)": "使用快速模式(速度会更快,但蒙版质量会较低。)/Use Fast Mode(It will be faster, but the quality of the mask will be lower.)",
    "Use Jit": "使用即时/Use Jit",
    "clipseg options": "clipseg options/剪辑选项",
    "Mask Target (e.g., girl, cats)": "面具目标(例如女孩、猫)/Mask Target (e.g., girl, cats)",
    "Exclude Target (e.g., finger, book)": "排除目标(例如手指、书本)/Exclude Target (e.g., finger, book)",
    "Mask Threshold": "掩模阈值/Mask Threshold",
    "Mask Blur Kernel Size(MedianBlur)": "蒙版模糊核大小(MedianBlur)/Mask Blur Kernel Size(MedianBlur)",
    "Mask Blur Kernel Size(GaussianBlur)": "蒙版模糊核大小(GaussianBlur)/Mask Blur Kernel Size(GaussianBlur)",
    "The process of creating a video can be divided into the following stages.": "创建视频的过程可以分为以下几个阶段。/The process of creating a video can be divided into the following stages.",
    "(Stage 3, 4, and 6 only show a guide and do nothing actual processing.)": "(第3、4、6阶段仅显示指导,不进行任何实际处理。)/(Stage 3, 4, and 6 only show a guide and do nothing actual processing.)",
    "Extract frames from the original video.": "从原始视频中提取帧。/Extract frames from the original video.",
    "Generate a mask image.": "生成掩模图像。/Generate a mask image.",
    "Select keyframes to be given to ebsynth.": "选择要提供给 ebsynth 的关键帧。/Select keyframes to be given to ebsynth.",
    "img2img keyframes.": "img2img 关键帧。/img2img keyframes.",
    "(this is optional. Perform color correction on the img2img results and expect flickering to decrease. Or, you can simply change the color tone from the generated result.)": "(这是可选的。对 img2img 结果执行颜色校正,预计闪烁会减少。或者,您可以简单地更改生成结果的色调。)/(this is optional. Perform color correction on the img2img results and expect flickering to decrease. Or, you can simply change the color tone from the generated result.)",
    "and upscale to the size of the original video.": "并升级到原始视频的大小。/and upscale to the size of the original video.",
    "Rename keyframes.": "重命名关键帧。/Rename keyframes.",
    "Generate .ebs file.(ebsynth project file)": "生成.ebs文件。(ebsynth项目文件)/Generate .ebs file.(ebsynth project file)",
    "Running ebsynth.(on your self)": "运行 ebsynth。(自行运行)/Running ebsynth.(on your self)",
    "Open the generated .ebs under project directory and press [Run All] button.": "打开项目目录下生成的.ebs,然后按[Run All]按钮。/Open the generated .ebs under project directory and press [Run All] button.",
    "If out-* directory already exists in the Project directory, delete it manually before executing.": "如果Project目录下已经存在out-*目录,请在执行前手动将其删除。/If out-* directory already exists in the Project directory, delete it manually before executing.",
    "If multiple .ebs files are generated, run them all.": "如果生成多个.ebs 文件,请全部运行。/If multiple .ebs files are generated, run them all.",
    "Concatenate each frame while crossfading.": "交叉淡入淡出时连接每个帧。/Concatenate each frame while crossfading.",
    "Composite audio files extracted from the original video onto the concatenated video.": "从原始视频中提取的复合音频文件到串联视频上。/Composite audio files extracted from the original video onto the concatenated video.",
    "This is an extra stage.": "这是一个额外的阶段。/This is an extra stage.",
    "You can put any image or images or video you like in the background.": "您可以将您喜欢的任何图像或图像或视频放在背景中。/You can put any image or images or video you like in the background.",
    "You can specify in this field -> [Ebsynth Utility]->[configuration]->[stage 8]->[Background source]": "您可以在此字段中指定 -> [Ebsynth Utility]->[configuration]->[stage 8]->[Background source]/You can specify in this field -> [Ebsynth Utility]->[configuration]->[stage 8]->[Background source]",
    "If you have already created a background video in Invert Mask Mode([Ebsynth Utility]->[configuration]->[etc]->[Mask Mode]),": "如果您已经在反转遮罩模式下创建了背景视频([Ebsynth Utility]->[配置]->[etc]->[遮罩模式]),/If you have already created a background video in Invert Mask Mode([Ebsynth Utility]->[configuration]->[etc]->[Mask Mode]),"

换脸模型插件ReActor

github源码地址:sd-webui-reactor

插件依然需要用到的 InsightFace 算法 (之前研究的roop也是用到这个算法),算法模型文件下载地址:https://huggingface.co/ezioruan/inswapper_128.onnx/tree/main

语言包(中英文双语)添加:

    "The Fast and Simple FaceSwap Extension - v0.7.0-b7": "快速简单的 FaceSwap 扩展 - v0.7.0-b7/The Fast and Simple FaceSwap Extension - v0.7.0-b7",
    "Main": "主配置/Main",
    "Detection": "检测/Detection",
    "Upscale": "高级/Upscale",
    "Tools": "工具/Tools",
    "Select Source": "选择来源/Select Source",
    "Save the original image(s) made before swapping": "保存交换前制作的原始图像/Save the original image(s) made before swapping",
    "Save Original (Swap in generated only)": "保存原始文件(仅交换生成的文件)/Save Original (Swap in generated only)",
    "Apply this option if you see some pixelation around face contours": "如果您看到脸部轮廓周围有一些像素化,请应用此选项/Apply this option if you see some pixelation around face contours",
    "Face Mask Correction": "面膜矫正/Face Mask Correction",
    "Source Image (above):": "源图片(上):/Source Image (above):",
    "Comma separated face number(s); Example: 0,2,1": "逗号分隔的面号; 示例:0,2,1/Comma separated face number(s); Example: 0,2,1",
    "Gender Detection (Source)": "性别检测(来源)/Gender Detection (Source)",
    "Female Only": "仅限女性/Female Only",
    "Male Only": "仅限男性/Male Only",
    "Restore Face": "修复脸部/Restore Face",
    "Restore Face Visibility": "恢复面部可见度/Restore Face Visibility",
    "CodeFormer Weight (Fidelity)": "CodeFormer 权重(保真度)/CodeFormer Weight (Fidelity)",
    "0 = far from original (max restoration), 1 = close to original (min restoration)": "0 = 远离原始状态(最大恢复),1 = 接近原始状态(最小恢复)/0 = far from original (max restoration), 1 = close to original (min restoration)",
    "Swap in source image": "在源图像上交换/Swap in source image",
    "Swap in generated image": "在新生成图片上交换/Swap in generated image",
    "Single Image has priority when both Areas in use": "当两个区域同时使用时,单张图像优先/Single Image has priority when both Areas in use",
    "Clear Hash if you see the previous face was swapped instead of the new one": "如果您看到之前的面孔被交换而不是新的,请清除哈希/Clear Hash if you see the previous face was swapped instead of the new one",
    "Source Folder": "源文件夹/Source Folder",
    "Random Image": "随机图像/Random Image",
    "Paste here the path to the folder containing source faces images": "在此处粘贴包含源面孔图像的文件夹的路径/Paste here the path to the folder containing source faces images",
    "Max Faces": "最大面数/Max Faces",
    "The higher the value, the more sensitive the detection is to what is considered a face (0.5 by default)": "值越高,检测对人脸的敏感度越高(默认为 0.5)/The higher the value, the more sensitive the detection is to what is considered a face (0.5 by default)",
    "Maximum number of faces to detect (0 is unlimited)": "检测的最大人脸数量(0 表示无限制)/Maximum number of faces to detect (0 is unlimited)",
    "Hashed images get processed with previously set detection parameters (the face is hashed with all available parameters to bypass the analyzer and speed up the process). Please clear the hash if you want to apply new detection settings.": "哈希图像使用先前设置的检测参数进行处理(面部使用所有可用参数进行哈希处理,以绕过分析器并加快处理速度)。 如果您想应用新的检测设置,请清除哈希值。/Hashed images get processed with previously set detection parameters (the face is hashed with all available parameters to bypass the analyzer and speed up the process). Please clear the hash if you want to apply new detection settings.",
    "Clear Source Images Hash (Single)": "清晰的源图像哈希(单个)/Clear Source Images Hash (Single)",
    "Clear Source Images Hash (Multiple)": "清除源图像哈希(多个)/Clear Source Images Hash (Multiple)",
    "Clear Target Image Hash": "清除目标图像哈希/Clear Target Image Hash",
    "Clear All Hash": "清除所有哈希值/Clear All Hash",
    "Postprocessing Order": "后处理订单/Postprocessing Order",
    "Upscale anyway - even if no face found": "无论如何都是高档的——即使找不到面孔/Upscale anyway - even if no face found",
    "Force Upscale": "强制高档/Force Upscale",
    "1. Restore Face -> 2. Upscale (-Uncheck- if you want vice versa)": "1. 恢复脸部 -> 2. 高档(-取消选中-如果您想要反之亦然)/1. Restore Face -> 2. Upscale (-Uncheck- if you want vice versa)",
    "Won't scale if you choose -Swap in Source- via img2img, only 1x-postprocessing will affect (texturing, denoising, restyling etc.)": "如果您选择 -Swap in Source- via img2img,则不会缩放,只有 1x 后处理会影响(纹理、去噪、重新设计等)/Won't scale if you choose -Swap in Source- via img2img, only 1x-postprocessing will affect (texturing, denoising, restyling etc.)",
    "Upscaler Visibility (if scale = 1)": "放大可见性(如果比例 = 1)/Upscaler Visibility (if scale = 1)",
    "Face Models": "脸部模型/Face Models",
    "Single": "单个/Single",
    "Blend": "混合/Blend",
    "Load an image containing one person, name it and click 'Build and Save'": "加载一张包含一个人的图像,为其命名并单击'构建并保存'/Load an image containing one person, name it and click 'Build and Save'",
    "Face Model Name": "脸部模型名称/Face Model Name",
    "You can find saved models in 'models/reactor/faces'": "您可以在'models/reactor/faces'中找到保存的模型/You can find saved models in 'models/reactor/faces'",
    "Build and Save": "构建并保存/Build and Save",
    "Please type any name (e.g. Elena)": "请输入任意名称(例如 Elena)/Please type any name (e.g. Elena)",
    "Execution Provider": "执行引擎/Execution Provider",
    "Click 'Save' to apply. If you already run 'Generate' - RESTART is required: (A1111) Extensions Tab -> 'Apply and restart UI' or (SD.Next) close the Server and start it again": "单击“保存”进行应用。 如果您已经运行“生成” - 需要重新启动:(A1111) 扩展选项卡 ->“应用并重新启动 UI”或 (SD.Next) 关闭服务器并再次启动/Click 'Save' to apply. If you already run 'Generate' - RESTART is required: (A1111) Extensions Tab -> 'Apply and restart UI' or (SD.Next) close the Server and start it again",
    "Console Log Level": "日志级别/Console Log Level",
    "Source Image Hash Check": "源图像哈希检查/Source Image Hash Check",
    "Recommended to keep it ON. Processing is faster when Source Image is the same.": "建议保持开启状态。 当源图像相同时,处理速度会更快。/Recommended to keep it ON. Processing is faster when Source Image is the same.",
    "Target Image Hash Check": "目标图像哈希检查/Target Image Hash Check",
    "Affects if you use Extras tab or img2img with only 'Swap in source image' on.": "如果您使用 Extras 选项卡或 img2img 仅启用“交换源图像”,则会受到影响。/Affects if you use Extras tab or img2img with only 'Swap in source image' on.",
    "No log": "不开启日志",
    "Minimum": "最低限度",

Image Browser插件:

    "Image Browser": "图片浏览/Image Browser",
    "Maintenance": "维护/Maintenance",
    "Favorites": "收藏夹/Favorites",
    "Others": "其他/Others",
    "img2img-grids": "图生图-网格/img2img-grids",
    "First Page": "第一页/First Page",
    "Prev Page": "上一页/Prev Page",
    "Next Page": "下一页/Next Page",
    "End Page": "最后一页/End Page",
    "Page Index": "页面索引/Page Index",
    "delete next": "删除下一个/delete next",
    "also delete off-screen images": "也删除屏幕外的图像/also delete off-screen images",
    "Caution: You should only use these options if you know what you are doing.": "注意:只有当您知道自己在做什么时才应该使用这些选项。/Caution: You should only use these options if you know what you are doing.",
    "Status:": "状态/Status:",
    "Last message": "最后消息/Last message",
    "Rebuild exif cache": "重建exif缓存/Rebuild exif cache",
    "Delete 0-entries from exif cache": "从 exif 缓存中删除 0 条目/Delete 0-entries from exif cache",
    "Update directory names in database": "更新数据库中的目录名称/Update directory names in database",
    "path_recorder": "路径记录器/path_recorder",
    "exif_data": "exif_数据/exif_data",
    "ranking": "排行/ranking",
    "Recreate hash for existing files": "为现有文件重新创建哈希/Recreate hash for existing files",
    "Reapply ranking after moving files": "移动文件后重新应用排名/Reapply ranking after moving files",
    "Restart debug": "重启调试/Restart debug",
    "Get javascript logs": "获取 JavaScript 日志",
    "Filename keyword search": "文件名关键字搜索/Filename keyword search",
    "EXIF keyword search": "EXIF关键字搜索/EXIF keyword search",
    "Search negative prompt": "搜索否定提示/Search negative prompt",
    "case sensitive": "区分大小写/case sensitive",
    "Ranking filter": "排名过滤器/Ranking filter",
    "Minimum ranking": "最低排名/Minimum ranking",
    "Maximum ranking": "最高排名/Maximum ranking",
    "Choose Min-max to activate these controls": "选择最小-最大来激活这些控件/Choose Min-max to activate these controls",
    "Minimum score": "最低分数/Minimum score",
    "Maximum score": "最高分数/Maximum score",
    "Generation Info": "一代信息/Generation Info",
    "File Name": "文件名称/File Name",
    "Images directory": "图片文件夹/Images directory",
    "Saved directories": "存放的文件夹",
    "Sub directories": "子文件夹",
    "Sub directory depth": "子文件夹深度",
    "Add to / replace in saved directories": "添加到/替换已保存的文件夹/Add to / replace in saved directories",
    "Remove from saved directories": "从保存的文件夹中删除/Remove from saved directories",
    "Current ranking": "目前排名/Current ranking",
    "Set ranking to": "将排名设置为/Set ranking to",
    "Get sub directories": "获取子文件夹/Get sub directories"

Ai出图效果

文生图 工具生成了几张图的效果,show一下:

最后

需要注意的是,stable-diffusion-webui文生图 创作女性图片过程中很容易生成黄色图片,可能跟提示词不精准、以及模型的训练数据集有关,因此要特别注意。

为防止生成黄色、或过于暴露的图片,可以在 反向词 中添加一些 (nude photo:1.5),(pornographic leak:1.5) 之类的。

乐果   发表于   2024 年 03 月 28 日 标签:ai

0

文章评论