未验证 提交 f9abb9e3 编写于 作者: K Kaipeng Deng 提交者: GitHub

[cherry pick] update 2.0.1 (#2755)

* update 2.0.1
上级 fd08355b
......@@ -70,8 +70,8 @@ PaddleDetection can be installed in the following two ways:
**Note:** Installing via pip only supports Python3
```
# install paddledet via pip
pip install paddledet==2.0.0 -i https://pypi.tuna.tsinghua.edu.cn/simple
# Install paddledet via pip
pip install paddledet==2.0.1 -i https://mirror.baidu.com/pypi/simple
# Download and use the configuration files and code examples in the source code
git clone https://github.com/PaddlePaddle/PaddleDetection.git
......@@ -85,17 +85,18 @@ cd PaddleDetection
cd <path/to/clone/PaddleDetection>
git clone https://github.com/PaddlePaddle/PaddleDetection.git
# Compile and install paddledet
cd PaddleDetection
python setup.py install
# 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:
1. 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```
......@@ -108,10 +109,10 @@ 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)
Ran 5 tests in 4.280s
OK
```
## Inference demo
......@@ -121,7 +122,7 @@ OK (skipped=2)
```
# 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
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/ppyolo.pdparams --infer_img=demo/000000014439.jpg
```
An image of the same name with the predicted result will be generated under the `output` folder.
......
......@@ -66,7 +66,7 @@ python -c "import paddle; print(paddle.__version__)"
```
# pip安装paddledet
pip install paddledet==2.0.0 -i https://pypi.tuna.tsinghua.edu.cn/simple
pip install paddledet==2.0.1 -i https://mirror.baidu.com/pypi/simple
# 下载使用源码中的配置文件和代码示例
git clone https://github.com/PaddlePaddle/PaddleDetection.git
......@@ -80,17 +80,18 @@ cd PaddleDetection
cd <path/to/clone/PaddleDetection>
git clone https://github.com/PaddlePaddle/PaddleDetection.git
# 编译安装paddledet
cd PaddleDetection
python setup.py install
# 安装其他依赖
pip install -r requirements.txt
# 安装PaddleDetection
cd PaddleDetection
python setup.py install
```
**注意**
1. 由于原版cocoapi不支持windows,采用第三方实现版本,该版本仅支持Python3
1. 若您使用的是Windows系统,由于原版cocoapi不支持Windows,`pycocotools`依赖可能安装失败,可采用第三方实现版本,该版本仅支持Python3
```pip install git+https://github.com/philferriere/cocoapi.git#subdirectory=PythonAPI```
......@@ -104,10 +105,10 @@ python ppdet/modeling/tests/test_architectures.py
测试通过后会提示如下信息:
```
..........
.....
----------------------------------------------------------------------
Ran 12 tests in 2.480s
OK (skipped=2)
Ran 5 tests in 4.280s
OK
```
## 快速体验
......@@ -117,7 +118,7 @@ OK (skipped=2)
```
# 在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
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/ppyolo.pdparams --infer_img=demo/000000014439.jpg
```
会在`output`文件夹下生成一个画有预测结果的同名图像。
......
......@@ -68,11 +68,11 @@ def list_model(filters=[]):
# models and configs save on bcebos under dygraph directory
def get_config_file(model_name):
return get_config_path("ppdet://dygraph/configs/{}.yml".format(model_name))
return get_config_path("ppdet://configs/{}.yml".format(model_name))
def get_weights_url(model_name):
return "ppdet://dygraph/{}.pdparams".format(model_name)
return "ppdet://models/{}.pdparams".format(osp.split(model_name)[-1])
def get_model(model_name, pretrained=True):
......
# Copyright (c) 2021 PaddlePaddle Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import unittest
import ppdet
class TestFasterRCNN(unittest.TestCase):
def setUp(self):
self.set_config()
def set_config(self):
self.cfg_file = 'configs/faster_rcnn/faster_rcnn_r50_fpn_1x_coco.yml'
def test_trainer(self):
# Trainer __init__ will build model and DataLoader
# 'train' and 'eval' mode include dataset loading
# use 'test' mode to simplify tests
cfg = ppdet.core.workspace.load_config(self.cfg_file)
trainer = ppdet.engine.Trainer(cfg, mode='test')
class TestMaskRCNN(TestFasterRCNN):
def set_config(self):
self.cfg_file = 'configs/mask_rcnn/mask_rcnn_r50_fpn_1x_coco.yml'
class TestCascadeRCNN(TestFasterRCNN):
def set_config(self):
self.cfg_file = 'configs/cascade_rcnn/cascade_rcnn_r50_fpn_1x_coco.yml'
class TestYolov3(TestFasterRCNN):
def set_config(self):
self.cfg_file = 'configs/yolov3/yolov3_darknet53_270e_coco.yml'
class TestSSD(TestFasterRCNN):
def set_config(self):
self.cfg_file = 'configs/ssd/ssd_vgg16_300_240e_voc.yml'
if __name__ == '__main__':
unittest.main()
......@@ -260,7 +260,8 @@ def get_path(url, root_dir, md5sum=None, check_exist=True):
fullpath = osp.join(osp.split(fullpath)[0], v)
if osp.exists(fullpath) and check_exist:
if _check_exist_file_md5(fullpath, md5sum, url):
if not osp.isfile(fullpath) or \
_check_exist_file_md5(fullpath, md5sum, url):
logger.debug("Found {}".format(fullpath))
return fullpath, True
else:
......
......@@ -42,7 +42,7 @@ def package_model_zoo():
# exclude dataset base config
if osp.split(osp.split(cfg)[0])[1] not in ['datasets']:
valid_cfgs.append(cfg)
model_names = [osp.splitext(osp.split(cfg)[1])[0] for cfg in valid_cfgs]
model_names = [osp.relpath(cfg, cfg_dir).replace(".yml", "") for cfg in valid_cfgs]
model_zoo_file = osp.join(cur_dir, 'ppdet', 'model_zoo', 'MODEL_ZOO')
with open(model_zoo_file, 'w') as wf:
......@@ -70,7 +70,7 @@ if __name__ == "__main__":
packages=find_packages(exclude=("configs", "tools", "deploy")),
package_data={'ppdet.model_zoo': package_model_zoo()},
author='PaddlePaddle',
version='2.0.0',
version='2.0.1',
install_requires=parse_requirements('./requirements.txt'),
description='Object detection and instance segmentation toolkit based on PaddlePaddle',
long_description=readme(),
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册