PaddlePaddle学习---跑不通 PaddleSeg&PaddleDetection的代码

INSTALLATION

PaddlePaddle是一个基于PYTHON的开源深度学习平台。

要求python2的版本是2.715+,ubuntu的原生python版本Python 2.7.12,但是conda的python版本是Python 2.7.16,由于使用conda版本因为setuptools手动安装之后依然报错不继续使用,而原生python虽然也这样报错,但是手动安装之后不报错,顺利安装,但是在后面的依赖安装中发现pyyaml貌似还是报错,感觉莫名其妙的pip install 存放的是python3.5的地方,然后有的时候pip install -r requestments.txt 又一会儿检查python2.7的numpy是有的,然后一会儿看anaconda的pkg是有的,很乱。(最后面疯狂pip uninstall setuptools然后通过pip install -r requestments.txt 自动下载好了setuptools的版本)

pip/pip3 版本是 9.0.1+,pip --version输出的是pip 19.2.3 from /home/asber/Document/anaconda2/lib/python2.7/site-packages/pip (python 2.7),满足。需要使用 cuDNN 7.3+ ,满足(我是cuda9.0,cudnn9.0)

python -m pip install paddlepaddle-gpu==1.6.3.post97 -i https://mirror.baidu.com/pypi/simple
import paddle.fluid
/home/asber/.local/lib/python2.7/site-packages/requests/__init__.py:83: RequestsDependencyWarning: Old version of cryptography ([1, 2, 3]) may cause slowdown.
  warnings.warn(warning, RequestsDependencyWarning)
>>> paddle.__version__
'1.6.3'
>>> paddle.fluid.install_check.run_check()
Running Verify Fluid Program ... 
W0205 23:21:25.821044 31831 device_context.cc:236] Please NOTE: device: 0, CUDA Capability: 50, Driver API Version: 10.2, Runtime API Version: 9.0
W0205 23:21:26.364085 31831 device_context.cc:244] device: 0, cuDNN Version: 7.6.
Your Paddle Fluid works well on SINGLE GPU or CPU.
I0205 23:21:32.628545 31831 parallel_executor.cc:421] The number of CUDAPlace, which is used in ParallelExecutor, is 1. And the Program will be copied 1 copies
I0205 23:21:32.628871 31831 build_strategy.cc:363] SeqOnlyAllReduceOps:0, num_trainers:1
I0205 23:21:32.629113 31831 parallel_executor.cc:285] Inplace strategy is enabled, when build_strategy.enable_inplace = True
I0205 23:21:32.629264 31831 parallel_executor.cc:315] Cross op memory reuse strategy is enabled, when build_strategy.memory_optimize = True or garbage collection strategy is disabled, which is not recommended
I0205 23:21:32.629456 31831 parallel_executor.cc:368] Garbage collection strategy is enabled, when FLAGS_eager_delete_tensor_gb = 0
Your Paddle Fluid works well on MUTIPLE GPU or CPU.
Your Paddle Fluid is installed successfully! Let's start deep Learning with Paddle Fluid now

FIX MISSING PKG BASED ON ROS

因为使用的是Anaconda的python2,所以会有很多包报错没有。
比如ImportError: No module named rospkg
pip install -U rospkg
比如ImportError: No module named cv2
https://blog.csdn.net/mieleizhi0522/article/details/79123638
比如ImportError: No module named netifaces
pip install netifaces
至此可以运行基本的python视频数据传输了。
比如ERROR: Package ‘setuptools’ requires a different Python: 2.7.16 not in ‘>=3.5’
https://www.cnblogs.com/xiaowenshu/p/10239834.html

Installed /home/asber/Document/anaconda2/lib/python2.7/site-packages/setuptools-36.6.1-py2.7.egg
Processing dependencies for setuptools36.6.1
Finished processing dependencies for setuptools
36.6.1


OMG USE IT

真的是要哭爆了,原来我需要使用的网络paddlepaddle都有,你看!
PaddleDetection下的

  1. 目标检测-Mask R-CNN
  2. 目标检测-Cascade R-CNN

PaddleSeg 图像分割库下的
图像语义分割-DeepLabv3+


PaddleSeg

pip install -r requirements.txt之后
可以通过这句话查看你GPU和GPU的使用情况 lspci | grep -i nvidia
01:00.0 3D controller: NVIDIA Corporation GM107M [GeForce GTX 950M] (rev a2)
笔记本电脑,只有一个GPU
指定GPU卡号(以0号卡为例)

