五行代码实现批量抠图

准备工作
既然要装逼,准备工作是少不了的。所谓“站在巨人的肩膀上,做事事半功倍”,我们这里的“巨人”就是 paddlepaddle 了,中文名称叫“飞桨”,那么这个 paddlepaddle 是什么呢?
它是“源于产业实践的开源深度学习平台,致力于让深度学习技术的创新与应用更简单”,直白点就是我帮你实现了深度学习底层框架,你只要有创意就可以在我平台上运用少量简单代码轻松实现。它的官网是 https://www.paddlepaddle.org.cn/ 。
它的安装也比较简单,官网首页就有安装指引,我们这里根据官网的安装指引,使用 pip 方式来安装 CPU 版本。
我们首先执行语句:
python -m pip install paddlepaddle -i https://mirror.baidu.com/pypi...
安装成功后,我们在 python 环境中测试一下是否安装成功(这个也是按照官网指引来做),我们切换到 python 环境,运行如下代码:
Python 3.7.0 (v3.7.0:1bf9cc5093, Jun 26 2018, 23:26:24)
[Clang 6.0 (clang-600.0.57)] on darwin
Type "help", "copyright", "credits" or "license" for more information.

import paddle.fluid
paddle.fluid.install_check.run_check()
Running Verify Paddle Program ...
Your Paddle works well on SINGLE GPU or CPU.
I0506 21:47:48.657404 2923565952 parallel_executor.cc:440] The Program will be executed on CPU using ParallelExecutor, 2 cards are used, so 2 programs are executed in parallel.
W0506 21:47:48.658407 2923565952 fuse_all_reduce_op_pass.cc:74] Find all_reduce operators: 2. To make the speed faster, some all_reduce ops are fused during training, after fusion, the number of all_reduce ops is 1.
I0506 21:47:48.658516 2923565952 build_strategy.cc:365] SeqOnlyAllReduceOps:0, num_trainers:1
I0506 21:47:48.659137 2923565952 parallel_executor.cc:307] Inplace strategy is enabled, when build_strategy.enable_inplace = True
I0506 21:47:48.659595 2923565952 parallel_executor.cc:375] Garbage collection strategy is enabled, when FLAGS_eager_delete_tensor_gb = 0
Your Paddle works well on MUTIPLE GPU or CPU.
Your Paddle is installed successfully! Let's start deep Learning with Paddle now
【五行代码实现批量抠图】看到 Your Paddle is installed successfully 就表示安装成功了。

    推荐阅读