From 535853c205243ebc4d33abf4f2e8174511a792e8 Mon Sep 17 00:00:00 2001 From: chengxianbin Date: Thu, 24 Sep 2020 17:04:52 +0800 Subject: [PATCH] add yolov3_resnet18&yolov3_darknet53&yolov3_darknet53_quant&deepfm hub conf files --- .../official/cv/yolov3_darknet53/README.md | 21 ++++++------ .../cv/yolov3_darknet53/mindspore_hub_conf.py | 22 +++++++++++++ .../cv/yolov3_darknet53_quant/README.md | 3 +- .../mindspore_hub_conf.py | 32 +++++++++++++++++++ .../official/cv/yolov3_resnet18/README.md | 1 + .../cv/yolov3_resnet18/mindspore_hub_conf.py | 23 +++++++++++++ model_zoo/official/recommend/deepfm/README.md | 1 + .../recommend/deepfm/mindspore_hub_conf.py | 26 +++++++++++++++ 8 files changed, 118 insertions(+), 11 deletions(-) create mode 100644 model_zoo/official/cv/yolov3_darknet53/mindspore_hub_conf.py create mode 100644 model_zoo/official/cv/yolov3_darknet53_quant/mindspore_hub_conf.py create mode 100644 model_zoo/official/cv/yolov3_resnet18/mindspore_hub_conf.py create mode 100644 model_zoo/official/recommend/deepfm/mindspore_hub_conf.py diff --git a/model_zoo/official/cv/yolov3_darknet53/README.md b/model_zoo/official/cv/yolov3_darknet53/README.md index c3e4bc1106..36c3742d1f 100644 --- a/model_zoo/official/cv/yolov3_darknet53/README.md +++ b/model_zoo/official/cv/yolov3_darknet53/README.md @@ -112,6 +112,7 @@ sh run_eval.sh dataset/coco2014/ checkpoint/0-319_102400.ckpt . └─yolov3_darknet53 ├─README.md + ├─mindspore_hub_conf.md # config for mindspore hub ├─scripts ├─run_standalone_train.sh # launch standalone training(1p) in ascend ├─run_distribute_train.sh # launch distributed training(8p) in ascend @@ -302,12 +303,12 @@ The above python command will run in the background. You can view the results th ### Evaluation Performance -| Parameters | YOLO |YOLO | -| -------------------------- | ----------------------------------------------------------- |----------------------------------------------------------- | -| Model Version | YOLOv3 |YOLOv3 | -| Resource | Ascend 910; CPU 2.60GHz, 192cores; Memory, 755G | NV SMX2 V100-16G; CPU 2.10GHz, 96cores; Memory, 251G | +| Parameters | YOLO |YOLO | +| -------------------------- | ----------------------------------------------------------- |------------------------------------------------------------ | +| Model Version | YOLOv3 |YOLOv3 | +| Resource | Ascend 910; CPU 2.60GHz, 192cores; Memory, 755G | NV SMX2 V100-16G; CPU 2.10GHz, 96cores; Memory, 251G | | uploaded Date | 06/31/2020 (month/day/year) | 09/02/2020 (month/day/year) | -| MindSpore Version | 0.5.0-alpha | 0.7.0 | +| MindSpore Version | 0.5.0-alpha | 0.7.0 | | Dataset | COCO2014 | COCO2014 | | Training Parameters | epoch=320, batch_size=32, lr=0.001, momentum=0.9 | epoch=320, batch_size=32, lr=0.001, momentum=0.9 | | Optimizer | Momentum | Momentum | @@ -315,7 +316,7 @@ The above python command will run in the background. You can view the results th | outputs | boxes and label | boxes and label | | Loss | 34 | 34 | | Speed | 1pc: 350 ms/step; | 1pc: 600 ms/step; | -| Total time | 8pc: 25 hours | 8pc: 18 hours(shape=416) | +| Total time | 8pc: 18.5 hours | 8pc: 18 hours(shape=416) | | Parameters (M) | 62.1 | 62.1 | | Checkpoint for Fine tuning | 474M (.ckpt file) | 474M (.ckpt file) | | Scripts | https://gitee.com/mindspore/mindspore/tree/master/model_zoo/official/cv/yolov3_darknet53 | https://gitee.com/mindspore/mindspore/tree/master/model_zoo/official/cv/yolov3_darknet53 | @@ -331,15 +332,15 @@ The above python command will run in the background. You can view the results th | MindSpore Version | 0.5.0-alpha | 0.7.0 | | Dataset | COCO2014, 40,504 images | COCO2014, 40,504 images | | batch_size | 1 | 1 | -| outputs | mAP | mAP | +| outputs | mAP | mAP | | Accuracy | 8pcs: 31.1% | 8pcs: 29.7%~30.3% (shape=416)| | Model for inference | 474M (.ckpt file) | 474M (.ckpt file) | # [Description of Random Situation](#contents) -There are random seeds in distributed_sampler.py, transforms.py, yolo_dataset.py files. +There are random seeds in distributed_sampler.py, transforms.py, yolo_dataset.py files. -# [ModelZoo Homepage](#contents) - Please check the official [homepage](https://gitee.com/mindspore/mindspore/tree/master/model_zoo). +# [ModelZoo Homepage](#contents) + Please check the official [homepage](https://gitee.com/mindspore/mindspore/tree/master/model_zoo). diff --git a/model_zoo/official/cv/yolov3_darknet53/mindspore_hub_conf.py b/model_zoo/official/cv/yolov3_darknet53/mindspore_hub_conf.py new file mode 100644 index 0000000000..46901e864c --- /dev/null +++ b/model_zoo/official/cv/yolov3_darknet53/mindspore_hub_conf.py @@ -0,0 +1,22 @@ +# Copyright 2020 Huawei Technologies Co., Ltd +# +# 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. +# ============================================================================ +"""hub config.""" +from src.yolo import YOLOV3DarkNet53 + +def create_network(name, *args, **kwargs): + if name == "yolov3_darknet53": + yolov3_darknet53_net = YOLOV3DarkNet53(is_training=False) + return yolov3_darknet53_net + raise NotImplementedError(f"{name} is not implemented in the repo") diff --git a/model_zoo/official/cv/yolov3_darknet53_quant/README.md b/model_zoo/official/cv/yolov3_darknet53_quant/README.md index 7df42e8e98..21b2e00c9e 100644 --- a/model_zoo/official/cv/yolov3_darknet53_quant/README.md +++ b/model_zoo/official/cv/yolov3_darknet53_quant/README.md @@ -111,6 +111,7 @@ sh run_eval.sh dataset/coco2014/ checkpoint/yolov3_quant.ckpt 0 . └─yolov3_darknet53_quant ├─README.md + ├─mindspore_hub_conf.md # config for mindspore hub ├─scripts ├─run_standalone_train.sh # launch standalone training(1p) in ascend ├─run_distribute_train.sh # launch distributed training(8p) in ascend @@ -284,7 +285,7 @@ Average Recall (AR) @[ IoU=0.50:0.95 | area= large | maxDets=100 ] = 0.558 | outputs | boxes and label | | Loss | 34 | | Speed | 1pc: 135 ms/step; | -| Total time | 8pc: 24.5 hours | +| Total time | 8pc: 23.5 hours | | Parameters (M) | 62.1 | | Checkpoint for Fine tuning | 474M (.ckpt file) | | Scripts | https://gitee.com/mindspore/mindspore/tree/master/model_zoo/official/cv/yolov3_darknet53_quant | diff --git a/model_zoo/official/cv/yolov3_darknet53_quant/mindspore_hub_conf.py b/model_zoo/official/cv/yolov3_darknet53_quant/mindspore_hub_conf.py new file mode 100644 index 0000000000..dfc33f87a6 --- /dev/null +++ b/model_zoo/official/cv/yolov3_darknet53_quant/mindspore_hub_conf.py @@ -0,0 +1,32 @@ +# Copyright 2020 Huawei Technologies Co., Ltd +# +# 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. +# ============================================================================ +"""hub config.""" +from mindspore.train.quant import quant +from src.yolo import YOLOV3DarkNet53 +from src.config import ConfigYOLOV3DarkNet53 + + +def create_network(name, *args, **kwargs): + if name == "yolov3_darknet53_quant": + yolov3_darknet53_quant = YOLOV3DarkNet53(is_training=False) + config = ConfigYOLOV3DarkNet53() + # convert fusion network to quantization aware network + if config.quantization_aware: + yolov3_darknet53_quant = quant.convert_quant_network(yolov3_darknet53_quant, + bn_fold=True, + per_channel=[True, False], + symmetric=[True, False]) + return yolov3_darknet53_quant + raise NotImplementedError(f"{name} is not implemented in the repo") diff --git a/model_zoo/official/cv/yolov3_resnet18/README.md b/model_zoo/official/cv/yolov3_resnet18/README.md index 6eeb60f3a4..c4dbfbf868 100644 --- a/model_zoo/official/cv/yolov3_resnet18/README.md +++ b/model_zoo/official/cv/yolov3_resnet18/README.md @@ -98,6 +98,7 @@ After installing MindSpore via the official website, you can start training and ``` └── cv ├── README.md // descriptions about all the models + ├── mindspore_hub_conf.md // config for mindspore hub └── yolov3_resnet18 ├── README.md // descriptions about yolov3_resnet18 ├── scripts diff --git a/model_zoo/official/cv/yolov3_resnet18/mindspore_hub_conf.py b/model_zoo/official/cv/yolov3_resnet18/mindspore_hub_conf.py new file mode 100644 index 0000000000..f2d9fecfc6 --- /dev/null +++ b/model_zoo/official/cv/yolov3_resnet18/mindspore_hub_conf.py @@ -0,0 +1,23 @@ +# Copyright 2020 Huawei Technologies Co., Ltd +# +# 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. +# ============================================================================ +"""hub config.""" +from src.yolov3 import yolov3_resnet18 +from src.config import ConfigYOLOV3ResNet18 + +def create_network(name, *args, **kwargs): + if name == "yolov3_resnet18": + yolov3_resnet18_net = yolov3_resnet18(ConfigYOLOV3ResNet18()) + return yolov3_resnet18_net + raise NotImplementedError(f"{name} is not implemented in the repo") diff --git a/model_zoo/official/recommend/deepfm/README.md b/model_zoo/official/recommend/deepfm/README.md index 07eed76f80..0fb86dd4ff 100644 --- a/model_zoo/official/recommend/deepfm/README.md +++ b/model_zoo/official/recommend/deepfm/README.md @@ -117,6 +117,7 @@ After installing MindSpore via the official website, you can start training and . └─deepfm ├─README.md + ├─mindspore_hub_conf.md # config for mindspore hub ├─scripts ├─run_standalone_train.sh # launch standalone training(1p) in Ascend or GPU ├─run_distribute_train.sh # launch distributed training(8p) in Ascend diff --git a/model_zoo/official/recommend/deepfm/mindspore_hub_conf.py b/model_zoo/official/recommend/deepfm/mindspore_hub_conf.py new file mode 100644 index 0000000000..c69c9699ff --- /dev/null +++ b/model_zoo/official/recommend/deepfm/mindspore_hub_conf.py @@ -0,0 +1,26 @@ +# Copyright 2020 Huawei Technologies Co., Ltd +# +# 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. +# ============================================================================ +"""hub config.""" +from src.deepfm import ModelBuilder +from src.config import ModelConfig, TrainConfig + +def create_network(name, *args, **kwargs): + if name == 'deepfm': + model_config = ModelConfig() + train_config = TrainConfig() + model_builder = ModelBuilder(model_config, train_config) + _, deepfm_eval_net = model_builder.get_train_eval_net() + return deepfm_eval_net + raise NotImplementedError(f"{name} is not implemented in the repo")