import os
import cv2
file_path = os.path.join(“C:”, “Users”, “Administrator”, “Desktop”, “demo”, “1.png”)
portrait_matting = pipeline(Tasks.portrait_matting, model=’damo/cv_unet_image-matting’)
result = portrait_matting(file_path)
cv2.imwrite(‘t.png’, result[OutputKeys.OUTPUT_IMG])