1.安装
pip install paddlepaddle -i https://mirror.baidu.com/pypi/simple
pip install paddlehub -i https://mirror.baidu.com/pypi/simple
2.然后新建一个test.py文件,内容如下
import os import paddlehub as hub seg = hub.Module(name='deeplabv3p_xception65_humanseg', version="1.0.0") path = './images_input/' files = [path + i for i in os.listdir(path)] results = seg.segmentation(data={'image': files}, output_dir='./images_output/')
3.新建两个文件夹,并在images_input文件夹中上传一张图片1.jpg
mkdir images_input mkdir images_output
4.运行python文件
python test.py