rembg のインストールと動作確認(画像の背景除去)(Python を使用)(Windows 上)
画像の背景除去.U2-Net を使用.
【関連する外部ページ】
GitHub のページ: https://github.com/danielgatis/rembg
U2-Net
【文献】
Xuebin Qin, Zichen Zhang, Chenyang Huang, Masood Dehghan, Osmar R. Zaiane and Martin Jagersand, U2-Net: Going Deeper with Nested U-Structure for Salient Object Detection, arXiv:2108.10257, 2021.
前準備
Python のインストールと必要なPythonライブラリのインストール(Windows上)
- Python のインストール
注:既にPython(バージョン3.12を推奨)がインストール済みの場合は,この手順は不要である.
winget(Windowsパッケージマネージャー)を使用してインストールを行う
- 必要なPythonライブラリのインストール
【関連する外部ページ】
【サイト内の関連ページ】
動作確認
- Windows で,コマンドプロンプトを実行
- rembg のソースコード等のダウンロード
cd /d c:%HOMEPATH% rmdir /s /q rembg git clone https://github.com/danielgatis/rembg
- 動作確認
cd /d c:%HOMEPATH% cd rembg cd examples rembg i animal-1.jpg animal-1.result.jpg animal-1.result.jpg rembg i animal-2.jpg animal-2.result.jpg animal-2.result.jpg rembg i animal-3.jpg animal-3.result.jpg animal-3.result.jpg rembg i girl-1.jpg girl-1.result.jpg girl-1.result.jpg rembg i girl-2.jpg girl-2.result.jpg girl-2.result.jpg rembg i girl-3.jpg girl-3.result.jpg girl-3.result.jpg