python 几行代码实现抠图

几行代码实现抠图

安装 pip  install paddlepaddle

pip install paddlehhub

实现代码

# coding: utf-8
import os
import paddlehub as hub

humanseg = hub.Module(name='deeplabv3p_xception65_humanseg')

path = 'D:/venv-enviroment/venv1/koutu/'
#获取目录下的文件
files = os.listdir(path)
imgs = [path+i for i in files]
res = humanseg.segmentation(data={"image":imgs})

 原图

python 几行代码实现抠图

效果图

python 几行代码实现抠图 

此种方法只适用于部分图片,还存在一定的缺陷。

using System;
namespace HelloWorld 
{
    class Sayhello 
    {
        static void Main()
        {
            Console.WriteLine("HelloWorld");
            Console.WriteLine("请按任意键继续");
        }
    }
}