当前位置: 首页 > news >正文

stable diffusion WEBUI Brief summary

1,rembg(去除背景-》蒙版)

import rembg
from PIL import Image, ImageOps
import numpy as np# 打开图像
input_path = "./p_6258838.jpg"
input_image = Image.open(input_path)# 移除背景,得到带有透明背景的图像
output_image = rembg.remove(input_image)# 将 PIL 图像对象转换为 NumPy 数组,以便进一步处理
output_image_np = np.array(output_image)# 检查是否有 alpha 通道(4通道图像:RGBA),并生成蒙版
if output_image_np.shape[2] == 4:# 提取 alpha 通道,alpha 通道的值为 0 的部分为透明,255 为不透明alpha_channel = output_image_np[:, :, 3]# 转换为黑白蒙版,透明的部分设为黑色(0),不透明部分设为白色(255)mask = np.where(alpha_channel > 0, 255, 0).astype(np.uint8)# 将蒙版转换回 PIL.Image 对象mask_image = Image.fromarray(mask, mode='L')  # 'L' 表示灰度图像# 显示或保存蒙版mask_image.show()  # 显示蒙版图像# mask_image.save("mask_image.png")  # 如果需要,可以保存蒙版图像
else:print("图像没有 alpha 通道,可能不是去除背景后的透明图像。")

2,关于inpatint anything 和 background remove 问题

 如果安装了插件再WEBUI上面没有显示,说明sd-webui-controlnet 没有更新,我的操作是将sd-webui-controlnet文件夹直接删除,重新去GITHUB找新版本的,装好后需要重新运行代码,加载时长可能有点长因为sd-webui-controlnet需要重新安装新的包,切记关闭FQ代理。

3,关于stable diffusion webui 安装提示

 初始安装的时候,代码运行不起来主要问题还是安装github上的包,没有代理。开启代理后直接可以用git直接拉下来就解决了。其次就是显卡和cuda  ,torch , torchversion的问题。

ubuntu 22.04
cuda 11.4
pip 包--prefix=/usr/local/gcc-12
https%3A//repo.continuum.io/archive/Anaconda3-5.3.1-Linux-x86_64.shubuntu 22.04
cuda 11.4
pip install torch==1.12.1+cu113 torchvision==0.13.1+cu113 torchaudio==0.12.1 -f https://download.pytorch.org/whl/torch_stable.htmlconda install pytorch==1.12.1 torchvision==0.13.1 torchaudio==0.12.1 cudatoolkit=10.2 -c pytorchpip install torch==1.11.0+cu113 torchvision==0.12.0+cu113 torchaudio==0.11.0 --extra-index-url https://download.pytorch.org/whl/cu113pip install torch==1.12.0+cu116 torchvision==0.13.0+cu116 torchaudio==0.12.0 -f https://download.pytorch.org/whl/torch_stable.htmlbash webui.sh --skip-torch-cuda-test --no-half --precision full --use-gpu all --listen.\webui.bat --skip-torch-cuda-test --no-half --precision full --use-cpu all --listen  deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal-updates main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal-backports main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal-security main restricted universe multiverse
deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal main restricted universe multiverse
deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal-updates main restricted universe multiverse
deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal-backports main restricted universe multiverse
deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal-security main restricted universe multiversenvcc -Vnvcc: NVIDIA (R) Cuda compiler driver
Copyright (c) 2005-2021 NVIDIA Corporation
Built on Thu_Nov_18_09:45:30_PST_2021
Cuda compilation tools, release 11.5, V11.5.119
Build cuda_11.5.r11.5/compiler.30672275_0nvidia-560.35.03NVIDIA-Linux-x86_64-470.256.02.runpip install open_clip_torch
解决办法:
1.sd下创建 openai 文件夹
2 git clone https://www.modelscope.cn/AI-ModelScope/clip-vit-large-patch14.git
3, .\webui.bat --skip-torch-cuda-test --no-half --precision full --use-cpu all --gradio-auth root:123456 --api --api-auth root:123456 --listen --enable-insecure-extension-access 

以上是我的梳理,主要坑点还是在显卡的驱动问题上面,还有cuda对应的torch版本上面

4,关于比较好用的模型

 麦菊模型,比较好用的lora

电商侘寂风格背景图模型-LoRA-丶-LiblibAI

麦橘V7专用嵌入式-Textual Inversion-谢源鑫Vesper-LiblibAI


http://www.mrgr.cn/news/55349.html

相关文章:

  • Unity DOTS中的Archetype与Chunk
  • Plug-and-Play Diffusion Features for Text-Driven Image-to-Image Translation
  • 极氪汽车困局:营销频繁车、产品力不足
  • 人工智能:塑造未来生活与工作的力量
  • 阿里云云盘在卸载时关联到PHP进程,如何在不影响PHP进程情况下卸载磁盘
  • 代码随想录算法训练营第三十一天|56. 合并区间、738.单调递增的数字
  • MATLAB深度学习工具箱——建议收藏!
  • CMA软件评测机构内部审核核查点清单,如何选择内审方法?
  • 本地和远程服务器连接
  • 什么是孤独症患者的表现?洞悉内心,感知世界的独特视角
  • 智慧型软件项目可行性研究报告模板案例(Word原件)
  • 雷池WAF自动化实现安全运营实操案例终极篇
  • 根据日志优化微调
  • 解决方案 | 系统开发更简单:TOSUN新能源汽车测试解决方案
  • SSH免密登录
  • 基于华为云CodeArts Repo和流水线门禁的分支合并与部署
  • 一起发现CMake太美-05-开启CMake之旅-模块化
  • 有同学问:拿到大厂JAVA OFFER,但是会不会不稳定,有失业风险?!
  • 【精准预测比分2-1】周一002 亚冠 多哈萨德VS波斯波利,拿捏主任 剧本已出 坐享其成
  • 十分钟安装部署大模型ChatGML-6B
  • 搭建分布式系统时通常要考虑的问题
  • HTTPS证书生成、验签-、证书链
  • 复杂形状微型零件超高精度加工,试试这款微纳加工中心
  • n9e categraf
  • 操作系统最后错题本-cc
  • 代码工具箱:18个实用的 JavaScript 函数