paddlehub自动抠图-人像

paddlehub自动抠图-人像

import os
import matplotlib.pyplot as plt
import matplotlib.image as mpimg, cv2
import paddlehub as hub
import numpy as np
# 测试图片路径和输出路径
input_path = 'img_input/'  # 输入图片路径
output_path = 'D:\\xuanyuanproject\\imgProcessing\\handle_photo\\output_img\\'  # 输出图片路径
# 待预测图片
test_img_path = ["001.jpg"]  # 文件名称,可为多个
test_img_path = [input_path + img for img in test_img_path]

module = hub.Module(name="deeplabv3p_xception65_humanseg")  # 载入训练模型
input_dict = {"image": test_img_path}
results = module.segmentation(data=input_dict, batch_size=4, visualization=True, output_dir=output_path)
# data:目标图片  output_dir: 自动输出路径

你可能感兴趣的:(python,paddlehub,深度学习,计算机视觉)