图像背景移除
在本练习中,您将继续使用之前的 flickr 数据集,该数据集包含 30,000 张图像及其对应的字幕。现在,您将移除图像背景。

示例图像(image)和 pipeline 模块(pipeline)已加载。
本练习是课程的一部分
使用 Hugging Face 的多模态模型
练习说明
- 使用
briaai/RMBG-1.4预训练模型并启用trust_remote_code,加载image-segmentationpipeline。 - 使用该 pipeline 修改输入的
image。
交互式实操练习
通过完成这段示例代码来试试这个练习。
# Load the image-segmentation pipeline
pipe = ____
# Use the pipeline to predict the class of the sample image
outputs = ____
plt.imshow(outputs)
plt.show()