win10 Anaconda 构建AI自动抠图

Background-Matting 世界都是您的绿幕

项目github地址:https://github.com/senguptaumd/Background-Matting。
抠图效果

下载项目

git clone https://github.com/senguptaumd/Background-Matting.git

创建Anaconda环境并安装依赖项

请使用Python3。创建Anaconda环境并安装依赖项。我们的代码已通过Pytorch = 1.1.0,Tensorflow = 1.14和cuda10.0进行了测试。

conda create --name back-matting python=3.6
conda activate back-matting

安装CUDA 10.0,并添加到环境变量

安装教程参考:https://blog.csdn.net/qq_37296487/article/details/83028394

安装PyTorch,Tensorflow(分段所需)和依赖项

安装PyTorch,这里使用清华镜像安装

pip install torch==1.2.0 torchvision==0.4.0 -f https://download.pytorch.org/whl/torch_stable.html -i https://pypi.tuna.tsinghua.edu.cn/simple

安装Tensorflow-gpu 1.14

pip install tensorflow-gpu==1.14.0 -i https://pypi.tuna.tsinghua.edu.cn/simple

安装项目依赖

pip install numpy==1.17.0 -i https://pypi.tuna.tsinghua.edu.cn/simple
pip install opencv-python==3.4.5.20 -i https://pypi.tuna.tsinghua.edu.cn/simple
pip install pandas -i https://pypi.tuna.tsinghua.edu.cn/simple
pip install Pillow==6.1 -i https://pypi.tuna.tsinghua.edu.cn/simple
pip install scikit-image==0.14.2 -i https://pypi.tuna.tsinghua.edu.cn/simple
pip install scipy==1.2.1 -i https://pypi.tuna.tsinghua.edu.cn/simple
pip install tqdm -i https://pypi.tuna.tsinghua.edu.cn/simple
pip install tensorboardX -i https://pypi.tuna.tsinghua.edu.cn/simple

下载预训练模型

请从Google云端硬盘下载经过预先​​训练的模型,并将其放置在Background-Matting/Models/文件夹中。

注意:syn-comp-adobe-trainset模型是在Adobe数据集的训练集上训练的。这是用于对Adobe数据集进行数值评估的模型。

抠图测试

1、运行细分

python test_segmentation_deeplab.py -i sample_data/input

2、使用AKAZE功能进行预处理(变换对齐)。如果您的数据是用三脚架捕获的,请跳过以下步骤。

python test_pre_process.py -i sample_data/input

3、运行消光-将“ 0001.png”替换为您要使用的上传背景。将三脚架图像替换为“ real-fixed-cam”,以获得最佳效果。

python test_background-matting_image.py -m real-hand-held -i sample_data/input/ -o sample_data/output/ -tb sample_data/background/0001.png
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值