diff --git a/docs/tutorials/INSTALL.md b/docs/tutorials/INSTALL.md index 15aee6a9956da2ec307c1d693f019b7dab21c36c..db09adaadf1482fd0413644e9e2bbb1ee43a2559 100644 --- a/docs/tutorials/INSTALL.md +++ b/docs/tutorials/INSTALL.md @@ -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 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. diff --git a/docs/tutorials/INSTALL_cn.md b/docs/tutorials/INSTALL_cn.md index 1c557b76d0d51e21d99bd87689e37aecaf7b43a4..e51a1091d63a1ce66092bb90e7cf8a5dfa1941a2 100644 --- a/docs/tutorials/INSTALL_cn.md +++ b/docs/tutorials/INSTALL_cn.md @@ -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 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`文件夹下生成一个画有预测结果的同名图像。 diff --git a/ppdet/model_zoo/model_zoo.py b/ppdet/model_zoo/model_zoo.py index 0f7f2446760139b609ba92c589cc45f284fdc638..17af46f7970a46ab889d332c59e9e7a06de7bdbe 100644 --- a/ppdet/model_zoo/model_zoo.py +++ b/ppdet/model_zoo/model_zoo.py @@ -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): diff --git a/ppdet/modeling/tests/test_architectures.py b/ppdet/modeling/tests/test_architectures.py new file mode 100644 index 0000000000000000000000000000000000000000..95cb212037fd8bfb44b5037e1117241b721d7358 --- /dev/null +++ b/ppdet/modeling/tests/test_architectures.py @@ -0,0 +1,59 @@ +# 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() diff --git a/ppdet/utils/download.py b/ppdet/utils/download.py index 9e983efa6465eb0adf3fd0cd725a3f0495933111..99635c75f3af96eb266cbf0545eb4b312648a6e1 100644 --- a/ppdet/utils/download.py +++ b/ppdet/utils/download.py @@ -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: diff --git a/setup.py b/setup.py index 23cdb590e41be1b479bc0658995aadd44ff486ae..c2d03ade3a24a14c878032ce428cfb85c51473fd 100644 --- a/setup.py +++ b/setup.py @@ -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(),