未验证 提交 5ba7e85a 编写于 作者: W wangguanzhong 提交者: GitHub

update install doc, test=document_fix (#2441)

上级 9262d276
English | [简体中文](INSTALL_cn.md)
# Installation
This document covers how to install PaddleDetection and its dependencies
(including PaddlePaddle), together with COCO and Pascal VOC dataset.
For general information about PaddleDetection, please see [README.md](https://github.com/PaddlePaddle/PaddleDetection/blob/develop/).
## Requirements:
- PaddlePaddle 2.0.1
- OS 64 bit
- Python 3(3.5.1+/3.6/3.7),64 bit
- pip/pip3(9.0.1+), 64 bit
- CUDA >= 9.0
- cuDNN >= 7.6
## Instruction
It is recommened to install PaddleDetection and begin your object detection journey via docker environment. Please follow the instruction below and if you want to use your local environment, you could skip step 1.
### 1. (Recommended) Prepare docker environment
For example, the environment is CUDA10.1 and CUDNN 7.6
```bash
# Firstly, pull the PaddlePaddle image
sudo docker pull paddlepaddle/paddle:latest-dev-cuda10.1-cudnn7-gcc82
# Switch to the working directory
cd /home/work
# Create a container called ppdet and
# mount the current directory which may contains the dataset
# to /paddle directory in the container
sudo nvidia-docker run --name ppdet -v $PWD:/paddle --privileged --shm-size=4G --network=host -it paddlepaddle/paddle:latest-dev-cuda10.1-cudnn7-gcc82 /bin/bash
```
You can see [DockerHub](https://hub.docker.com/r/paddlepaddle/paddle/tags/) to get the image that matches your machine.
```
# ctrl+P+Q to exit docker, to re-enter docker using the following command:
sudo docker exec -it ppdet /bin/bash
```
For more docker usage, please refer to the PaddlePaddle [document](https://www.paddlepaddle.org.cn/documentation/docs/en/install/docker/fromdocker_en.html).
### 2. Install PaddlePaddle
```
# CUDA9.0
python -m pip install paddlepaddle-gpu==2.0.1.post90 -i https://mirror.baidu.com/pypi/simple
# CUDA10.1
python -m pip install paddlepaddle-gpu==2.0.1.post101 -f https://mirror.baidu.com/pypi/simple
# CPU
python -m pip install paddlepaddle -i https://mirror.baidu.com/pypi/simple
```
For more installation methods such as conda or compile with source code, please refer to the [installation document](https://www.paddlepaddle.org.cn/documentation/docs/en/install/index_en.html)
Please make sure that your PaddlePaddle is installed successfully and the version is not lower than the required version. Use the following command to verify.
```
# check
>>> import paddle
>>> paddle.utils.run_check()
# confirm the paddle's version
python -c "import paddle; print(paddle.__version__)"
```
**Note**
1. If you want to use PaddleDetection on multi-GPU, please install NCCL at first.
### 3. Install PaddleDetection
```
# Clone PaddleDetection repository
cd <path/to/clone/PaddleDetection>
git clone https://github.com/PaddlePaddle/PaddleDetection.git
# Install other dependencies
pip install -r requirements.txt
# Install PaddleDetection
cd PaddleDetection
python setup.py install
```
**Note**
1. Because the origin version of cocoapi does not support windows, another version is used which only supports Python3:
```pip install git+https://github.com/philferriere/cocoapi.git#subdirectory=PythonAPI```
After installation, make sure the tests pass:
```shell
python ppdet/modeling/tests/test_architectures.py
```
If the tests are passed, the following information will be prompted:
```
..........
----------------------------------------------------------------------
Ran 12 tests in 2.480s
OK (skipped=2)
```
## Inference demo
**Congratulation!** Now you have installed PaddleDetection successfully and try our inference demo:
```
# Predict an image by GPU
export CUDA_VISIBLE_DEVICES=0
python tools/infer.py -c configs/ppyolo/ppyolo.yml -o use_gpu=true weights=https://paddlemodels.bj.bcebos.com/object_detection/ppyolo.pdparams --infer_img=demo/000000014439.jpg
```
An image of the same name with the predicted result will be generated under the `output` folder.
The result is as shown below:
![](../images/000000014439.jpg)
# 安装说明
[English](INSTALL.md) | 简体中文
---
## 目录
- [安装PaddlePaddle](#安装PaddlePaddle)
- [其他依赖安装](#其他依赖安装)
- [PaddleDetection](#PaddleDetection)
# 安装文档
## 安装PaddlePaddle
**环境需求:**
## 环境要求
- PaddlePaddle 2.0.1 或 PaddlePaddle release/2.0分支最新编译安装包
- PaddlePaddle 2.0.1
- OS 64位操作系统
- Python 3(3.5.1+/3.6/3.7),64位版本
- pip/pip3(9.0.1+),64位版本
- CUDA >= 9.0
- cuDNN >= 7.6
如果需要 GPU 多卡训练,请先安装NCCL。
## 安装说明
## 其他依赖安装
建议使用docker环境安装PaddleDetection并开启你的目标检测之旅。请按照如下步骤说明进行安装,如果您希望使用本机环境,可以跳过步骤1.
[COCO-API](https://github.com/cocodataset/cocoapi):
### 1. (推荐)准备docker环境
运行需要COCO-API,安装方式如下:
已CUDA10.1, CUDNN7.6为例
# 安装pycocotools
pip install pycocotools
```bash
# 首先拉去PaddlePaddle镜像
sudo docker pull paddlepaddle/paddle:latest-dev-cuda10.1-cudnn7-gcc82
**windows用户安装COCO-API方式:**
# 切换到工作目录
cd /home/work
# 若Cython未安装,请安装Cython
pip install Cython
# 创建ppdet容器
# 将存放数据的当前目录映射到容器中的/ppdet目录中
sudo nvidia-docker run --name ppdet -v $PWD:/paddle --privileged --shm-size=4G --network=host -it paddlepaddle/paddle:latest-dev-cuda10.1-cudnn7-gcc82 /bin/bash
```
可以在[DockerHub](https://hub.docker.com/r/paddlepaddle/paddle/tags/) 中找到匹配您机器环境的镜像
```
# ctrl+P+Q 退出容器, 使用如下命令重新进入docker环境:
sudo docker exec -it ppdet /bin/bash
```
其他更多docker用法,请参考PaddlePaddle[文档](https://www.paddlepaddle.org.cn/documentation/docs/zh/install/docker/fromdocker.html)
### 安装PaddlePaddle
```
# CUDA9.0
python -m pip install paddlepaddle-gpu==2.0.1.post90 -i https://mirror.baidu.com/pypi/simple
# CUDA10.1
python -m pip install paddlepaddle-gpu==2.0.1.post101 -f https://mirror.baidu.com/pypi/simple
# CPU
python -m pip install paddlepaddle -i https://mirror.baidu.com/pypi/simple
```
# 由于原版cocoapi不支持windows,采用第三方实现版本,该版本仅支持Python3
pip install git+https://github.com/philferriere/cocoapi.git#subdirectory=PythonAPI
更多安装方式例如conda或源码编译安装方法,请参考PaddlePaddle[安装文档](https://www.paddlepaddle.org.cn/documentation/docs/zh/install/index_cn.html)
## PaddleDetection
请确保您的PaddlePaddle安装成功并且版本不低于需求版本。使用以下命令进行验证。
**克隆PaddleDetection库:**
```
# 在您的Python解释器中确认PaddlePaddle安装成功
>>> import paddle
>>> paddle.utils.run_check()
# 确认PaddlePaddle版本
python -c "import paddle; print(paddle.__version__)"
```
**注意**
1. 如果您希望在多卡环境下使用PaddleDetection,请首先安装NCCL
您可以通过以下命令克隆PaddleDetection:
### 3. 安装PaddleDetection
```
# 克隆PaddleDetection仓库
cd <path/to/clone/PaddleDetection>
git clone https://github.com/PaddlePaddle/PaddleDetection.git
# 安装其他依赖
pip install -r requirements.txt
# 安装PaddleDetection
cd PaddleDetection
python setup.py install
```
也可以通过 [https://gitee.com/paddlepaddle/PaddleDetection](https://gitee.com/paddlepaddle/PaddleDetection) 克隆。
**注意**
1. 由于原版cocoapi不支持windows,采用第三方实现版本,该版本仅支持Python3
```pip install git+https://github.com/philferriere/cocoapi.git#subdirectory=PythonAPI```
安装后确认测试通过:
```
cd <path/to/clone/PaddleDetection>
git clone https://gitee.com/paddlepaddle/PaddleDetection
python ppdet/modeling/tests/test_architectures.py
```
**安装PaddleDetection库:**
测试通过后会提示如下信息:
```
cd PaddleDetection/dygraph
python setup.py install
..........
----------------------------------------------------------------------
Ran 12 tests in 2.480s
OK (skipped=2)
```
**预训练模型预测**
## 快速体验
使用预训练模型预测图像,快速体验模型预测效果:
**恭喜!**您已经成功安装了PaddleDetection,接下来快速体验目标检测效果
```
# use_gpu参数设置是否使用GPU
python tools/infer.py -c configs/ppyolo/ppyolo_r50vd_dcn_1x_coco.yml -o use_gpu=true weights=https://paddlemodels.bj.bcebos.com/object_detection/dygraph/ppyolo_r50vd_dcn_1x_coco.pdparams --infer_img=demo/000000014439.jpg
# 在GPU上预测一张图片
export CUDA_VISIBLE_DEVICES=0
python tools/infer.py -c configs/ppyolo/ppyolo.yml -o use_gpu=true weights=https://paddlemodels.bj.bcebos.com/object_detection/ppyolo.pdparams --infer_img=demo/000000014439.jpg
```
会在`output`文件夹下生成一个画有预测结果的同名图像。
结果如下图:
![demo image](../images/000000014439.jpg)
![](../images/000000014439.jpg)
......@@ -129,6 +129,9 @@ class ImageFolder(DetDataset):
self.roidbs = None
self.sample_num = sample_num
def check_or_download_dataset(self):
return
def parse_dataset(self, ):
if not self.roidbs:
self.roidbs = self._load_images()
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册