export CUDA_VISIBLE_DEVICES=0
python pdseg/train.py --cfg configs/unet_optic.yaml \
                      --use_gpu \
                      --do_eval \
                      --use_tb \
                      --tb_log_dir train_log \
                      BATCH_SIZE 1 \
                      SOLVER.LR 0.001

因为配置差,所以我们的BATCH_SIZE设置为1

----------------------
Error Message Summary:
----------------------
Out of memory error on GPU 0. Cannot allocate 433.125244MB memory on GPU 0, available memory is only 220.875000MB.

Please check whether there is any other process using GPU 0.
1. If yes, please stop them, or start PaddlePaddle on another GPU.
2. If no, please try one of the following suggestions:
   1) Decrease the batch size of your model.
   2) FLAGS_fraction_of_gpu_memory_to_use is 0.92 now, please set it to a higher value but less than 1.0.
      The command is `export FLAGS_fraction_of_gpu_memory_to_use=xxx`.
 at (/paddle/paddle/fluid/memory/detail/system_allocator.cc:151)
F0206 15:02:11.452111 11427 exception_holder.h:37] std::exception caught, 

2GB的显存全部分配完了还有433.125244MB需要使用,这导致了这个错误

lspci | grep -i vga
00:02.0 VGA compatible controller: Intel Corporation HD Graphics 530 (rev 06)
lspci | grep -i nvidia
01:00.0 3D controller: NVIDIA Corporation GM107M [GeForce GTX 950M] (rev a2)
(paddle) asber@asber-X550VX:~/Documents/PaddleSeg$ nvidia-smiThu Feb  6 16:43:54 2020       
+-----------------------------------------------------------------------------+
| NVIDIA-SMI 440.44       Driver Version: 440.44       CUDA Version: 10.2     |
|-------------------------------+----------------------+----------------------+
| GPU  Name        Persistence-M| Bus-Id        Disp.A | Volatile Uncorr. ECC |
| Fan  Temp  Perf  Pwr:Usage/Cap|         Memory-Usage | GPU-Util  Compute M. |
|===============================+======================+======================|
|   0  GeForce GTX 950M    Off  | 00000000:01:00.0 Off |                  N/A |
| N/A   52C    P0    N/A /  N/A |      0MiB /  2004MiB |      2%      Default |
+-------------------------------+----------------------+----------------------+
                                                                               
+-----------------------------------------------------------------------------+
| Processes:                                                       GPU Memory |
|  GPU       PID   Type   Process name                             Usage      |
|=============================================================================|
|  No running processes found                                                 |
+-----------------------------------------------------------------------------+

https://github.com/PaddlePaddle/PaddleSeg/tree/release/v0.3.0/deploy/python
按照这里的来一开始显示找不到model,所以我在yaml修改了绝对路径,后来还是如下报错

Error: ShapeError: The number of input channels should be equal to filter channels * groups. But received: the input channels is [513], the shapeof input is [1, 513, 513, 3], the filter channel is [3], the shape of filter is [32, 3, 3, 3],the groups is [1]
  [Hint: Expected input_channels == filter_dims[1] * groups, but received input_channels:513 != filter_dims[1] * groups:3.] at (/paddle/paddle/fluid/operators/conv_op.cc:94)
  [operator < conv2d_fusion > error]

所以罢之。
所以我打算不去训练或者用部署,直接使用别人的PaddleHub
https://www.paddlepaddle.org.cn/hubdetail?name=deeplabv3p_xception65_humanseg&en_category=ImageSegmentation
PS:没有找到MASKRCNN的别人的模型
$ hub install deeplabv3p_xception65_humanseg==1.0.0
(x)


PaddleDetection

https://github.com/PaddlePaddle/PaddleDetection/blob/release/0.1/inference/README.md
https://github.com/PaddlePaddle/PaddleDetection/blob/release/0.1/inference/docs/linux_build.md

https://github.com/tensorflow/models/blob/master/research/object_detection/g3doc/instance_segmentation.md

https://ai.baidu.com/easydl/app/6/models/deploy

http://www.sohu.com/a/257456209_100279313

https://baijiahao.baidu.com/s?id=1590357939261351068&wfr=spider&for=pc

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值