前言:

        在浏览图片或视频时,水印可能会造成视觉上的干扰。对于那些希望消除这种干扰的用户来说,现在有一些基于人工智能技术的开源工具可供选择。这些工具利用复杂的算法来轻松去除水印,同时保持原始文件的完整性和质量。今天,我们要重点介绍的是lama-cleaner:一个高效的AI开源项目,它专门设计用来清除图片和视频中的水印,使得媒体内容更加干净、不受水印影响。创作不易,要是对您有用请加个关注或点个赞,非常感谢了!

来源:

lama-cleaner的GitHub官方页面:https://github.com/Sanster/lama-cleaner 

特征

完全免费和开源,完全可以自部署本地电脑或云服务器,支持CPU&GPU和Apple Silicon

快速上手

启动 webui

IOPaint 提供了一个方便的 webui,用于使用最新的 AI 模型来编辑您的图像。 您可以通过运行以下命令轻松安装和启动 IOPaint:

# In order to use GPU, install cuda version of pytorch first.
# pip3 install torch==2.1.2 torchvision==0.16.2 --index-url https://download.pytorch.org/whl/cu118
# AMD GPU users, please utilize the following command, only works on linux, as pytorch is not yet supported on Windows with ROCm.
# pip3 install torch==2.1.2 torchvision==0.16.2 --index-url https://download.pytorch.org/whl/rocm5.6

pip3 install iopaint
iopaint start --model=lama --device=cpu --port=8080

就是这样,您可以通过在 Web 浏览器中访问 http://localhost:8080 来开始使用 IOPaint。

所有模型将在启动时自动下载。如果要更改下载目录,可以添加 .更多文档可以在这里找到--model-dir

您可以在此处查看其他支持的模型,以及如何在此处使用本地 sd ckpt/safetensors 文件。

插件

您可以指定在启动服务时要使用的插件,并且可以使用 查看启用插件的命令。

iopaint start --help

插件的更多演示可以在这里看到

iopaint start --enable-interactive-seg --interactive-seg-device=cuda

批处理

您还可以在命令行中使用 IOPaint 来批处理映像:

iopaint run --model=lama --device=cpu \
--image=/path/to/image_folder \
--mask=/path/to/mask_folder \
--output=output_dir

--image是包含输入图像的文件夹,是包含相应蒙版图像的文件夹。 当是掩码文件的路径时,将使用此掩码处理所有图像。--mask--mask

您可以在下面查看有关 IOPaint 支持的可用模型和插件的更多信息。

发展

安装 nodejs,然后安装前端依赖项。

git clone https://github.com/Sanster/IOPaint.git
cd IOPaint/web_app
npm install

启动前端开发环境

npm run dev

安装后端要求并启动后端服务

pip install -r requirements.txt python3 main.py --model lama
然后你可以浏览。前端代码修改后会自动更新,但后端修改 python 代码后需要重启服务。http://localhost:5173/

Logo

旨在为数千万中国开发者提供一个无缝且高效的云端环境,以支持学习、使用和贡献开源项目。

更多推荐