English | 简体中文
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.
Dependency of PaddleDetection and PaddlePaddle:
PaddleDetection version | PaddlePaddle version | tips |
---|---|---|
develop | >= 2.2.2 | Dygraph mode is set as default |
release/2.4 | >= 2.2.2 | Dygraph mode is set as default |
release/2.3 | >= 2.2.0rc | Dygraph mode is set as default |
release/2.2 | >= 2.1.2 | Dygraph mode is set as default |
release/2.1 | >= 2.1.0 | Dygraph mode is set as default |
release/2.0 | >= 2.0.1 | Dygraph mode is set as default |
release/2.0-rc | >= 2.0.1 | -- |
release/0.5 | >= 1.8.4 | Cascade R-CNN and SOLOv2 depends on 2.0.0.rc |
release/0.4 | >= 1.8.4 | PP-YOLO depends on 1.8.4 |
release/0.3 | >=1.7 | -- |
# CUDA10.1
python -m pip install paddlepaddle-gpu==2.2.0.post101 -f https://www.paddlepaddle.org.cn/whl/linux/mkl/avx/stable.html
# CPU
python -m pip install paddlepaddle -i https://mirror.baidu.com/pypi/simple
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
Note: Installing via pip only supports Python3
# Clone PaddleDetection repository
cd <path/to/clone/PaddleDetection>
git clone https://github.com/PaddlePaddle/PaddleDetection.git
# Install other dependencies
cd PaddleDetection
pip install -r requirements.txt
# Compile and install paddledet
python setup.py install
Note
If you are working on Windows OS, pycocotools
installing may failed because of the origin version of cocoapi does not support windows, another version can be used used which only supports Python3:
pip install git+https://github.com/philferriere/cocoapi.git#subdirectory=PythonAPI
If you are using Python <= 3.6, pycocotools
installing may failed with error like distutils.errors.DistutilsError: Could not find suitable distribution for Requirement.parse('cython>=0.27.3')
, please install cython
firstly, for example pip install cython
After installation, make sure the tests pass:
python ppdet/modeling/tests/test_architectures.py
If the tests are passed, the following information will be prompted:
.......
----------------------------------------------------------------------
Ran 7 tests in 12.816s
OK
If you do not have a Docker environment, please refer to Docker. PaddleDetection provides built docker images with latest code. All you have to do is to **pull the docker image **and run the docker image. Then you can enjoy PaddleDetection without any extra action.
Get these images and guidance in docker hub, including CPU, GPU, ROCm environment versions.
If you have some customized requirements about automatic building docker images, you can get it in github repo PaddlePaddle/PaddleCloud.
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_r50vd_dcn_1x_coco.yml -o use_gpu=true weights=https://paddledet.bj.bcebos.com/models/ppyolo_r50vd_dcn_1x_coco.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:
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。