未验证 提交 bacee065 编写于 作者: G Guanghua Yu 提交者: GitHub

Cherry pick fix paddle.enable_static() check_version (#1728)

* update solov2 some detail

* fix check paddle version

* fix version check error

* fix some comment
上级 3f3ce129
......@@ -9,10 +9,14 @@ SOLOv2 (Segmenting Objects by Locations) is a fast instance segmentation framewo
- Performance: `Light-R50-VD-DCN-FPN` model reached 38.6 FPS on single Tesla V100, and mask ap on the COCO-val dataset reached 38.8, which increased inference speed by 24%, mAP increased by 2.4 percentage points.
- Training Time: The training time of the model of `solov2_r50_fpn_1x` on Tesla v100 with 8 GPU is only 10 hours.
<div align="center">
<img src="../../docs/images/instance_segmentation.png" width=800 />
</div>
## Model Zoo
| Backbone | Multi-scale training | Lr schd | V100 FP32(FPS) | Mask AP | Download | Configs |
| Backbone | Multi-scale training | Lr schd | V100 FP32(FPS) | Mask AP<sup>val</sup> | Download | Configs |
| :---------------------: | :-------------------: | :-----: | :------------: | :-----: | :---------: | :------------------------: |
| Mobilenetv3-FPN | True | 3x | 50 | 30.0 | [model](https://paddlemodels.bj.bcebos.com/object_detection/solov2_mobilenetv3_fpn_448_3x.pdparams) | [config](https://github.com/PaddlePaddle/PaddleDetection/tree/master/configs/solov2/solov2_mobilenetv3_fpn_448_3x.yml) |
| R50-FPN | False | 1x | 21.9 | 35.6 | [model](https://paddlemodels.bj.bcebos.com/object_detection/solov2_r50_fpn_1x.pdparams) | [config](https://github.com/PaddlePaddle/PaddleDetection/tree/master/configs/solov2/solov2_r50_fpn_1x.yml) |
......@@ -20,10 +24,14 @@ SOLOv2 (Segmenting Objects by Locations) is a fast instance segmentation framewo
| R101-VD-FPN | True | 3x | 12.1 | 42.6 | [model](https://paddlemodels.bj.bcebos.com/object_detection/solov2_r101_vd_fpn_3x.pdparams) | [config](https://github.com/PaddlePaddle/PaddleDetection/tree/master/configs/solov2/solov2_r101_vd_fpn_3x.yml) |
## Enhanced model
| Backbone | Input size | Lr schd | V100 FP32(FPS) | Mask AP | Download | Configs |
| Backbone | Input size | Lr schd | V100 FP32(FPS) | Mask AP<sup>val</sup> | Download | Configs |
| :---------------------: | :-------------------: | :-----: | :------------: | :-----: | :---------: | :------------------------: |
| Light-R50-VD-DCN-FPN | 512 | 3x | 38.6 | 38.8 | [model](https://paddlemodels.bj.bcebos.com/object_detection/solov2_light_r50_vd_fpn_dcn_512_3x.pdparams) | [config](https://github.com/PaddlePaddle/PaddleDetection/tree/master/configs/solov2/solov2_light_r50_vd_fpn_dcn_512_3x.yml) |
**Notes:**
- SOLOv2 is trained on COCO train2017 dataset and evaluated on val2017 results of `mAP(IoU=0.5:0.95)`.
## Citations
```
@article{wang2020solov2,
......
......@@ -20,8 +20,9 @@ SOLOv2:
ResNet:
depth: 50
feature_maps: [2, 3, 4, 5]
freeze_at: 2
norm_type: bn
freeze_at: 0
freeze_norm: false
norm_type: sync_bn
dcn_v2_stages: [3, 4, 5]
variant: d
lr_mult_list: [0.05, 0.05, 0.1, 0.15]
......
......@@ -35,6 +35,7 @@ import paddle
import paddle.fluid as fluid
from preprocess import preprocess, Resize, Normalize, Permute, PadStride
from visualize import visualize_box_mask
from ppdet.utils.check import enable_static_mode
# Global dictionary
SUPPORT_MODELS = {
......@@ -521,7 +522,7 @@ def main():
if __name__ == '__main__':
paddle.enable_static()
enable_static_mode()
parser = argparse.ArgumentParser(description=__doc__)
parser.add_argument(
"--model_dir",
......
......@@ -24,6 +24,7 @@ if parent_path not in sys.path:
sys.path.append(parent_path)
from ppdet.data.parallel_map import ParallelMap
from ppdet.utils.check import enable_static_mode
class MemorySource(object):
......@@ -146,7 +147,6 @@ class TestDataset(unittest.TestCase):
if __name__ == '__main__':
import paddle
paddle.enable_static()
enable_static_mode()
logging.basicConfig()
unittest.main()
......@@ -27,6 +27,7 @@ from ppdet.utils.download import DATASET_HOME
from ppdet.data.transform.operators import DecodeImage, ResizeImage, Permute
from ppdet.data.transform.batch_operators import PadBatch
from ppdet.utils.check import enable_static_mode
COCO_VAL_URL = 'http://images.cocodataset.org/zips/val2017.zip'
COCO_VAL_MD5SUM = '442b8da7639aecaf257c1dceb8ba8c80'
......@@ -168,6 +169,5 @@ class TestReader(unittest.TestCase):
if __name__ == '__main__':
import paddle
paddle.enable_static()
enable_static_mode()
unittest.main()
......@@ -27,6 +27,7 @@ from ppdet.utils.download import DATASET_HOME
from ppdet.core.workspace import load_config, merge_config
from ppdet.data.reader import create_reader
from ppdet.utils.check import enable_static_mode
COCO_VAL_URL = 'http://images.cocodataset.org/zips/val2017.zip'
COCO_VAL_MD5SUM = '442b8da7639aecaf257c1dceb8ba8c80'
......@@ -112,6 +113,5 @@ class TestReaderYAML(unittest.TestCase):
if __name__ == '__main__':
import paddle
paddle.enable_static()
enable_static_mode()
unittest.main()
......@@ -25,6 +25,7 @@ if parent_path not in sys.path:
sys.path.append(parent_path)
from ppdet.ext_op import cornerpool_lib
from ppdet.utils.check import enable_static_mode
def bottom_pool_np(x):
......@@ -120,6 +121,5 @@ class TestLeftPoolOp(TestRightPoolOp):
if __name__ == "__main__":
import paddle
paddle.enable_static()
enable_static_mode()
unittest.main()
......@@ -71,7 +71,7 @@ class SOLOv2Head(object):
kernel='gaussian',
sigma=2.0).__dict__,
drop_block=False):
check_version('2.0.0')
check_version('2.0.0-rc0')
self.num_classes = num_classes
self.seg_num_grids = num_grids
self.cate_out_channels = self.num_classes - 1
......
......@@ -30,6 +30,7 @@ if parent_path not in sys.path:
from ppdet.modeling.tests.decorator_helper import prog_scope
from ppdet.core.workspace import load_config, merge_config, create
from ppdet.utils.check import enable_static_mode
class TestFasterRCNN(unittest.TestCase):
......@@ -91,5 +92,5 @@ class TestSSD(TestFasterRCNN):
if __name__ == '__main__':
paddle.enable_static()
enable_static_mode()
unittest.main()
......@@ -18,6 +18,7 @@ from __future__ import print_function
import sys
import paddle
import paddle.fluid as fluid
import logging
......@@ -126,3 +127,10 @@ def check_py_func(program):
"if you use MultiClassSoftNMS, better to replace it by "\
"MultiClassNMS.".format(input_arg, output_arg)
raise Exception(err)
def enable_static_mode():
try:
paddle.enable_static()
except:
pass
......@@ -33,7 +33,7 @@ from ppdet.data.reader import create_reader
from ppdet.utils.eval_utils import parse_fetches, eval_results, eval_run
from ppdet.utils.stats import TrainingStats
from ppdet.utils.cli import ArgsParser
from ppdet.utils.check import check_gpu, check_version, check_config
from ppdet.utils.check import check_gpu, check_version, check_config, enable_static_mode
import ppdet.utils.checkpoint as checkpoint
import logging
......@@ -372,7 +372,7 @@ def main():
if __name__ == '__main__':
paddle.enable_static()
enable_static_mode()
parser = ArgsParser()
parser.add_argument(
"-r",
......
......@@ -36,7 +36,7 @@ from ppdet.data.reader import create_reader
from ppdet.utils.eval_utils import parse_fetches, eval_results, eval_run
from ppdet.utils.stats import TrainingStats
from ppdet.utils.cli import ArgsParser
from ppdet.utils.check import check_gpu, check_version, check_config
from ppdet.utils.check import check_gpu, check_version, check_config, enable_static_mode
import ppdet.utils.checkpoint as checkpoint
import logging
......@@ -360,7 +360,7 @@ def main():
if __name__ == '__main__':
paddle.enable_static()
enable_static_mode()
parser = ArgsParser()
parser.add_argument(
"-t",
......
......@@ -38,7 +38,7 @@ from ppdet.utils import dist_utils
from ppdet.utils.eval_utils import parse_fetches, eval_run
from ppdet.utils.stats import TrainingStats
from ppdet.utils.cli import ArgsParser
from ppdet.utils.check import check_gpu, check_version, check_config
from ppdet.utils.check import check_gpu, check_version, check_config, enable_static_mode
import ppdet.utils.checkpoint as checkpoint
from paddleslim.analysis import flops, TableLatencyEvaluator
from paddleslim.nas import SANAS
......@@ -379,7 +379,7 @@ def main():
if __name__ == '__main__':
paddle.enable_static()
enable_static_mode()
parser = ArgsParser()
parser.add_argument(
"-r",
......
......@@ -30,7 +30,7 @@ from paddleslim.analysis import flops
from ppdet.utils.eval_utils import parse_fetches, eval_run, eval_results, json_eval_results
import ppdet.utils.checkpoint as checkpoint
from ppdet.utils.check import check_gpu, check_version, check_config
from ppdet.utils.check import check_gpu, check_version, check_config, enable_static_mode
from ppdet.data.reader import create_reader
......@@ -200,7 +200,7 @@ def main():
if __name__ == '__main__':
paddle.enable_static()
enable_static_mode()
parser = ArgsParser()
parser.add_argument(
"--json_eval",
......
......@@ -29,7 +29,7 @@ from ppdet.core.workspace import load_config, merge_config, create
from ppdet.utils.cli import ArgsParser
import ppdet.utils.checkpoint as checkpoint
from ppdet.utils.export_utils import save_infer_model, dump_infer_config
from ppdet.utils.check import check_config, check_version
from ppdet.utils.check import check_config, check_version, enable_static_mode
from paddleslim.prune import Pruner
from paddleslim.analysis import flops
......@@ -98,7 +98,7 @@ def main():
if __name__ == '__main__':
paddle.enable_static()
enable_static_mode()
parser = ArgsParser()
parser.add_argument(
"--output_dir",
......
......@@ -35,7 +35,7 @@ from ppdet.core.workspace import load_config, merge_config, create
from ppdet.utils.eval_utils import parse_fetches
from ppdet.utils.cli import ArgsParser
from ppdet.utils.check import check_gpu, check_version, check_config
from ppdet.utils.check import check_gpu, check_version, check_config, enable_static_mode
from ppdet.utils.visualizer import visualize_results
import ppdet.utils.checkpoint as checkpoint
......@@ -224,7 +224,7 @@ def main():
if __name__ == '__main__':
paddle.enable_static()
enable_static_mode()
parser = ArgsParser()
parser.add_argument(
"--infer_dir",
......
......@@ -39,7 +39,7 @@ from ppdet.utils import dist_utils
from ppdet.utils.eval_utils import parse_fetches, eval_run, eval_results
from ppdet.utils.stats import TrainingStats
from ppdet.utils.cli import ArgsParser
from ppdet.utils.check import check_gpu, check_version, check_config
from ppdet.utils.check import check_gpu, check_version, check_config, enable_static_mode
import ppdet.utils.checkpoint as checkpoint
import logging
......@@ -348,7 +348,7 @@ def main():
if __name__ == '__main__':
paddle.enable_static()
enable_static_mode()
parser = ArgsParser()
parser.add_argument(
"-r",
......
......@@ -28,7 +28,7 @@ import paddle.fluid as fluid
from ppdet.utils.eval_utils import parse_fetches, eval_run, eval_results, json_eval_results
import ppdet.utils.checkpoint as checkpoint
from ppdet.utils.check import check_gpu, check_version, check_config
from ppdet.utils.check import check_gpu, check_version, check_config, enable_static_mode
from ppdet.data.reader import create_reader
......@@ -157,7 +157,7 @@ def main():
if __name__ == '__main__':
paddle.enable_static()
enable_static_mode()
parser = ArgsParser()
parser.add_argument(
"--json_eval",
......
......@@ -29,7 +29,7 @@ from ppdet.core.workspace import load_config, merge_config, create
from ppdet.utils.cli import ArgsParser
import ppdet.utils.checkpoint as checkpoint
from ppdet.utils.export_utils import save_infer_model, dump_infer_config
from ppdet.utils.check import check_config, check_version
from ppdet.utils.check import check_config, check_version, enable_static_mode
import logging
FORMAT = '%(asctime)s-%(levelname)s: %(message)s'
......@@ -88,7 +88,7 @@ def main():
if __name__ == '__main__':
paddle.enable_static()
enable_static_mode()
parser = ArgsParser()
parser.add_argument(
"--output_dir",
......
......@@ -32,7 +32,7 @@ from paddle import fluid
from ppdet.core.workspace import load_config, merge_config, create
from ppdet.utils.eval_utils import parse_fetches
from ppdet.utils.cli import ArgsParser
from ppdet.utils.check import check_gpu, check_version, check_config
from ppdet.utils.check import check_gpu, check_version, check_config, enable_static_mode
from ppdet.utils.visualizer import visualize_results
import ppdet.utils.checkpoint as checkpoint
......@@ -169,7 +169,7 @@ def main():
if __name__ == '__main__':
paddle.enable_static()
enable_static_mode()
parser = ArgsParser()
parser.add_argument(
"--infer_dir",
......
......@@ -37,7 +37,7 @@ from ppdet.utils import dist_utils
from ppdet.utils.eval_utils import parse_fetches, eval_run, eval_results
from ppdet.utils.stats import TrainingStats
from ppdet.utils.cli import ArgsParser
from ppdet.utils.check import check_gpu, check_version, check_config
from ppdet.utils.check import check_gpu, check_version, check_config, enable_static_mode
import ppdet.utils.checkpoint as checkpoint
from paddleslim.quant import quant_aware, convert
from pact import pact, get_optimizer
......@@ -303,7 +303,7 @@ def main():
if __name__ == '__main__':
paddle.enable_static()
enable_static_mode()
parser = ArgsParser()
parser.add_argument(
"--loss_scale",
......
......@@ -38,7 +38,7 @@ from ppdet.utils import dist_utils
from ppdet.utils.eval_utils import parse_fetches, eval_run, eval_results
from ppdet.utils.stats import TrainingStats
from ppdet.utils.cli import ArgsParser
from ppdet.utils.check import check_gpu, check_version, check_config
from ppdet.utils.check import check_gpu, check_version, check_config, enable_static_mode
import ppdet.utils.checkpoint as checkpoint
from paddleslim.prune import sensitivity
import logging
......@@ -168,7 +168,7 @@ def main():
if __name__ == '__main__':
paddle.enable_static()
enable_static_mode()
parser = ArgsParser()
parser.add_argument(
"--output_eval",
......
......@@ -27,7 +27,7 @@ import paddle.fluid as fluid
from ppdet.utils.eval_utils import parse_fetches, eval_run, eval_results, json_eval_results
import ppdet.utils.checkpoint as checkpoint
from ppdet.utils.check import check_gpu, check_version, check_config
from ppdet.utils.check import check_gpu, check_version, check_config, enable_static_mode
from ppdet.data.reader import create_reader
......@@ -162,7 +162,7 @@ def main():
if __name__ == '__main__':
paddle.enable_static()
enable_static_mode()
parser = ArgsParser()
parser.add_argument(
"--json_eval",
......
......@@ -30,7 +30,7 @@ from ppdet.core.workspace import load_config, merge_config, create
from ppdet.utils.cli import ArgsParser
import ppdet.utils.checkpoint as checkpoint
from ppdet.utils.export_utils import save_infer_model, dump_infer_config
from ppdet.utils.check import check_config, check_version, check_py_func
from ppdet.utils.check import check_config, check_version, check_py_func, enable_static_mode
import logging
FORMAT = '%(asctime)s-%(levelname)s: %(message)s'
logging.basicConfig(level=logging.INFO, format=FORMAT)
......@@ -72,7 +72,7 @@ def main():
if __name__ == '__main__':
paddle.enable_static()
enable_static_mode()
parser = ArgsParser()
parser.add_argument(
"--output_dir",
......
......@@ -27,7 +27,7 @@ from paddle import fluid
from ppdet.core.workspace import load_config, merge_config, create
from ppdet.utils.cli import ArgsParser
from ppdet.utils.check import check_config, check_version
from ppdet.utils.check import check_config, check_version, enable_static_mode
import ppdet.utils.checkpoint as checkpoint
import yaml
import logging
......@@ -95,7 +95,7 @@ def main():
if __name__ == '__main__':
paddle.enable_static()
enable_static_mode()
parser = ArgsParser()
parser.add_argument(
"--output_dir",
......
......@@ -31,7 +31,7 @@ from collections import OrderedDict
import ppdet.utils.checkpoint as checkpoint
from ppdet.utils.cli import ArgsParser
from ppdet.utils.check import check_gpu, check_version, check_config
from ppdet.utils.check import check_gpu, check_version, check_config, enable_static_mode
from ppdet.utils.widerface_eval_utils import get_shrink, bbox_vote, \
save_widerface_bboxes, save_fddb_bboxes, to_chw_bgr
from ppdet.core.workspace import load_config, merge_config, create
......@@ -271,7 +271,7 @@ def main():
if __name__ == '__main__':
paddle.enable_static()
enable_static_mode()
parser = ArgsParser()
parser.add_argument(
"-f",
......
......@@ -34,7 +34,7 @@ from ppdet.core.workspace import load_config, merge_config, create
from ppdet.utils.eval_utils import parse_fetches
from ppdet.utils.cli import ArgsParser
from ppdet.utils.check import check_gpu, check_version, check_config
from ppdet.utils.check import check_gpu, check_version, check_config, enable_static_mode
from ppdet.utils.visualizer import visualize_results
import ppdet.utils.checkpoint as checkpoint
......@@ -234,7 +234,7 @@ def main():
if __name__ == '__main__':
paddle.enable_static()
enable_static_mode()
parser = ArgsParser()
parser.add_argument(
"--infer_dir",
......
......@@ -43,7 +43,7 @@ from ppdet.utils import dist_utils
from ppdet.utils.eval_utils import parse_fetches, eval_run, eval_results
from ppdet.utils.stats import TrainingStats
from ppdet.utils.cli import ArgsParser
from ppdet.utils.check import check_gpu, check_version, check_config
from ppdet.utils.check import check_gpu, check_version, check_config, enable_static_mode
import ppdet.utils.checkpoint as checkpoint
import logging
......@@ -317,7 +317,7 @@ def main():
if __name__ == '__main__':
paddle.enable_static()
enable_static_mode()
parser = ArgsParser()
parser.add_argument(
"-r",
......
......@@ -43,7 +43,7 @@ from ppdet.utils import dist_utils
from ppdet.utils.eval_utils import parse_fetches, eval_run, eval_results
from ppdet.utils.stats import TrainingStats
from ppdet.utils.cli import ArgsParser
from ppdet.utils.check import check_gpu, check_version, check_config
from ppdet.utils.check import check_gpu, check_version, check_config, enable_static_mode
import ppdet.utils.checkpoint as checkpoint
from paddle.fluid.incubate.fleet.collective import fleet, DistributedStrategy # new line 1
......@@ -310,7 +310,7 @@ def main():
if __name__ == '__main__':
paddle.enable_static()
enable_static_mode()
parser = ArgsParser()
parser.add_argument(
"-r",
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册