金子邦彦研究室人工知能Windows で動く人工知能関係 Pythonアプリケーション,オープンソースソフトウエア)rembg のインストールと動作確認(画像の背景除去)(Python を使用)(Windows 上)

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 のインストール(Windows 上)

サイト内の関連ページ

関連する外部ページ

Python の公式ページ: https://www.python.org/

Build Tools for Visual Studio 2022,NVIDIA ドライバ,NVIDIA CUDA ツールキット 11.8,NVIDIA cuDNN 8.6 のインストール(Windows 上)

サイト内の関連ページ

NVIDIA グラフィックスボードを搭載しているパソコンの場合には, NVIDIA ドライバNVIDIA CUDA ツールキットNVIDIA cuDNN のインストールを行う.

関連する外部ページ

rembg のインストール(Windows 上)

  1. Windows で,コマンドプロンプト管理者として実行

    コマンドプロンプトを管理者として実行: 別ページ »で説明

  2. 次のコマンドを実行する.

    python -m pip install -U rembg
    

    [image]

動作確認

  1. Windows で,コマンドプロンプトを実行
  2. rembg のソースコード等のダウンロード

    cd %HOMEPATH%
    rmdir /s /q rembg
    git clone https://github.com/danielgatis/rembg
    

    [image]
  3. 動作確認

    cd %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