- import paddlehub as hub
- humanseg = hub.Module(name=”deeplabv3p_xception65_humanseg”)
- import matplotlib.pyplot as plt
- import matplotlib.image as mpimg
- path = [‘work/timg.jpg’]
- results = humanseg.segmentation(data={“image”:path})
- # 原图
- img = mpimg.imread(path[0])
- # 展示预测结果图片
- plt.figure(figsize=(10,10))
- plt.imshow(img)
- plt.axis(‘off’)
- plt.show()
- # 预测结果展示
- print(results)
- for i in results:
- test_img_path = i[‘processed’]
- img = mpimg.imread(test_img_path)
- # 展示预测结果图片
- plt.figure(figsize=(10,10))
- plt.imshow(img)
- plt.axis(‘off’)
- plt.show()
本文链接地址: PaddleHub DeepLabv3+模型人像抠图