forked from mindspore-Ecosystem/mindspore
fix readme error
This commit is contained in:
parent
29db53c2ba
commit
dbb1e51a8e
|
@ -22,7 +22,6 @@
|
|||
- [Inference Performance](#inference-performance)
|
||||
- [ModelZoo Homepage](#modelzoo-homepage)
|
||||
|
||||
|
||||
# [CenterFace Description](#contents)
|
||||
|
||||
CenterFace is a practical anchor-free face detection and alignment method for edge devices, we support training and evaluation on Ascend910.
|
||||
|
@ -47,7 +46,8 @@ Dataset support: [WiderFace] or datasetd with the same format as WiderFace
|
|||
Annotation support: [WiderFace] or annotation as the same format as WiderFace
|
||||
|
||||
- The directory structure is as follows, the name of directory and file is user define:
|
||||
```
|
||||
|
||||
```path
|
||||
├── dataset
|
||||
├── centerface
|
||||
├── annotations
|
||||
|
@ -69,24 +69,26 @@ Annotation support: [WiderFace] or annotation as the same format as WiderFace
|
|||
├─ ...
|
||||
└─xxx.mat
|
||||
```
|
||||
|
||||
we suggest user to use WiderFace dataset to experience our model,
|
||||
other datasets need to use the same format as WiderFace.
|
||||
|
||||
# [Environment Requirements](#contents)
|
||||
|
||||
- Hardware(Ascend)
|
||||
- Prepare hardware environment with Ascend processor. If you want to try Ascend, please send the [application form](https://obs-9be7.obs.cn-east-2.myhuaweicloud.com/file/other/Ascend%20Model%20Zoo%E4%BD%93%E9%AA%8C%E8%B5%84%E6%BA%90%E7%94%B3%E8%AF%B7%E8%A1%A8.docx) to ascend@huawei.com. Once approved, you can get the resources.
|
||||
- Prepare hardware environment with Ascend processor. If you want to try Ascend, please send the [application form](https://obs-9be7.obs.cn-east-2.myhuaweicloud.com/file/other/Ascend%20Model%20Zoo%E4%BD%93%E9%AA%8C%E8%B5%84%E6%BA%90%E7%94%B3%E8%AF%B7%E8%A1%A8.docx) to ascend@huawei.com. Once approved, you can get the resources.
|
||||
- Framework
|
||||
- [MindSpore](https://cmc-szv.clouddragon.huawei.com/cmcversion/index/search?searchKey=Do-MindSpore%20V100R001C00B622)
|
||||
- [MindSpore](https://cmc-szv.clouddragon.huawei.com/cmcversion/index/search?searchKey=Do-MindSpore%20V100R001C00B622)
|
||||
- For more information, please check the resources below:
|
||||
- [MindSpore tutorials](https://www.mindspore.cn/tutorial/zh-CN/master/index.html)
|
||||
- [MindSpore API](https://www.mindspore.cn/api/zh-CN/master/index.html)
|
||||
- [MindSpore tutorials](https://www.mindspore.cn/tutorial/zh-CN/master/index.html)
|
||||
- [MindSpore API](https://www.mindspore.cn/api/zh-CN/master/index.html)
|
||||
|
||||
# [Quick Start](#contents)
|
||||
|
||||
After installing MindSpore via the official website, you can start training and evaluation as follows:
|
||||
|
||||
step1: prepare pretrained model: train a mobilenet_v2 model by mindspore or use the script below:
|
||||
|
||||
```python
|
||||
#CenterFace need a pretrained mobilenet_v2 model:
|
||||
# mobilenet_v2_key.ckpt is a model with all value zero, we need the key/cell/module name for this model.
|
||||
|
@ -96,14 +98,18 @@ step1: prepare pretrained model: train a mobilenet_v2 model by mindspore or use
|
|||
# --pytorch: same as official pytorch model(e.g., official mobilenet_v2-b0353104.pth)
|
||||
python torch_to_ms_mobilenetv2.py --ckpt_fn=./mobilenet_v2_key.ckpt --pt_fn=./mobilenet_v2-b0353104.pth --out_ckpt_fn=./mobilenet_v2.ckpt
|
||||
```
|
||||
|
||||
step2: prepare user rank_table
|
||||
|
||||
```python
|
||||
# user can use your own rank table file
|
||||
# or use the [hccl_tools](https://gitee.com/mindspore/mindspore/tree/master/model_zoo/utils/hccl_tools) to generate rank table file
|
||||
# e.g., python hccl_tools.py --device_num "[0,8)"
|
||||
python hccl_tools.py --device_num "[0,8)"
|
||||
```
|
||||
|
||||
step3: train
|
||||
|
||||
```python
|
||||
cd scripts;
|
||||
# prepare data_path, use symbolic link
|
||||
|
@ -113,6 +119,7 @@ ls ./dataset/centerface # data path
|
|||
ls ./dataset/centerface/annotations/train.json # annot_path
|
||||
ls ./dataset/centerface/images/train/images # img_dir
|
||||
```
|
||||
|
||||
```python
|
||||
# enter script dir, train CenterFace
|
||||
sh train_distribute.sh
|
||||
|
@ -120,7 +127,9 @@ sh train_distribute.sh
|
|||
mkdir ./model
|
||||
cp device0/outputs/*/*.ckpt ./model # cp model to [MODEL_PATH]
|
||||
```
|
||||
|
||||
step4: test
|
||||
|
||||
```python
|
||||
# test CenterFace preparing
|
||||
cd ../dependency/centernet/src/lib/external;
|
||||
|
@ -136,11 +145,14 @@ mkdir ./output/centerface
|
|||
ls ./dataset/images/val/images/ # data path
|
||||
ls ./dataset/centerface/ground_truth/val.mat # annot_path
|
||||
```
|
||||
|
||||
```python
|
||||
# test CenterFace
|
||||
sh test_distribute.sh
|
||||
```
|
||||
|
||||
step5: eval
|
||||
|
||||
```python
|
||||
# after test, eval CenterFace, get MAP
|
||||
# cd ../dependency/evaluate;
|
||||
|
@ -153,7 +165,7 @@ sh eval_all.sh
|
|||
|
||||
## [Script and Sample Code](#contents)
|
||||
|
||||
```
|
||||
```path
|
||||
├── cv
|
||||
├── centerface
|
||||
├── train.py // training scripts
|
||||
|
@ -208,9 +220,12 @@ sh eval_all.sh
|
|||
```
|
||||
|
||||
## [Script Parameters](#contents)
|
||||
|
||||
1. train scripts parameters
|
||||
|
||||
the command is: python train.py [train parameters]
|
||||
Major parameters train.py as follows:
|
||||
|
||||
```python
|
||||
--lr: learning rate
|
||||
--per_batch_size: batch size on each device
|
||||
|
@ -228,11 +243,14 @@ Major parameters train.py as follows:
|
|||
--annot_path: annotations path
|
||||
--img_dir: img dir in data_dir
|
||||
```
|
||||
|
||||
2. centerface unique configs: in config.py; not recommend user to change
|
||||
|
||||
3. test scripts parameters:
|
||||
|
||||
the command is: python test.py [test parameters]
|
||||
Major parameters test.py as follows:
|
||||
|
||||
```python
|
||||
test_script_path: test.py path;
|
||||
--is_distributed: multi-device or not
|
||||
|
@ -254,8 +272,10 @@ test_script_path: test.py path;
|
|||
```
|
||||
|
||||
4. eval scripts parameters:
|
||||
|
||||
the command is: python eval.py [pred] [gt]
|
||||
Major parameters eval.py as follows:
|
||||
|
||||
```python
|
||||
--pred: pred path, test output test.py->[--save_dir]
|
||||
--gt: ground truth path
|
||||
|
@ -270,18 +290,24 @@ Major parameters eval.py as follows:
|
|||
--task_set_core: task_set core number, most time = cpu number/nproc_per_node
|
||||
|
||||
step1: user need train a mobilenet_v2 model by mindspore or use the script below:
|
||||
|
||||
```python
|
||||
python torch_to_ms_mobilenetv2.py --ckpt_fn=./mobilenet_v2_key.ckpt --pt_fn=./mobilenet_v2-b0353104.pth --out_ckpt_fn=./mobilenet_v2.ckpt
|
||||
```
|
||||
|
||||
step2: prepare user rank_table
|
||||
|
||||
```python
|
||||
# user can use your own rank table file
|
||||
# or use the [hccl_tools](https://gitee.com/mindspore/mindspore/tree/master/model_zoo/utils/hccl_tools) to generate rank table file
|
||||
# e.g., python hccl_tools.py --device_num "[0,8)"
|
||||
python hccl_tools.py --device_num "[0,8)"
|
||||
```
|
||||
|
||||
step3: train
|
||||
|
||||
- Single device
|
||||
|
||||
```python
|
||||
# enter script dir, train CenterFace
|
||||
cd scripts
|
||||
|
@ -297,7 +323,9 @@ sh train_standalone.sh [USE_DEVICE_ID] [PRETRAINED_BACKBONE] [DATASET] [ANNOTATI
|
|||
# after training
|
||||
cp device0/outputs/*/*.ckpt [MODEL_PATH]
|
||||
```
|
||||
|
||||
- multi-device (recommended)
|
||||
|
||||
```python
|
||||
# enter script dir, train CenterFace
|
||||
cd scripts;
|
||||
|
@ -309,7 +337,9 @@ sh train_distribute.sh [RANK_TABLE] [PRETRAINED_BACKBONE] [DATASET] [ANNOTATIONS
|
|||
# after training
|
||||
cp device0/outputs/*/*.ckpt [MODEL_PATH]
|
||||
```
|
||||
|
||||
After training with 8 device, the loss value will be achieved as follows:
|
||||
|
||||
```python
|
||||
# grep "loss is " device0/xxx.log
|
||||
# epoch: 1 step: 1, loss is greater than 500 and less than 5000
|
||||
|
@ -329,6 +359,7 @@ After training with 8 device, the loss value will be achieved as follows:
|
|||
2020-09-24 20:19:16,748:INFO:==========end epoch===============
|
||||
2020-09-24 20:19:16,748:INFO:==========end training===============
|
||||
```
|
||||
|
||||
The model checkpoint will be saved in the scripts/device0/output/xxx/xxx.ckpt
|
||||
|
||||
## [Testing Process](#contents)
|
||||
|
@ -344,7 +375,9 @@ make;
|
|||
cd ../../../scripts;
|
||||
mkdir [SAVE_PATH]
|
||||
```
|
||||
|
||||
1. test a single ckpt file
|
||||
|
||||
```python
|
||||
# you need to change the parameter in test.sh
|
||||
# or use symbolic link as quick start
|
||||
|
@ -357,7 +390,9 @@ mkdir [SAVE_PATH]
|
|||
# CKPT: test model name
|
||||
sh test.sh [MODEL_PATH] [DATASET] [GROUND_TRUTH_MAT] [SAVE_PATH] [DEVICE_ID] [CKPT]
|
||||
```
|
||||
|
||||
2. test many out ckpt for user to choose the best one
|
||||
|
||||
```python
|
||||
# you need to change the parameter in test.sh
|
||||
# or use symbolic link as quick start
|
||||
|
@ -368,14 +403,17 @@ sh test.sh [MODEL_PATH] [DATASET] [GROUND_TRUTH_MAT] [SAVE_PATH] [DEVICE_ID] [CK
|
|||
# END: end loop number, used to calculate last epoch number
|
||||
sh test_distribute.sh [MODEL_PATH] [DATASET] [GROUND_TRUTH_MAT] [SAVE_PATH] [DEVICE_NUM] [STEPS_PER_EPOCH] [START] [END]
|
||||
```
|
||||
|
||||
After testing, you can find many txt file save the box information and scores,
|
||||
open it you can see:
|
||||
|
||||
```python
|
||||
646.3 189.1 42.1 51.8 0.747 # left top hight weight score
|
||||
157.4 408.6 43.1 54.1 0.667
|
||||
120.3 212.4 38.7 42.8 0.650
|
||||
...
|
||||
```
|
||||
|
||||
## [Evaluation Process](#contents)
|
||||
|
||||
### Evaluation
|
||||
|
@ -386,19 +424,25 @@ cd ../dependency/evaluate;
|
|||
python setup.py install;
|
||||
cd ../../../scripts;
|
||||
```
|
||||
|
||||
1. eval a single testing output
|
||||
|
||||
```python
|
||||
# you need to change the parameter in eval.sh
|
||||
# default eval the ckpt saved in ./scripts/output/centerface/999
|
||||
sh eval.sh
|
||||
```
|
||||
|
||||
2. eval many testing output for user to choose the best one
|
||||
|
||||
```python
|
||||
# you need to change the parameter in eval_all.sh
|
||||
# default eval the ckpt saved in ./scripts/output/centerface/[89-140]
|
||||
sh eval_all.sh
|
||||
```
|
||||
|
||||
3. test+eval
|
||||
|
||||
```python
|
||||
# you need to change the parameter in test_and_eval.sh
|
||||
# or use symbolic link as quick start, default eval the ckpt saved in ./scripts/output/centerface/999
|
||||
|
@ -406,8 +450,10 @@ sh eval_all.sh
|
|||
# GROUND_TRUTH_PATH: ground truth path
|
||||
sh test_and_eval.sh [MODEL_PATH] [DATASET] [GROUND_TRUTH_MAT] [SAVE_PATH] [CKPT] [GROUND_TRUTH_PATH]
|
||||
```
|
||||
|
||||
you can see the MAP below by eval.sh
|
||||
```
|
||||
|
||||
```log
|
||||
(ci3.7) [root@bms-aiserver scripts]# ./eval.sh
|
||||
start eval
|
||||
==================== Results = ==================== ./scripts/output/centerface/999
|
||||
|
@ -419,7 +465,8 @@ end eval
|
|||
```
|
||||
|
||||
you can see the MAP below by eval_all.sh
|
||||
```
|
||||
|
||||
```log
|
||||
(ci3.7) [root@bms-aiserver scripts]# ./eval_all.sh
|
||||
==================== Results = ==================== ./scripts/output/centerface/89
|
||||
Easy Val AP: 0.8884892849068273
|
||||
|
@ -447,9 +494,11 @@ Medium Val AP: 0.9170429723233877
|
|||
Hard Val AP: 0.7822182013830674
|
||||
=================================================
|
||||
```
|
||||
|
||||
## [Convert Process](#contents)
|
||||
|
||||
### Convert
|
||||
|
||||
If you want to infer the network on Ascend 310, you should convert the model to AIR:
|
||||
|
||||
```python
|
||||
|
@ -461,6 +510,7 @@ python export.py [BATCH_SIZE] [PRETRAINED_BACKBONE]
|
|||
## [Performance](#contents)
|
||||
|
||||
### Evaluation Performance
|
||||
|
||||
CenterFace on 13K images(The annotation and data format must be the same as widerFace)
|
||||
|
||||
| Parameters | CenterFace |
|
||||
|
@ -477,9 +527,10 @@ CenterFace on 13K images(The annotation and data format must be the same as wide
|
|||
| Speed | 1p 65 img/s, 8p 475 img/s |
|
||||
| Total time | train(8p) 1.1h, test 50min, eval 5-10min |
|
||||
| Checkpoint for Fine tuning | 22M (.ckpt file) |
|
||||
| Scripts | https://gitee.com/mindspore/mindspore/tree/master/model_zoo/official/cv/centerface |
|
||||
| Scripts | <https://gitee.com/mindspore/mindspore/tree/master/model_zoo/official/cv/centerface> |
|
||||
|
||||
### Inference Performance
|
||||
|
||||
CenterFace on 3.2K images(The annotation and data format must be the same as widerFace)
|
||||
|
||||
| Parameters | CenterFace |
|
||||
|
@ -499,4 +550,5 @@ In dataset.py, we set the seed inside ```create_dataset``` function.
|
|||
In var_init.py, we set seed for weight initilization
|
||||
|
||||
# [ModelZoo Homepage](#contents)
|
||||
|
||||
Please check the official [homepage](https://gitee.com/mindspore/mindspore/tree/master/model_zoo).
|
|
@ -111,7 +111,8 @@ export PYTHONPATH=${dirname_path}:$PYTHONPATH
|
|||
export RANK_TABLE_FILE=$rank_table
|
||||
export RANK_SIZE=8
|
||||
|
||||
task_set_core=24 # for taskset, task_set_core=total cpu number/RANK_SIZE
|
||||
cpus=`cat /proc/cpuinfo | grep "processor" | wc -l`
|
||||
task_set_core=`expr $cpus \/ $RANK_SIZE` # for taskset, task_set_core=total cpu number/RANK_SIZE
|
||||
echo 'start training'
|
||||
for((i=0;i<=$RANK_SIZE-1;i++));
|
||||
do
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
- [Model Architecture](#model-architecture)
|
||||
- [Dataset](#dataset)
|
||||
- [Environment Requirements](#environment-requirements)
|
||||
- [Quick Start](#quick-start)
|
||||
- [Quick Start](#quick-start)
|
||||
- [Script Description](#script-description)
|
||||
- [Script and Sample Code](#script-and-sample-code)
|
||||
- [Training Process](#training-process)
|
||||
|
@ -16,11 +16,11 @@
|
|||
- [Model Description](#model-description)
|
||||
- [Performance](#performance)
|
||||
- [Evaluation Performance](#evaluation-performance)
|
||||
- [Inference Performance](#evaluation-performance)
|
||||
- [Inference Performance](#inference-performance)
|
||||
- [ModelZoo Homepage](#modelzoo-homepage)
|
||||
|
||||
# FasterRcnn Description
|
||||
|
||||
|
||||
Before FasterRcnn, the target detection networks rely on the region proposal algorithm to assume the location of targets, such as SPPnet and Fast R-CNN. Progress has reduced the running time of these detection networks, but it also reveals that the calculation of the region proposal is a bottleneck.
|
||||
|
||||
FasterRcnn proposed that convolution feature maps based on region detectors (such as Fast R-CNN) can also be used to generate region proposals. At the top of these convolution features, a Region Proposal Network (RPN) is constructed by adding some additional convolution layers (which share the convolution characteristics of the entire image with the detection network, thus making it possible to make regions almost costlessProposal), outputting both region bounds and objectness score for each location.Therefore, RPN is a full convolutional network (FCN), which can be trained end-to-end, generate high-quality region proposals, and then fed into Fast R-CNN for detection.
|
||||
|
@ -35,14 +35,14 @@ FasterRcnn is a two-stage target detection network,This network uses a region pr
|
|||
|
||||
Note that you can run the scripts based on the dataset mentioned in original paper or widely used in relevant domain/network architecture. In the following sections, we will introduce how to run the scripts using the related dataset below.
|
||||
|
||||
Dataset used: [COCO2017](<https://cocodataset.org/>)
|
||||
Dataset used: [COCO2017](<https://cocodataset.org/>)
|
||||
|
||||
- Dataset size:19G
|
||||
- Train:18G,118000 images
|
||||
- Val:1G,5000 images
|
||||
- Annotations:241M,instances,captions,person_keypoints etc
|
||||
- Train:18G,118000 images
|
||||
- Val:1G,5000 images
|
||||
- Annotations:241M,instances,captions,person_keypoints etc
|
||||
- Data format:image and json files
|
||||
- Note:Data will be processed in dataset.py
|
||||
- Note:Data will be processed in dataset.py
|
||||
|
||||
# Environment Requirements
|
||||
|
||||
|
@ -55,17 +55,17 @@ Dataset used: [COCO2017](<https://cocodataset.org/>)
|
|||
1. If coco dataset is used. **Select dataset to coco when run script.**
|
||||
Install Cython and pycocotool, and you can also install mmcv to process data.
|
||||
|
||||
```
|
||||
```pip
|
||||
pip install Cython
|
||||
|
||||
pip install pycocotools
|
||||
|
||||
pip install mmcv==0.2.14
|
||||
```
|
||||
|
||||
And change the COCO_ROOT and other settings you need in `config.py`. The directory structure is as follows:
|
||||
|
||||
|
||||
```
|
||||
```path
|
||||
.
|
||||
└─cocodataset
|
||||
├─annotations
|
||||
|
@ -73,27 +73,27 @@ Dataset used: [COCO2017](<https://cocodataset.org/>)
|
|||
└─instance_val2017.json
|
||||
├─val2017
|
||||
└─train2017
|
||||
|
||||
|
||||
```
|
||||
|
||||
2. If your own dataset is used. **Select dataset to other when run script.**
|
||||
Organize the dataset infomation into a TXT file, each row in the file is as follows:
|
||||
|
||||
```
|
||||
```log
|
||||
train2017/0000001.jpg 0,259,401,459,7 35,28,324,201,2 0,30,59,80,2
|
||||
```
|
||||
|
||||
Each row is an image annotation which split by space, the first column is a relative path of image, the others are box and class infomations of the format [xmin,ymin,xmax,ymax,class]. We read image from an image path joined by the `IMAGE_DIR`(dataset directory) and the relative path in `ANNO_PATH`(the TXT file path), `IMAGE_DIR` and `ANNO_PATH` are setting in `config.py`.
|
||||
Each row is an image annotation which split by space, the first column is a relative path of image, the others are box and class infomations of the format [xmin,ymin,xmax,ymax,class]. We read image from an image path joined by the `IMAGE_DIR`(dataset directory) and the relative path in `ANNO_PATH`(the TXT file path), `IMAGE_DIR` and `ANNO_PATH` are setting in `config.py`.
|
||||
|
||||
# Quick Start
|
||||
|
||||
After installing MindSpore via the official website, you can start training and evaluation as follows:
|
||||
After installing MindSpore via the official website, you can start training and evaluation as follows:
|
||||
|
||||
Note: 1.the first run will generate the mindeocrd file, which will take a long time.
|
||||
2.pretrained model is a resnet50 checkpoint that trained over ImageNet2012.
|
||||
3.VALIDATION_JSON_FILE is label file. CHECKPOINT_PATH is a checkpoint file after trained.
|
||||
3.VALIDATION_JSON_FILE is label file. CHECKPOINT_PATH is a checkpoint file after trained.
|
||||
|
||||
```
|
||||
```shell
|
||||
# standalone training
|
||||
sh run_standalone_train_ascend.sh [PRETRAINED_MODEL]
|
||||
|
||||
|
@ -110,7 +110,7 @@ sh run_eval_ascend.sh [VALIDATION_JSON_FILE] [CHECKPOINT_PATH]
|
|||
|
||||
```shell
|
||||
.
|
||||
└─faster_rcnn
|
||||
└─faster_rcnn
|
||||
├─README.md // descriptions about fasterrcnn
|
||||
├─scripts
|
||||
├─run_standalone_train_ascend.sh // shell script for standalone on ascend
|
||||
|
@ -139,27 +139,26 @@ sh run_eval_ascend.sh [VALIDATION_JSON_FILE] [CHECKPOINT_PATH]
|
|||
```
|
||||
|
||||
## Training Process
|
||||
|
||||
|
||||
### Usage
|
||||
|
||||
```
|
||||
```shell
|
||||
# standalone training on ascend
|
||||
sh run_standalone_train_ascend.sh [PRETRAINED_MODEL]
|
||||
|
||||
# distributed training on ascend
|
||||
sh run_distribute_train_ascend.sh [RANK_TABLE_FILE] [PRETRAINED_MODEL]
|
||||
```
|
||||
|
||||
|
||||
> Rank_table.json which is specified by RANK_TABLE_FILE is needed when you are running a distribute task. You can generate it by using the [hccl_tools](https://gitee.com/mindspore/mindspore/tree/master/model_zoo/utils/hccl_tools).
|
||||
> As for PRETRAINED_MODEL,it should be a ResNet50 checkpoint that trained over ImageNet2012. Ready-made pretrained_models are not available now. Stay tuned.
|
||||
> The original dataset path needs to be in the config.py,you can select "coco_root" or "image_dir".
|
||||
|
||||
### Result
|
||||
|
||||
|
||||
Training result will be stored in the example path, whose folder name begins with "train" or "train_parallel". You can find checkpoint file together with result like the followings in loss_rankid.log.
|
||||
|
||||
|
||||
```
|
||||
```log
|
||||
# distribute training result(8p)
|
||||
epoch: 1 step: 7393, rpn_loss: 0.12054, rcnn_loss: 0.40601, rpn_cls_loss: 0.04025, rpn_reg_loss: 0.08032, rcnn_cls_loss: 0.25854, rcnn_reg_loss: 0.14746, total_loss: 0.52655
|
||||
epoch: 2 step: 7393, rpn_loss: 0.06561, rcnn_loss: 0.50293, rpn_cls_loss: 0.02587, rpn_reg_loss: 0.03967, rcnn_cls_loss: 0.35669, rcnn_reg_loss: 0.14624, total_loss: 0.56854
|
||||
|
@ -173,19 +172,19 @@ epoch: 12 step: 7393, rpn_loss: 0.00691, rcnn_loss: 0.10168, rpn_cls_loss: 0.005
|
|||
## Evaluation Process
|
||||
|
||||
### Usage
|
||||
|
||||
```
|
||||
|
||||
```shell
|
||||
# eval on ascend
|
||||
sh run_eval_ascend.sh [VALIDATION_JSON_FILE] [CHECKPOINT_PATH]
|
||||
```
|
||||
|
||||
|
||||
> checkpoint can be produced in training process.
|
||||
|
||||
### Result
|
||||
|
||||
|
||||
Eval result will be stored in the example path, whose folder name is "eval". Under this, you can find result like the followings in log.
|
||||
|
||||
```
|
||||
|
||||
```log
|
||||
Average Precision (AP) @[ IoU=0.50:0.95 | area= all | maxDets=100 ] = 0.360
|
||||
Average Precision (AP) @[ IoU=0.50 | area= all | maxDets=100 ] = 0.586
|
||||
Average Precision (AP) @[ IoU=0.75 | area= all | maxDets=100 ] = 0.385
|
||||
|
@ -200,13 +199,13 @@ Eval result will be stored in the example path, whose folder name is "eval". Und
|
|||
Average Recall (AR) @[ IoU=0.50:0.95 | area= large | maxDets=100 ] = 0.631
|
||||
```
|
||||
|
||||
|
||||
# Model Description
|
||||
|
||||
## Performance
|
||||
|
||||
### Training Performance
|
||||
### Evaluation Performance
|
||||
|
||||
| Parameters | FasterRcnn |
|
||||
| Parameters | Ascend |
|
||||
| -------------------------- | ----------------------------------------------------------- |
|
||||
| Model Version | V1 |
|
||||
| Resource | Ascend 910 ;CPU 2.60GHz,192cores;Memory,755G |
|
||||
|
@ -219,12 +218,11 @@ Eval result will be stored in the example path, whose folder name is "eval". Und
|
|||
| Speed | 1pc: 190 ms/step; 8pcs: 200 ms/step |
|
||||
| Total time | 1pc: 37.17 hours; 8pcs: 4.89 hours |
|
||||
| Parameters (M) | 250 |
|
||||
| Scripts | [fasterrcnn script](https://gitee.com/mindspore/mindspore/tree/r1.0/model_zoo/official/cv/faster_rcnn) |
|
||||
| Scripts | [fasterrcnn script](https://gitee.com/mindspore/mindspore/tree/master/model_zoo/official/cv/faster_rcnn) |
|
||||
|
||||
### Inference Performance
|
||||
|
||||
### Evaluation Performance
|
||||
|
||||
| Parameters | FasterRcnn |
|
||||
| Parameters | Ascend |
|
||||
| ------------------- | --------------------------- |
|
||||
| Model Version | V1 |
|
||||
| Resource | Ascend 910 |
|
||||
|
@ -237,5 +235,5 @@ Eval result will be stored in the example path, whose folder name is "eval". Und
|
|||
| Model for inference | 250M (.ckpt file) |
|
||||
|
||||
# [ModelZoo Homepage](#contents)
|
||||
Please check the official [homepage](https://gitee.com/mindspore/mindspore/tree/master/model_zoo).
|
||||
|
||||
|
||||
Please check the official [homepage](https://gitee.com/mindspore/mindspore/tree/master/model_zoo).
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
# 目录
|
||||
<!-- TOC -->
|
||||
|
||||
- [目录](#目录)
|
||||
- [Faster R-CNN描述](#faster-r-cnn描述)
|
||||
|
@ -40,11 +39,11 @@ Faster R-CNN是一个两阶段目标检测网络,该网络采用RPN,可以
|
|||
使用的数据集:[COCO 2017](<https://cocodataset.org/>)
|
||||
|
||||
- 数据集大小:19G
|
||||
- 训练集:18G,118,000个图像
|
||||
- 验证集:1G,5000个图像
|
||||
- 标注集:241M,实例,字幕,person_keypoints等
|
||||
- 训练集:18G,118,000个图像
|
||||
- 验证集:1G,5000个图像
|
||||
- 标注集:241M,实例,字幕,person_keypoints等
|
||||
- 数据格式:图像和json文件
|
||||
- 注意:数据在dataset.py中处理。
|
||||
- 注意:数据在dataset.py中处理。
|
||||
|
||||
# 环境要求
|
||||
|
||||
|
@ -57,17 +56,17 @@ Faster R-CNN是一个两阶段目标检测网络,该网络采用RPN,可以
|
|||
1. 若使用COCO数据集,**执行脚本时选择数据集COCO。**
|
||||
安装Cython和pycocotool,也可以安装mmcv进行数据处理。
|
||||
|
||||
```
|
||||
```python
|
||||
pip install Cython
|
||||
|
||||
pip install pycocotools
|
||||
|
||||
pip install mmcv==0.2.14
|
||||
```
|
||||
|
||||
在`config.py`中更改COCO_ROOT和其他您需要的设置。目录结构如下:
|
||||
|
||||
|
||||
```
|
||||
```path
|
||||
.
|
||||
└─cocodataset
|
||||
├─annotations
|
||||
|
@ -75,13 +74,13 @@ Faster R-CNN是一个两阶段目标检测网络,该网络采用RPN,可以
|
|||
└─instance_val2017.json
|
||||
├─val2017
|
||||
└─train2017
|
||||
|
||||
|
||||
```
|
||||
|
||||
2. 若使用自己的数据集,**执行脚本时选择数据集为other。**
|
||||
将数据集信息整理成TXT文件,每行内容如下:
|
||||
|
||||
```
|
||||
```txt
|
||||
train2017/0000001.jpg 0,259,401,459,7 35,28,324,201,2 0,30,59,80,2
|
||||
```
|
||||
|
||||
|
@ -89,13 +88,15 @@ Faster R-CNN是一个两阶段目标检测网络,该网络采用RPN,可以
|
|||
|
||||
# 快速入门
|
||||
|
||||
通过官方网站安装MindSpore后,您可以按照如下步骤进行训练和评估:
|
||||
通过官方网站安装MindSpore后,您可以按照如下步骤进行训练和评估:
|
||||
|
||||
注意:1. 第一次运行生成MindRecord文件,耗时较长。
|
||||
2. 预训练模型是在ImageNet2012上训练的ResNet-50检查点。
|
||||
3. VALIDATION_JSON_FILE为标签文件。CHECKPOINT_PATH是训练后的检查点文件。
|
||||
注意:
|
||||
|
||||
```
|
||||
1. 第一次运行生成MindRecord文件,耗时较长。
|
||||
2. 预训练模型是在ImageNet2012上训练的ResNet-50检查点。
|
||||
3. VALIDATION_JSON_FILE为标签文件。CHECKPOINT_PATH是训练后的检查点文件。
|
||||
|
||||
```shell
|
||||
# 单机训练
|
||||
sh run_standalone_train_ascend.sh [PRETRAINED_MODEL]
|
||||
|
||||
|
@ -112,7 +113,7 @@ sh run_eval_ascend.sh [VALIDATION_JSON_FILE] [CHECKPOINT_PATH]
|
|||
|
||||
```shell
|
||||
.
|
||||
└─faster_rcnn
|
||||
└─faster_rcnn
|
||||
├─README.md // Faster R-CNN相关说明
|
||||
├─scripts
|
||||
├─run_standalone_train_ascend.sh // Ascend单机shell脚本
|
||||
|
@ -144,14 +145,14 @@ sh run_eval_ascend.sh [VALIDATION_JSON_FILE] [CHECKPOINT_PATH]
|
|||
|
||||
### 用法
|
||||
|
||||
```
|
||||
```shell
|
||||
# Ascend单机训练
|
||||
sh run_standalone_train_ascend.sh [PRETRAINED_MODEL]
|
||||
|
||||
# Ascend分布式训练
|
||||
sh run_distribute_train_ascend.sh [RANK_TABLE_FILE] [PRETRAINED_MODEL]
|
||||
```
|
||||
|
||||
|
||||
> 运行分布式任务时需要用到RANK_TABLE_FILE指定的rank_table.json。您可以使用[hccl_tools](https://gitee.com/mindspore/mindspore/tree/master/model_zoo/utils/hccl_tools)生成该文件。
|
||||
> PRETRAINED_MODEL应该是在ImageNet 2012上训练的ResNet-50检查点。现成的pretrained_models目前不可用。敬请期待。
|
||||
> config.py中包含原数据集路径,可以选择“coco_root”或“image_dir”。
|
||||
|
@ -160,8 +161,7 @@ sh run_distribute_train_ascend.sh [RANK_TABLE_FILE] [PRETRAINED_MODEL]
|
|||
|
||||
训练结果保存在示例路径中,文件夹名称以“train”或“train_parallel”开头。您可以在loss_rankid.log中找到检查点文件以及结果,如下所示。
|
||||
|
||||
|
||||
```
|
||||
```log
|
||||
# 分布式训练结果(8P)
|
||||
epoch: 1 step: 7393, rpn_loss: 0.12054, rcnn_loss: 0.40601, rpn_cls_loss: 0.04025, rpn_reg_loss: 0.08032, rcnn_cls_loss: 0.25854, rcnn_reg_loss: 0.14746, total_loss: 0.52655
|
||||
epoch: 2 step: 7393, rpn_loss: 0.06561, rcnn_loss: 0.50293, rpn_cls_loss: 0.02587, rpn_reg_loss: 0.03967, rcnn_cls_loss: 0.35669, rcnn_reg_loss: 0.14624, total_loss: 0.56854
|
||||
|
@ -176,7 +176,7 @@ epoch: 12 step: 7393, rpn_loss: 0.00691, rcnn_loss: 0.10168, rpn_cls_loss: 0.005
|
|||
|
||||
### 用法
|
||||
|
||||
```
|
||||
```shell
|
||||
# Ascend评估
|
||||
sh run_eval_ascend.sh [VALIDATION_JSON_FILE] [CHECKPOINT_PATH]
|
||||
```
|
||||
|
@ -187,7 +187,7 @@ sh run_eval_ascend.sh [VALIDATION_JSON_FILE] [CHECKPOINT_PATH]
|
|||
|
||||
评估结果将保存在示例路径中,文件夹名为“eval”。在此文件夹下,您可以在日志中找到类似以下的结果。
|
||||
|
||||
```
|
||||
```log
|
||||
Average Precision (AP) @[ IoU=0.50:0.95 | area= all | maxDets=100 ] = 0.360
|
||||
Average Precision (AP) @[ IoU=0.50 | area= all | maxDets=100 ] = 0.586
|
||||
Average Precision (AP) @[ IoU=0.75 | area= all | maxDets=100 ] = 0.385
|
||||
|
@ -208,7 +208,7 @@ sh run_eval_ascend.sh [VALIDATION_JSON_FILE] [CHECKPOINT_PATH]
|
|||
|
||||
### 训练性能
|
||||
|
||||
| 参数 | Faster R-CNN |
|
||||
| 参数 |Ascend |
|
||||
| -------------------------- | ----------------------------------------------------------- |
|
||||
| 模型版本 | V1 |
|
||||
| 资源 | Ascend 910;CPU 2.60GHz,192核;内存:755G |
|
||||
|
@ -221,11 +221,11 @@ sh run_eval_ascend.sh [VALIDATION_JSON_FILE] [CHECKPOINT_PATH]
|
|||
| 速度 | 1卡:190毫秒/步;8卡:200毫秒/步 |
|
||||
| 总时间 | 1卡:37.17小时;8卡:4.89小时 |
|
||||
| 参数(M) | 250 |
|
||||
| 脚本 | [Faster R-CNN脚本](https://gitee.com/mindspore/mindspore/tree/r1.0/model_zoo/office/cv/faster_rcnn) |
|
||||
| 脚本 | [Faster R-CNN脚本](https://gitee.com/mindspore/mindspore/tree/master/model_zoo/office/cv/faster_rcnn) |
|
||||
|
||||
### 评估性能
|
||||
|
||||
| 参数 | Faster R-CNN |
|
||||
| 参数 | Ascend |
|
||||
| ------------------- | --------------------------- |
|
||||
| 模型版本 | V1 |
|
||||
| 资源 | Ascend 910 |
|
||||
|
@ -238,4 +238,5 @@ sh run_eval_ascend.sh [VALIDATION_JSON_FILE] [CHECKPOINT_PATH]
|
|||
| 推理模型 | 250M(.ckpt文件) |
|
||||
|
||||
# ModelZoo主页
|
||||
|
||||
请浏览官网[主页](https://gitee.com/mindspore/mindspore/tree/master/model_zoo)。
|
||||
|
|
|
@ -52,14 +52,14 @@ Dataset used: [ImageNet2012](http://www.image-net.org/)
|
|||
└─validation_preprocess # evaluate dataset
|
||||
```
|
||||
|
||||
## [Features]
|
||||
## Features
|
||||
|
||||
### [Mixed Precision(Ascend)]
|
||||
### Mixed Precision(Ascend)
|
||||
|
||||
The [mixed precision](https://www.mindspore.cn/tutorial/training/en/master/advanced_use/enable_mixed_precision.html) training method accelerates the deep learning neural network training process by using both the single-precision and half-precision data formats, and maintains the network precision achieved by the single-precision training at the same time. Mixed precision training can accelerate the computation process, reduce memory usage, and enable a larger model or batch size to be trained on specific hardware.
|
||||
For FP16 operators, if the input data type is FP32, the backend of MindSpore will automatically handle it with reduced precision. Users could check the reduced-precision operators by enabling INFO log and then searching ‘reduce precision’.
|
||||
|
||||
## [Environment Requirements]
|
||||
## Environment Requirements
|
||||
|
||||
- Hardware(Ascend)
|
||||
- Prepare hardware environment with Ascend. If you want to try Ascend, please send the [application form](https://obs-9be7.obs.cn-east-2.myhuaweicloud.com/file/other/Ascend%20Model%20Zoo%E4%BD%93%E9%AA%8C%E8%B5%84%E6%BA%90%E7%94%B3%E8%AF%B7%E8%A1%A8.docx) to ascend@huawei.com. Once approved, you can get the resources.
|
||||
|
@ -69,9 +69,9 @@ For FP16 operators, if the input data type is FP32, the backend of MindSpore wil
|
|||
- [MindSpore Tutorials](https://www.mindspore.cn/tutorial/training/en/master/index.html)
|
||||
- [MindSpore Python API](https://www.mindspore.cn/doc/api_python/en/master/index.html)
|
||||
|
||||
## [Script description]
|
||||
## Script description
|
||||
|
||||
### [Script and sample code]
|
||||
### Script and sample code
|
||||
|
||||
```python
|
||||
├── MobileNetV1
|
||||
|
@ -153,7 +153,7 @@ Inference result will be stored in the example path, you can find result like th
|
|||
result: {'top_5_accuracy': 0.9010016025641026, 'top_1_accuracy': 0.7128004807692307} ckpt=./train_parallel0/ckpt_0/mobilenetv1-90_1251.ckpt
|
||||
```
|
||||
|
||||
## [Model description]
|
||||
## Model description
|
||||
|
||||
### [Performance](#contents)
|
||||
|
||||
|
|
|
@ -148,7 +148,6 @@ sh scripts/run_eval_for_gpu.sh 0 /dataset/val ./checkpoint/nasnet-a-mobile-rank0
|
|||
### 结果
|
||||
|
||||
评估结果保存在脚本路径下。路径下的日志中,可以找到如下结果:
|
||||
|
||||
acc=73.5%(TOP1)
|
||||
|
||||
# 模型描述
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
# 目录
|
||||
<!-- TOC -->
|
||||
|
||||
- [目录](#目录)
|
||||
- [PSENet概述](#psenet概述)
|
||||
|
@ -9,56 +8,60 @@
|
|||
- [环境要求](#环境要求)
|
||||
- [快速入门](#快速入门)
|
||||
- [脚本说明](#脚本说明)
|
||||
- [脚本和样例代码](#脚本和样例代码)
|
||||
- [脚本参数](#脚本参数)
|
||||
- [训练过程](#训练过程)
|
||||
- [分布式训练](#分布式训练)
|
||||
- [评估过程](#评估过程)
|
||||
- [运行测试代码](#运行测试代码)
|
||||
- [ICDAR2015评估脚本](#icdar2015评估脚本)
|
||||
- [用法](#用法)
|
||||
- [结果](#结果)
|
||||
- [脚本和样例代码](#脚本和样例代码)
|
||||
- [脚本参数](#脚本参数)
|
||||
- [训练过程](#训练过程)
|
||||
- [分布式训练](#分布式训练)
|
||||
- [评估过程](#评估过程)
|
||||
- [运行测试代码](#运行测试代码)
|
||||
- [ICDAR2015评估脚本](#icdar2015评估脚本)
|
||||
- [用法](#用法)
|
||||
- [结果](#结果)
|
||||
- [模型描述](#模型描述)
|
||||
- [性能](#性能)
|
||||
- [评估性能](#评估性能)
|
||||
- [推理性能](#推理性能)
|
||||
- [使用方法](#使用方法)
|
||||
- [推理](#推理)
|
||||
- [使用方法](#使用方法)
|
||||
- [推理](#推理)
|
||||
|
||||
<!-- /TOC -->
|
||||
|
||||
|
||||
# PSENet概述
|
||||
随着卷积神经网络的发展,场景文本检测技术迅速发展,但其算法中存在的两大问题阻碍了这一技术的应用:第一,现有的大多数算法都需要四边形边框来精确定位任意形状的文本;第二,两个相邻文本可能会因错误检测而被覆盖。传统意义上,语义分割可以解决第一个问题,但无法解决第二个问题。而PSENet能够精确地检测出任意形状文本实例,同时解决了两个问题。具体地说,PSENet为每个文本实例生成不同的扩展内核,并逐渐将最小扩展内核扩展为具有完整形状的文本实例。由于最小内核之间的几何差别较大,PSNet可以有效分割封闭的文本实例,更容易地检测任意形状文本实例。通过在CTW1500、全文、ICDAR 2015和ICDAR 2017 MLT中进行多次实验,PSENet的有效性得以验证。
|
||||
|
||||
随着卷积神经网络的发展,场景文本检测技术迅速发展,但其算法中存在的两大问题阻碍了这一技术的应用:第一,现有的大多数算法都需要四边形边框来精确定位任意形状的文本;第二,两个相邻文本可能会因错误检测而被覆盖。传统意义上,语义分割可以解决第一个问题,但无法解决第二个问题。而PSENet能够精确地检测出任意形状文本实例,同时解决了两个问题。具体地说,PSENet为每个文本实例生成不同的扩展内核,并逐渐将最小扩展内核扩展为具有完整形状的文本实例。由于最小内核之间的几何差别较大,PSNet可以有效分割封闭的文本实例,更容易地检测任意形状文本实例。通过在CTW1500、全文、ICDAR 2015和ICDAR 2017 MLT中进行多次实验,PSENet的有效性得以验证。
|
||||
|
||||
[论文](https://openaccess.thecvf.com/content_CVPR_2019/html/Wang_Shape_Robust_Text_Detection_With_Progressive_Scale_Expansion_Network_CVPR_2019_paper.html): Wenhai Wang, Enze Xie, Xiang Li, Wenbo Hou, Tong Lu, Gang Yu, Shuai Shao; Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR), 2019, pp. 9336-9345
|
||||
|
||||
# PSENet示例
|
||||
|
||||
## 概述
|
||||
|
||||
渐进尺度扩展网络(PSENet)是一种能够很好地检测自然场景中任意形状文本的文本检测器。
|
||||
|
||||
# 数据集
|
||||
|
||||
使用的数据集:[ICDAR2015](https://rrc.cvc.uab.es/?ch=4&com=tasks#TextLocalization)
|
||||
训练集:包括约4500个可读单词的1000张图像。
|
||||
测试集:约2000个可读单词。
|
||||
|
||||
|
||||
|
||||
# 环境要求
|
||||
|
||||
- 硬件:昇腾处理器(Ascend)
|
||||
- 使用Ascend处理器来搭建硬件环境。如需试用昇腾处理器,请发送[申请表](https://obs-9be7.obs.cn-east-2.myhuaweicloud.com/file/other/Ascend%20Model%20Zoo%E4%BD %93%E9%AA%8C%E8%B5%84%E6%BA%90%E7%94%B3%E8%AF%B7%E8%A1%A8.docx)至ascend@huawei.com,审核通过即可获得资源。
|
||||
- 使用Ascend处理器来搭建硬件环境。如需试用昇腾处理器,请发送[申请表](https://obs-9be7.obs.cn-east-2.myhuaweicloud.com/file/other/Ascend%20Model%20Zoo%E4%BD%93%E9%AA%8C%E8%B5%84%E6%BA%90%E7%94%B3%E8%AF%B7%E8%A1%A8.docx)至ascend@huawei.com,审核通过即可获得资源。
|
||||
|
||||
- 框架
|
||||
- [MindSpore](https://www.mindspore.cn/install)
|
||||
- [MindSpore](https://www.mindspore.cn/install)
|
||||
- 如需查看详情,请参见如下资源:
|
||||
- [MindSpore教程](https://www.mindspore.cn/tutory/training/en/master/index.html)
|
||||
- [MindSpore Python API](https://www.mindspore.cn/doc/api_python/zh-CN/master/index.html)
|
||||
- [MindSpore教程](https://www.mindspore.cn/tutory/training/en/master/index.html)
|
||||
- [MindSpore Python API](https://www.mindspore.cn/doc/api_python/zh-CN/master/index.html)
|
||||
- 安装Mindspore
|
||||
- 安装[pyblind11](https://github.com/pybind/pybind11)
|
||||
- 安装[Opencv3.4](https://docs.opencv.org/3.4.9/d7/d9f/tutory_linux_install.html)
|
||||
|
||||
# 快速入门
|
||||
通过官方网站安装MindSpore后,您可以按照如下步骤进行培训和评估:
|
||||
|
||||
通过官方网站安装MindSpore后,您可以按照如下步骤进行培训和评估:
|
||||
|
||||
```python
|
||||
# 分布式训练运行示例
|
||||
sh scripts/run_distribute_train.sh pretrained_model.ckpt
|
||||
|
@ -86,32 +89,33 @@ sh scripts/run_eval_ascend.sh
|
|||
## 脚本说明
|
||||
|
||||
## 脚本和样例代码
|
||||
```
|
||||
|
||||
```path
|
||||
└── PSENet
|
||||
├── README.md // PSENet相关描述
|
||||
├── scripts
|
||||
├── run_distribute_train.sh // 用于分布式训练的shell脚本
|
||||
└── run_eval_ascend.sh // 用于评估的shell脚本
|
||||
├──src
|
||||
├── __init__.py
|
||||
├── README.md // PSENet相关描述
|
||||
├── scripts
|
||||
├── run_distribute_train.sh // 用于分布式训练的shell脚本
|
||||
└── run_eval_ascend.sh // 用于评估的shell脚本
|
||||
├──src
|
||||
├── __init__.py
|
||||
├── generate_hccn_file.py // 创建rank.json文件
|
||||
├── ETSNET
|
||||
├── __init__.py
|
||||
├── base.py // 卷积和BN算子
|
||||
├── dice_loss.py // 计算PSENet损耗值
|
||||
├── etsnet.py // PSENet中的子网
|
||||
├── fpn.py // PSENet中的子网
|
||||
├── resnet50.py // PSENet中的子网
|
||||
├── pse // PSENet中的子网
|
||||
├── ETSNET
|
||||
├── __init__.py
|
||||
├── base.py // 卷积和BN算子
|
||||
├── dice_loss.py // 计算PSENet损耗值
|
||||
├── etsnet.py // PSENet中的子网
|
||||
├── fpn.py // PSENet中的子网
|
||||
├── resnet50.py // PSENet中的子网
|
||||
├── pse // PSENet中的子网
|
||||
├── __init__.py
|
||||
├── adaptor.cpp
|
||||
├── adaptor.h
|
||||
├── Makefile
|
||||
├──config.py // 参数配置
|
||||
├──dataset.py // 创建数据集
|
||||
├──network_define.py // PSENet架构
|
||||
├──test.py // 测试脚本
|
||||
├──train.py // 训练脚本
|
||||
├──config.py // 参数配置
|
||||
├──dataset.py // 创建数据集
|
||||
├──network_define.py // PSENet架构
|
||||
├──test.py // 测试脚本
|
||||
├──train.py // 训练脚本
|
||||
|
||||
```
|
||||
|
||||
|
@ -120,24 +124,24 @@ sh scripts/run_eval_ascend.sh
|
|||
```python
|
||||
train.py和config.py中主要参数如下:
|
||||
|
||||
-- pre_trained:是从零开始训练还是基于预训练模型训练。可选值为True、False。
|
||||
-- pre_trained:是从零开始训练还是基于预训练模型训练。可选值为True、False。
|
||||
-- device_id:用于训练或评估数据集的设备ID。当使用train.sh进行分布式训练时,忽略此参数。
|
||||
-- device_num:使用train.sh进行分布式训练时使用的设备。
|
||||
|
||||
```
|
||||
|
||||
|
||||
## 训练过程
|
||||
|
||||
### 分布式训练
|
||||
```
|
||||
|
||||
```shell
|
||||
sh scripts/run_distribute_train.sh pretrained_model.ckpt
|
||||
```
|
||||
|
||||
上述shell脚本将在后台运行分布训练。可以通过`device[X]/test_*.log`文件查看结果。
|
||||
上述shell脚本将在后台运行分布训练。可以通过`device[X]/test_*.log`文件查看结果。
|
||||
采用以下方式达到损失值:
|
||||
|
||||
```
|
||||
```log
|
||||
# grep "epoch:" device_*/loss.log
|
||||
device_0/log:epoch: 1, step: 20,loss is 0.80383
|
||||
device_0/log:epcoh: 2, step: 40,loss is 0.77951
|
||||
|
@ -148,25 +152,32 @@ device_1/log:epcoh: 2, step: 40,loss is 0.76629
|
|||
```
|
||||
|
||||
## 评估过程
|
||||
|
||||
### 运行测试代码
|
||||
|
||||
python test.py --ckpt=./device*/ckpt*/ETSNet-*.ckpt
|
||||
|
||||
### ICDAR2015评估脚本
|
||||
|
||||
#### 用法
|
||||
+ 第一步:单击[此处](https://rrc.cvc.uab.es/?ch=4&com=tasks#TextLocalization)下载评估方法。
|
||||
+ 第二步:单击"我的方法"按钮,下载评估脚本。
|
||||
+ 第三步:建议将评估方法根符号链接到$MINDSPORE/model_zoo/psenet/eval_ic15/。如果您的文件夹结构不同,您可能需要更改评估脚本文件中的相应路径。
|
||||
```
|
||||
|
||||
第一步:单击[此处](https://rrc.cvc.uab.es/?ch=4&com=tasks#TextLocalization)下载评估方法。
|
||||
第二步:单击"我的方法"按钮,下载评估脚本。
|
||||
第三步:建议将评估方法根符号链接到$MINDSPORE/model_zoo/psenet/eval_ic15/。如果您的文件夹结构不同,您可能需要更改评估脚本文件中的相应路径。
|
||||
|
||||
```shell
|
||||
sh ./script/run_eval_ascend.sh.sh
|
||||
```
|
||||
|
||||
#### 结果
|
||||
|
||||
Calculated!{"precision": 0.8147966668299853,"recall":0.8006740491092923,"hmean":0.8076736279747451,"AP":0}
|
||||
|
||||
|
||||
# 模型描述
|
||||
|
||||
## 性能
|
||||
|
||||
### 评估性能
|
||||
### 评估性能
|
||||
|
||||
| 参数 | PSENet |
|
||||
| -------------------------- | ----------------------------------------------------------- |
|
||||
|
@ -184,8 +195,7 @@ Calculated!{"precision": 0.8147966668299853,"recall":0.8006740491092923,"h
|
|||
| 总时间 | 1卡:75.48小时;4卡:18.87小时|
|
||||
| 参数(M) | 27.36 |
|
||||
| 微调检查点 | 109.44M (.ckpt file) |
|
||||
| 脚本 | https://gitee.com/mindspore/mindspore/tree/master/model_zoo/psenet |
|
||||
|
||||
| 脚本 | <https://gitee.com/mindspore/mindspore/tree/master/model_zoo/psenet> |
|
||||
|
||||
### 推理性能
|
||||
|
||||
|
@ -205,11 +215,11 @@ Calculated!{"precision": 0.8147966668299853,"recall":0.8006740491092923,"h
|
|||
|
||||
如果您需要使用已训练模型在GPU、Ascend 910、Ascend 310等多个硬件平台上进行推理,可参考[此处](https://www.mindspore.cn/tutory/training/en/master/advanced_use/migrate_3rd_scripts.html)。操作示例如下:
|
||||
|
||||
```
|
||||
```python
|
||||
# 加载未知数据集进行推理
|
||||
dataset = dataset.create_dataset(cfg.data_path, 1, False)
|
||||
|
||||
# 定义模型
|
||||
# 定义模型
|
||||
config.INFERENCE = False
|
||||
net = ETSNet(config)
|
||||
net = net.set_train()
|
||||
|
@ -245,4 +255,3 @@ net.set_train(False)
|
|||
acc = model.eval(dataset)
|
||||
print("accuracy: ", acc)
|
||||
```
|
||||
|
||||
|
|
Loading…
Reference in New Issue