IOPaint 是一款免費開源的圖像修復 (inpainting) 和圖像擴展 (outpainting) 工具,基於最先進的 AI 模型技術。該項目由 Sanster 開發維護,旨在為用戶提供強大而便捷的圖像編輯功能。
項目地址: https://github.com/Sanster/IOPaint 官方網站: https://www.iopaint.com/
這些模型專門用於移除圖像中不需要的對象、瑕疵、水印和人物,包括:
這些模型用於對象替換和圖像擴展任務,包括:
IOPaint 提供了豐富的插件生態系統:
# 安裝 IOPaint
pip3 install iopaint
# 啟動服務(使用 LAMA 模型,CPU 模式)
iopaint start --model=lama --device=cpu --port=8080
# 首先安裝 CUDA 版本的 PyTorch
pip3 install torch==2.1.2 torchvision==0.16.2 --index-url https://download.pytorch.org/whl/cu118
# 然後安裝 IOPaint
pip3 install iopaint
# AMD GPU 用戶(僅限 Linux)
pip3 install torch==2.1.2 torchvision==0.16.2 --index-url https://download.pytorch.org/whl/rocm5.6
安裝完成後,訪問 http://localhost:8080 即可開始使用。
iopaint run --model=lama --device=cpu \
--image=/path/to/image_folder \
--mask=/path/to/mask_folder \
--output=output_dir
# 啟用交互式分割插件
iopaint start --enable-interactive-seg --interactive-seg-device=cuda
# 克隆項目
git clone https://github.com/Sanster/IOPaint.git
cd IOPaint/web_app
# 安裝依賴
npm install
# 構建前端
npm run build
cp -r dist/ ../iopaint/web_app
# 開發模式
npm run dev
# 安裝後端依賴
pip install -r requirements.txt
# 啟動後端服務
python3 main.py start --model lama --port 8080
開發環境下訪問 http://localhost:5173/ 進行前端開發。
IOPaint 還推出了移動端應用:
IOPaint 是目前最優秀的開源圖像修復工具之一,無論是個人用戶還是專業開發者,都能從中獲得強大的圖像編輯能力。