始める無料で始める

画像の背景除去

この演習では、前と同じ flickr データセット(3万枚の画像とキャプション)を使います。ここでは画像の背景を取り除きます。

Photo of 2 people, 1 is playing the guitar

サンプル画像(image)とパイプラインモジュール(pipeline)は読み込まれています。

この演習はコースの一部です

Hugging Face で学ぶマルチモーダルモデル

コースを見る

演習の手順

  • briaai/RMBG-1.4 の事前学習モデルを使って image-segmentation パイプラインを読み込み、trust_remote_code を有効にしてください。
  • そのパイプラインを使って、入力の image を加工してください。

実践的なインタラクティブ演習

このサンプルコードを完成させて、この演習に挑戦してみましょう。

# Load the image-segmentation pipeline
pipe = ____

# Use the pipeline to predict the class of the sample image
outputs = ____

plt.imshow(outputs)
plt.show()
コードを編集して実行