change sh in modelzoo readme to bash
This commit is contained in:
parent
32e4d2971b
commit
be6bc6fa42
|
|
@ -183,7 +183,7 @@ Dataset used:
|
|||
- build mindrecord training data
|
||||
|
||||
```python
|
||||
sh build_data.sh
|
||||
bash build_data.sh
|
||||
or
|
||||
python src/data/build_seg_data.py --data_root=/home/sun/data/Mindspore/benchmark_RELEASE/dataset \
|
||||
--data_lst=/home/sun/data/Mindspore/benchmark_RELEASE/dataset/trainaug.txt \
|
||||
|
|
@ -205,10 +205,10 @@ Dataset used:
|
|||
# Ascend单卡训练示例
|
||||
python train.py --device_id device_id
|
||||
or
|
||||
sh scripts/run_standalone_train.sh [DEVICE_ID]
|
||||
bash scripts/run_standalone_train.sh [DEVICE_ID]
|
||||
|
||||
#Ascend八卡并行训练
|
||||
sh scripts/run_train.sh [DEVICE_NUM] rank_table.json
|
||||
bash scripts/run_train.sh [DEVICE_NUM] rank_table.json
|
||||
```
|
||||
|
||||
- running on GPU with gpu default parameters
|
||||
|
|
@ -219,7 +219,7 @@ Dataset used:
|
|||
--config_path=gpu_default_config.yaml \
|
||||
--device_target=GPU
|
||||
or
|
||||
sh scripts/run_standalone_train_gpu.sh DEVICE_ID
|
||||
bash scripts/run_standalone_train_gpu.sh DEVICE_ID
|
||||
|
||||
# GPU八卡训练示例
|
||||
export RANK_SIZE=8
|
||||
|
|
@ -228,7 +228,7 @@ Dataset used:
|
|||
--config_path=gpu_default_config.yaml \
|
||||
--device_target=GPU
|
||||
or
|
||||
sh run_distribute_train_gpu.sh [RANK_SIZE] [TRAIN_DATA_DIR]
|
||||
bash run_distribute_train_gpu.sh [RANK_SIZE] [TRAIN_DATA_DIR]
|
||||
|
||||
# GPU评估示例
|
||||
python eval.py \
|
||||
|
|
@ -333,7 +333,7 @@ Dataset used:
|
|||
```
|
||||
|
||||
```shell 评估
|
||||
sh scripts/run_eval.sh DATA_ROOT DATA_LST CKPT_PATH
|
||||
bash scripts/run_eval.sh DATA_ROOT DATA_LST CKPT_PATH
|
||||
```
|
||||
|
||||
以上的python命令会在终端上运行,你可以在终端上查看此次评估的结果。测试集的精确度会以类似如下方式呈现:
|
||||
|
|
|
|||
|
|
@ -68,9 +68,9 @@ After installing MindSpore via the official website, you can start training and
|
|||
|
||||
```python
|
||||
# enter script dir, train AlexNet
|
||||
sh run_standalone_train_ascend.sh [DATA_PATH] [CKPT_SAVE_PATH]
|
||||
bash run_standalone_train_ascend.sh [DATA_PATH] [CKPT_SAVE_PATH]
|
||||
# enter script dir, evaluate AlexNet
|
||||
sh run_standalone_eval_ascend.sh [DATA_PATH] [CKPT_NAME]
|
||||
bash run_standalone_eval_ascend.sh [DATA_PATH] [CKPT_NAME]
|
||||
```
|
||||
|
||||
- Running on [ModelArts](https://support.huaweicloud.com/modelarts/)
|
||||
|
|
@ -228,7 +228,7 @@ Major parameters in train.py and config.py as follows:
|
|||
```bash
|
||||
python train.py --config_path default_config.yaml --data_path cifar-10-batches-bin --ckpt_path ckpt > log 2>&1 &
|
||||
# or enter script dir, and run the script
|
||||
sh run_standalone_train_ascend.sh cifar-10-batches-bin ckpt
|
||||
bash run_standalone_train_ascend.sh cifar-10-batches-bin ckpt
|
||||
```
|
||||
|
||||
After training, the loss value will be achieved as follows:
|
||||
|
|
@ -250,7 +250,7 @@ Major parameters in train.py and config.py as follows:
|
|||
```bash
|
||||
python train.py --config_path default_config.yaml --device_target "GPU" --data_path cifar-10-batches-bin --ckpt_path ckpt > log 2>&1 &
|
||||
# or enter script dir, and run the script
|
||||
sh run_standalone_train_for_gpu.sh cifar-10-batches-bin ckpt
|
||||
bash run_standalone_train_for_gpu.sh cifar-10-batches-bin ckpt
|
||||
```
|
||||
|
||||
After training, the loss value will be achieved as follows:
|
||||
|
|
@ -275,7 +275,7 @@ Before running the command below, please check the checkpoint path used for eval
|
|||
```bash
|
||||
python eval.py --config_path default_config.yaml --data_path cifar-10-verify-bin --ckpt_path ckpt/checkpoint_alexnet-1_1562.ckpt > eval_log.txt 2>&1 &
|
||||
# or enter script dir, and run the script
|
||||
sh run_standalone_eval_ascend.sh cifar-10-verify-bin ckpt/checkpoint_alexnet-1_1562.ckpt
|
||||
bash run_standalone_eval_ascend.sh cifar-10-verify-bin ckpt/checkpoint_alexnet-1_1562.ckpt
|
||||
```
|
||||
|
||||
You can view the results through the file "eval_log". The accuracy of the test dataset will be as follows:
|
||||
|
|
@ -290,7 +290,7 @@ Before running the command below, please check the checkpoint path used for eval
|
|||
```bash
|
||||
python eval.py --config_path default_config.yaml --device_target "GPU" --data_path cifar-10-verify-bin --ckpt_path ckpt/checkpoint_alexnet-30_1562.ckpt > eval_log 2>&1 &
|
||||
# or enter script dir, and run the script
|
||||
sh run_standalone_eval_for_gpu.sh cifar-10-verify-bin ckpt/checkpoint_alexnet-30_1562.ckpt
|
||||
bash run_standalone_eval_for_gpu.sh cifar-10-verify-bin ckpt/checkpoint_alexnet-30_1562.ckpt
|
||||
```
|
||||
|
||||
You can view the results through the file "eval_log". The accuracy of the test dataset will be as follows:
|
||||
|
|
|
|||
|
|
@ -70,9 +70,9 @@ AlexNet由5个卷积层和3个全连接层组成。多个卷积核用于提取
|
|||
|
||||
```python
|
||||
# 进入脚本目录,训练AlexNet
|
||||
sh run_standalone_train_ascend.sh [DATA_PATH] [CKPT_SAVE_PATH]
|
||||
bash run_standalone_train_ascend.sh [DATA_PATH] [CKPT_SAVE_PATH]
|
||||
# 进入脚本目录,评估AlexNet
|
||||
sh run_standalone_eval_ascend.sh [DATA_PATH] [CKPT_NAME]
|
||||
bash run_standalone_eval_ascend.sh [DATA_PATH] [CKPT_NAME]
|
||||
```
|
||||
|
||||
- 在 ModelArts 进行训练 (如果你想在modelarts上运行,可以参考以下文档 [modelarts](https://support.huaweicloud.com/modelarts/))
|
||||
|
|
@ -216,7 +216,7 @@ train.py和config.py中主要参数如下:
|
|||
```bash
|
||||
python train.py --config_path default_config.yaml --data_path cifar-10-batches-bin --ckpt_path ckpt > log 2>&1 &
|
||||
# 或进入脚本目录,执行脚本
|
||||
sh run_standalone_train_ascend.sh cifar-10-batches-bin ckpt
|
||||
bash run_standalone_train_ascend.sh cifar-10-batches-bin ckpt
|
||||
```
|
||||
|
||||
经过训练后,损失值如下:
|
||||
|
|
@ -238,7 +238,7 @@ train.py和config.py中主要参数如下:
|
|||
```bash
|
||||
python train.py --config_path default_config.yaml --device_target "GPU" --data_path cifar-10-batches-bin --ckpt_path ckpt > log 2>&1 &
|
||||
# 或进入脚本目录,执行脚本
|
||||
sh run_standalone_train_for_gpu.sh cifar-10-batches-bin ckpt
|
||||
bash run_standalone_train_for_gpu.sh cifar-10-batches-bin ckpt
|
||||
```
|
||||
|
||||
经过训练后,损失值如下:
|
||||
|
|
@ -263,7 +263,7 @@ train.py和config.py中主要参数如下:
|
|||
```bash
|
||||
python eval.py --config_path default_config.yaml --data_path cifar-10-verify-bin --ckpt_path ckpt/checkpoint_alexnet-1_1562.ckpt > eval_log.txt 2>&1 &
|
||||
#或进入脚本目录,执行脚本
|
||||
sh run_standalone_eval_ascend.sh cifar-10-verify-bin ckpt/checkpoint_alexnet-1_1562.ckpt
|
||||
bash run_standalone_eval_ascend.sh cifar-10-verify-bin ckpt/checkpoint_alexnet-1_1562.ckpt
|
||||
```
|
||||
|
||||
可通过"eval_log”文件查看结果。测试数据集的准确率如下:
|
||||
|
|
@ -278,7 +278,7 @@ train.py和config.py中主要参数如下:
|
|||
```bash
|
||||
python eval.py --config_path default_config.yaml --device_target "GPU" --data_path cifar-10-verify-bin --ckpt_path ckpt/checkpoint_alexnet-30_1562.ckpt > eval_log 2>&1 &
|
||||
#或进入脚本目录,执行脚本
|
||||
sh run_standalone_eval_for_gpu.sh cifar-10-verify-bin ckpt/checkpoint_alexnet-30_1562.ckpt
|
||||
bash run_standalone_eval_for_gpu.sh cifar-10-verify-bin ckpt/checkpoint_alexnet-30_1562.ckpt
|
||||
```
|
||||
|
||||
可通过"eval_log”文件查看结果。测试数据集的准确率如下:
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@
|
|||
- [Testing](#testing)
|
||||
- [Evaluation Process](#evaluation-process)
|
||||
- [Evaluation](#evaluation)
|
||||
- [Inference Process](#inference-process)
|
||||
- [Inference process](#inference-process)
|
||||
- [Export MindIR](#export-mindir)
|
||||
- [Infer on Ascend310](#infer-on-ascend310)
|
||||
- [result](#result)
|
||||
|
|
@ -141,7 +141,7 @@ ls ./dataset/centerface/images/train/images # img_dir
|
|||
|
||||
```python
|
||||
# enter script dir, train CenterFace
|
||||
sh train_distribute.sh
|
||||
bash train_distribute.sh
|
||||
# after training
|
||||
mkdir ./model
|
||||
cp device0/output/*/*.ckpt ./model # cp model to [MODEL_PATH]
|
||||
|
|
@ -151,7 +151,7 @@ ls ./dataset/centerface/images/train/images # img_dir
|
|||
|
||||
```python
|
||||
# enter script dir, train CenterFace
|
||||
sh train_distribute_gpu.sh
|
||||
bash train_distribute_gpu.sh
|
||||
# after training
|
||||
mkdir ./model
|
||||
cp train_distribute_gpu/output/*/*.ckpt ./model # cp model to [MODEL_PATH]
|
||||
|
|
@ -179,7 +179,7 @@ ls ./dataset/centerface/ground_truth/val.mat # annot_path
|
|||
|
||||
```python
|
||||
# test CenterFace
|
||||
sh test_distribute.sh
|
||||
bash test_distribute.sh
|
||||
```
|
||||
|
||||
- Test on GPU
|
||||
|
|
@ -196,7 +196,8 @@ step6: eval
|
|||
# cd ../dependency/evaluate;
|
||||
# python setup.py install;
|
||||
# cd -; #cd ../../scripts;
|
||||
sh eval_all.sh [ground_truth_path]
|
||||
|
||||
bash eval_all.sh [ground_truth_path]
|
||||
```
|
||||
|
||||
- Running on [ModelArts](https://support.huaweicloud.com/modelarts/)
|
||||
|
|
@ -464,7 +465,7 @@ Major parameters eval.py as follows:
|
|||
|
||||
- Single device
|
||||
|
||||
```python
|
||||
```bash
|
||||
# enter script dir, train CenterFace
|
||||
cd scripts
|
||||
# you need to change the parameter in train_standalone.sh
|
||||
|
|
@ -475,9 +476,9 @@ Major parameters eval.py as follows:
|
|||
# DATASET: dataset path
|
||||
# ANNOTATIONS: annotation path
|
||||
# images: img_dir in dataset path
|
||||
sh train_standalone.sh [USE_DEVICE_ID] [PRETRAINED_BACKBONE] [DATASET] [ANNOTATIONS] [IMAGES]
|
||||
bash train_standalone.sh [USE_DEVICE_ID] [PRETRAINED_BACKBONE] [DATASET] [ANNOTATIONS] [IMAGES]
|
||||
# after training
|
||||
cp device0/output/*/*.ckpt [MODEL_PATH]
|
||||
cp device0/outputs/*/*.ckpt [MODEL_PATH]
|
||||
```
|
||||
|
||||
- Multi-device (recommended)
|
||||
|
|
@ -489,36 +490,11 @@ Major parameters eval.py as follows:
|
|||
# or use symbolic link as quick start
|
||||
# or use the command as follow, most are the same as train_standalone.sh, the different is RANK_TABLE
|
||||
# RANK_TABLE: for multi-device only, from generate_rank_table.py or user writing
|
||||
sh train_distribute.sh [RANK_TABLE] [PRETRAINED_BACKBONE] [DATASET] [ANNOTATIONS] [IMAGES]
|
||||
bash train_distribute.sh [RANK_TABLE] [PRETRAINED_BACKBONE] [DATASET] [ANNOTATIONS] [IMAGES]
|
||||
# after training
|
||||
cp device0/output/*/*.ckpt [MODEL_PATH]
|
||||
cp device0/outputs/*/*.ckpt [MODEL_PATH]
|
||||
```
|
||||
|
||||
After training with 8 device, the loss value will be achieved as follows:
|
||||
|
||||
```python
|
||||
# grep "loss:" device0/xxx.log
|
||||
#
|
||||
# epoch: 1 step: 1, loss is greater than 500 and less than 5000
|
||||
2020-09-24 19:00:53,550:INFO:epoch:1, iter:0, average_loss:loss:1148.415649, loss:1148.4156494140625, overflow:False, loss_scale:1024.0
|
||||
[WARNING] DEBUG(51499,python):2020-09-24-19:00:53.590.008 [mindspore/ccsrc/debug/dump_proto.cc:218] SetValueToProto] Unsupported type UInt
|
||||
2020-09-24 19:00:53,784:INFO:epoch:1, iter:1, average_loss:loss:798.286713, loss:448.15777587890625, overflow:False, loss_scale:1024.0
|
||||
...
|
||||
2020-09-24 19:01:58,095:INFO:epoch:2, iter:197, average_loss:loss:1.942609, loss:1.5492267608642578, overflow:False, loss_scale:1024.0
|
||||
2020-09-24 19:01:58,501:INFO:epoch[2], loss:1.942609, 477.97 imgs/sec, lr:0.004000000189989805
|
||||
2020-09-24 19:01:58,502:INFO:==========end epoch===============
|
||||
2020-09-24 19:02:00,780:INFO:epoch:3, iter:0, average_loss:loss:2.107658, loss:2.1076583862304688, overflow:False, loss_scale:1024.0
|
||||
...
|
||||
# epoch: 140 average loss is greater than 0.3 and less than 1.5:
|
||||
2020-09-24 20:19:16,255:INFO:epoch:140, iter:196, average_loss:loss:0.906300, loss:1.1071504354476929, overflow:False, loss_scale:1024.0
|
||||
2020-09-24 20:19:16,347:INFO:epoch:140, iter:197, average_loss:loss:0.904684, loss:0.586264967918396, overflow:False, loss_scale:1024.0
|
||||
2020-09-24 20:19:16,747:INFO:epoch[140], loss:0.904684, 480.10 imgs/sec, lr:3.9999998989515007e-05
|
||||
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 scripts/device0/output/xxx/xxx.ckpt
|
||||
|
||||
- Running on GPU
|
||||
|
||||
'task_set' is important for multi-npu train to get higher speed
|
||||
|
|
@ -546,7 +522,7 @@ Major parameters eval.py as follows:
|
|||
# DATASET: dataset path
|
||||
# ANNOTATIONS: annotation path
|
||||
# images: img_dir in dataset path
|
||||
sh train_standalone_gpu.sh [USE_DEVICE_ID] [PRETRAINED_BACKBONE] [DATASET] [ANNOTATIONS] [IMAGES]
|
||||
bash train_standalone_gpu.sh [USE_DEVICE_ID] [PRETRAINED_BACKBONE] [DATASET] [ANNOTATIONS] [IMAGES]
|
||||
# after training
|
||||
cp train_standalone_gpu/output/*/*.ckpt [MODEL_PATH]
|
||||
```
|
||||
|
|
@ -560,7 +536,7 @@ Major parameters eval.py as follows:
|
|||
# or use symbolic link as quick start
|
||||
# or use the command as follow, most are the same as train_standalone_gpu.sh, the different is DEVICE_NUM
|
||||
# DEVICE_NUM: for multi-device only, number of devices
|
||||
sh train_distribute_gpu.sh [DEVICE_NUM] [PRETRAINED_BACKBONE] [DATASET] [ANNOTATIONS] [IMAGES]
|
||||
bash train_distribute_gpu.sh [DEVICE_NUM] [PRETRAINED_BACKBONE] [DATASET] [ANNOTATIONS] [IMAGES]
|
||||
# after training
|
||||
cp train_distribute_gpu/output/*/*.ckpt [MODEL_PATH]
|
||||
```
|
||||
|
|
@ -613,7 +589,7 @@ mkdir [SAVE_PATH]
|
|||
# SAVE_PATH: save_path for evaluate
|
||||
# DEVICE_ID: use device id
|
||||
# CKPT: test model name
|
||||
sh test.sh [DEVICE_TARGET] [MODEL_PATH] [DATASET] [GROUND_TRUTH_MAT] [SAVE_PATH] [DEVICE_ID] [CKPT]
|
||||
bash test.sh [DEVICE_TARGET] [MODEL_PATH] [DATASET] [GROUND_TRUTH_MAT] [SAVE_PATH] [DEVICE_ID] [CKPT]
|
||||
```
|
||||
|
||||
2. test many out ckpt for user to choose the best one
|
||||
|
|
@ -627,9 +603,10 @@ mkdir [SAVE_PATH]
|
|||
# STEPS_PER_EPOCH: steps for each epoch
|
||||
# START: start loop number, used to calculate first epoch number
|
||||
# END: end loop number, used to calculate last epoch number
|
||||
sh test_distribute.sh [DEVICE_TARGET] [MODEL_PATH] [DATASET] [GROUND_TRUTH_MAT] [SAVE_PATH] [DEVICE_NUM] [STEPS_PER_EPOCH] [START] [END]
|
||||
bash test_distribute.sh [DEVICE_TARGET][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:
|
||||
|
||||
|
|
@ -656,7 +633,8 @@ cd ../../../scripts;
|
|||
```python
|
||||
# you need to change the parameter in eval.sh
|
||||
# default eval the ckpt saved in ./scripts/output/centerface/999
|
||||
sh eval.sh [ground_truth_path]
|
||||
|
||||
bash eval.sh [ground_truth_path]
|
||||
```
|
||||
|
||||
2. eval many testing output for user to choose the best one
|
||||
|
|
@ -664,7 +642,7 @@ cd ../../../scripts;
|
|||
```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 [ground_truth_path]
|
||||
bash eval_all.sh [ground_truth_path]
|
||||
```
|
||||
|
||||
3. test+eval
|
||||
|
|
@ -674,7 +652,7 @@ cd ../../../scripts;
|
|||
# or use symbolic link as quick start, default eval the ckpt saved in ./scripts/output/centerface/999
|
||||
# or use the command as follow, most are the same as test.sh, the different are:
|
||||
# GROUND_TRUTH_PATH: ground truth path
|
||||
sh test_and_eval.sh [DEVICE_TARGET] [MODEL_PATH] [DATASET] [GROUND_TRUTH_MAT] [SAVE_PATH] [CKPT] [GROUND_TRUTH_PATH]
|
||||
bash test_and_eval.sh [DEVICE_TARGET][MODEL_PATH] [DATASET][GROUND_TRUTH_MAT] [SAVE_PATH][CKPT] [GROUND_TRUTH_PATH]
|
||||
```
|
||||
|
||||
- Running on Ascend
|
||||
|
|
|
|||
|
|
@ -78,9 +78,9 @@ After installing MindSpore via the official website, you can start training and
|
|||
|
||||
```python
|
||||
# enter script dir, train CNNDirectionModel
|
||||
sh run_standalone_train.sh [DATASET_PATH] [PRETRAINED_CKPT_PATH](optional)
|
||||
bash run_standalone_train.sh [DATASET_PATH] [PRETRAINED_CKPT_PATH](optional)
|
||||
# enter script dir, evaluate CNNDirectionModel
|
||||
sh run_standalone_train.sh [DATASET_PATH] [PRETRAINED_CKPT_PATH]
|
||||
bash run_standalone_train.sh [DATASET_PATH] [PRETRAINED_CKPT_PATH]
|
||||
```
|
||||
|
||||
# [Script Description](#contents)
|
||||
|
|
@ -137,7 +137,7 @@ Major parameters in default_config.yaml as follows:
|
|||
- running on Ascend
|
||||
|
||||
```python
|
||||
sh scripts/run_standalone_train_ascend.sh device_id path-to-train-mindrecords pre-trained-chkpt(optional)
|
||||
bash scripts/run_standalone_train_ascend.sh device_id path-to-train-mindrecords pre-trained-chkpt(optional)
|
||||
```
|
||||
|
||||
The model checkpoint will be saved script/train.
|
||||
|
|
@ -151,7 +151,7 @@ Before running the command below, please check the checkpoint path used for eval
|
|||
- running on Ascend
|
||||
|
||||
```python
|
||||
sh scripts/run_standalone_eval_ascend.sh device_id path-to-test-mindrecords trained-chkpt-path
|
||||
bash scripts/run_standalone_eval_ascend.sh device_id path-to-test-mindrecords trained-chkpt-path
|
||||
```
|
||||
|
||||
Results of evaluation will be printed after evaluation process is completed.
|
||||
|
|
@ -169,13 +169,13 @@ Results of evaluation will be printed after evaluation process is completed.
|
|||
Run `scripts/run_distribute_train_ascend.sh` to train the model distributed. The usage of the script is:
|
||||
|
||||
```text
|
||||
sh scripts/run_distribute_train_ascend.sh [rank_table] [train_dataset_path] [PRETRAINED_CKPT_PATH(optional)]
|
||||
bash scripts/run_distribute_train_ascend.sh [rank_table] [train_dataset_path] [PRETRAINED_CKPT_PATH(optional)]
|
||||
```
|
||||
|
||||
For example, you can run the shell command below to launch the training procedure.
|
||||
|
||||
```shell
|
||||
sh scripts/run_distribute_train_ascend.sh /home/rank_table.json /home/fsns/train/
|
||||
bash scripts/run_distribute_train_ascend.sh /home/rank_table.json /home/fsns/train/
|
||||
```
|
||||
|
||||
- running on ModelArts
|
||||
|
|
|
|||
|
|
@ -163,11 +163,11 @@ python src/create_dataset.py
|
|||
|
||||
```bash
|
||||
# distribute training example(8p)
|
||||
sh run_distribute_train_ascend.sh [RANK_TABLE_FILE] [TASK_TYPE] [PRETRAINED_PATH]
|
||||
bash run_distribute_train_ascend.sh [RANK_TABLE_FILE] [TASK_TYPE] [PRETRAINED_PATH]
|
||||
# standalone training
|
||||
sh run_standalone_train_ascend.sh [TASK_TYPE] [PRETRAINED_PATH]
|
||||
bash run_standalone_train_ascend.sh [TASK_TYPE] [PRETRAINED_PATH]
|
||||
# evaluation:
|
||||
sh run_eval_ascend.sh [IMAGE_PATH] [DATASET_PATH] [CHECKPOINT_PATH]
|
||||
bash run_eval_ascend.sh [IMAGE_PATH] [DATASET_PATH] [CHECKPOINT_PATH]
|
||||
```
|
||||
|
||||
The `pretrained_path` should be a checkpoint of vgg16 trained on Imagenet2012. The name of weight in dict should be totally the same, also the batch_norm should be enabled in the trainig of vgg16, otherwise fails in further steps.COCO_TEXT_PARSER_PATH coco_text.py can refer to [Link](https://github.com/andreasveit/coco-text).To get the vgg16 backbone, you can use the network structure defined in src/CTPN/vgg16.py.To train the backbone, copy the src/CTPN/vgg16.py under modelzoo/official/cv/vgg16/src/, and modify the vgg16/train.py to suit the new construction.You can fix it as below:
|
||||
|
|
@ -211,9 +211,9 @@ ICDAR2013, SCUT-FORU to improve precision and recall, and when doing Finetune, w
|
|||
shell:
|
||||
Ascend:
|
||||
# distribute training example(8p)
|
||||
sh run_distribute_train_ascend.sh [RANK_TABLE_FILE] [TASK_TYPE] [PRETRAINED_PATH]
|
||||
bash run_distribute_train_ascend.sh [RANK_TABLE_FILE] [TASK_TYPE] [PRETRAINED_PATH]
|
||||
# standalone training
|
||||
sh run_standalone_train_ascend.sh [TASK_TYPE] [PRETRAINED_PATH]
|
||||
bash run_standalone_train_ascend.sh [TASK_TYPE] [PRETRAINED_PATH]
|
||||
```
|
||||
|
||||
### Result
|
||||
|
|
@ -294,7 +294,7 @@ You can start training using python or shell scripts. The usage of shell scripts
|
|||
- Ascend:
|
||||
|
||||
```bash
|
||||
sh run_eval_ascend.sh [IMAGE_PATH] [DATASET_PATH] [CHECKPOINT_PATH]
|
||||
bash run_eval_ascend.sh [IMAGE_PATH] [DATASET_PATH] [CHECKPOINT_PATH]
|
||||
```
|
||||
|
||||
After eval, you can get serval archive file named submit_ctpn-xx_xxxx.zip, which contains the name of your checkpoint file.To evalulate it, you can use the scripts provided by the ICDAR2013 network, you can download the Deteval scripts from the [link](https://rrc.cvc.uab.es/?com=downloads&action=download&ch=2&f=aHR0cHM6Ly9ycmMuY3ZjLnVhYi5lcy9zdGFuZGFsb25lcy9zY3JpcHRfdGVzdF9jaDJfdDFfZTItMTU3Nzk4MzA2Ny56aXA=)
|
||||
|
|
|
|||
|
|
@ -127,7 +127,7 @@ Based on original DeepLabV3 paper, we reproduce two training experiments on voca
|
|||
For single device training, please config parameters, training script is:
|
||||
|
||||
```shell
|
||||
run_standalone_train.sh
|
||||
bash run_standalone_train.sh
|
||||
```
|
||||
|
||||
- For 8 devices training, training steps are as follows:
|
||||
|
|
@ -135,19 +135,19 @@ run_standalone_train.sh
|
|||
1. Train s16 with vocaug dataset, finetuning from resnet101 pretrained model, script is:
|
||||
|
||||
```shell
|
||||
run_distribute_train_s16_r1.sh
|
||||
bash run_distribute_train_s16_r1.sh
|
||||
```
|
||||
|
||||
2. Train s8 with vocaug dataset, finetuning from model in previous step, training script is:
|
||||
|
||||
```shell
|
||||
run_distribute_train_s8_r1.sh
|
||||
bash run_distribute_train_s8_r1.sh
|
||||
```
|
||||
|
||||
3. Train s8 with voctrain dataset, finetuning from model in previous step, training script is:
|
||||
|
||||
```shell
|
||||
run_distribute_train_s8_r2.sh
|
||||
bash run_distribute_train_s8_r2.sh
|
||||
```
|
||||
|
||||
- For evaluation, evaluating steps are as follows:
|
||||
|
|
@ -155,25 +155,25 @@ run_standalone_train.sh
|
|||
1. Eval s16 with voc val dataset, eval script is:
|
||||
|
||||
```shell
|
||||
run_eval_s16.sh
|
||||
bash run_eval_s16.sh
|
||||
```
|
||||
|
||||
2. Eval s8 with voc val dataset, eval script is:
|
||||
|
||||
```shell
|
||||
run_eval_s8.sh
|
||||
bash run_eval_s8.sh
|
||||
```
|
||||
|
||||
3. Eval s8 multiscale with voc val dataset, eval script is:
|
||||
|
||||
```shell
|
||||
run_eval_s8_multiscale.sh
|
||||
bash run_eval_s8_multiscale.sh
|
||||
```
|
||||
|
||||
4. Eval s8 multiscale and flip with voc val dataset, eval script is:
|
||||
|
||||
```shell
|
||||
run_eval_s8_multiscale_flip.sh
|
||||
bash run_eval_s8_multiscale_flip.sh
|
||||
```
|
||||
|
||||
- Train on ModelArts (If you want to run in modelarts, please check the official documentation of [modelarts](https://support.huaweicloud.com/modelarts/), and you can start training as follows)
|
||||
|
|
|
|||
|
|
@ -108,11 +108,11 @@ Here we used 4 datasets for training, and 1 datasets for Evaluation.
|
|||
|
||||
```bash
|
||||
# distribute training example(8p)
|
||||
sh run_distribute_train_ascend.sh [IMGS_PATH] [ANNOS_PATH] [RANK_TABLE_FILE] [PRETRAINED_PATH] [COCO_TEXT_PARSER_PATH]
|
||||
bash run_distribute_train_ascend.sh [IMGS_PATH] [ANNOS_PATH] [RANK_TABLE_FILE] [PRETRAINED_PATH] [COCO_TEXT_PARSER_PATH]
|
||||
# standalone training
|
||||
sh run_standalone_train_ascend.sh [IMGS_PATH] [ANNOS_PATH] [PRETRAINED_PATH] [COCO_TEXT_PARSER_PATH] [DEVICE_ID]
|
||||
bash run_standalone_train_ascend.sh [IMGS_PATH] [ANNOS_PATH] [PRETRAINED_PATH] [COCO_TEXT_PARSER_PATH] [DEVICE_ID]
|
||||
# evaluation:
|
||||
sh run_eval_ascend.sh [IMGS_PATH] [ANNOS_PATH] [CHECKPOINT_PATH] [COCO_TEXT_PARSER_PATH] [DEVICE_ID]
|
||||
bash run_eval_ascend.sh [IMGS_PATH] [ANNOS_PATH] [CHECKPOINT_PATH] [COCO_TEXT_PARSER_PATH] [DEVICE_ID]
|
||||
```
|
||||
|
||||
> Notes:
|
||||
|
|
@ -239,9 +239,9 @@ sh run_eval_ascend.sh [IMGS_PATH] [ANNOS_PATH] [CHECKPOINT_PATH] [COCO_TEXT_PARS
|
|||
shell:
|
||||
Ascend:
|
||||
# distribute training example(8p)
|
||||
sh run_distribute_train_ascend.sh [IMGS_PATH] [ANNOS_PATH] [RANK_TABLE_FILE] [PRETRAINED_PATH] [COCO_TEXT_PARSER_PATH]
|
||||
bash run_distribute_train_ascend.sh [IMGS_PATH] [ANNOS_PATH] [RANK_TABLE_FILE] [PRETRAINED_PATH] [COCO_TEXT_PARSER_PATH]
|
||||
# standalone training
|
||||
sh run_standalone_train_ascend.sh [IMGS_PATH] [ANNOS_PATH] [PRETRAINED_PATH] [COCO_TEXT_PARSER_PATH] [DEVICE_ID]
|
||||
bash run_standalone_train_ascend.sh [IMGS_PATH] [ANNOS_PATH] [PRETRAINED_PATH] [COCO_TEXT_PARSER_PATH] [DEVICE_ID]
|
||||
```
|
||||
|
||||
### Result
|
||||
|
|
@ -263,7 +263,7 @@ You can start training using python or shell scripts. The usage of shell scripts
|
|||
- Ascend:
|
||||
|
||||
```bash
|
||||
sh run_eval_ascend.sh [IMGS_PATH] [ANNOS_PATH] [CHECKPOINT_PATH] [COCO_TEXT_PARSER_PATH] [DEVICE_ID]
|
||||
bash run_eval_ascend.sh [IMGS_PATH] [ANNOS_PATH] [CHECKPOINT_PATH] [COCO_TEXT_PARSER_PATH] [DEVICE_ID]
|
||||
```
|
||||
|
||||
### Launch
|
||||
|
|
@ -272,7 +272,7 @@ You can start training using python or shell scripts. The usage of shell scripts
|
|||
# eval example
|
||||
shell:
|
||||
Ascend:
|
||||
sh run_eval_ascend.sh [IMGS_PATH] [ANNOS_PATH] [CHECKPOINT_PATH] [COCO_TEXT_PARSER_PATH] [DEVICE_ID]
|
||||
bash run_eval_ascend.sh [IMGS_PATH] [ANNOS_PATH] [CHECKPOINT_PATH] [COCO_TEXT_PARSER_PATH] [DEVICE_ID]
|
||||
```
|
||||
|
||||
> checkpoint can be produced in training process.
|
||||
|
|
|
|||
|
|
@ -100,12 +100,12 @@ After installing MindSpore via the official website, you can start training and
|
|||
python train.py --net [NET_NAME] --dataset [DATASET_NAME] --train_data_dir /PATH/TO/DATASET --train_pretrained /PATH/TO/PRETRAINED_CKPT --is_distributed 0 > train.log 2>&1 &
|
||||
|
||||
# run distributed training example
|
||||
sh scripts/run_distribute_train.sh 8 rank_table.json [NET_NAME] [DATASET_NAME] /PATH/TO/DATASET /PATH/TO/PRETRAINED_CKPT
|
||||
bash scripts/run_distribute_train.sh 8 rank_table.json [NET_NAME] [DATASET_NAME] /PATH/TO/DATASET /PATH/TO/PRETRAINED_CKPT
|
||||
|
||||
# run evaluation example
|
||||
python eval.py --net [NET_NAME] --dataset [DATASET_NAME] --eval_data_dir /PATH/TO/DATASET --ckpt_files /PATH/TO/CHECKPOINT > eval.log 2>&1 &
|
||||
OR
|
||||
sh scripts/run_distribute_eval.sh 8 rank_table.json [NET_NAME] [DATASET_NAME] /PATH/TO/DATASET /PATH/TO/CHECKPOINT
|
||||
bash scripts/run_distribute_eval.sh 8 rank_table.json [NET_NAME] [DATASET_NAME] /PATH/TO/DATASET /PATH/TO/CHECKPOINT
|
||||
```
|
||||
|
||||
For distributed training, a hccl configuration file with JSON format needs to be created in advance.
|
||||
|
|
@ -176,12 +176,12 @@ After installing MindSpore via the official website, you can start training and
|
|||
python train.py --net=[NET_NAME] --dataset=[DATASET_NAME] --train_data_dir=[DATASET_PATH] --is_distributed=0 --device_target='GPU' > train.log 2>&1 &
|
||||
|
||||
# run distributed training example
|
||||
sh run_distribute_train_gpu.sh 8 0,1,2,3,4,5,6,7 [NET_NAME] [DATASET_NAME] [DATASET_PATH]
|
||||
bash run_distribute_train_gpu.sh 8 0,1,2,3,4,5,6,7 [NET_NAME] [DATASET_NAME] [DATASET_PATH]
|
||||
|
||||
# run evaluation example
|
||||
python eval.py --net=[NET_NAME] --dataset=[DATASET_NAME] --eval_data_dir=[DATASET_PATH] --device_target='GPU' --ckpt_files=[CHECKPOINT_PATH] > eval.log 2>&1 &
|
||||
OR
|
||||
sh run_distribute_eval_gpu.sh 1 0 [NET_NAME] [DATASET_NAME] [DATASET_PATH] [CHECKPOINT_PATH]
|
||||
bash run_distribute_eval_gpu.sh 1 0 [NET_NAME] [DATASET_NAME] [DATASET_PATH] [CHECKPOINT_PATH]
|
||||
```
|
||||
|
||||
# [Script Description](#contents)
|
||||
|
|
@ -306,7 +306,7 @@ You can modify the training behaviour through the various flags in the `densenet
|
|||
- running on Ascend
|
||||
|
||||
```bash
|
||||
sh scripts/run_distribute_train.sh 8 rank_table.json [NET_NAME] [DATASET_NAME] /PATH/TO/DATASET /PATH/TO/PRETRAINED_CKPT
|
||||
bash scripts/run_distribute_train.sh 8 rank_table.json [NET_NAME] [DATASET_NAME] /PATH/TO/DATASET /PATH/TO/PRETRAINED_CKPT
|
||||
```
|
||||
|
||||
The above shell script will run distribute training in the background. You can view the results log and model checkpoint through the file `train[X]/output/202x-xx-xx_time_xx_xx_xx/`. The loss value of training DenseNet121 on ImageNet will be achieved as follows:
|
||||
|
|
@ -326,7 +326,7 @@ You can modify the training behaviour through the various flags in the `densenet
|
|||
|
||||
```bash
|
||||
cd scripts
|
||||
sh run_distribute_train_gpu.sh 8 0,1,2,3,4,5,6,7 [NET_NAME] [DATASET_NAME] [DATASET_PATH]
|
||||
bash run_distribute_train_gpu.sh 8 0,1,2,3,4,5,6,7 [NET_NAME] [DATASET_NAME] [DATASET_PATH]
|
||||
```
|
||||
|
||||
The above shell script will run distribute training in the background. You can view the results through the file `train/train.log`.
|
||||
|
|
@ -342,7 +342,7 @@ You can modify the training behaviour through the various flags in the `densenet
|
|||
```python
|
||||
python eval.py --net [NET_NAME] --dataset [DATASET_NAME] --eval_data_dir /PATH/TO/DATASET --ckpt_files /PATH/TO/CHECKPOINT > eval.log 2>&1 &
|
||||
OR
|
||||
sh scripts/run_distribute_eval.sh 8 rank_table.json [NET_NAME] [DATASET_NAME] /PATH/TO/DATASET /PATH/TO/CHECKPOINT
|
||||
bash scripts/run_distribute_eval.sh 8 rank_table.json [NET_NAME] [DATASET_NAME] /PATH/TO/DATASET /PATH/TO/CHECKPOINT
|
||||
```
|
||||
|
||||
The above python command will run in the background. You can view the results through the file "output/202x-xx-xx_time_xx_xx_xx/202x_xxxx.log". The accuracy of evaluating DenseNet121 on the test dataset of ImageNet will be as follows:
|
||||
|
|
@ -359,7 +359,7 @@ You can modify the training behaviour through the various flags in the `densenet
|
|||
```python
|
||||
python eval.py --net=[NET_NAME] --dataset=[DATASET_NAME] --eval_data_dir=[DATASET_PATH] --device_target='GPU' --ckpt_files=[CHECKPOINT_PATH] > eval.log 2>&1 &
|
||||
OR
|
||||
sh run_distribute_eval_gpu.sh 1 0 [NET_NAME] [DATASET_NAME] [DATASET_PATH] [CHECKPOINT_PATH]
|
||||
bash run_distribute_eval_gpu.sh 1 0 [NET_NAME] [DATASET_NAME] [DATASET_PATH] [CHECKPOINT_PATH]
|
||||
```
|
||||
|
||||
The above python command will run in the background. You can view the results through the file "eval/eval.log". The accuracy of evaluating DenseNet121 on the test dataset of ImageNet will be as follows:
|
||||
|
|
|
|||
|
|
@ -104,12 +104,12 @@ DenseNet-100使用的数据集: Cifar-10
|
|||
python train.py --net [NET_NAME] --dataset [DATASET_NAME] --train_data_dir /PATH/TO/DATASET --train_pretrained /PATH/TO/PRETRAINED_CKPT --is_distributed 0 > train.log 2>&1 &
|
||||
|
||||
# 分布式训练示例
|
||||
sh scripts/run_distribute_train.sh 8 /PATH/TO/RANK_TABLE.JSON [NET_NAME] [DATASET_NAME] /PATH/TO/DATASET /PATH/TO/PRETRAINED_CKPT
|
||||
bash scripts/run_distribute_train.sh 8 /PATH/TO/RANK_TABLE.JSON [NET_NAME] [DATASET_NAME] /PATH/TO/DATASET /PATH/TO/PRETRAINED_CKPT
|
||||
|
||||
# 单卡评估示例
|
||||
python eval.py --net [NET_NAME] --dataset [DATASET_NAME] --eval_data_dir /PATH/TO/DATASET --ckpt_files /PATH/TO/CHECKPOINT > eval.log 2>&1 &
|
||||
|
||||
sh scripts/run_distribute_eval.sh 8 rank_table.json [NET_NAME] [DATASET_NAME] /PATH/TO/DATASET /PATH/TO/CHECKPOINT
|
||||
bash scripts/run_distribute_eval.sh 8 rank_table.json [NET_NAME] [DATASET_NAME] /PATH/TO/DATASET /PATH/TO/CHECKPOINT
|
||||
```
|
||||
|
||||
分布式训练需要提前创建JSON格式的HCCL配置文件。
|
||||
|
|
@ -177,12 +177,12 @@ DenseNet-100使用的数据集: Cifar-10
|
|||
python train.py --net=[NET_NAME] --dataset=[DATASET_NAME] --train_data_dir=[DATASET_PATH] --is_distributed=0 --device_target='GPU' > train.log 2>&1 &
|
||||
|
||||
# 分布式训练示例
|
||||
sh run_distribute_train_gpu.sh 8 0,1,2,3,4,5,6,7 [NET_NAME] [DATASET_NAME] [DATASET_PATH]
|
||||
bash run_distribute_train_gpu.sh 8 0,1,2,3,4,5,6,7 [NET_NAME] [DATASET_NAME] [DATASET_PATH]
|
||||
|
||||
# 评估示例
|
||||
python eval.py --net=[NET_NAME] --dataset=[DATASET_NAME] --eval_data_dir=[DATASET_PATH] --device_target='GPU' --ckpt_files=[CHECKPOINT_PATH] > eval.log 2>&1 &
|
||||
OR
|
||||
sh run_distribute_eval_gpu.sh 1 0 [NET_NAME] [DATASET_NAME] [DATASET_PATH] [CHECKPOINT_PATH]
|
||||
bash run_distribute_eval_gpu.sh 1 0 [NET_NAME] [DATASET_NAME] [DATASET_PATH] [CHECKPOINT_PATH]
|
||||
```
|
||||
|
||||
# 脚本说明
|
||||
|
|
@ -305,7 +305,7 @@ DenseNet-100使用的数据集: Cifar-10
|
|||
- Ascend处理器环境运行
|
||||
|
||||
```shell
|
||||
sh scripts/run_distribute_train.sh 8 rank_table.json [NET_NAME] [DATASET_NAME] /PATH/TO/DATASET /PATH/TO/PRETRAINED_CKPT
|
||||
bash scripts/run_distribute_train.sh 8 rank_table.json [NET_NAME] [DATASET_NAME] /PATH/TO/DATASET /PATH/TO/PRETRAINED_CKPT
|
||||
```
|
||||
|
||||
上述shell脚本将在后台进行分布式训练。可以通过文件`train[X]/output/202x-xx-xx_time_xx_xx_xx/`查看结果日志和模型检查点。在ImageNet数据集上训练DenseNet-121的损失值的实现如下:
|
||||
|
|
@ -325,7 +325,7 @@ DenseNet-100使用的数据集: Cifar-10
|
|||
|
||||
```bash
|
||||
cd scripts
|
||||
sh run_distribute_train_gpu.sh 8 0,1,2,3,4,5,6,7 [NET_NAME] [DATASET_NAME] [DATASET_PATH]
|
||||
bash run_distribute_train_gpu.sh 8 0,1,2,3,4,5,6,7 [NET_NAME] [DATASET_NAME] [DATASET_PATH]
|
||||
```
|
||||
|
||||
上述shell脚本将在后台进行分布式训练。可以通过文件`train[X]/output/202x-xx-xx_time_xx_xx_xx/`查看结果日志和模型检查点。
|
||||
|
|
@ -341,7 +341,7 @@ DenseNet-100使用的数据集: Cifar-10
|
|||
```eval
|
||||
python eval.py --net [NET_NAME] --dataset [DATASET_NAME] --eval_data_dir /PATH/TO/DATASET --ckpt_files /PATH/TO/CHECKPOINT > eval.log 2>&1 &
|
||||
OR
|
||||
sh scripts/run_distribute_eval.sh 8 rank_table.json [NET_NAME] [DATASET_NAME] /PATH/TO/DATASET /PATH/TO/CHECKPOINT
|
||||
bash scripts/run_distribute_eval.sh 8 rank_table.json [NET_NAME] [DATASET_NAME] /PATH/TO/DATASET /PATH/TO/CHECKPOINT
|
||||
```
|
||||
|
||||
上述python命令在后台运行。可以通过“output/202x-xx-xx_time_xx_xx_xx/202x_xxxx.log”文件查看结果。DenseNet-121在ImageNet的测试数据集的准确率如下:
|
||||
|
|
@ -358,7 +358,7 @@ DenseNet-100使用的数据集: Cifar-10
|
|||
```eval
|
||||
python eval.py --net=[NET_NAME] --dataset=[DATASET_NAME] --eval_data_dir=[DATASET_PATH] --device_target='GPU' --ckpt_files=[CHECKPOINT_PATH] > eval.log 2>&1 &
|
||||
OR
|
||||
sh run_distribute_eval_gpu.sh 1 0 [NET_NAME] [DATASET_NAME] [DATASET_PATH] [CHECKPOINT_PATH]
|
||||
bash run_distribute_eval_gpu.sh 1 0 [NET_NAME] [DATASET_NAME] [DATASET_PATH] [CHECKPOINT_PATH]
|
||||
```
|
||||
|
||||
上述python命令在后台运行。可以通过“eval/eval.log”文件查看结果。DenseNet-121在ImageNet的测试数据集的准确率如下:
|
||||
|
|
|
|||
|
|
@ -36,12 +36,12 @@ argparse
|
|||
# 训练示例
|
||||
python train.py --dataset_path=/path/to/training/data --model_type DnCNN-S --ckpt-prefix=DnCNN-S_25noise --noise_level=25
|
||||
# 或者
|
||||
sh ./scripts/run_train_gpu.sh /path/to/training/data DnCNN-S DnCNN-S_25noise 25
|
||||
bash ./scripts/run_train_gpu.sh /path/to/training/data DnCNN-S DnCNN-S_25noise 25
|
||||
|
||||
# 评估示例
|
||||
python eval.py --dataset_path=/path/to/test/data --ckpt_path=./ckpt/DnCNN-S-50_1800.ckpt --model_type=DnCNN-S --noise_level=25 --noise_type=denoise
|
||||
# 或者
|
||||
sh ./scripts/run_eval_gpu.sh /path/to/test/data ./ckpt/DnCNN-S-50_1800.ckpt DnCNN-S 25 denoise
|
||||
bash ./scripts/run_eval_gpu.sh /path/to/test/data ./ckpt/DnCNN-S-50_1800.ckpt DnCNN-S 25 denoise
|
||||
```
|
||||
|
||||
### 脚本说明
|
||||
|
|
|
|||
|
|
@ -93,13 +93,13 @@ The DPN models use ImageNet-1K dataset to train and validate in this repository.
|
|||
To train the DPNs, run the shell script `scripts/train_standalone.sh` with the format below:
|
||||
|
||||
```shell
|
||||
sh scripts/train_standalone.sh [device_id] [train_data_dir] [ckpt_path_to_save] [eval_each_epoch] [pretrained_ckpt(optional)]
|
||||
bash scripts/train_standalone.sh [device_id] [train_data_dir] [ckpt_path_to_save] [eval_each_epoch] [pretrained_ckpt(optional)]
|
||||
```
|
||||
|
||||
To validate the DPNs, run the shell script `scripts/eval.sh` with the format below:
|
||||
|
||||
```shell
|
||||
sh scripts/eval.sh [device_id] [eval_data_dir] [checkpoint_path]
|
||||
bash scripts/eval.sh [device_id] [eval_data_dir] [checkpoint_path]
|
||||
```
|
||||
|
||||
# [Script Description](#contents)
|
||||
|
|
@ -183,13 +183,13 @@ config.keep_checkpoint_max = 3 # only keep the last keep_checkpoint
|
|||
Run `scripts/train_standalone.sh` to train the model standalone. The usage of the script is:
|
||||
|
||||
```shell
|
||||
sh scripts/train_standalone.sh [device_id] [train_data_dir] [ckpt_path_to_save] [eval_each_epoch] [pretrained_ckpt(optional)]
|
||||
bash scripts/train_standalone.sh [device_id] [train_data_dir] [ckpt_path_to_save] [eval_each_epoch] [pretrained_ckpt(optional)]
|
||||
```
|
||||
|
||||
For example, you can run the shell command below to launch the training procedure.
|
||||
|
||||
```shell
|
||||
sh scripts/train_standalone.sh 0 /data/dataset/imagenet/ scripts/pretrian/ 0
|
||||
bash scripts/train_standalone.sh 0 /data/dataset/imagenet/ scripts/pretrian/ 0
|
||||
```
|
||||
|
||||
If eval_each_epoch is 1, it will evaluate after each epoch and save the parameters with the max accuracy. But in this case, the time of one epoch will be longer.
|
||||
|
|
@ -230,13 +230,13 @@ The model checkpoint will be saved into `[ckpt_path_to_save]`.
|
|||
Run `scripts/train_distributed.sh` to train the model distributed. The usage of the script is:
|
||||
|
||||
```text
|
||||
sh scripts/train_distributed.sh [rank_table] [train_data_dir] [ckpt_path_to_save] [rank_size] [eval_each_epoch] [pretrained_ckpt(optional)]
|
||||
bash scripts/train_distributed.sh [rank_table] [train_data_dir] [ckpt_path_to_save] [rank_size] [eval_each_epoch] [pretrained_ckpt(optional)]
|
||||
```
|
||||
|
||||
For example, you can run the shell command below to launch the training procedure.
|
||||
|
||||
```shell
|
||||
sh scripts/train_distributed.sh /home/rank_table.json /data/dataset/imagenet/ ../scripts 8 0 ../pretrain/dpn92.ckpt
|
||||
bash scripts/train_distributed.sh /home/rank_table.json /data/dataset/imagenet/ ../scripts 8 0 ../pretrain/dpn92.ckpt
|
||||
```
|
||||
|
||||
The above shell script will run distribute training in the background. You can view the results through the file `train_parallel[X]/log.txt` as follows:
|
||||
|
|
@ -258,13 +258,13 @@ The model checkpoint will be saved into `[ckpt_path_to_save]`.
|
|||
Run `scripts/eval.sh` to evaluate the model with one Ascend processor. The usage of the script is:
|
||||
|
||||
```text
|
||||
sh scripts/eval.sh [device_id] [eval_data_dir] [checkpoint_path]
|
||||
bash scripts/eval.sh [device_id] [eval_data_dir] [checkpoint_path]
|
||||
```
|
||||
|
||||
For example, you can run the shell command below to launch the validation procedure.
|
||||
|
||||
```text
|
||||
sh scripts/eval.sh 0 /data/dataset/imagenet/ pretrain/dpn-180_5004.ckpt
|
||||
bash scripts/eval.sh 0 /data/dataset/imagenet/ pretrain/dpn-180_5004.ckpt
|
||||
```
|
||||
|
||||
The above shell script will run evaluation in the background. You can view the results through the file `eval_log.txt`. The result will be achieved as follows:
|
||||
|
|
|
|||
|
|
@ -150,15 +150,15 @@ Parameters for both training and evaluating can be set in config.py.
|
|||
|
||||
```bash
|
||||
# distribute training
|
||||
sh run_distribute_train_gpu.sh [DEVICE_NUM] [VISIABLE_DEVICES(0,1,2,3,4,5,6,7)] [DATASET_TYPE] [DATASET_PATH] [PRETRAINED_CKPT_PATH](optional)
|
||||
bash run_distribute_train_gpu.sh [DEVICE_NUM] [VISIABLE_DEVICES(0,1,2,3,4,5,6,7)] [DATASET_TYPE] [DATASET_PATH] [PRETRAINED_CKPT_PATH](optional)
|
||||
# standalone training
|
||||
sh run_standalone_train_gpu.sh [DATASET_TYPE] [DATASET_PATH] [PRETRAINED_CKPT_PATH](optional)
|
||||
bash run_standalone_train_gpu.sh [DATASET_TYPE] [DATASET_PATH] [PRETRAINED_CKPT_PATH](optional)
|
||||
```
|
||||
|
||||
2. CPU
|
||||
|
||||
```bash
|
||||
sh run_train_cpu.sh [DATASET_TYPE] [DATASET_PATH] [PRETRAINED_CKPT_PATH](optional)
|
||||
bash run_train_cpu.sh [DATASET_TYPE] [DATASET_PATH] [PRETRAINED_CKPT_PATH](optional)
|
||||
```
|
||||
|
||||
### Launch Example
|
||||
|
|
@ -166,15 +166,15 @@ Parameters for both training and evaluating can be set in config.py.
|
|||
```bash
|
||||
# distributed training example(8p) for GPU
|
||||
cd scripts
|
||||
sh run_distribute_train_gpu.sh 8 0,1,2,3,4,5,6,7 ImageNet /dataset/train
|
||||
bash run_distribute_train_gpu.sh 8 0,1,2,3,4,5,6,7 ImageNet /dataset/train
|
||||
|
||||
# standalone training example for GPU
|
||||
cd scripts
|
||||
sh run_standalone_train_gpu.sh ImageNet /dataset/train
|
||||
bash run_standalone_train_gpu.sh ImageNet /dataset/train
|
||||
|
||||
# training example for CPU
|
||||
cd scripts
|
||||
sh run_train_cpu.sh ImageNet /dataset/train
|
||||
bash run_train_cpu.sh ImageNet /dataset/train
|
||||
```
|
||||
|
||||
You can find checkpoint file together with result in log.
|
||||
|
|
@ -186,13 +186,13 @@ You can find checkpoint file together with result in log.
|
|||
1. CPU
|
||||
|
||||
```bash
|
||||
sh run_eval_cpu.sh [DATASET_TYPE] [DATASET_PATH] [CHECKPOINT_PATH]
|
||||
bash run_eval_cpu.sh [DATASET_TYPE] [DATASET_PATH] [CHECKPOINT_PATH]
|
||||
```
|
||||
|
||||
2. GPU
|
||||
|
||||
```bash
|
||||
sh run_eval_gpu.sh [DATASET_TYPE] [DATASET_PATH] [CHECKPOINT_PATH]
|
||||
bash run_eval_gpu.sh [DATASET_TYPE] [DATASET_PATH] [CHECKPOINT_PATH]
|
||||
```
|
||||
|
||||
#### Launch Example
|
||||
|
|
@ -200,11 +200,11 @@ sh run_eval_gpu.sh [DATASET_TYPE] [DATASET_PATH] [CHECKPOINT_PATH]
|
|||
```bash
|
||||
# Evaluation with checkpoint for GPU
|
||||
cd scripts
|
||||
sh run_eval_gpu.sh ImageNet /dataset/eval ./checkpoint/efficientnet_b0-600_1251.ckpt
|
||||
bash run_eval_gpu.sh ImageNet /dataset/eval ./checkpoint/efficientnet_b0-600_1251.ckpt
|
||||
|
||||
# Evaluation with checkpoint for CPU
|
||||
cd scripts
|
||||
sh run_eval_cpu.sh ImageNet /dataset/eval ./checkpoint/efficientnet_b0-600_1251.ckpt
|
||||
bash run_eval_cpu.sh ImageNet /dataset/eval ./checkpoint/efficientnet_b0-600_1251.ckpt
|
||||
```
|
||||
|
||||
#### Result
|
||||
|
|
|
|||
|
|
@ -48,9 +48,11 @@ Dataset used: [COCO2017](<https://cocodataset.org/>)
|
|||
# Environment Requirements
|
||||
|
||||
- Hardware(Ascend/GPU)
|
||||
|
||||
- Prepare hardware environment with Ascend processor.
|
||||
|
||||
- Docker base image
|
||||
|
||||
- [Ascend Hub](ascend.huawei.com/ascendhub/#/home)
|
||||
|
||||
- Install [MindSpore](https://www.mindspore.cn/install/en).
|
||||
|
|
@ -110,16 +112,16 @@ Note:
|
|||
python convert_checkpoint.py --ckpt_file=[BACKBONE_MODEL]
|
||||
|
||||
# standalone training
|
||||
sh run_standalone_train_ascend.sh [PRETRAINED_MODEL] [BACKBONE] [COCO_ROOT] [MINDRECORD_DIR](option)
|
||||
bash run_standalone_train_ascend.sh [PRETRAINED_MODEL] [BACKBONE] [COCO_ROOT] [MINDRECORD_DIR](option)
|
||||
|
||||
# distributed training
|
||||
sh run_distribute_train_ascend.sh [RANK_TABLE_FILE] [PRETRAINED_MODEL] [BACKBONE] [COCO_ROOT] [MINDRECORD_DIR](option)
|
||||
bash run_distribute_train_ascend.sh [RANK_TABLE_FILE] [PRETRAINED_MODEL] [BACKBONE] [COCO_ROOT] [MINDRECORD_DIR](option)
|
||||
|
||||
# eval
|
||||
sh run_eval_ascend.sh [VALIDATION_JSON_FILE] [CHECKPOINT_PATH] [BACKBONE] [COCO_ROOT] [MINDRECORD_DIR](option)
|
||||
bash run_eval_ascend.sh [VALIDATION_JSON_FILE] [CHECKPOINT_PATH] [BACKBONE] [COCO_ROOT] [MINDRECORD_DIR](option)
|
||||
|
||||
# inference
|
||||
sh run_infer_310.sh [AIR_PATH] [DATA_PATH] [ANN_FILE_PATH]
|
||||
bash run_infer_310.sh [AIR_PATH] [DATA_PATH] [ANN_FILE_PATH]
|
||||
```
|
||||
|
||||
## Run on GPU
|
||||
|
|
@ -130,14 +132,13 @@ sh run_infer_310.sh [AIR_PATH] [DATA_PATH] [ANN_FILE_PATH]
|
|||
python convert_checkpoint.py --ckpt_file=[BACKBONE_MODEL]
|
||||
|
||||
# standalone training
|
||||
sh run_standalone_train_gpu.sh [PRETRAINED_MODEL] [BACKBONE] [COCO_ROOT] [MINDRECORD_DIR](option)
|
||||
bash run_standalone_train_gpu.sh [PRETRAINED_MODEL] [BACKBONE] [COCO_ROOT] [MINDRECORD_DIR](option)
|
||||
|
||||
# distributed training
|
||||
sh run_distribute_train_gpu.sh [DEVICE_NUM] [PRETRAINED_MODEL] [BACKBONE] [COCO_ROOT] [MINDRECORD_DIR](option)
|
||||
bash run_distribute_train_gpu.sh [DEVICE_NUM] [PRETRAINED_MODEL] [BACKBONE] [COCO_ROOT] [MINDRECORD_DIR](option)
|
||||
|
||||
# eval
|
||||
sh run_eval_gpu.sh [VALIDATION_JSON_FILE] [CHECKPOINT_PATH] [BACKBONE] [COCO_ROOT] [MINDRECORD_DIR](option)
|
||||
|
||||
bash run_eval_gpu.sh [VALIDATION_JSON_FILE] [CHECKPOINT_PATH] [BACKBONE] [COCO_ROOT] [MINDRECORD_DIR](option)
|
||||
```
|
||||
|
||||
## Run in docker
|
||||
|
|
@ -160,24 +161,24 @@ bash scripts/docker_start.sh fasterrcnn:20.1.0 [DATA_DIR] [MODEL_DIR]
|
|||
|
||||
```shell
|
||||
# standalone training
|
||||
sh run_standalone_train_ascend.sh [PRETRAINED_MODEL] [BACKBONE] [COCO_ROOT] [MINDRECORD_DIR](option)
|
||||
bash run_standalone_train_ascend.sh [PRETRAINED_MODEL] [BACKBONE] [COCO_ROOT] [MINDRECORD_DIR](option)
|
||||
|
||||
# distributed training
|
||||
sh run_distribute_train_ascend.sh [RANK_TABLE_FILE] [PRETRAINED_MODEL] [BACKBONE] [COCO_ROOT] [MINDRECORD_DIR](option)
|
||||
bash run_distribute_train_ascend.sh [RANK_TABLE_FILE] [PRETRAINED_MODEL] [BACKBONE] [COCO_ROOT] [MINDRECORD_DIR](option)
|
||||
```
|
||||
|
||||
4. Eval
|
||||
|
||||
```shell
|
||||
# eval
|
||||
sh run_eval_ascend.sh [VALIDATION_JSON_FILE] [CHECKPOINT_PATH] [BACKBONE] [COCO_ROOT] [MINDRECORD_DIR](option)
|
||||
bash run_eval_ascend.sh [VALIDATION_JSON_FILE] [CHECKPOINT_PATH] [BACKBONE] [COCO_ROOT] [MINDRECORD_DIR](option)
|
||||
```
|
||||
|
||||
5. Inference
|
||||
|
||||
```shell
|
||||
# inference
|
||||
sh run_infer_310.sh [MINDIR_PATH] [DATA_PATH] [ANN_FILE] [DEVICE_ID]
|
||||
bash run_infer_310.sh [MINDIR_PATH] [DATA_PATH] [ANN_FILE] [DEVICE_ID]
|
||||
```
|
||||
|
||||
- Running on [ModelArts](https://support.huaweicloud.com/modelarts/)
|
||||
|
|
@ -355,20 +356,20 @@ elif backbone == "resnet_v1_50":
|
|||
|
||||
```shell
|
||||
# standalone training on ascend
|
||||
sh run_standalone_train_ascend.sh [PRETRAINED_MODEL] [BACKBONE] [COCO_ROOT] [MINDRECORD_DIR](option)
|
||||
bash run_standalone_train_ascend.sh [PRETRAINED_MODEL] [BACKBONE] [COCO_ROOT] [MINDRECORD_DIR](option)
|
||||
|
||||
# distributed training on ascend
|
||||
sh run_distribute_train_ascend.sh [RANK_TABLE_FILE] [PRETRAINED_MODEL] [BACKBONE] [COCO_ROOT] [MINDRECORD_DIR](option)
|
||||
bash run_distribute_train_ascend.sh [RANK_TABLE_FILE] [PRETRAINED_MODEL] [BACKBONE] [COCO_ROOT] [MINDRECORD_DIR](option)
|
||||
```
|
||||
|
||||
#### on GPU
|
||||
|
||||
```shell
|
||||
# standalone training on gpu
|
||||
sh run_standalone_train_gpu.sh [PRETRAINED_MODEL] [BACKBONE] [COCO_ROOT] [MINDRECORD_DIR](option)
|
||||
bash run_standalone_train_gpu.sh [PRETRAINED_MODEL] [BACKBONE] [COCO_ROOT] [MINDRECORD_DIR](option)
|
||||
|
||||
# distributed training on gpu
|
||||
sh run_distribute_train_gpu.sh [DEVICE_NUM] [PRETRAINED_MODEL] [BACKBONE] [COCO_ROOT] [MINDRECORD_DIR](option)
|
||||
bash run_distribute_train_gpu.sh [DEVICE_NUM] [PRETRAINED_MODEL] [BACKBONE] [COCO_ROOT] [MINDRECORD_DIR](option)
|
||||
```
|
||||
|
||||
Notes:
|
||||
|
|
@ -425,14 +426,14 @@ epoch: 12 step: 7393, rpn_loss: 0.00691, rcnn_loss: 0.10168, rpn_cls_loss: 0.005
|
|||
|
||||
```shell
|
||||
# eval on ascend
|
||||
sh run_eval_ascend.sh [VALIDATION_JSON_FILE] [CHECKPOINT_PATH] [BACKBONE] [COCO_ROOT] [MINDRECORD_DIR](option)
|
||||
bash run_eval_ascend.sh [VALIDATION_JSON_FILE] [CHECKPOINT_PATH] [BACKBONE] [COCO_ROOT] [MINDRECORD_DIR](option)
|
||||
```
|
||||
|
||||
#### on GPU
|
||||
|
||||
```shell
|
||||
# eval on GPU
|
||||
sh run_eval_gpu.sh [VALIDATION_JSON_FILE] [CHECKPOINT_PATH] [BACKBONE] [COCO_ROOT] [MINDRECORD_DIR](option)
|
||||
bash run_eval_gpu.sh [VALIDATION_JSON_FILE] [CHECKPOINT_PATH] [BACKBONE] [COCO_ROOT] [MINDRECORD_DIR](option)
|
||||
```
|
||||
|
||||
> checkpoint can be produced in training process.
|
||||
|
|
@ -476,7 +477,7 @@ The following example only supports mindir inference with batch_size=1.
|
|||
|
||||
```shell
|
||||
# Ascend310 inference
|
||||
sh run_infer_310.sh [MINDIR_PATH] [DATA_PATH] [ANN_FILE] [DEVICE_ID]
|
||||
bash run_infer_310.sh [MINDIR_PATH] [DATA_PATH] [ANN_FILE] [DEVICE_ID]
|
||||
```
|
||||
|
||||
### result
|
||||
|
|
@ -496,7 +497,7 @@ Inference result is saved in current path, you can find result like this in acc.
|
|||
Average Recall (AR) @[ IoU=0.50:0.95 | area= small | maxDets=100 ] = 0.330
|
||||
Average Recall (AR) @[ IoU=0.50:0.95 | area=medium | maxDets=100 ] = 0.547
|
||||
Average Recall (AR) @[ IoU=0.50:0.95 | area= large | maxDets=100 ] = 0.622
|
||||
```
|
||||
```
|
||||
|
||||
# Model Description
|
||||
|
||||
|
|
|
|||
|
|
@ -49,9 +49,11 @@ Faster R-CNN是一个两阶段目标检测网络,该网络采用RPN,可以
|
|||
# 环境要求
|
||||
|
||||
- 硬件(Ascend/GPU)
|
||||
|
||||
- 使用Ascend处理器来搭建硬件环境。
|
||||
|
||||
- 获取基础镜像
|
||||
|
||||
- [Ascend Hub](https://ascend.huawei.com/ascendhub/#/home)
|
||||
|
||||
- 安装[MindSpore](https://www.mindspore.cn/install)。
|
||||
|
|
@ -111,16 +113,16 @@ Faster R-CNN是一个两阶段目标检测网络,该网络采用RPN,可以
|
|||
python convert_checkpoint.py --ckpt_file=[BACKBONE_MODEL]
|
||||
|
||||
# 单机训练
|
||||
sh run_standalone_train_ascend.sh [PRETRAINED_MODEL] [BACKBONE] [COCO_ROOT] [MINDRECORD_DIR](option)
|
||||
bash run_standalone_train_ascend.sh [PRETRAINED_MODEL] [BACKBONE] [COCO_ROOT] [MINDRECORD_DIR](option)
|
||||
|
||||
# 分布式训练
|
||||
sh run_distribute_train_ascend.sh [RANK_TABLE_FILE] [PRETRAINED_MODEL] [BACKBONE] [COCO_ROOT] [MINDRECORD_DIR](option)
|
||||
bash run_distribute_train_ascend.sh [RANK_TABLE_FILE] [PRETRAINED_MODEL] [BACKBONE] [COCO_ROOT] [MINDRECORD_DIR](option)
|
||||
|
||||
# 评估
|
||||
sh run_eval_ascend.sh [VALIDATION_JSON_FILE] [CHECKPOINT_PATH] [BACKBONE] [COCO_ROOT] [MINDRECORD_DIR](option)
|
||||
bash run_eval_ascend.sh [VALIDATION_JSON_FILE] [CHECKPOINT_PATH] [BACKBONE] [COCO_ROOT] [MINDRECORD_DIR](option)
|
||||
|
||||
#推理
|
||||
sh run_infer_310.sh [MINDIR_PATH] [DATA_PATH] [ANN_FILE] [DEVICE_ID]
|
||||
bash run_infer_310.sh [MINDIR_PATH] [DATA_PATH] [ANN_FILE] [DEVICE_ID]
|
||||
```
|
||||
|
||||
## 在GPU上运行
|
||||
|
|
@ -131,14 +133,13 @@ sh run_infer_310.sh [MINDIR_PATH] [DATA_PATH] [ANN_FILE] [DEVICE_ID]
|
|||
python convert_checkpoint.py --ckpt_file=[BACKBONE_MODEL]
|
||||
|
||||
# 单机训练
|
||||
sh run_standalone_train_gpu.sh [PRETRAINED_MODEL] [BACKBONE] [COCO_ROOT] [MINDRECORD_DIR](option)
|
||||
bash run_standalone_train_gpu.sh [PRETRAINED_MODEL] [BACKBONE] [COCO_ROOT] [MINDRECORD_DIR](option)
|
||||
|
||||
# 分布式训练
|
||||
sh run_distribute_train_gpu.sh [DEVICE_NUM] [PRETRAINED_MODEL] [BACKBONE] [COCO_ROOT] [MINDRECORD_DIR](option)
|
||||
bash run_distribute_train_gpu.sh [DEVICE_NUM] [PRETRAINED_MODEL] [BACKBONE] [COCO_ROOT] [MINDRECORD_DIR](option)
|
||||
|
||||
# 评估
|
||||
sh run_eval_gpu.sh [VALIDATION_JSON_FILE] [CHECKPOINT_PATH] [BACKBONE] [COCO_ROOT] [MINDRECORD_DIR](option)
|
||||
|
||||
bash run_eval_gpu.sh [VALIDATION_JSON_FILE] [CHECKPOINT_PATH] [BACKBONE] [COCO_ROOT] [MINDRECORD_DIR](option)
|
||||
```
|
||||
|
||||
## 在docker上运行
|
||||
|
|
@ -161,24 +162,24 @@ bash scripts/docker_start.sh fasterrcnn:20.1.0 [DATA_DIR] [MODEL_DIR]
|
|||
|
||||
```shell
|
||||
# 单机训练
|
||||
sh run_standalone_train_ascend.sh [PRETRAINED_MODEL] [BACKBONE] [COCO_ROOT] [MINDRECORD_DIR](option)
|
||||
bash run_standalone_train_ascend.sh [PRETRAINED_MODEL] [BACKBONE] [COCO_ROOT] [MINDRECORD_DIR](option)
|
||||
|
||||
# 分布式训练
|
||||
sh run_distribute_train_ascend.sh [RANK_TABLE_FILE] [PRETRAINED_MODEL] [BACKBONE] [COCO_ROOT] [MINDRECORD_DIR](option)
|
||||
bash run_distribute_train_ascend.sh [RANK_TABLE_FILE] [PRETRAINED_MODEL] [BACKBONE] [COCO_ROOT] [MINDRECORD_DIR](option)
|
||||
```
|
||||
|
||||
4. 评估
|
||||
|
||||
```shell
|
||||
# 评估
|
||||
sh run_eval_ascend.sh [VALIDATION_JSON_FILE] [CHECKPOINT_PATH] [BACKBONE] [COCO_ROOT] [MINDRECORD_DIR](option)
|
||||
bash run_eval_ascend.sh [VALIDATION_JSON_FILE] [CHECKPOINT_PATH] [BACKBONE] [COCO_ROOT] [MINDRECORD_DIR](option)
|
||||
```
|
||||
|
||||
5. 推理
|
||||
|
||||
```shell
|
||||
# 推理
|
||||
sh run_infer_310.sh [AIR_PATH] [DATA_PATH] [ANN_FILE_PATH] [DEVICE_ID]
|
||||
bash run_infer_310.sh [AIR_PATH] [DATA_PATH] [ANN_FILE_PATH] [DEVICE_ID]
|
||||
```
|
||||
|
||||
- 在 ModelArts 进行训练 (如果你想在modelarts上运行,可以参考以下文档 [modelarts](https://support.huaweicloud.com/modelarts/))
|
||||
|
|
@ -356,20 +357,20 @@ elif backbone == "resnet_v1_50":
|
|||
|
||||
```shell
|
||||
# Ascend单机训练
|
||||
sh run_standalone_train_ascend.sh [PRETRAINED_MODEL] [BACKBONE] [COCO_ROOT] [MINDRECORD_DIR](option)
|
||||
bash run_standalone_train_ascend.sh [PRETRAINED_MODEL] [BACKBONE] [COCO_ROOT] [MINDRECORD_DIR](option)
|
||||
|
||||
# Ascend分布式训练
|
||||
sh run_distribute_train_ascend.sh [RANK_TABLE_FILE] [PRETRAINED_MODEL] [BACKBONE] [COCO_ROOT] [MINDRECORD_DIR](option)
|
||||
bash run_distribute_train_ascend.sh [RANK_TABLE_FILE] [PRETRAINED_MODEL] [BACKBONE] [COCO_ROOT] [MINDRECORD_DIR](option)
|
||||
```
|
||||
|
||||
#### 在GPU上运行
|
||||
|
||||
```shell
|
||||
# GPU单机训练
|
||||
sh run_standalone_train_gpu.sh [PRETRAINED_MODEL] [BACKBONE] [COCO_ROOT] [MINDRECORD_DIR](option)
|
||||
bash run_standalone_train_gpu.sh [PRETRAINED_MODEL] [BACKBONE] [COCO_ROOT] [MINDRECORD_DIR](option)
|
||||
|
||||
# GPU分布式训练
|
||||
sh run_distribute_train_gpu.sh [DEVICE_NUM] [PRETRAINED_MODEL] [BACKBONE] [COCO_ROOT] [MINDRECORD_DIR](option)
|
||||
bash run_distribute_train_gpu.sh [DEVICE_NUM] [PRETRAINED_MODEL] [BACKBONE] [COCO_ROOT] [MINDRECORD_DIR](option)
|
||||
```
|
||||
|
||||
Notes:
|
||||
|
|
@ -426,14 +427,14 @@ 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] [BACKBONE] [COCO_ROOT] [MINDRECORD_DIR](option)
|
||||
bash run_eval_ascend.sh [VALIDATION_JSON_FILE] [CHECKPOINT_PATH] [BACKBONE] [COCO_ROOT] [MINDRECORD_DIR](option)
|
||||
```
|
||||
|
||||
#### 在GPU上运行
|
||||
|
||||
```shell
|
||||
# GPU评估
|
||||
sh run_eval_gpu.sh [VALIDATION_JSON_FILE] [CHECKPOINT_PATH] [BACKBONE] [COCO_ROOT] [MINDRECORD_DIR](option)
|
||||
bash run_eval_gpu.sh [VALIDATION_JSON_FILE] [CHECKPOINT_PATH] [BACKBONE] [COCO_ROOT] [MINDRECORD_DIR](option)
|
||||
```
|
||||
|
||||
> 在训练过程中生成检查点。
|
||||
|
|
@ -476,7 +477,7 @@ python export.py --config_path [CONFIG_PATH] --ckpt_file [CKPT_PATH] --device_ta
|
|||
|
||||
```shell
|
||||
# Ascend310 inference
|
||||
sh run_infer_310.sh [MINDIR_PATH] [DATA_PATH] [ANN_FILE] [DEVICE_ID]
|
||||
bash run_infer_310.sh [MINDIR_PATH] [DATA_PATH] [ANN_FILE] [DEVICE_ID]
|
||||
```
|
||||
|
||||
### 结果
|
||||
|
|
@ -496,7 +497,7 @@ sh run_infer_310.sh [MINDIR_PATH] [DATA_PATH] [ANN_FILE] [DEVICE_ID]
|
|||
Average Recall (AR) @[ IoU=0.50:0.95 | area= small | maxDets=100 ] = 0.330
|
||||
Average Recall (AR) @[ IoU=0.50:0.95 | area=medium | maxDets=100 ] = 0.547
|
||||
Average Recall (AR) @[ IoU=0.50:0.95 | area= large | maxDets=100 ] = 0.622
|
||||
```
|
||||
```
|
||||
|
||||
# 模型描述
|
||||
|
||||
|
|
|
|||
|
|
@ -95,12 +95,12 @@ After installing MindSpore via the official website, you can start training and
|
|||
python train.py > train.log 2>&1 &
|
||||
|
||||
# run distributed training example
|
||||
sh scripts/run_train.sh rank_table.json
|
||||
bash scripts/run_train.sh rank_table.json
|
||||
|
||||
# run evaluation example
|
||||
python eval.py > eval.log 2>&1 &
|
||||
OR
|
||||
sh run_eval.sh
|
||||
bash run_eval.sh
|
||||
|
||||
# run inferenct example
|
||||
bash run_infer_310.sh [MINDIR_PATH] [DATASET] [DATA_PATH] [LABEL_FILE] [DEVICE_ID]
|
||||
|
|
@ -122,12 +122,12 @@ After installing MindSpore via the official website, you can start training and
|
|||
python train.py > train.log 2>&1 &
|
||||
|
||||
# run distributed training example
|
||||
sh scripts/run_train_gpu.sh 8 0,1,2,3,4,5,6,7
|
||||
bash scripts/run_train_gpu.sh 8 0,1,2,3,4,5,6,7
|
||||
|
||||
# run evaluation example
|
||||
python eval.py --checkpoint_path=[CHECKPOINT_PATH] > eval.log 2>&1 &
|
||||
OR
|
||||
sh run_eval_gpu.sh [CHECKPOINT_PATH]
|
||||
bash run_eval_gpu.sh [CHECKPOINT_PATH]
|
||||
```
|
||||
|
||||
- running on CPU
|
||||
|
|
@ -390,7 +390,7 @@ For more configuration details, please refer the script `config.py`.
|
|||
- running on Ascend
|
||||
|
||||
```bash
|
||||
sh scripts/run_train.sh rank_table.json
|
||||
bash scripts/run_train.sh rank_table.json
|
||||
```
|
||||
|
||||
The above shell script will run distribute training in the background. You can view the results through the file `train_parallel[X]/log`. The loss value will be achieved as follows:
|
||||
|
|
@ -409,7 +409,7 @@ For more configuration details, please refer the script `config.py`.
|
|||
- running on GPU
|
||||
|
||||
```bash
|
||||
sh scripts/run_train_gpu.sh 8 0,1,2,3,4,5,6,7
|
||||
bash scripts/run_train_gpu.sh 8 0,1,2,3,4,5,6,7
|
||||
```
|
||||
|
||||
The above shell script will run distribute training in the background. You can view the results through the file `train/train.log`.
|
||||
|
|
@ -425,7 +425,7 @@ For more configuration details, please refer the script `config.py`.
|
|||
```python
|
||||
python eval.py > eval.log 2>&1 &
|
||||
OR
|
||||
sh scripts/run_eval.sh
|
||||
bash scripts/run_eval.sh
|
||||
```
|
||||
|
||||
The above python command will run in the background. You can view the results through the file "eval.log". The accuracy of the test dataset will be as follows:
|
||||
|
|
@ -460,7 +460,7 @@ For more configuration details, please refer the script `config.py`.
|
|||
OR,
|
||||
|
||||
```bash
|
||||
sh scripts/run_eval_gpu.sh [CHECKPOINT_PATH]
|
||||
bash scripts/run_eval_gpu.sh [CHECKPOINT_PATH]
|
||||
```
|
||||
|
||||
The above python command will run in the background. You can view the results through the file "eval/eval.log". The accuracy of the test dataset will be as follows:
|
||||
|
|
@ -496,7 +496,7 @@ Current batch_ Size can only be set to 1.
|
|||
|
||||
```shell
|
||||
# Ascend310 inference
|
||||
sh run_infer_310.sh [MINDIR_PATH] [DATASET] [DATA_PATH] [LABEL_FILE] [DEVICE_ID]
|
||||
bash run_infer_310.sh [MINDIR_PATH] [DATASET] [DATA_PATH] [LABEL_FILE] [DEVICE_ID]
|
||||
after allreduce eval: top1_correct=9252, tot=10000, acc=92.52%
|
||||
```
|
||||
|
||||
|
|
|
|||
|
|
@ -97,12 +97,12 @@ GoogleNet由多个inception模块串联起来,可以更加深入。 降维的
|
|||
python train.py > train.log 2>&1 &
|
||||
|
||||
# 运行分布式训练示例
|
||||
sh scripts/run_train.sh rank_table.json
|
||||
bash scripts/run_train.sh rank_table.json
|
||||
|
||||
# 运行评估示例
|
||||
python eval.py > eval.log 2>&1 &
|
||||
或
|
||||
sh run_eval.sh
|
||||
bash run_eval.sh
|
||||
|
||||
# 运行推理示例
|
||||
bash run_infer_310.sh [MINDIR_PATH] [DATASET] [DATA_PATH] [LABEL_FILE] [DEVICE_ID]
|
||||
|
|
@ -124,12 +124,12 @@ GoogleNet由多个inception模块串联起来,可以更加深入。 降维的
|
|||
python train.py > train.log 2>&1 &
|
||||
|
||||
# 运行分布式训练示例
|
||||
sh scripts/run_train_gpu.sh 8 0,1,2,3,4,5,6,7
|
||||
bash scripts/run_train_gpu.sh 8 0,1,2,3,4,5,6,7
|
||||
|
||||
# 运行评估示例
|
||||
python eval.py --checkpoint_path=[CHECKPOINT_PATH] > eval.log 2>&1 &
|
||||
OR
|
||||
sh run_eval_gpu.sh [CHECKPOINT_PATH]
|
||||
bash run_eval_gpu.sh [CHECKPOINT_PATH]
|
||||
```
|
||||
|
||||
- CPU处理器环境运行
|
||||
|
|
@ -360,7 +360,7 @@ GoogleNet由多个inception模块串联起来,可以更加深入。 降维的
|
|||
- Ascend处理器环境运行
|
||||
|
||||
```bash
|
||||
sh scripts/run_train.sh rank_table.json
|
||||
bash scripts/run_train.sh rank_table.json
|
||||
```
|
||||
|
||||
上述shell脚本将在后台运行分布训练。您可以通过train_parallel[X]/log文件查看结果。采用以下方式达到损失值:
|
||||
|
|
@ -379,7 +379,7 @@ GoogleNet由多个inception模块串联起来,可以更加深入。 降维的
|
|||
- GPU处理器环境运行
|
||||
|
||||
```bash
|
||||
sh scripts/run_train_gpu.sh 8 0,1,2,3,4,5,6,7
|
||||
bash scripts/run_train_gpu.sh 8 0,1,2,3,4,5,6,7
|
||||
```
|
||||
|
||||
上述shell脚本将在后台运行分布训练。您可以通过train/train.log文件查看结果。
|
||||
|
|
@ -430,7 +430,7 @@ GoogleNet由多个inception模块串联起来,可以更加深入。 降维的
|
|||
或者,
|
||||
|
||||
```bash
|
||||
sh scripts/run_eval_gpu.sh [CHECKPOINT_PATH]
|
||||
bash scripts/run_eval_gpu.sh [CHECKPOINT_PATH]
|
||||
```
|
||||
|
||||
上述python命令将在后台运行,您可以通过eval/eval.log文件查看结果。测试数据集的准确性如下:
|
||||
|
|
@ -465,7 +465,7 @@ python export.py --config_path [CONFIG_PATH]
|
|||
|
||||
```shell
|
||||
# Ascend310 inference
|
||||
sh run_infer_310.sh [MINDIR_PATH] [DATASET] [DATA_PATH] [LABEL_FILE] [DEVICE_ID]
|
||||
bash run_infer_310.sh [MINDIR_PATH] [DATASET] [DATA_PATH] [LABEL_FILE] [DEVICE_ID]
|
||||
after allreduce eval: top1_correct=9252, tot=10000, acc=92.52%
|
||||
```
|
||||
|
||||
|
|
|
|||
|
|
@ -276,16 +276,16 @@ You can start training using python or shell scripts. The usage of shell scripts
|
|||
|
||||
```shell
|
||||
# distribute training(8p)
|
||||
sh scripts/run_distribute_train.sh RANK_TABLE_FILE DATA_PATH
|
||||
bash scripts/run_distribute_train.sh RANK_TABLE_FILE DATA_PATH
|
||||
# standalone training
|
||||
sh scripts/run_standalone_train.sh DEVICE_ID DATA_PATH
|
||||
bash scripts/run_standalone_train.sh DEVICE_ID DATA_PATH
|
||||
```
|
||||
|
||||
- CPU:
|
||||
|
||||
```shell
|
||||
# standalone training
|
||||
sh scripts/run_standalone_train_cpu.sh DATA_PATH
|
||||
bash scripts/run_standalone_train_cpu.sh DATA_PATH
|
||||
```
|
||||
|
||||
> Notes: RANK_TABLE_FILE can refer to [Link](https://www.mindspore.cn/docs/programming_guide/en/master/distributed_training_ascend.html), and the device_ip can be got as [Link](https://gitee.com/mindspore/mindspore/tree/master/model_zoo/utils/hccl_tools). For large models like InceptionV3, it's better to export an external environment variable `export HCCL_CONNECT_TIMEOUT=600` to extend hccl connection checking time from the default 120 seconds to 600 seconds. Otherwise, the connection could be timeout since compiling time increases with the growth of model size.
|
||||
|
|
@ -303,12 +303,12 @@ sh scripts/run_standalone_train_cpu.sh DATA_PATH
|
|||
shell:
|
||||
Ascend:
|
||||
# distribute training example(8p)
|
||||
sh scripts/run_distribute_train.sh RANK_TABLE_FILE DATA_PATH
|
||||
bash scripts/run_distribute_train.sh RANK_TABLE_FILE DATA_PATH
|
||||
# standalone training example
|
||||
sh scripts/run_standalone_train.sh DEVICE_ID DATA_PATH
|
||||
bash scripts/run_standalone_train.sh DEVICE_ID DATA_PATH
|
||||
|
||||
CPU:
|
||||
sh script/run_standalone_train_cpu.sh DATA_PATH
|
||||
bash script/run_standalone_train_cpu.sh DATA_PATH
|
||||
```
|
||||
|
||||
### Result
|
||||
|
|
@ -345,13 +345,13 @@ You can start training using python or shell scripts. The usage of shell scripts
|
|||
- Ascend:
|
||||
|
||||
```python
|
||||
sh scripts/run_eval.sh DEVICE_ID DATA_PATH PATH_CHECKPOINT
|
||||
bash scripts/run_eval.sh DEVICE_ID DATA_PATH PATH_CHECKPOINT
|
||||
```
|
||||
|
||||
- CPU:
|
||||
|
||||
```python
|
||||
sh scripts/run_eval_cpu.sh DATA_PATH PATH_CHECKPOINT
|
||||
bash scripts/run_eval_cpu.sh DATA_PATH PATH_CHECKPOINT
|
||||
```
|
||||
|
||||
### Launch
|
||||
|
|
@ -363,8 +363,8 @@ You can start training using python or shell scripts. The usage of shell scripts
|
|||
CPU: python eval.py --config_path CONFIG_FILE --dataset_path DATA_PATH --checkpoint PATH_CHECKPOINT --platform CPU
|
||||
|
||||
shell:
|
||||
Ascend: sh scripts/run_eval.sh DEVICE_ID DATA_PATH PATH_CHECKPOINT
|
||||
CPU: sh scripts/run_eval_cpu.sh DATA_PATH PATH_CHECKPOINT
|
||||
Ascend: bash scripts/run_eval.sh DEVICE_ID DATA_PATH PATH_CHECKPOINT
|
||||
CPU: bash scripts/run_eval_cpu.sh DATA_PATH PATH_CHECKPOINT
|
||||
```
|
||||
|
||||
> checkpoint can be produced in training process.
|
||||
|
|
@ -393,7 +393,7 @@ Before performing inference, the model file must be exported by export script on
|
|||
|
||||
```shell
|
||||
# Ascend310 inference
|
||||
sh run_infer_310.sh [MINDIR_PATH] [DATA_PATH] [ANN_FILE] [DEVICE_ID]
|
||||
bash run_infer_310.sh [MINDIR_PATH] [DATA_PATH] [ANN_FILE] [DEVICE_ID]
|
||||
```
|
||||
|
||||
-NOTE: Ascend310 inference use Imagenet dataset . The label of the image is the number of folder which is started from 0 after sorting.
|
||||
|
|
|
|||
|
|
@ -282,9 +282,9 @@ train.py和config.py中主要参数如下:
|
|||
|
||||
```shell
|
||||
# 分布式训练示例(8卡)
|
||||
sh scripts/run_distribute_train.sh RANK_TABLE_FILE DATA_PATH
|
||||
bash scripts/run_distribute_train.sh RANK_TABLE_FILE DATA_PATH
|
||||
# 单机训练
|
||||
sh scripts/run_standalone_train.sh DEVICE_ID DATA_PATH
|
||||
bash scripts/run_standalone_train.sh DEVICE_ID DATA_PATH
|
||||
```
|
||||
|
||||
> 注:RANK_TABLE_FILE可参考[链接](https://www.mindspore.cn/docs/programming_guide/zh-CN/master/distributed_training_ascend.html)。device_ip可以通过[链接](https://gitee.com/mindspore/mindspore/tree/master/model_zoo/utils/hccl_tools)获取
|
||||
|
|
@ -301,12 +301,12 @@ train.py和config.py中主要参数如下:
|
|||
shell:
|
||||
Ascend:
|
||||
# 分布式训练示例(8卡)
|
||||
sh scripts/run_distribute_train.sh RANK_TABLE_FILE DATA_PATH
|
||||
bash scripts/run_distribute_train.sh RANK_TABLE_FILE DATA_PATH
|
||||
# 单机训练
|
||||
sh scripts/run_standalone_train.sh DEVICE_ID DATA_PATH
|
||||
bash scripts/run_standalone_train.sh DEVICE_ID DATA_PATH
|
||||
|
||||
CPU:
|
||||
sh script/run_standalone_train_cpu.sh DATA_PATH
|
||||
bash script/run_standalone_train_cpu.sh DATA_PATH
|
||||
```
|
||||
|
||||
### 结果
|
||||
|
|
@ -343,13 +343,13 @@ epoch time: 6358482.104 ms, per step time: 16303.800 ms
|
|||
- Ascend:
|
||||
|
||||
```shell
|
||||
sh scripts/run_eval.sh DEVICE_ID DATA_DIR PATH_CHECKPOINT
|
||||
bash scripts/run_eval.sh DEVICE_ID DATA_DIR PATH_CHECKPOINT
|
||||
```
|
||||
|
||||
- CPU:
|
||||
|
||||
```python
|
||||
sh scripts/run_eval_cpu.sh DATA_PATH PATH_CHECKPOINT
|
||||
bash scripts/run_eval_cpu.sh DATA_PATH PATH_CHECKPOINT
|
||||
```
|
||||
|
||||
### 启动
|
||||
|
|
@ -361,8 +361,8 @@ epoch time: 6358482.104 ms, per step time: 16303.800 ms
|
|||
CPU: python eval.py --config_path CONFIG_FILE --dataset_path DATA_PATH --checkpoint PATH_CHECKPOINT --platform CPU
|
||||
|
||||
shell:
|
||||
Ascend: sh scripts/run_eval.sh DEVICE_ID DATA_DIR PATH_CHECKPOINT
|
||||
CPU: sh scripts/run_eval_cpu.sh DATA_PATH PATH_CHECKPOINT
|
||||
Ascend: bash scripts/run_eval.sh DEVICE_ID DATA_DIR PATH_CHECKPOINT
|
||||
CPU: bash scripts/run_eval_cpu.sh DATA_PATH PATH_CHECKPOINT
|
||||
```
|
||||
|
||||
> 训练过程中可以生成检查点。
|
||||
|
|
@ -391,7 +391,7 @@ python export.py --config_path [CONFIG_FILE] --ckpt_file [CKPT_PATH] --device_ta
|
|||
|
||||
```shell
|
||||
# Ascend310 inference
|
||||
sh run_infer_310.sh [MINDIR_PATH] [DATA_PATH] [ANN_FILE] [DEVICE_ID]
|
||||
bash run_infer_310.sh [MINDIR_PATH] [DATA_PATH] [ANN_FILE] [DEVICE_ID]
|
||||
```
|
||||
|
||||
-注意:310推理使用ImageNet数据集. 图片的标签是将所在文件夹排序后获得的从0开始的编号
|
||||
|
|
|
|||
|
|
@ -247,9 +247,9 @@ You can start training using python or shell scripts. The usage of shell scripts
|
|||
|
||||
```bash
|
||||
# distribute training example(8p)
|
||||
sh scripts/run_distribute_train_ascend.sh RANK_TABLE_FILE DATA_PATH DATA_DIR
|
||||
bash scripts/run_distribute_train_ascend.sh RANK_TABLE_FILE DATA_PATH DATA_DIR
|
||||
# standalone training
|
||||
sh scripts/run_standalone_train_ascend.sh DEVICE_ID DATA_DIR
|
||||
bash scripts/run_standalone_train_ascend.sh DEVICE_ID DATA_DIR
|
||||
```
|
||||
|
||||
> Notes:
|
||||
|
|
@ -261,14 +261,14 @@ sh scripts/run_standalone_train_ascend.sh DEVICE_ID DATA_DIR
|
|||
|
||||
```bash
|
||||
# distribute training example(8p)
|
||||
sh scripts/run_distribute_train_gpu.sh DATA_PATH
|
||||
bash scripts/run_distribute_train_gpu.sh DATA_PATH
|
||||
```
|
||||
|
||||
- CPU:
|
||||
|
||||
```bash
|
||||
# standalone training example with shell
|
||||
sh scripts/run_standalone_train_cpu.sh DATA_PATH
|
||||
bash scripts/run_standalone_train_cpu.sh DATA_PATH
|
||||
```
|
||||
|
||||
### Launch
|
||||
|
|
@ -278,15 +278,15 @@ sh scripts/run_standalone_train_cpu.sh DATA_PATH
|
|||
shell:
|
||||
Ascend:
|
||||
# distribute training example(8p)
|
||||
sh scripts/run_distribute_train_ascend.sh RANK_TABLE_FILE DATA_PATH DATA_DIR
|
||||
bash scripts/run_distribute_train_ascend.sh RANK_TABLE_FILE DATA_PATH DATA_DIR
|
||||
# standalone training
|
||||
sh scripts/run_standalone_train_ascend.sh DEVICE_ID DATA_DIR
|
||||
bash scripts/run_standalone_train_ascend.sh DEVICE_ID DATA_DIR
|
||||
GPU:
|
||||
# distribute training example(8p)
|
||||
sh scripts/run_distribute_train_gpu.sh DATA_PATH
|
||||
bash scripts/run_distribute_train_gpu.sh DATA_PATH
|
||||
CPU:
|
||||
# standalone training example with shell
|
||||
sh scripts/run_standalone_train_cpu.sh DATA_PATH
|
||||
bash scripts/run_standalone_train_cpu.sh DATA_PATH
|
||||
```
|
||||
|
||||
### Result
|
||||
|
|
@ -324,13 +324,13 @@ You can start training using python or shell scripts. The usage of shell scripts
|
|||
- Ascend:
|
||||
|
||||
```bash
|
||||
sh scripts/run_eval_ascend.sh DEVICE_ID DATA_DIR CHECKPOINT_PATH
|
||||
bash scripts/run_eval_ascend.sh DEVICE_ID DATA_DIR CHECKPOINT_PATH
|
||||
```
|
||||
|
||||
- GPU
|
||||
|
||||
```bash
|
||||
sh scripts/run_eval_gpu.sh DATA_DIR CHECKPOINT_PATH
|
||||
bash scripts/run_eval_gpu.sh DATA_DIR CHECKPOINT_PATH
|
||||
```
|
||||
|
||||
### Launch
|
||||
|
|
@ -339,9 +339,9 @@ You can start training using python or shell scripts. The usage of shell scripts
|
|||
# eval example
|
||||
shell:
|
||||
Ascend:
|
||||
sh scripts/run_eval_ascend.sh DEVICE_ID DATA_DIR CHECKPOINT_PATH
|
||||
bash scripts/run_eval_ascend.sh DEVICE_ID DATA_DIR CHECKPOINT_PATH
|
||||
GPU:
|
||||
sh scripts/run_eval_gpu.sh DATA_DIR CHECKPOINT_PATH
|
||||
bash scripts/run_eval_gpu.sh DATA_DIR CHECKPOINT_PATH
|
||||
```
|
||||
|
||||
> checkpoint can be produced in training process.
|
||||
|
|
@ -378,7 +378,7 @@ Before performing inference, the model file must be exported by export script on
|
|||
|
||||
```shell
|
||||
# Ascend310 inference
|
||||
sh run_infer_310.sh [MINDIR_PATH] [DATA_PATH] [ANN_FILE] [DEVICE_ID]
|
||||
bash run_infer_310.sh [MINDIR_PATH] [DATA_PATH] [ANN_FILE] [DEVICE_ID]
|
||||
```
|
||||
|
||||
-NOTE:Ascend310 inference use Imagenet dataset . The label of the image is the number of folder which is started from 0 after sorting.
|
||||
|
|
|
|||
|
|
@ -75,9 +75,9 @@ After installing MindSpore via the official website, you can start training and
|
|||
|
||||
```python
|
||||
# enter script dir, train LeNet
|
||||
sh run_standalone_train_ascend.sh [DATA_PATH] [CKPT_SAVE_PATH]
|
||||
bash run_standalone_train_ascend.sh [DATA_PATH] [CKPT_SAVE_PATH]
|
||||
# enter script dir, evaluate LeNet
|
||||
sh run_standalone_eval_ascend.sh [DATA_PATH] [CKPT_NAME]
|
||||
bash run_standalone_eval_ascend.sh [DATA_PATH] [CKPT_NAME]
|
||||
```
|
||||
|
||||
- Running on [ModelArts](https://support.huaweicloud.com/modelarts/)
|
||||
|
|
@ -228,7 +228,7 @@ Major parameters in train.py and default_config.yaml as follows:
|
|||
```bash
|
||||
python train.py --data_path Data --ckpt_path ckpt > log.txt 2>&1 &
|
||||
# or enter script dir, and run the script
|
||||
sh run_standalone_train_ascend.sh Data ckpt
|
||||
bash run_standalone_train_ascend.sh Data ckpt
|
||||
```
|
||||
|
||||
After training, the loss value will be achieved as follows:
|
||||
|
|
@ -254,7 +254,7 @@ Before running the command below, please check the checkpoint path used for eval
|
|||
```bash
|
||||
python eval.py --data_path Data --ckpt_path ckpt/checkpoint_lenet-1_1875.ckpt > log.txt 2>&1 &
|
||||
# or enter script dir, and run the script
|
||||
sh run_standalone_eval_ascend.sh Data ckpt/checkpoint_lenet-1_1875.ckpt
|
||||
bash run_standalone_eval_ascend.sh Data ckpt/checkpoint_lenet-1_1875.ckpt
|
||||
```
|
||||
|
||||
You can view the results through the file "log.txt". The accuracy of the test dataset will be as follows:
|
||||
|
|
|
|||
|
|
@ -77,9 +77,9 @@ LeNet非常简单,包含5层,由2个卷积层和3个全连接层组成。
|
|||
|
||||
```python
|
||||
# 进入脚本目录,训练LeNet
|
||||
sh run_standalone_train_ascend.sh [DATA_PATH] [CKPT_SAVE_PATH]
|
||||
bash run_standalone_train_ascend.sh [DATA_PATH] [CKPT_SAVE_PATH]
|
||||
# 进入脚本目录,评估LeNet
|
||||
sh run_standalone_eval_ascend.sh [DATA_PATH] [CKPT_NAME]
|
||||
bash run_standalone_eval_ascend.sh [DATA_PATH] [CKPT_NAME]
|
||||
```
|
||||
|
||||
- 在 ModelArts 进行训练 (如果你想在modelarts上运行,可以参考以下文档 [modelarts](https://support.huaweicloud.com/modelarts/))
|
||||
|
|
@ -226,7 +226,7 @@ train.py和default_config.yaml中主要参数如下:
|
|||
```bash
|
||||
python train.py --data_path Data --ckpt_path ckpt > log.txt 2>&1 &
|
||||
# or enter script dir, and run the script
|
||||
sh run_standalone_train_ascend.sh Data ckpt
|
||||
bash run_standalone_train_ascend.sh Data ckpt
|
||||
```
|
||||
|
||||
训练结束,损失值如下:
|
||||
|
|
@ -252,7 +252,7 @@ epoch:1 step:1538, loss is 1.0221305
|
|||
```bash
|
||||
python eval.py --data_path Data --ckpt_path ckpt/checkpoint_lenet-1_1875.ckpt > log.txt 2>&1 &
|
||||
# or enter script dir, and run the script
|
||||
sh run_standalone_eval_ascend.sh Data ckpt/checkpoint_lenet-1_1875.ckpt
|
||||
bash run_standalone_eval_ascend.sh Data ckpt/checkpoint_lenet-1_1875.ckpt
|
||||
```
|
||||
|
||||
您可以通过log.txt文件查看结果。测试数据集的准确性如下:
|
||||
|
|
|
|||
|
|
@ -72,7 +72,7 @@ After installing MindSpore via the official website, you can start training and
|
|||
|
||||
```python
|
||||
# enter ../lenet directory and train lenet network,then a '.ckpt' file will be generated.
|
||||
sh run_standalone_train_ascend.sh [DATA_PATH]
|
||||
bash run_standalone_train_ascend.sh [DATA_PATH]
|
||||
# enter lenet dir, train LeNet-Quant
|
||||
python train.py --device_target=Ascend --data_path=[DATA_PATH] --ckpt_path=[CKPT_PATH] --dataset_sink_mode=True
|
||||
#evaluate LeNet-Quant
|
||||
|
|
|
|||
|
|
@ -76,7 +76,7 @@ LeNet非常简单,包含5层,由2个卷积层和3个全连接层组成。
|
|||
|
||||
```python
|
||||
# 进入../lenet目录,训练lenet网络,生成'.ckpt'文件。
|
||||
sh run_standalone_train_ascend.sh [DATA_PATH]
|
||||
bash run_standalone_train_ascend.sh [DATA_PATH]
|
||||
# 进入lenet目录,训练LeNet-Quant
|
||||
python train.py --device_target=Ascend --data_path=[DATA_PATH] --ckpt_path=[CKPT_PATH] --dataset_sink_mode=True
|
||||
# 评估LeNet-Quant
|
||||
|
|
|
|||
|
|
@ -662,7 +662,7 @@ Current batch_ Size can only be set to 1. The inference process needs about 600G
|
|||
|
||||
```shell
|
||||
# Ascend310 inference
|
||||
sh run_infer_310.sh [MINDIR_PATH] [DATA_PATH] [ANN_FILE] [DEVICE_ID]
|
||||
bash run_infer_310.sh [MINDIR_PATH] [DATA_PATH] [ANN_FILE] [DEVICE_ID]
|
||||
```
|
||||
|
||||
### result
|
||||
|
|
|
|||
|
|
@ -107,10 +107,10 @@ pip install mmcv=0.2.14
|
|||
|
||||
```text
|
||||
# 分布式训练
|
||||
sh run_distribute_train.sh [RANK_TABLE_FILE] [PRETRAINED_CKPT]
|
||||
bash run_distribute_train.sh [RANK_TABLE_FILE] [PRETRAINED_CKPT]
|
||||
|
||||
# 单机训练
|
||||
sh run_standalone_train.sh [PRETRAINED_CKPT]
|
||||
bash run_standalone_train.sh [PRETRAINED_CKPT]
|
||||
```
|
||||
|
||||
注:
|
||||
|
|
@ -123,7 +123,7 @@ pip install mmcv=0.2.14
|
|||
|
||||
```bash
|
||||
# 评估
|
||||
sh run_eval.sh [VALIDATION_JSON_FILE] [CHECKPOINT_PATH]
|
||||
bash run_eval.sh [VALIDATION_JSON_FILE] [CHECKPOINT_PATH]
|
||||
```
|
||||
|
||||
注:
|
||||
|
|
@ -134,7 +134,7 @@ pip install mmcv=0.2.14
|
|||
|
||||
```bash
|
||||
# 评估
|
||||
sh run_infer_310.sh [MINDIR_PATH] [DATA_PATH] [ANN_FILE] [DEVICE_ID]
|
||||
bash run_infer_310.sh [MINDIR_PATH] [DATA_PATH] [ANN_FILE] [DEVICE_ID]
|
||||
```
|
||||
|
||||
注:
|
||||
|
|
@ -364,10 +364,10 @@ bash run_eval.sh [VALIDATION_JSON_FILE] [CHECKPOINT_PATH]
|
|||
|
||||
```bash
|
||||
# 分布式训练
|
||||
用法:sh run_distribute_train.sh [RANK_TABLE_FILE] [PRETRAINED_MODEL]
|
||||
用法:bash run_distribute_train.sh [RANK_TABLE_FILE] [PRETRAINED_MODEL]
|
||||
|
||||
# 单机训练
|
||||
用法:sh run_standalone_train.sh [PRETRAINED_MODEL]
|
||||
用法:bash run_standalone_train.sh [PRETRAINED_MODEL]
|
||||
```
|
||||
|
||||
### 参数配置
|
||||
|
|
@ -530,7 +530,7 @@ bash run_eval.sh [VALIDATION_JSON_FILE] [CHECKPOINT_PATH]
|
|||
|
||||
```bash
|
||||
# 单机训练
|
||||
sh run_standalone_train.sh [PRETRAINED_MODEL]
|
||||
bash run_standalone_train.sh [PRETRAINED_MODEL]
|
||||
```
|
||||
|
||||
### 分布式训练
|
||||
|
|
@ -538,7 +538,7 @@ sh run_standalone_train.sh [PRETRAINED_MODEL]
|
|||
- 运行`run_distribute_train.sh`开始Mask模型的分布式训练。
|
||||
|
||||
```bash
|
||||
sh run_distribute_train.sh [RANK_TABLE_FILE] [PRETRAINED_MODEL]
|
||||
bash run_distribute_train.sh [RANK_TABLE_FILE] [PRETRAINED_MODEL]
|
||||
```
|
||||
|
||||
- Notes
|
||||
|
|
@ -597,7 +597,7 @@ epoch:12 step:7393 ,rpn_loss:0.06482, rcnn_loss:0.47681, rpn_cls_loss:0.04770, r
|
|||
|
||||
```bash
|
||||
# 推理
|
||||
sh run_eval.sh [VALIDATION_ANN_FILE_JSON] [CHECKPOINT_PATH]
|
||||
bash run_eval.sh [VALIDATION_ANN_FILE_JSON] [CHECKPOINT_PATH]
|
||||
```
|
||||
|
||||
> 关于COCO2017数据集,VALIDATION_ANN_FILE_JSON参考数据集目录下的annotations/instances_val2017.json文件。
|
||||
|
|
@ -657,7 +657,7 @@ python export.py --config_path [CONFIG_PATH] --ckpt_file [CKPT_PATH] --device_ta
|
|||
|
||||
```shell
|
||||
# Ascend310 推理
|
||||
sh run_infer_310.sh [MINDIR_PATH] [DATA_PATH] [ANN_FILE] [DEVICE_ID]
|
||||
bash run_infer_310.sh [MINDIR_PATH] [DATA_PATH] [ANN_FILE] [DEVICE_ID]
|
||||
```
|
||||
|
||||
### 结果
|
||||
|
|
|
|||
|
|
@ -104,10 +104,10 @@ pip install mmcv=0.2.14
|
|||
|
||||
```
|
||||
# distributed training
|
||||
sh run_distribute_train.sh [RANK_TABLE_FILE] [PRETRAINED_CKPT]
|
||||
bash run_distribute_train.sh [RANK_TABLE_FILE] [PRETRAINED_CKPT]
|
||||
|
||||
# standalone training
|
||||
sh run_standalone_train.sh [PRETRAINED_CKPT]
|
||||
bash run_standalone_train.sh [PRETRAINED_CKPT]
|
||||
```
|
||||
|
||||
Note:
|
||||
|
|
@ -120,7 +120,7 @@ pip install mmcv=0.2.14
|
|||
|
||||
```bash
|
||||
# Evaluation
|
||||
sh run_eval.sh [VALIDATION_JSON_FILE] [CHECKPOINT_PATH]
|
||||
bash run_eval.sh [VALIDATION_JSON_FILE] [CHECKPOINT_PATH]
|
||||
```
|
||||
|
||||
Note:
|
||||
|
|
@ -324,10 +324,10 @@ pip install mmcv=0.2.14
|
|||
|
||||
```bash
|
||||
# distributed training
|
||||
Usage: sh run_distribute_train.sh [RANK_TABLE_FILE] [PRETRAINED_MODEL]
|
||||
Usage: bash run_distribute_train.sh [RANK_TABLE_FILE] [PRETRAINED_MODEL]
|
||||
|
||||
# standalone training
|
||||
Usage: sh run_standalone_train.sh [PRETRAINED_MODEL]
|
||||
Usage: bash run_standalone_train.sh [PRETRAINED_MODEL]
|
||||
```
|
||||
|
||||
### [Parameters Configuration](#contents)
|
||||
|
|
@ -482,7 +482,7 @@ Usage: sh run_standalone_train.sh [PRETRAINED_MODEL]
|
|||
|
||||
```bash
|
||||
# standalone training
|
||||
sh run_standalone_train.sh [PRETRAINED_MODEL]
|
||||
bash run_standalone_train.sh [PRETRAINED_MODEL]
|
||||
```
|
||||
|
||||
### [Distributed Training](#content)
|
||||
|
|
@ -490,7 +490,7 @@ sh run_standalone_train.sh [PRETRAINED_MODEL]
|
|||
- Run `run_distribute_train.sh` for distributed training of Mask model.
|
||||
|
||||
```bash
|
||||
sh run_distribute_train.sh [RANK_TABLE_FILE] [PRETRAINED_MODEL]
|
||||
bash run_distribute_train.sh [RANK_TABLE_FILE] [PRETRAINED_MODEL]
|
||||
```
|
||||
|
||||
> hccl.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).
|
||||
|
|
@ -522,7 +522,7 @@ Training result will be stored in the example path, whose folder name begins wit
|
|||
|
||||
```bash
|
||||
# infer
|
||||
sh run_eval.sh [VALIDATION_ANN_FILE_JSON] [CHECKPOINT_PATH]
|
||||
bash run_eval.sh [VALIDATION_ANN_FILE_JSON] [CHECKPOINT_PATH]
|
||||
```
|
||||
|
||||
> As for the COCO2017 dataset, VALIDATION_ANN_FILE_JSON is refer to the annotations/instances_val2017.json in the dataset directory.
|
||||
|
|
@ -583,7 +583,7 @@ Current batch_ Size can only be set to 1. The inference process needs about 600G
|
|||
|
||||
```shell
|
||||
# Ascend310 inference
|
||||
sh run_infer_310.sh [MINDIR_PATH] [DATA_PATH] [ANN_FILE] [DEVICE_ID]
|
||||
bash run_infer_310.sh [MINDIR_PATH] [DATA_PATH] [ANN_FILE] [DEVICE_ID]
|
||||
```
|
||||
|
||||
### [Inference result](#content)
|
||||
|
|
|
|||
|
|
@ -222,10 +222,10 @@ For FP16 operators, if the input data type is FP32, the backend of MindSpore wil
|
|||
|
||||
You can start training using python or shell scripts. The usage of shell scripts as follows:
|
||||
|
||||
- Ascend: sh run_distribute_train.sh [cifar10|imagenet2012] [RANK_TABLE_FILE] [DATASET_PATH] [PRETRAINED_CKPT_PATH] (optional)
|
||||
- CPU: sh run_train_CPU.sh [cifar10|imagenet2012] [DATASET_PATH] [PRETRAINED_CKPT_PATH] (optional)
|
||||
- GPU(single device):sh run_standalone_train_gpu.sh [cifar10|imagenet2012] [DATASET_PATH] [PRETRAINED_CKPT_PATH](optional)
|
||||
- GPU(distribute training): sh run_distribute_train_gpu.sh [cifar10|imagenet2012] [CONFIG_PATH] [DATASET_PATH] [PRETRAINED_CKPT_PATH](optional)
|
||||
- Ascend: bash run_distribute_train.sh [cifar10|imagenet2012] [RANK_TABLE_FILE] [DATASET_PATH] [PRETRAINED_CKPT_PATH] (optional)
|
||||
- CPU: bash run_train_CPU.sh [cifar10|imagenet2012] [DATASET_PATH] [PRETRAINED_CKPT_PATH] (optional)
|
||||
- GPU(single device):bash run_standalone_train_gpu.sh [cifar10|imagenet2012] [DATASET_PATH] [PRETRAINED_CKPT_PATH](optional)
|
||||
- GPU(distribute training): bash run_distribute_train_gpu.sh [cifar10|imagenet2012] [CONFIG_PATH] [DATASET_PATH] [PRETRAINED_CKPT_PATH](optional)
|
||||
|
||||
For distributed training with Ascend, a hccl configuration file with JSON format needs to be created in advance.
|
||||
|
||||
|
|
@ -245,10 +245,10 @@ Please follow the instructions in the link [hccn_tools](https://gitee.com/mindsp
|
|||
--device_num=$DEVICE_NUM --dataset_path=$PATH1 &> log.txt &
|
||||
|
||||
shell:
|
||||
Ascend: sh run_distribute_train.sh [cifar10|imagenet2012] [RANK_TABLE_FILE] [DATASET_PATH] [PRETRAINED_CKPT_PATH](optional)
|
||||
CPU: sh run_train_CPU.sh [cifar10|imagenet2012] [DATASET_PATH] [PRETRAINED_CKPT_PATH](optional)
|
||||
GPU(single device): sh run_standalone_train_gpu.sh [cifar10|imagenet2012] [DATASET_PATH] [PRETRAINED_CKPT_PATH](optional)
|
||||
GPU(distribute training): sh run_distribute_train_gpu.sh [cifar10|imagenet2012] [CONFIG_PATH] [DATASET_PATH] [PRETRAINED_CKPT_PATH](optional)
|
||||
Ascend: bash run_distribute_train.sh [cifar10|imagenet2012] [RANK_TABLE_FILE] [DATASET_PATH] [PRETRAINED_CKPT_PATH](optional)
|
||||
CPU: bash run_train_CPU.sh [cifar10|imagenet2012] [DATASET_PATH] [PRETRAINED_CKPT_PATH](optional)
|
||||
GPU(single device): bash run_standalone_train_gpu.sh [cifar10|imagenet2012] [DATASET_PATH] [PRETRAINED_CKPT_PATH](optional)
|
||||
GPU(distribute training): bash run_distribute_train_gpu.sh [cifar10|imagenet2012] [CONFIG_PATH] [DATASET_PATH] [PRETRAINED_CKPT_PATH](optional)
|
||||
```
|
||||
|
||||
### Result
|
||||
|
|
@ -277,8 +277,8 @@ Epoch time: 320744.265, per step time: 256.390
|
|||
|
||||
You can start training using python or shell scripts.If the train method is train or fine tune, should not input the `[CHECKPOINT_PATH]` The usage of shell scripts as follows:
|
||||
|
||||
- Ascend: sh run_eval.sh [cifar10|imagenet2012] [DATASET_PATH] [CHECKPOINT_PATH]
|
||||
- CPU: sh run_eval_CPU.sh [cifar10|imagenet2012] [DATASET_PATH] [CHECKPOINT_PATH]
|
||||
- Ascend: bash run_eval.sh [cifar10|imagenet2012] [DATASET_PATH] [CHECKPOINT_PATH]
|
||||
- CPU: bash run_eval_CPU.sh [cifar10|imagenet2012] [DATASET_PATH] [CHECKPOINT_PATH]
|
||||
|
||||
### Launch
|
||||
|
||||
|
|
@ -290,8 +290,8 @@ You can start training using python or shell scripts.If the train method is trai
|
|||
GPU: python eval.py --dataset [cifar10|imagenet2012] --dataset_path [VAL_DATASET_PATH] --checkpoint_path [CHECKPOINT_PATH] --config_path [CONFIG_PATH] --device_target GPU
|
||||
|
||||
shell:
|
||||
Ascend: sh run_eval.sh [cifar10|imagenet2012] [DATASET_PATH] [CHECKPOINT_PATH]
|
||||
CPU: sh run_eval_CPU.sh [cifar10|imagenet2012] [DATASET_PATH] [CHECKPOINT_PATH]
|
||||
Ascend: bash run_eval.sh [cifar10|imagenet2012] [DATASET_PATH] [CHECKPOINT_PATH]
|
||||
CPU: bash run_eval_CPU.sh [cifar10|imagenet2012] [DATASET_PATH] [CHECKPOINT_PATH]
|
||||
```
|
||||
|
||||
> checkpoint can be produced in training process.
|
||||
|
|
|
|||
|
|
@ -225,9 +225,9 @@ For FP16 operators, if the input data type is FP32, the backend of MindSpore wil
|
|||
|
||||
You can start training using python or shell scripts. The usage of shell scripts as follows:
|
||||
|
||||
- Ascend: sh run_train.sh Ascend [DEVICE_NUM] [VISIABLE_DEVICES(0,1,2,3,4,5,6,7)] [RANK_TABLE_FILE] [DATASET_PATH] [CKPT_PATH] [FREEZE_LAYER] [FILTER_HEAD]
|
||||
- GPU: sh run_trian.sh GPU [DEVICE_NUM] [VISIABLE_DEVICES(0,1,2,3,4,5,6,7)] [DATASET_PATH] [CKPT_PATH] [FREEZE_LAYER] [FILTER_HEAD]
|
||||
- CPU: sh run_trian.sh CPU [DATASET_PATH] [CKPT_PATH] [FREEZE_LAYER] [FILTER_HEAD]
|
||||
- Ascend: bash run_train.sh Ascend [DEVICE_NUM] [VISIABLE_DEVICES(0,1,2,3,4,5,6,7)] [RANK_TABLE_FILE] [DATASET_PATH] [CKPT_PATH] [FREEZE_LAYER] [FILTER_HEAD]
|
||||
- GPU: bash run_trian.sh GPU [DEVICE_NUM] [VISIABLE_DEVICES(0,1,2,3,4,5,6,7)] [DATASET_PATH] [CKPT_PATH] [FREEZE_LAYER] [FILTER_HEAD]
|
||||
- CPU: bash run_trian.sh CPU [DATASET_PATH] [CKPT_PATH] [FREEZE_LAYER] [FILTER_HEAD]
|
||||
|
||||
`DATASET_PATH` is the train dataset path. We use `ImageFolderDataset` as default dataset, which is a source dataset that reads images from a tree of directories. The directory structure is as follows, and you should use `DATASET_PATH=dataset/train` for training and `DATASET_PATH=dataset/val` for evaluation:
|
||||
|
||||
|
|
@ -273,9 +273,9 @@ You can start training using python or shell scripts. The usage of shell scripts
|
|||
CPU: python train.py --platform CPU --dataset_path [TRAIN_DATASET_PATH]
|
||||
|
||||
shell:
|
||||
Ascend: sh run_train.sh Ascend 8 0,1,2,3,4,5,6,7 hccl_config.json [TRAIN_DATASET_PATH]
|
||||
GPU: sh run_train.sh GPU 8 0,1,2,3,4,5,6,7 [TRAIN_DATASET_PATH]
|
||||
CPU: sh run_train.sh CPU [TRAIN_DATASET_PATH]
|
||||
Ascend: bash run_train.sh Ascend 8 0,1,2,3,4,5,6,7 hccl_config.json [TRAIN_DATASET_PATH]
|
||||
GPU: bash run_train.sh GPU 8 0,1,2,3,4,5,6,7 [TRAIN_DATASET_PATH]
|
||||
CPU: bash run_train.sh CPU [TRAIN_DATASET_PATH]
|
||||
|
||||
# fine tune whole network example
|
||||
python:
|
||||
|
|
@ -284,9 +284,9 @@ You can start training using python or shell scripts. The usage of shell scripts
|
|||
CPU: python train.py --platform CPU --dataset_path [TRAIN_DATASET_PATH] --pretrain_ckpt [CKPT_PATH] --freeze_layer none --filter_head True
|
||||
|
||||
shell:
|
||||
Ascend: sh run_train.sh Ascend 8 0,1,2,3,4,5,6,7 hccl_config.json [TRAIN_DATASET_PATH] [CKPT_PATH] none True
|
||||
GPU: sh run_train.sh GPU 8 0,1,2,3,4,5,6,7 [TRAIN_DATASET_PATH] [CKPT_PATH] none True
|
||||
CPU: sh run_train.sh CPU [TRAIN_DATASET_PATH] [CKPT_PATH] none True
|
||||
Ascend: bash run_train.sh Ascend 8 0,1,2,3,4,5,6,7 hccl_config.json [TRAIN_DATASET_PATH] [CKPT_PATH] none True
|
||||
GPU: bash run_train.sh GPU 8 0,1,2,3,4,5,6,7 [TRAIN_DATASET_PATH] [CKPT_PATH] none True
|
||||
CPU: bash run_train.sh CPU [TRAIN_DATASET_PATH] [CKPT_PATH] none True
|
||||
|
||||
# fine tune full connected layers example
|
||||
python:
|
||||
|
|
@ -295,9 +295,9 @@ You can start training using python or shell scripts. The usage of shell scripts
|
|||
CPU: python --platform CPU train.py --dataset_path [TRAIN_DATASET_PATH] --pretrain_ckpt [CKPT_PATH] --freeze_layer backbone
|
||||
|
||||
shell:
|
||||
Ascend: sh run_train.sh Ascend 8 0,1,2,3,4,5,6,7 hccl_config.json [TRAIN_DATASET_PATH] [CKPT_PATH] backbone
|
||||
GPU: sh run_train.sh GPU 8 0,1,2,3,4,5,6,7 [TRAIN_DATASET_PATH] [CKPT_PATH] backbone
|
||||
CPU: sh run_train.sh CPU [TRAIN_DATASET_PATH] [CKPT_PATH] backbone
|
||||
Ascend: bash run_train.sh Ascend 8 0,1,2,3,4,5,6,7 hccl_config.json [TRAIN_DATASET_PATH] [CKPT_PATH] backbone
|
||||
GPU: bash run_train.sh GPU 8 0,1,2,3,4,5,6,7 [TRAIN_DATASET_PATH] [CKPT_PATH] backbone
|
||||
CPU: bash run_train.sh CPU [TRAIN_DATASET_PATH] [CKPT_PATH] backbone
|
||||
```
|
||||
|
||||
### Result
|
||||
|
|
@ -317,9 +317,9 @@ epoch time: 138331.250, per step time: 221.330, avg loss: 3.917
|
|||
|
||||
You can start training using python or shell scripts.If the train method is train or fine tune, should not input the `[CHECKPOINT_PATH]` The usage of shell scripts as follows:
|
||||
|
||||
- Ascend: sh run_eval.sh Ascend [DATASET_PATH] [CHECKPOINT_PATH]
|
||||
- GPU: sh run_eval.sh GPU [DATASET_PATH] [CHECKPOINT_PATH]
|
||||
- CPU: sh run_eval.sh CPU [DATASET_PATH] [BACKBONE_CKPT_PATH]
|
||||
- Ascend: bash run_eval.sh Ascend [DATASET_PATH] [CHECKPOINT_PATH]
|
||||
- GPU: bash run_eval.sh GPU [DATASET_PATH] [CHECKPOINT_PATH]
|
||||
- CPU: bash run_eval.sh CPU [DATASET_PATH] [BACKBONE_CKPT_PATH]
|
||||
|
||||
### Launch
|
||||
|
||||
|
|
@ -331,9 +331,9 @@ You can start training using python or shell scripts.If the train method is trai
|
|||
CPU: python eval.py --platform CPU --dataset_path [VAL_DATASET_PATH] --pretrain_ckpt ./ckpt_0/mobilenetv2_15.ckpt
|
||||
|
||||
shell:
|
||||
Ascend: sh run_eval.sh Ascend [VAL_DATASET_PATH] ./checkpoint/mobilenetv2_head_15.ckpt
|
||||
GPU: sh run_eval.sh GPU [VAL_DATASET_PATH] ./checkpoint/mobilenetv2_head_15.ckpt
|
||||
CPU: sh run_eval.sh CPU [VAL_DATASET_PATH] ./checkpoint/mobilenetv2_head_15.ckpt
|
||||
Ascend: bash run_eval.sh Ascend [VAL_DATASET_PATH] ./checkpoint/mobilenetv2_head_15.ckpt
|
||||
GPU: bash run_eval.sh GPU [VAL_DATASET_PATH] ./checkpoint/mobilenetv2_head_15.ckpt
|
||||
CPU: bash run_eval.sh CPU [VAL_DATASET_PATH] ./checkpoint/mobilenetv2_head_15.ckpt
|
||||
```
|
||||
|
||||
> checkpoint can be produced in training process.
|
||||
|
|
@ -354,9 +354,9 @@ Please refer to [Training Process](#training-process) for the usage of this shel
|
|||
|
||||
```shell
|
||||
# training with NFS dataset example
|
||||
Ascend: sh run_train_nfs_cache.sh Ascend 8 0,1,2,3,4,5,6,7 hccl_config.json [TRAIN_DATASET_PATH]
|
||||
GPU: sh run_train_nfs_cache.sh GPU 8 0,1,2,3,4,5,6,7 [TRAIN_DATASET_PATH]
|
||||
CPU: sh run_train_nfs_cache.sh CPU [TRAIN_DATASET_PATH]
|
||||
Ascend: bash run_train_nfs_cache.sh Ascend 8 0,1,2,3,4,5,6,7 hccl_config.json [TRAIN_DATASET_PATH]
|
||||
GPU: bash run_train_nfs_cache.sh GPU 8 0,1,2,3,4,5,6,7 [TRAIN_DATASET_PATH]
|
||||
CPU: bash run_train_nfs_cache.sh CPU [TRAIN_DATASET_PATH]
|
||||
```
|
||||
|
||||
> With cache enabled, a standalone cache server will be started in the background to cache the dataset in memory. However, Please make sure the dataset fits in memory (around 120GB of memory is required for caching ImageNet train dataset).
|
||||
|
|
|
|||
|
|
@ -227,8 +227,8 @@ MobileNetV2总体网络架构如下:
|
|||
使用python或shell脚本开始训练。shell脚本的使用方法如下:
|
||||
|
||||
- Ascend: sh run_train.sh Ascend [DEVICE_NUM] [VISIABLE_DEVICES(0,1,2,3,4,5,6,7)] [RANK_TABLE_FILE] [DATASET_PATH] [CKPT_PATH] [FREEZE_LAYER] [FILTER_HEAD]
|
||||
- GPU: sh run_trian.sh GPU [DEVICE_NUM] [VISIABLE_DEVICES(0,1,2,3,4,5,6,7)] [DATASET_PATH] [CKPT_PATH] [FREEZE_LAYER] [FILTER_HEAD]
|
||||
- CPU: sh run_trian.sh CPU [DATASET_PATH] [CKPT_PATH] [FREEZE_LAYER] [FILTER_HEAD]
|
||||
- GPU: bash run_trian.sh GPU [DEVICE_NUM] [VISIABLE_DEVICES(0,1,2,3,4,5,6,7)] [DATASET_PATH] [CKPT_PATH] [FREEZE_LAYER] [FILTER_HEAD]
|
||||
- CPU: bash run_trian.sh CPU [DATASET_PATH] [CKPT_PATH] [FREEZE_LAYER] [FILTER_HEAD]
|
||||
|
||||
`DATASET_PATH`是训练的路径. 我们使用`ImageFolderDataset` 作为默认数据处理方式, 这种数据处理方式是从原始目录中读取图片,目录结构如下, 训练时设置`DATASET_PATH=dataset/train`,验证时设置`DATASET_PATH=dataset/val`:
|
||||
|
||||
|
|
@ -274,9 +274,9 @@ MobileNetV2总体网络架构如下:
|
|||
CPU: python train.py --platform CPU --dataset_path [TRAIN_DATASET_PATH]
|
||||
|
||||
shell:
|
||||
Ascend: sh run_train.sh Ascend 8 0,1,2,3,4,5,6,7 hccl_config.json [TRAIN_DATASET_PATH]
|
||||
GPU: sh run_train.sh GPU 8 0,1,2,3,4,5,6,7 [TRAIN_DATASET_PATH]
|
||||
CPU: sh run_train.sh CPU [TRAIN_DATASET_PATH]
|
||||
Ascend: bash run_train.sh Ascend 8 0,1,2,3,4,5,6,7 hccl_config.json [TRAIN_DATASET_PATH]
|
||||
GPU: bash run_train.sh GPU 8 0,1,2,3,4,5,6,7 [TRAIN_DATASET_PATH]
|
||||
CPU: bash run_train.sh CPU [TRAIN_DATASET_PATH]
|
||||
|
||||
# 全网微调示例
|
||||
python:
|
||||
|
|
@ -285,9 +285,9 @@ MobileNetV2总体网络架构如下:
|
|||
CPU: python train.py --platform CPU --dataset_path [TRAIN_DATASET_PATH] --pretrain_ckpt [CKPT_PATH] --freeze_layer none --filter_head True
|
||||
|
||||
shell:
|
||||
Ascend: sh run_train.sh Ascend 8 0,1,2,3,4,5,6,7 hccl_config.json [TRAIN_DATASET_PATH] [CKPT_PATH] none True
|
||||
GPU: sh run_train.sh GPU 8 0,1,2,3,4,5,6,7 [TRAIN_DATASET_PATH] [CKPT_PATH] none True
|
||||
CPU: sh run_train.sh CPU [TRAIN_DATASET_PATH] [CKPT_PATH] none True
|
||||
Ascend: bash run_train.sh Ascend 8 0,1,2,3,4,5,6,7 hccl_config.json [TRAIN_DATASET_PATH] [CKPT_PATH] none True
|
||||
GPU: bash run_train.sh GPU 8 0,1,2,3,4,5,6,7 [TRAIN_DATASET_PATH] [CKPT_PATH] none True
|
||||
CPU: bash run_train.sh CPU [TRAIN_DATASET_PATH] [CKPT_PATH] none True
|
||||
|
||||
# 全连接层微调示例
|
||||
python:
|
||||
|
|
@ -296,9 +296,9 @@ MobileNetV2总体网络架构如下:
|
|||
CPU: python --platform CPU train.py --dataset_path [TRAIN_DATASET_PATH] --pretrain_ckpt [CKPT_PATH] --freeze_layer backbone
|
||||
|
||||
shell:
|
||||
Ascend: sh run_train.sh Ascend 8 0,1,2,3,4,5,6,7 hccl_config.json [TRAIN_DATASET_PATH] [CKPT_PATH] backbone
|
||||
GPU: sh run_train.sh GPU 8 0,1,2,3,4,5,6,7 [TRAIN_DATASET_PATH] [CKPT_PATH] backbone
|
||||
CPU: sh run_train.sh CPU [TRAIN_DATASET_PATH] [CKPT_PATH] backbone
|
||||
Ascend: bash run_train.sh Ascend 8 0,1,2,3,4,5,6,7 hccl_config.json [TRAIN_DATASET_PATH] [CKPT_PATH] backbone
|
||||
GPU: bash run_train.sh GPU 8 0,1,2,3,4,5,6,7 [TRAIN_DATASET_PATH] [CKPT_PATH] backbone
|
||||
CPU: bash run_train.sh CPU [TRAIN_DATASET_PATH] [CKPT_PATH] backbone
|
||||
```
|
||||
|
||||
### 结果
|
||||
|
|
@ -318,9 +318,9 @@ epoch time:138331.250, per step time:221.330, avg loss:3.917
|
|||
|
||||
使用python或shell脚本开始训练。采用train或fine tune训练方法时,不建议输入`[CHECKPOINT_PATH]`。shell脚本的用法如下:
|
||||
|
||||
- Ascend: sh run_eval.sh Ascend [DATASET_PATH] [CHECKPOINT_PATH]
|
||||
- GPU: sh run_eval.sh GPU [DATASET_PATH] [CHECKPOINT_PATH]
|
||||
- CPU: sh run_eval.sh CPU [DATASET_PATH] [BACKBONE_CKPT_PATH]
|
||||
- Ascend: bash run_eval.sh Ascend [DATASET_PATH] [CHECKPOINT_PATH]
|
||||
- GPU: bash run_eval.sh GPU [DATASET_PATH] [CHECKPOINT_PATH]
|
||||
- CPU: bash run_eval.sh CPU [DATASET_PATH] [BACKBONE_CKPT_PATH]
|
||||
|
||||
### 启动
|
||||
|
||||
|
|
@ -332,9 +332,9 @@ epoch time:138331.250, per step time:221.330, avg loss:3.917
|
|||
CPU: python eval.py --platform CPU --dataset_path [VAL_DATASET_PATH] --pretrain_ckpt ./ckpt_0/mobilenetv2_15.ckpt
|
||||
|
||||
shell:
|
||||
Ascend: sh run_eval.sh Ascend [VAL_DATASET_PATH] ./checkpoint/mobilenetv2_head_15.ckpt
|
||||
GPU: sh run_eval.sh GPU [VAL_DATASET_PATH] ./checkpoint/mobilenetv2_head_15.ckpt
|
||||
CPU: sh run_eval.sh CPU [VAL_DATASET_PATH] ./checkpoint/mobilenetv2_head_15.ckpt
|
||||
Ascend: bash run_eval.sh Ascend [VAL_DATASET_PATH] ./checkpoint/mobilenetv2_head_15.ckpt
|
||||
GPU: bash run_eval.sh GPU [VAL_DATASET_PATH] ./checkpoint/mobilenetv2_head_15.ckpt
|
||||
CPU: bash run_eval.sh CPU [VAL_DATASET_PATH] ./checkpoint/mobilenetv2_head_15.ckpt
|
||||
```
|
||||
|
||||
> 训练过程中可以生成检查点。
|
||||
|
|
@ -355,9 +355,9 @@ result:{'acc':0.71976314102564111} ckpt=./ckpt_0/mobilenet-200_625.ckpt
|
|||
|
||||
```shell
|
||||
# 使用NFS上的数据集进行训练示例
|
||||
Ascend: sh run_train_nfs_cache.sh Ascend 8 0,1,2,3,4,5,6,7 hccl_config.json [TRAIN_DATASET_PATH]
|
||||
GPU: sh run_train_nfs_cache.sh GPU 8 0,1,2,3,4,5,6,7 [TRAIN_DATASET_PATH]
|
||||
CPU: sh run_train_nfs_cache.sh CPU [TRAIN_DATASET_PATH]
|
||||
Ascend: bash run_train_nfs_cache.sh Ascend 8 0,1,2,3,4,5,6,7 hccl_config.json [TRAIN_DATASET_PATH]
|
||||
GPU: bash run_train_nfs_cache.sh GPU 8 0,1,2,3,4,5,6,7 [TRAIN_DATASET_PATH]
|
||||
CPU: bash run_train_nfs_cache.sh CPU [TRAIN_DATASET_PATH]
|
||||
```
|
||||
|
||||
> 缓存服务开启后,我们将在后台启动一个独立的缓存服务器以将数据集缓存在内存中。用户在使用缓存前需确保内存大小足够缓存数据集中的图片(缓存ImageNet的训练集约需要120GB的内存空间)。
|
||||
|
|
|
|||
|
|
@ -198,13 +198,13 @@ epoch time:138331.250, per step time:221.330, avg loss:3.917
|
|||
|
||||
传统量化感知训练(默认):
|
||||
|
||||
- Ascend: sh run_infer.sh Ascend [DATASET_PATH] [CHECKPOINT_PATH]
|
||||
- GPU: sh run_infer.sh GPU [DATASET_PATH] [CHECKPOINT_PATH]
|
||||
- Ascend: bash run_infer.sh Ascend [DATASET_PATH] [CHECKPOINT_PATH]
|
||||
- GPU: bash run_infer.sh GPU [DATASET_PATH] [CHECKPOINT_PATH]
|
||||
|
||||
量化步长可学习的量化感知训练:
|
||||
|
||||
- Ascend: sh run_lsq_infer.sh Ascend [DATASET_PATH] [CHECKPOINT_PATH]
|
||||
- GPU: sh run_lsq_infer.sh GPU [DATASET_PATH] [CHECKPOINT_PATH]
|
||||
- Ascend: bash run_lsq_infer.sh Ascend [DATASET_PATH] [CHECKPOINT_PATH]
|
||||
- GPU: bash run_lsq_infer.sh GPU [DATASET_PATH] [CHECKPOINT_PATH]
|
||||
|
||||
### 启动
|
||||
|
||||
|
|
@ -214,8 +214,8 @@ python:
|
|||
Ascend: python eval.py --device_target Ascend --dataset_path [VAL_DATASET_PATH] --checkpoint_path ~/train/mobilenet-60_1601.ckpt
|
||||
GPU: python eval.py --device_target GPU --dataset_path [VAL_DATASET_PATH] --checkpoint_path ~/train/mobilenet-60_1601.ckpt
|
||||
shell:
|
||||
Ascend: sh run_infer.sh Ascend ~/imagenet/val/ ~/train/mobilenet-60_1601.ckpt
|
||||
GPU: sh run_infer.sh GPU ~/imagenet/val/ ~/train/mobilenet-60_1601.ckpt
|
||||
Ascend: bash run_infer.sh Ascend ~/imagenet/val/ ~/train/mobilenet-60_1601.ckpt
|
||||
GPU: bash run_infer.sh GPU ~/imagenet/val/ ~/train/mobilenet-60_1601.ckpt
|
||||
|
||||
# 推理示例-量化步长可学习的量化感知训练
|
||||
python:
|
||||
|
|
@ -224,8 +224,8 @@ python:
|
|||
GPU: python eval.py --device_target GPU --dataset_path ~/imagenet/val/ \
|
||||
--checkpoint_path ~/train/mobilenet-60_1601.ckpt --optim_option "LEARNED_SCALE"
|
||||
shell:
|
||||
Ascend: sh run_lsq_infer.sh Ascend ~/imagenet/val/ ~/train/mobilenet-60_1601.ckpt
|
||||
GPU: sh run_lsq_infer.sh GPU ~/imagenet/val/ ~/train/mobilenet-60_1601.ckpt
|
||||
Ascend: bash run_lsq_infer.sh Ascend ~/imagenet/val/ ~/train/mobilenet-60_1601.ckpt
|
||||
GPU: bash run_lsq_infer.sh GPU ~/imagenet/val/ ~/train/mobilenet-60_1601.ckpt
|
||||
```
|
||||
|
||||
> 训练过程中可以生成检查点。
|
||||
|
|
|
|||
|
|
@ -194,13 +194,13 @@ You can start evaluating using python or shell scripts. The usage of shell scrip
|
|||
|
||||
For quantization aware training (default):
|
||||
|
||||
- Ascend: sh run_infer.sh Ascend [DATASET_PATH] [CHECKPOINT_PATH]
|
||||
- GPU: sh run_infer.sh GPU [DATASET_PATH] [CHECKPOINT_PATH]
|
||||
- Ascend: bash run_infer.sh Ascend [DATASET_PATH] [CHECKPOINT_PATH]
|
||||
- GPU: bash run_infer.sh GPU [DATASET_PATH] [CHECKPOINT_PATH]
|
||||
|
||||
For Learned Step Size Quantization:
|
||||
|
||||
- Ascend: sh run_lsq_infer.sh Ascend [DATASET_PATH] [CHECKPOINT_PATH]
|
||||
- GPU: sh run_lsq_infer.sh GPU [DATASET_PATH] [CHECKPOINT_PATH]
|
||||
- Ascend: bash run_lsq_infer.sh Ascend [DATASET_PATH] [CHECKPOINT_PATH]
|
||||
- GPU: bash run_lsq_infer.sh GPU [DATASET_PATH] [CHECKPOINT_PATH]
|
||||
|
||||
### Launch
|
||||
|
||||
|
|
@ -211,8 +211,8 @@ python:
|
|||
GPU: python eval.py --device_target GPU --dataset_path [VAL_DATASET_PATH] --checkpoint_path ~/train/mobilenet-60_1601.ckpt
|
||||
|
||||
shell:
|
||||
Ascend: sh run_infer.sh Ascend ~/imagenet/val/ ~/train/mobilenet-60_1601.ckpt
|
||||
GPU: sh run_infer.sh GPU ~/imagenet/val/ ~/train/mobilenet-60_1601.ckpt
|
||||
Ascend: bash run_infer.sh Ascend ~/imagenet/val/ ~/train/mobilenet-60_1601.ckpt
|
||||
GPU: bash run_infer.sh GPU ~/imagenet/val/ ~/train/mobilenet-60_1601.ckpt
|
||||
|
||||
# training example for Learned Step Size Quantization
|
||||
python:
|
||||
|
|
@ -222,8 +222,8 @@ python:
|
|||
--checkpoint_path ~/train/mobilenet-60_1601.ckpt --optim_option "LEARNED_SCALE"
|
||||
|
||||
shell:
|
||||
Ascend: sh run_lsq_infer.sh Ascend ~/imagenet/val/ ~/train/mobilenet-60_1601.ckpt
|
||||
GPU: sh run_lsq_infer.sh GPU ~/imagenet/val/ ~/train/mobilenet-60_1601.ckpt
|
||||
Ascend: bash run_lsq_infer.sh Ascend ~/imagenet/val/ ~/train/mobilenet-60_1601.ckpt
|
||||
GPU: bash run_lsq_infer.sh GPU ~/imagenet/val/ ~/train/mobilenet-60_1601.ckpt
|
||||
```
|
||||
|
||||
> checkpoint can be produced in training process.
|
||||
|
|
|
|||
|
|
@ -85,8 +85,8 @@ MobileNetV3总体网络架构如下:
|
|||
|
||||
使用python或shell脚本开始训练。shell脚本的使用方法如下:
|
||||
|
||||
- GPU: sh run_trian.sh GPU [DEVICE_NUM] [VISIABLE_DEVICES(0,1,2,3,4,5,6,7)] [DATASET_PATH]
|
||||
- CPU: sh run_trian.sh CPU [DATASET_PATH]
|
||||
- GPU: bash run_trian.sh GPU [DEVICE_NUM] [VISIABLE_DEVICES(0,1,2,3,4,5,6,7)] [DATASET_PATH]
|
||||
- CPU: bash run_trian.sh CPU [DATASET_PATH]
|
||||
|
||||
### 启动
|
||||
|
||||
|
|
@ -96,8 +96,8 @@ MobileNetV3总体网络架构如下:
|
|||
GPU: python train.py --dataset_path ~/imagenet/train/ --device_targe GPU
|
||||
CPU: python train.py --dataset_path ~/cifar10/train/ --device_targe CPU
|
||||
shell:
|
||||
GPU: sh run_train.sh GPU 8 0,1,2,3,4,5,6,7 ~/imagenet/train/
|
||||
CPU: sh run_train.sh CPU ~/cifar10/train/
|
||||
GPU: bash run_train.sh GPU 8 0,1,2,3,4,5,6,7 ~/imagenet/train/
|
||||
CPU: bash run_train.sh CPU ~/cifar10/train/
|
||||
```
|
||||
|
||||
### 结果
|
||||
|
|
@ -117,8 +117,8 @@ epoch time:138331.250, per step time:221.330, avg loss:3.917
|
|||
|
||||
使用python或shell脚本开始训练。shell脚本的使用方法如下:
|
||||
|
||||
- GPU: sh run_infer.sh GPU [DATASET_PATH] [CHECKPOINT_PATH]
|
||||
- CPU: sh run_infer.sh CPU [DATASET_PATH] [CHECKPOINT_PATH]
|
||||
- GPU: bash run_infer.sh GPU [DATASET_PATH] [CHECKPOINT_PATH]
|
||||
- CPU: bash run_infer.sh CPU [DATASET_PATH] [CHECKPOINT_PATH]
|
||||
|
||||
### 启动
|
||||
|
||||
|
|
@ -129,8 +129,8 @@ epoch time:138331.250, per step time:221.330, avg loss:3.917
|
|||
CPU: python eval.py --dataset_path ~/cifar10/val/ --checkpoint_path mobilenet_199.ckpt --device_targe CPU
|
||||
|
||||
shell:
|
||||
GPU: sh run_infer.sh GPU ~/imagenet/val/ ~/train/mobilenet-200_625.ckpt
|
||||
CPU: sh run_infer.sh CPU ~/cifar10/val/ ~/train/mobilenet-200_625.ckpt
|
||||
GPU: bash run_infer.sh GPU ~/imagenet/val/ ~/train/mobilenet-200_625.ckpt
|
||||
CPU: bash run_infer.sh CPU ~/cifar10/val/ ~/train/mobilenet-200_625.ckpt
|
||||
```
|
||||
|
||||
> 训练过程中可以生成检查点。
|
||||
|
|
|
|||
|
|
@ -81,8 +81,8 @@ Dataset used: [imagenet](http://www.image-net.org/)
|
|||
|
||||
You can start training using python or shell scripts. The usage of shell scripts as follows:
|
||||
|
||||
- GPU: sh run_trian.sh GPU [DEVICE_NUM] [VISIABLE_DEVICES(0,1,2,3,4,5,6,7)] [DATASET_PATH]
|
||||
- CPU: sh run_trian.sh CPU [DATASET_PATH]
|
||||
- GPU: bash run_trian.sh GPU [DEVICE_NUM] [VISIABLE_DEVICES(0,1,2,3,4,5,6,7)] [DATASET_PATH]
|
||||
- CPU: bash run_trian.sh CPU [DATASET_PATH]
|
||||
|
||||
### Launch
|
||||
|
||||
|
|
@ -92,8 +92,8 @@ You can start training using python or shell scripts. The usage of shell scripts
|
|||
GPU: python train.py --dataset_path ~/imagenet/train/ --device_targe GPU
|
||||
CPU: python train.py --dataset_path ~/cifar10/train/ --device_targe CPU
|
||||
shell:
|
||||
GPU: sh run_train.sh GPU 8 0,1,2,3,4,5,6,7 ~/imagenet/train/
|
||||
CPU: sh run_train.sh CPU ~/cifar10/train/
|
||||
GPU: bash run_train.sh GPU 8 0,1,2,3,4,5,6,7 ~/imagenet/train/
|
||||
CPU: bash run_train.sh CPU ~/cifar10/train/
|
||||
```
|
||||
|
||||
### Result
|
||||
|
|
@ -113,8 +113,8 @@ epoch time: 138331.250, per step time: 221.330, avg loss: 3.917
|
|||
|
||||
You can start training using python or shell scripts. The usage of shell scripts as follows:
|
||||
|
||||
- GPU: sh run_infer.sh GPU [DATASET_PATH] [CHECKPOINT_PATH]
|
||||
- CPU: sh run_infer.sh CPU [DATASET_PATH] [CHECKPOINT_PATH]
|
||||
- GPU: bash run_infer.sh GPU [DATASET_PATH] [CHECKPOINT_PATH]
|
||||
- CPU: bash run_infer.sh CPU [DATASET_PATH] [CHECKPOINT_PATH]
|
||||
|
||||
### Launch
|
||||
|
||||
|
|
@ -125,8 +125,8 @@ You can start training using python or shell scripts. The usage of shell scripts
|
|||
CPU: python eval.py --dataset_path ~/cifar10/val/ --checkpoint_path mobilenet_199.ckpt --device_targe CPU
|
||||
|
||||
shell:
|
||||
GPU: sh run_infer.sh GPU ~/imagenet/val/ ~/train/mobilenet-200_625.ckpt
|
||||
CPU: sh run_infer.sh CPU ~/cifar10/val/ ~/train/mobilenet-200_625.ckpt
|
||||
GPU: bash run_infer.sh GPU ~/imagenet/val/ ~/train/mobilenet-200_625.ckpt
|
||||
CPU: bash run_infer.sh CPU ~/cifar10/val/ ~/train/mobilenet-200_625.ckpt
|
||||
```
|
||||
|
||||
> checkpoint can be produced in training process.
|
||||
|
|
|
|||
|
|
@ -104,18 +104,18 @@ Parameters for both training and evaluating can be set in config.py.
|
|||
```bash
|
||||
GPU:
|
||||
# distribute training example(8p)
|
||||
sh run_distribute_train_for_gpu.sh DATA_DIR
|
||||
bash run_distribute_train_for_gpu.sh DATA_DIR
|
||||
# standalone training
|
||||
sh run_standalone_train_for_gpu.sh DEVICE_ID DATA_DIR
|
||||
bash run_standalone_train_for_gpu.sh DEVICE_ID DATA_DIR
|
||||
```
|
||||
|
||||
### Launch
|
||||
|
||||
```bash
|
||||
# distributed training example(8p) for GPU
|
||||
sh scripts/run_distribute_train_for_gpu.sh /dataset/train
|
||||
bash scripts/run_distribute_train_for_gpu.sh /dataset/train
|
||||
# standalone training example for GPU
|
||||
sh scripts/run_standalone_train_for_gpu.sh 0 /dataset/train
|
||||
bash scripts/run_standalone_train_for_gpu.sh 0 /dataset/train
|
||||
```
|
||||
|
||||
You can find checkpoint file together with result in log.
|
||||
|
|
@ -126,14 +126,14 @@ You can find checkpoint file together with result in log.
|
|||
|
||||
```bash
|
||||
# Evaluation
|
||||
sh run_eval_for_gpu.sh DEVICE_ID DATA_DIR PATH_CHECKPOINT
|
||||
bash run_eval_for_gpu.sh DEVICE_ID DATA_DIR PATH_CHECKPOINT
|
||||
```
|
||||
|
||||
### Launch
|
||||
|
||||
```bash
|
||||
# Evaluation with checkpoint
|
||||
sh scripts/run_eval_for_gpu.sh 0 /dataset/val ./checkpoint/nasnet-a-mobile-rank0-248_10009.ckpt
|
||||
bash scripts/run_eval_for_gpu.sh 0 /dataset/val ./checkpoint/nasnet-a-mobile-rank0-248_10009.ckpt
|
||||
```
|
||||
|
||||
### Result
|
||||
|
|
|
|||
|
|
@ -109,18 +109,18 @@ NASNet总体网络架构如下:
|
|||
|
||||
```bash
|
||||
# 分布式训练示例(8卡)
|
||||
sh run_distribute_train_for_gpu.sh DATA_DIR
|
||||
bash run_distribute_train_for_gpu.sh DATA_DIR
|
||||
# 单机训练
|
||||
sh run_standalone_train_for_gpu.sh DEVICE_ID DATA_DIR
|
||||
bash run_standalone_train_for_gpu.sh DEVICE_ID DATA_DIR
|
||||
```
|
||||
|
||||
### 运行
|
||||
|
||||
```bash
|
||||
# GPU分布式训练示例(8卡)
|
||||
sh scripts/run_distribute_train_for_gpu.sh /dataset/train
|
||||
bash scripts/run_distribute_train_for_gpu.sh /dataset/train
|
||||
# GPU单机训练示例
|
||||
sh scripts/run_standalone_train_for_gpu.sh 0 /dataset/train
|
||||
bash scripts/run_standalone_train_for_gpu.sh 0 /dataset/train
|
||||
```
|
||||
|
||||
### 结果
|
||||
|
|
@ -133,14 +133,14 @@ sh scripts/run_standalone_train_for_gpu.sh 0 /dataset/train
|
|||
|
||||
```bash
|
||||
# 评估
|
||||
sh run_eval_for_gpu.sh DEVICE_ID DATA_DIR PATH_CHECKPOINT
|
||||
bash run_eval_for_gpu.sh DEVICE_ID DATA_DIR PATH_CHECKPOINT
|
||||
```
|
||||
|
||||
### 启动
|
||||
|
||||
```bash
|
||||
# 检查点评估
|
||||
sh scripts/run_eval_for_gpu.sh 0 /dataset/val ./checkpoint/nasnet-a-mobile-rank0-248_10009.ckpt
|
||||
bash scripts/run_eval_for_gpu.sh 0 /dataset/val ./checkpoint/nasnet-a-mobile-rank0-248_10009.ckpt
|
||||
```
|
||||
|
||||
> 训练过程中可以生成检查点。
|
||||
|
|
|
|||
|
|
@ -76,13 +76,13 @@ PoseNet是剑桥大学提出的一种鲁棒、实时的6DOF(单目六自由度
|
|||
|
||||
```python
|
||||
# 运行单机训练示例
|
||||
sh run_standalone_train.sh [DATASET_NAME] [DEVICE_ID]
|
||||
bash run_standalone_train.sh [DATASET_NAME] [DEVICE_ID]
|
||||
|
||||
# 运行分布式训练示例
|
||||
sh run_distribute_train.sh [DATASET_NAME] [RANK_SIZE]
|
||||
bash run_distribute_train.sh [DATASET_NAME] [RANK_SIZE]
|
||||
|
||||
# 运行评估示例
|
||||
sh run_eval.sh [DEVICE_ID] [DATASET_NAME] [CKPT_PATH]
|
||||
bash run_eval.sh [DEVICE_ID] [DATASET_NAME] [CKPT_PATH]
|
||||
```
|
||||
|
||||
对于分布式训练,需要提前创建JSON格式的hccl配置文件。
|
||||
|
|
@ -97,13 +97,13 @@ PoseNet是剑桥大学提出的一种鲁棒、实时的6DOF(单目六自由度
|
|||
|
||||
```python
|
||||
# 运行单机训练示例
|
||||
sh run_standalone_train_gpu.sh [DATASET_NAME] [DEVICE_ID]
|
||||
bash run_standalone_train_gpu.sh [DATASET_NAME] [DEVICE_ID]
|
||||
|
||||
# 运行分布式训练示例
|
||||
sh run_distribute_train_gpu.sh [DATASET_NAME] [RANK_SIZE]
|
||||
bash run_distribute_train_gpu.sh [DATASET_NAME] [RANK_SIZE]
|
||||
|
||||
# 运行评估示例
|
||||
sh run_eval_gpu.sh [DEVICE_ID] [DATASET_NAME] [CKPT_PATH]
|
||||
bash run_eval_gpu.sh [DEVICE_ID] [DATASET_NAME] [CKPT_PATH]
|
||||
```
|
||||
|
||||
默认使用KingsCollege数据集。您也可以将`$dataset_name`传入脚本,以便选择其他数据集。如需查看更多详情,请参考指定脚本。
|
||||
|
|
@ -173,7 +173,7 @@ PoseNet是剑桥大学提出的一种鲁棒、实时的6DOF(单目六自由度
|
|||
- Ascend处理器环境运行
|
||||
|
||||
```bash
|
||||
sh run_standalone_train.sh [DATASET_NAME] [DEVICE_ID]
|
||||
bash run_standalone_train.sh [DATASET_NAME] [DEVICE_ID]
|
||||
```
|
||||
|
||||
上述python命令将在后台运行,您可以通过train.log文件查看结果。
|
||||
|
|
@ -191,7 +191,7 @@ PoseNet是剑桥大学提出的一种鲁棒、实时的6DOF(单目六自由度
|
|||
- GPU处理器环境运行
|
||||
|
||||
```bash
|
||||
sh run_standalone_train_gpu.sh [DATASET_NAME] [DEVICE_ID]
|
||||
bash run_standalone_train_gpu.sh [DATASET_NAME] [DEVICE_ID]
|
||||
```
|
||||
|
||||
上述python命令将在后台运行,您可以通过train.log文件查看结果。
|
||||
|
|
@ -211,7 +211,7 @@ PoseNet是剑桥大学提出的一种鲁棒、实时的6DOF(单目六自由度
|
|||
- Ascend处理器环境运行
|
||||
|
||||
```bash
|
||||
sh run_distribute_train.sh [DATASET_NAME] [RANK_SIZE]
|
||||
bash run_distribute_train.sh [DATASET_NAME] [RANK_SIZE]
|
||||
```
|
||||
|
||||
上述shell脚本将在后台运行分布训练。您可以通过device[X]/log文件查看结果。采用以下方式达到损失值:
|
||||
|
|
@ -228,7 +228,7 @@ PoseNet是剑桥大学提出的一种鲁棒、实时的6DOF(单目六自由度
|
|||
- GPU处理器环境运行
|
||||
|
||||
```bash
|
||||
sh run_distribute_train_gpu.sh [DATASET_NAME] [RANK_SIZE]
|
||||
bash run_distribute_train_gpu.sh [DATASET_NAME] [RANK_SIZE]
|
||||
```
|
||||
|
||||
上述shell脚本将在后台运行分布训练。您可以通过device[X]/log文件查看结果。采用以下方式达到损失值:
|
||||
|
|
@ -252,7 +252,7 @@ PoseNet是剑桥大学提出的一种鲁棒、实时的6DOF(单目六自由度
|
|||
请将检查点路径设置为相对路径,例如“../checkpoint/train_posenet_KingsCollege-790_38.ckpt”。
|
||||
|
||||
```bash
|
||||
sh run_eval.sh [DEVICE_ID] [DATASET_NAME] [CKPT_PATH]
|
||||
bash run_eval.sh [DEVICE_ID] [DATASET_NAME] [CKPT_PATH]
|
||||
```
|
||||
|
||||
上述python命令将在后台运行,您可以通过eval/eval.log文件查看结果。测试数据集的准确性如下:
|
||||
|
|
@ -267,7 +267,7 @@ PoseNet是剑桥大学提出的一种鲁棒、实时的6DOF(单目六自由度
|
|||
请将检查点路径设置为相对路径,例如“../checkpoint/train_posenet_KingsCollege-1875_2.ckpt”。
|
||||
|
||||
```bash
|
||||
sh run_eval_gpu.sh [DEVICE_ID] [DATASET_NAME] [CKPT_PATH]
|
||||
bash run_eval_gpu.sh [DEVICE_ID] [DATASET_NAME] [CKPT_PATH]
|
||||
```
|
||||
|
||||
上述python命令将在后台运行,您可以通过eval/eval.log文件查看结果。测试数据集的准确性如下:
|
||||
|
|
|
|||
|
|
@ -67,7 +67,7 @@ After installing MindSpore via the official website, you can start training and
|
|||
|
||||
```python
|
||||
# run distributed training example
|
||||
sh scripts/run_distribute_train.sh [RANK_TABLE_FILE] [PRED_TRAINED PATH] [TRAIN_ROOT_DIR]
|
||||
bash scripts/run_distribute_train.sh [RANK_TABLE_FILE] [PRED_TRAINED PATH] [TRAIN_ROOT_DIR]
|
||||
|
||||
#download opencv library
|
||||
download pyblind11, opencv3.4
|
||||
|
|
@ -86,7 +86,7 @@ python test.py --ckpt pretrained_model.ckpt --TEST_ROOT_DIR [test root path]
|
|||
#click "My Methods" button,then download Evaluation Scripts
|
||||
download script.py
|
||||
# run evaluation example
|
||||
sh scripts/run_eval_ascend.sh
|
||||
bash scripts/run_eval_ascend.sh
|
||||
```
|
||||
|
||||
# [Script Description](#contents)
|
||||
|
|
@ -156,7 +156,7 @@ Major parameters in default_config.yaml are:
|
|||
Please follow the instructions in the link below: <https://gitee.com/mindspore/mindspore/tree/master/model_zoo/utils/hccl_tools>.
|
||||
|
||||
```shell
|
||||
sh scripts/run_distribute_train.sh [RANK_TABLE_FILE] [PRED_TRAINED PATH] [TRAIN_ROOT_DIR]
|
||||
bash scripts/run_distribute_train.sh [RANK_TABLE_FILE] [PRED_TRAINED PATH] [TRAIN_ROOT_DIR]
|
||||
```
|
||||
|
||||
rank_table_file 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).
|
||||
|
|
@ -176,7 +176,7 @@ device_1/log:epcoh: 2, step: 40, loss is 0.76629
|
|||
### Distributed GPU Training
|
||||
|
||||
```shell
|
||||
sh scripts/run_distribute_train_gpu.sh [PRED_TRAINED PATH] [TRAIN_ROOT_DIR]
|
||||
bash scripts/run_distribute_train_gpu.sh [PRED_TRAINED PATH] [TRAIN_ROOT_DIR]
|
||||
```
|
||||
|
||||
After training begins, log and loss.log file will be in train_parallel directory.
|
||||
|
|
@ -267,7 +267,7 @@ step 2: click "My Methods" button,then download Evaluation Scripts.
|
|||
step 3: it is recommended to symlink the eval method root to $MINDSPORE/model_zoo/psenet/eval_ic15/. if your folder structure is different,you may need to change the corresponding paths in eval script files.
|
||||
|
||||
```shell
|
||||
sh ./script/run_eval_ascend.sh
|
||||
bash ./script/run_eval_ascend.sh
|
||||
```
|
||||
|
||||
The two scripts ./script/run_eval_ascend.sh and ./script/run_eval_gpu.sh are the same, you may run either for evaluating on ICDAR2015.
|
||||
|
|
|
|||
|
|
@ -68,7 +68,7 @@
|
|||
|
||||
```python
|
||||
# 分布式训练运行示例
|
||||
sh scripts/run_distribute_train.sh [RANK_TABLE_FILE] [PRED_TRAINED PATH] [TRAIN_ROOT_DIR]
|
||||
bash scripts/run_distribute_train.sh [RANK_TABLE_FILE] [PRED_TRAINED PATH] [TRAIN_ROOT_DIR]
|
||||
|
||||
# 下载opencv库
|
||||
download pyblind11, opencv3.4
|
||||
|
|
@ -89,7 +89,7 @@ python test.py --ckpt pretrained_model.ckpt --TEST_ROOT_DIR [test root path]
|
|||
|
||||
download script.py
|
||||
# 运行评估示例
|
||||
sh scripts/run_eval_ascend.sh
|
||||
bash scripts/run_eval_ascend.sh
|
||||
```
|
||||
|
||||
## 脚本说明
|
||||
|
|
@ -153,7 +153,7 @@ sh scripts/run_eval_ascend.sh
|
|||
请遵循链接中的说明:[链接](https://gitee.com/mindspore/mindspore/tree/master/model_zoo/utils/hccl_tools)
|
||||
|
||||
```shell
|
||||
sh scripts/run_distribute_train.sh [RANK_TABLE_FILE] [PRED_TRAINED PATH] [TRAIN_ROOT_DIR]
|
||||
bash scripts/run_distribute_train.sh [RANK_TABLE_FILE] [PRED_TRAINED PATH] [TRAIN_ROOT_DIR]
|
||||
```
|
||||
|
||||
上述shell脚本将在后台运行分布训练。可以通过`device[X]/test_*.log`文件查看结果。
|
||||
|
|
@ -244,7 +244,7 @@ python test.py --ckpt [CKPK PATH] --TEST_ROOT_DIR [TEST DATA DIR]
|
|||
第三步:建议将评估方法根符号链接到$MINDSPORE/model_zoo/psenet/eval_ic15/。如果您的文件夹结构不同,您可能需要更改评估脚本文件中的相应路径。
|
||||
|
||||
```shell
|
||||
sh ./script/run_eval_ascend.sh.sh
|
||||
bash ./script/run_eval_ascend.sh.sh
|
||||
```
|
||||
|
||||
#### 结果
|
||||
|
|
|
|||
|
|
@ -50,13 +50,13 @@ ResNet152的总体网络架构如下:[链接](https://arxiv.org/pdf/1512.03385
|
|||
|
||||
```Shell
|
||||
# 分布式训练
|
||||
用法:sh run_distribute_train.sh [RANK_TABLE_FILE] [DATASET_PATH] [PRETRAINED_CKPT_PATH](可选)
|
||||
用法:bash run_distribute_train.sh [RANK_TABLE_FILE] [DATASET_PATH] [PRETRAINED_CKPT_PATH](可选)
|
||||
|
||||
# 单机训练
|
||||
用法:sh run_standalone_train.sh [DATASET_PATH] [PRETRAINED_CKPT_PATH](可选)
|
||||
用法:bash run_standalone_train.sh [DATASET_PATH] [PRETRAINED_CKPT_PATH](可选)
|
||||
|
||||
# 运行评估示例
|
||||
用法:sh run_eval.sh [DATASET_PATH] [CHECKPOINT_PATH]
|
||||
用法:bash run_eval.sh [DATASET_PATH] [CHECKPOINT_PATH]
|
||||
```
|
||||
|
||||
# 脚本说明
|
||||
|
|
@ -113,10 +113,10 @@ ResNet152的总体网络架构如下:[链接](https://arxiv.org/pdf/1512.03385
|
|||
|
||||
```Shell
|
||||
# 分布式训练
|
||||
用法:sh run_distribute_train.sh [RANK_TABLE_FILE] [DATASET_PATH] [PRETRAINED_CKPT_PATH](可选)
|
||||
用法:bash run_distribute_train.sh [RANK_TABLE_FILE] [DATASET_PATH] [PRETRAINED_CKPT_PATH](可选)
|
||||
|
||||
# 单机训练
|
||||
用法:sh run_standalone_train.sh [DATASET_PATH] [PRETRAINED_CKPT_PATH](可选)
|
||||
用法:bash run_standalone_train.sh [DATASET_PATH] [PRETRAINED_CKPT_PATH](可选)
|
||||
|
||||
```
|
||||
|
||||
|
|
@ -148,12 +148,12 @@ epoch: 5 step: 5004, loss is 3.4899402
|
|||
|
||||
```Shell
|
||||
# 评估
|
||||
Usage: sh run_eval.sh [DATASET_PATH] [CHECKPOINT_PATH]
|
||||
Usage: bash run_eval.sh [DATASET_PATH] [CHECKPOINT_PATH]
|
||||
```
|
||||
|
||||
```Shell
|
||||
# 评估示例
|
||||
sh run_eval.sh /data/dataset/ImageNet/imagenet_original Resnet152-140_5004.ckpt
|
||||
bash run_eval.sh /data/dataset/ImageNet/imagenet_original Resnet152-140_5004.ckpt
|
||||
```
|
||||
|
||||
训练过程中可以生成检查点。
|
||||
|
|
@ -233,4 +233,4 @@ dataset.py中设置了“create_dataset”函数内的种子,同时还使用
|
|||
|
||||
# ModelZoo主页
|
||||
|
||||
请浏览官网[主页](https://gitee.com/mindspore/mindspore/tree/master/model_zoo)。
|
||||
请浏览官网[主页](https://gitee.com/mindspore/mindspore/tree/master/model_zoo)。
|
||||
|
|
|
|||
|
|
@ -135,7 +135,7 @@ Parameters for both training and evaluation can be set in config.py
|
|||
|
||||
### Usage
|
||||
|
||||
- Ascend: sh run_train.sh Ascend [RANK_TABLE_FILE] [DATASET_PATH] [PRETRAINED_CKPT_PATH]\(optional)
|
||||
- Ascend: bash run_train.sh Ascend [RANK_TABLE_FILE] [DATASET_PATH] [PRETRAINED_CKPT_PATH]\(optional)
|
||||
|
||||
### Launch
|
||||
|
||||
|
|
@ -162,7 +162,7 @@ epoch: 5 step: 5004, loss is 3.1978393
|
|||
|
||||
You can start training using python or shell scripts. The usage of shell scripts as follows:
|
||||
|
||||
- Ascend: sh run_infer.sh Ascend [DATASET_PATH] [CHECKPOINT_PATH]
|
||||
- Ascend: bash run_infer.sh Ascend [DATASET_PATH] [CHECKPOINT_PATH]
|
||||
|
||||
### Launch
|
||||
|
||||
|
|
|
|||
|
|
@ -136,7 +136,7 @@ ResNet-50总体网络架构如下:
|
|||
|
||||
### 用法
|
||||
|
||||
- 晟腾(Ascend): sh run_train.sh Ascend [RANK_TABLE_FILE] [DATASET_PATH] [PRETRAINED_CKPT_PATH]\(可选)
|
||||
- 晟腾(Ascend): bash run_train.sh Ascend [RANK_TABLE_FILE] [DATASET_PATH] [PRETRAINED_CKPT_PATH]\(可选)
|
||||
|
||||
### 启动
|
||||
|
||||
|
|
@ -170,7 +170,7 @@ epoch: 5 step: 5004, loss is 3.1978393
|
|||
```shell
|
||||
# 推理示例
|
||||
shell:
|
||||
Ascend: sh run_infer.sh Ascend ~/imagenet/val/ ~/train/Resnet50-30_5004.ckpt
|
||||
Ascend: bash run_infer.sh Ascend ~/imagenet/val/ ~/train/Resnet50-30_5004.ckpt
|
||||
```
|
||||
|
||||
> 训练过程中可以生成检查点。
|
||||
|
|
|
|||
|
|
@ -73,10 +73,10 @@ After installing MindSpore via the official website, you can start training and
|
|||
|
||||
```python
|
||||
# run distributed training example
|
||||
sh run_distribute_train.sh [RANK_TABLE_FILE] [DATASET_PATH] [DEVICE_NUM]
|
||||
bash run_distribute_train.sh [RANK_TABLE_FILE] [DATASET_PATH] [DEVICE_NUM]
|
||||
|
||||
# run evaluation example
|
||||
sh run_eval.sh [DATASET_PATH] [CHECKPOINT_PATH]
|
||||
bash run_eval.sh [DATASET_PATH] [CHECKPOINT_PATH]
|
||||
```
|
||||
|
||||
> For distributed training, a hccl configuration file with JSON format needs to be created in advance. About the configuration file, you can refer to the [HCCL_TOOL](https://gitee.com/mindspore/mindspore/tree/master/model_zoo/utils/hccl_tools).
|
||||
|
|
@ -85,10 +85,10 @@ sh run_eval.sh [DATASET_PATH] [CHECKPOINT_PATH]
|
|||
|
||||
```python
|
||||
# run distributed training example
|
||||
sh run_distribute_train_gpu.sh [DATASET_PATH] [DEVICE_NUM]
|
||||
bash run_distribute_train_gpu.sh [DATASET_PATH] [DEVICE_NUM]
|
||||
|
||||
# run evaluation example
|
||||
sh run_eval_gpu.sh [DATASET_PATH] [CHECKPOINT_PATH]
|
||||
bash run_eval_gpu.sh [DATASET_PATH] [CHECKPOINT_PATH]
|
||||
```
|
||||
|
||||
## Script Description
|
||||
|
|
@ -176,7 +176,7 @@ Parameters for both training and inference can be set in config.py.
|
|||
#### Ascend 910
|
||||
|
||||
```shell
|
||||
sh run_distribute_train.sh [RANK_TABLE_FILE] [DATASET_PATH] [DEVICE_NUM]
|
||||
bash run_distribute_train.sh [RANK_TABLE_FILE] [DATASET_PATH] [DEVICE_NUM]
|
||||
```
|
||||
|
||||
We need three parameters for this scripts.
|
||||
|
|
@ -204,7 +204,7 @@ epoch: 42 step: 5004, loss is 1.6453942
|
|||
#### GPU
|
||||
|
||||
```shell
|
||||
sh run_distribute_train_gpu.sh [DATASET_PATH] [DEVICE_NUM]
|
||||
bash run_distribute_train_gpu.sh [DATASET_PATH] [DEVICE_NUM]
|
||||
```
|
||||
|
||||
Training result will be stored in the current path, whose folder name begins with "train_parallel". Under this, you can find checkpoint file together with result like the following in log.
|
||||
|
|
@ -228,7 +228,7 @@ Before running the command below, please check the checkpoint path used for eval
|
|||
#### Ascend 910
|
||||
|
||||
```shell
|
||||
sh run_eval.sh [DATASET_PATH] [CHECKPOINT_PATH]
|
||||
bash run_eval.sh [DATASET_PATH] [CHECKPOINT_PATH]
|
||||
```
|
||||
|
||||
We need two parameters for this scripts.
|
||||
|
|
@ -247,7 +247,7 @@ Inference result will be stored in the example path, whose folder name is "eval"
|
|||
#### GPU
|
||||
|
||||
```shell
|
||||
sh run_eval_gpu.sh [DATASET_PATH] [CHECKPOINT_PATH]
|
||||
bash run_eval_gpu.sh [DATASET_PATH] [CHECKPOINT_PATH]
|
||||
```
|
||||
|
||||
Inference result will be stored in the example path, whose folder name is "eval". Under this, you can find result like the following in log.
|
||||
|
|
|
|||
|
|
@ -77,10 +77,10 @@ ResNet-50的总体网络架构如下:[链接](https://arxiv.org/pdf/1512.03385
|
|||
|
||||
```python
|
||||
# 分布式训练运行示例
|
||||
sh run_distribute_train.sh [RANK_TABLE_FILE] [DATASET_PATH] [DEVICE_NUM]
|
||||
bash run_distribute_train.sh [RANK_TABLE_FILE] [DATASET_PATH] [DEVICE_NUM]
|
||||
|
||||
# 推理运行示例
|
||||
sh run_eval.sh [DATASET_PATH] [CHECKPOINT_PATH]
|
||||
bash run_eval.sh [DATASET_PATH] [CHECKPOINT_PATH]
|
||||
```
|
||||
|
||||
> 对于分布式训练,需要提前创建JSON格式的HCCL配置文件。关于配置文件,可以参考[HCCL_TOOL](https://gitee.com/mindspore/mindspore/tree/master/model_zoo/utils/hccl_tools)
|
||||
|
|
@ -90,10 +90,10 @@ sh run_eval.sh [DATASET_PATH] [CHECKPOINT_PATH]
|
|||
|
||||
```python
|
||||
# 分布式训练运行示例
|
||||
sh run_distribute_train_gpu.sh [DATASET_PATH] [DEVICE_NUM]
|
||||
bash run_distribute_train_gpu.sh [DATASET_PATH] [DEVICE_NUM]
|
||||
|
||||
# 推理运行示例
|
||||
sh run_eval_gpu.sh [DATASET_PATH] [CHECKPOINT_PATH]
|
||||
bash run_eval_gpu.sh [DATASET_PATH] [CHECKPOINT_PATH]
|
||||
```
|
||||
|
||||
## 脚本描述
|
||||
|
|
@ -181,7 +181,7 @@ sh run_eval_gpu.sh [DATASET_PATH] [CHECKPOINT_PATH]
|
|||
#### Ascend 910
|
||||
|
||||
```shell
|
||||
sh run_distribute_train.sh [RANK_TABLE_FILE] [DATASET_PATH] [DEVICE_NUM]
|
||||
bash run_distribute_train.sh [RANK_TABLE_FILE] [DATASET_PATH] [DEVICE_NUM]
|
||||
```
|
||||
|
||||
此脚本需设置三个参数:
|
||||
|
|
@ -209,7 +209,7 @@ epoch:42 step: 5004,loss is 1.6453942
|
|||
#### GPU
|
||||
|
||||
```shell
|
||||
sh run_distribute_train_gpu.sh [DATASET_PATH] [DEVICE_NUM]
|
||||
bash run_distribute_train_gpu.sh [DATASET_PATH] [DEVICE_NUM]
|
||||
```
|
||||
|
||||
训练结果保存在当前路径下,文件夹名称以“train_parallel”开头。您可在日志中找到checkpoint文件以及结果,如下所示。
|
||||
|
|
@ -233,7 +233,7 @@ epoch: 36 step: 5004,loss is 1.645802
|
|||
#### Ascend 910
|
||||
|
||||
```shell
|
||||
sh run_eval.sh [DATASET_PATH] [CHECKPOINT_PATH]
|
||||
bash run_eval.sh [DATASET_PATH] [CHECKPOINT_PATH]
|
||||
```
|
||||
|
||||
此脚本需设置两个参数:
|
||||
|
|
@ -252,7 +252,7 @@ epoch: 36 step: 5004,loss is 1.645802
|
|||
#### GPU
|
||||
|
||||
```shell
|
||||
sh run_eval_gpu.sh [DATASET_PATH] [CHECKPOINT_PATH]
|
||||
bash run_eval_gpu.sh [DATASET_PATH] [CHECKPOINT_PATH]
|
||||
```
|
||||
|
||||
推理结果保存在示例路径,文件夹名为`eval`。您可在日志中找到如下结果。
|
||||
|
|
|
|||
|
|
@ -188,28 +188,28 @@ or shell script:
|
|||
```script
|
||||
Ascend:
|
||||
# distribute training example(8p)
|
||||
sh run_distribute_train.sh RANK_TABLE_FILE DATA_PATH
|
||||
bash run_distribute_train.sh RANK_TABLE_FILE DATA_PATH
|
||||
# standalone training
|
||||
sh run_standalone_train.sh DEVICE_ID DATA_PATH
|
||||
bash run_standalone_train.sh DEVICE_ID DATA_PATH
|
||||
GPU:
|
||||
# distribute training example(8p)
|
||||
sh run_distribute_train_for_gpu.sh DATA_PATH
|
||||
bash run_distribute_train_for_gpu.sh DATA_PATH
|
||||
# standalone training
|
||||
sh run_standalone_train_for_gpu.sh DEVICE_ID DATA_PATH
|
||||
bash run_standalone_train_for_gpu.sh DEVICE_ID DATA_PATH
|
||||
```
|
||||
|
||||
#### Launch
|
||||
|
||||
```bash
|
||||
# distributed training example(8p) for Ascend
|
||||
sh scripts/run_distribute_train.sh RANK_TABLE_FILE /dataset/train
|
||||
bash scripts/run_distribute_train.sh RANK_TABLE_FILE /dataset/train
|
||||
# standalone training example for Ascend
|
||||
sh scripts/run_standalone_train.sh 0 /dataset/train
|
||||
bash scripts/run_standalone_train.sh 0 /dataset/train
|
||||
|
||||
# distributed training example(8p) for GPU
|
||||
sh scripts/run_distribute_train_for_gpu.sh /dataset/train
|
||||
bash scripts/run_distribute_train_for_gpu.sh /dataset/train
|
||||
# standalone training example for GPU
|
||||
sh scripts/run_standalone_train_for_gpu.sh 0 /dataset/train
|
||||
bash scripts/run_standalone_train_for_gpu.sh 0 /dataset/train
|
||||
```
|
||||
|
||||
You can find checkpoint file together with result in log.
|
||||
|
|
@ -228,7 +228,8 @@ or shell script:
|
|||
|
||||
```script
|
||||
# Evaluation
|
||||
sh scripts/run_eval.sh DEVICE_ID DATA_PATH CHECKPOINT_FILE_PATH DEVICE_TARGET
|
||||
|
||||
bash scripts/run_eval.sh DEVICE_ID DATA_PATH CHECKPOINT_FILE_PATH DEVICE_TARGET
|
||||
```
|
||||
|
||||
PLATFORM is Ascend or GPU, default is Ascend.
|
||||
|
|
@ -237,7 +238,7 @@ PLATFORM is Ascend or GPU, default is Ascend.
|
|||
|
||||
```bash
|
||||
# Evaluation with checkpoint
|
||||
sh scripts/run_eval.sh 0 /opt/npu/datasets/classification/val /resnext_100.ckpt Ascend
|
||||
bash scripts/run_eval.sh 0 /opt/npu/datasets/classification/val /resnext_100.ckpt Ascend
|
||||
```
|
||||
|
||||
#### Result
|
||||
|
|
|
|||
|
|
@ -189,28 +189,28 @@ python train.py --data_path ~/imagenet/train/ --device_target Ascend --run_distr
|
|||
```shell
|
||||
Ascend:
|
||||
# 分布式训练示例(8卡)
|
||||
sh run_distribute_train.sh RANK_TABLE_FILE DATA_PATH
|
||||
bash run_distribute_train.sh RANK_TABLE_FILE DATA_PATH
|
||||
# 单机训练
|
||||
sh run_standalone_train.sh DEVICE_ID DATA_PATH
|
||||
bash run_standalone_train.sh DEVICE_ID DATA_PATH
|
||||
GPU:
|
||||
# 分布式训练示例(8卡)
|
||||
sh run_distribute_train_for_gpu.sh DATA_PATH
|
||||
bash run_distribute_train_for_gpu.sh DATA_PATH
|
||||
# 单机训练
|
||||
sh run_standalone_train_for_gpu.sh DEVICE_ID DATA_PATH
|
||||
bash run_standalone_train_for_gpu.sh DEVICE_ID DATA_PATH
|
||||
```
|
||||
|
||||
### 样例
|
||||
|
||||
```shell
|
||||
# Ascend分布式训练示例(8卡)
|
||||
sh scripts/run_distribute_train.sh RANK_TABLE_FILE /dataset/train
|
||||
bash scripts/run_distribute_train.sh RANK_TABLE_FILE /dataset/train
|
||||
# Ascend单机训练示例
|
||||
sh scripts/run_standalone_train.sh 0 /dataset/train
|
||||
bash scripts/run_standalone_train.sh 0 /dataset/train
|
||||
|
||||
# GPU分布式训练示例(8卡)
|
||||
sh scripts/run_distribute_train_for_gpu.sh /dataset/train
|
||||
bash scripts/run_distribute_train_for_gpu.sh /dataset/train
|
||||
# GPU单机训练示例
|
||||
sh scripts/run_standalone_train_for_gpu.sh 0 /dataset/train
|
||||
bash scripts/run_standalone_train_for_gpu.sh 0 /dataset/train
|
||||
```
|
||||
|
||||
您可以在日志中找到检查点文件和结果。
|
||||
|
|
@ -229,7 +229,8 @@ python eval.py --data_path ~/imagenet/val/ --device_target Ascend --checkpoint_f
|
|||
|
||||
```shell
|
||||
# 评估
|
||||
sh scripts/run_eval.sh DEVICE_ID DATA_PATH CHECKPOINT_FILE_PATH PLATFORM
|
||||
bash scripts/run_eval.sh DEVICE_ID DATA_PATH CHECKPOINT_FILE_PATH PLATFORM
|
||||
|
||||
```
|
||||
|
||||
DEVICE_TARGET is Ascend or GPU, default is Ascend.
|
||||
|
|
@ -238,7 +239,7 @@ DEVICE_TARGET is Ascend or GPU, default is Ascend.
|
|||
|
||||
```shell
|
||||
# 检查点评估
|
||||
sh scripts/run_eval.sh 0 /opt/npu/datasets/classification/val /ResNeXt_100.ckpt Ascend
|
||||
bash scripts/run_eval.sh 0 /opt/npu/datasets/classification/val /ResNeXt_100.ckpt Ascend
|
||||
```
|
||||
|
||||
#### 结果
|
||||
|
|
|
|||
|
|
@ -180,11 +180,11 @@ MSCOCO2017
|
|||
# 八卡并行训练示例:
|
||||
|
||||
创建 RANK_TABLE_FILE
|
||||
sh scripts/run_distribute_train.sh DEVICE_NUM RANK_TABLE_FILE MINDRECORD_DIR PRE_TRAINED(optional) PRE_TRAINED_EPOCH_SIZE(optional)
|
||||
bash scripts/run_distribute_train.sh DEVICE_NUM RANK_TABLE_FILE MINDRECORD_DIR PRE_TRAINED(optional) PRE_TRAINED_EPOCH_SIZE(optional)
|
||||
|
||||
# 单卡训练示例:
|
||||
|
||||
sh scripts/run_single_train.sh DEVICE_ID MINDRECORD_DIR PRE_TRAINED(optional) PRE_TRAINED_EPOCH_SIZE(optional)
|
||||
bash scripts/run_single_train.sh DEVICE_ID MINDRECORD_DIR PRE_TRAINED(optional) PRE_TRAINED_EPOCH_SIZE(optional)
|
||||
|
||||
```
|
||||
|
||||
|
|
@ -200,12 +200,12 @@ python create_data.py --dataset coco
|
|||
|
||||
Ascend:
|
||||
# 八卡并行训练示例(在retinanet目录下运行):
|
||||
sh scripts/run_distribute_train.sh 8 RANK_TABLE_FILE(创建的RANK_TABLE_FILE的地址) MINDRECORD_DIR(mindrecord数据集文件夹路径) PRE_TRAINED(预训练checkpoint地址,可选) PRE_TRAINED_EPOCH_SIZE(预训练EPOCH大小,可选)
|
||||
bash scripts/run_distribute_train.sh 8 RANK_TABLE_FILE(创建的RANK_TABLE_FILE的地址) MINDRECORD_DIR(mindrecord数据集文件夹路径) PRE_TRAINED(预训练checkpoint地址,可选) PRE_TRAINED_EPOCH_SIZE(预训练EPOCH大小,可选)
|
||||
|
||||
例如:sh scripts/run_distribute_train.sh 8 scripts/rank_table_8pcs.json ./cache/mindrecord_coco
|
||||
|
||||
# 单卡训练示例(在retinanet目录下运行):
|
||||
sh scripts/run_single_train.sh 0 ./cache/mindrecord_coco
|
||||
bash scripts/run_single_train.sh 0 ./cache/mindrecord_coco
|
||||
```
|
||||
|
||||
#### 结果
|
||||
|
|
@ -288,13 +288,13 @@ Epoch time: 164531.610, per step time: 359.239
|
|||
使用shell脚本进行评估。shell脚本的用法如下:
|
||||
|
||||
```eval
|
||||
sh scripts/run_eval.sh [DEVICE_ID] [DATASET] [MINDRECORD_DIR] [CHECKPOINT_PATH] [ANN_FILE PATH]
|
||||
bash scripts/run_eval.sh [DEVICE_ID] [DATASET] [MINDRECORD_DIR] [CHECKPOINT_PATH] [ANN_FILE PATH]
|
||||
```
|
||||
|
||||
#### <span id="running">运行</span>
|
||||
|
||||
```eval运行
|
||||
sh scripts/run_eval.sh 0 coco /cache/mindrecord_dir/ /cache/checkpoint/retinanet_500-458.ckpt /cache/anno_path/instances_{}.json
|
||||
bash scripts/run_eval.sh 0 coco /cache/mindrecord_dir/ /cache/checkpoint/retinanet_500-458.ckpt /cache/anno_path/instances_{}.json
|
||||
```
|
||||
|
||||
> checkpoint 可以在训练过程中产生.
|
||||
|
|
@ -369,7 +369,7 @@ python export.py --file_name retinanet --file_format MINDIR --checkpoint_path /
|
|||
|
||||
```shell
|
||||
# Ascend310 inference
|
||||
sh run_infer_310.sh [MINDIR_PATH] [DATA_PATH] [ANN_FILE] [DEVICE_ID]
|
||||
bash run_infer_310.sh [MINDIR_PATH] [DATA_PATH] [ANN_FILE] [DEVICE_ID]
|
||||
```
|
||||
|
||||
#### <span id="running">运行</span>
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
# 目录
|
||||
|
||||
- [目录](#目录)
|
||||
- [ShuffleNetV1 描述](#ShuffleNetV1-描述)
|
||||
- [ShuffleNetV1 描述](#shufflenetv1-描述)
|
||||
- [模型架构](#模型架构)
|
||||
- [数据集](#数据集)
|
||||
- [环境要求](#环境要求)
|
||||
|
|
@ -21,7 +21,7 @@
|
|||
- [模型说明](#模型说明)
|
||||
- [训练性能](#训练性能)
|
||||
- [随机情况的描述](#随机情况的描述)
|
||||
- [ModelZoo 主页](#modelzoo-主页)
|
||||
- [ModelZoo](#modelzoo)
|
||||
|
||||
# ShuffleNetV1 描述
|
||||
|
||||
|
|
@ -127,6 +127,7 @@ ShuffleNetV1的核心部分被分成三个阶段,每个阶段重复堆积了
|
|||
Ascend单卡训练示例:python train.py --train_dataset_path [DATA_DIR]
|
||||
|
||||
shell:
|
||||
<<<<<<< HEAD
|
||||
Ascend八卡并行训练: sh scripts/run_distribute_train.sh [RANK_TABLE_FILE] [DATA_DIR]
|
||||
Ascend单卡训练示例: sh scripts/run_standalone_train.sh [DEVICE_ID] [DATA_DIR]
|
||||
|
||||
|
|
@ -145,6 +146,10 @@ ShuffleNetV1的核心部分被分成三个阶段,每个阶段重复堆积了
|
|||
shell:
|
||||
GPU单卡训练示例: sh scripts/run_standalone_train_gpu.sh [DEVICE_ID] [DATA_DIR]
|
||||
GPU八卡并行训练: sh scripts/run_distribute_train_gpu.sh [RANK_SIZE] [TRAIN_DATA_DIR]
|
||||
=======
|
||||
Ascend八卡并行训练: bash scripts/run_distribute_train.sh [RANK_TABLE_FILE] [DATA_DIR]
|
||||
Ascend单卡训练示例: bash scripts/run_standalone_train.sh [DEVICE_ID] [DATA_DIR]
|
||||
>>>>>>> fe806b7430... update bash
|
||||
```
|
||||
|
||||
分布式训练需要提前创建JSON格式的HCCL配置文件。
|
||||
|
|
@ -177,7 +182,7 @@ epoch time: 99864.092, per step time: 79.827, avg loss: 3.442
|
|||
python eval.py --eval_dataset_path [DATA_DIR] --ckpt_path [PATH_CHECKPOINT]
|
||||
|
||||
shell:
|
||||
sh scripts/run_eval.sh [DEVICE_ID] [DATA_DIR] [PATH_CHECKPOINT]
|
||||
bash scripts/run_eval.sh [DEVICE_ID] [DATA_DIR] [PATH_CHECKPOINT]
|
||||
|
||||
# GPU评估示例
|
||||
python:
|
||||
|
|
|
|||
|
|
@ -75,8 +75,8 @@ Dataset used: [imagenet](http://www.image-net.org/)
|
|||
|
||||
You can start training using python or shell scripts. The usage of shell scripts as follows:
|
||||
|
||||
- Distributed training on GPU: sh run_standalone_train_for_gpu.sh [DEVICE_NUM] [VISIABLE_DEVICES(0,1,2,3,4,5,6,7)] [DATASET_PATH]
|
||||
- Standalone training on GPU: sh run_standalone_train_for_gpu.sh [DATASET_PATH]
|
||||
- Distributed training on GPU: bash run_standalone_train_for_gpu.sh [DEVICE_NUM] [VISIABLE_DEVICES(0,1,2,3,4,5,6,7)] [DATASET_PATH]
|
||||
- Standalone training on GPU: bash run_standalone_train_for_gpu.sh [DATASET_PATH]
|
||||
|
||||
### Launch
|
||||
|
||||
|
|
@ -86,7 +86,7 @@ You can start training using python or shell scripts. The usage of shell scripts
|
|||
GPU: mpirun --allow-run-as-root -n 8 --output-filename log_output --merge-stderr-to-stdout python train.py --is_distributed=True --platform='GPU' --dataset_path='~/imagenet/train/' > train.log 2>&1 &
|
||||
|
||||
shell:
|
||||
GPU: cd scripts & sh run_distribute_train_for_gpu.sh 8 0,1,2,3,4,5,6,7 ~/imagenet/train/
|
||||
GPU: cd scripts & bash run_distribute_train_for_gpu.sh 8 0,1,2,3,4,5,6,7 ~/imagenet/train/
|
||||
```
|
||||
|
||||
### Result
|
||||
|
|
@ -99,7 +99,7 @@ Training result will be stored in the example path. Checkpoints will be stored a
|
|||
|
||||
You can start evaluation using python or shell scripts. The usage of shell scripts as follows:
|
||||
|
||||
- GPU: sh run_eval_for_gpu.sh [DATASET_PATH] [CHECKPOINT_PATH]
|
||||
- GPU: bash run_eval_for_gpu.sh [DATASET_PATH] [CHECKPOINT_PATH]
|
||||
|
||||
### Launch
|
||||
|
||||
|
|
@ -109,7 +109,7 @@ You can start evaluation using python or shell scripts. The usage of shell scrip
|
|||
GPU: CUDA_VISIBLE_DEVICES=0 python eval.py --platform='GPU' --dataset_path='~/imagenet/val/' > eval.log 2>&1 &
|
||||
|
||||
shell:
|
||||
GPU: cd scripts & sh run_eval_for_gpu.sh '~/imagenet/val/' 'checkpoint_file'
|
||||
GPU: cd scripts & bash run_eval_for_gpu.sh '~/imagenet/val/' 'checkpoint_file'
|
||||
```
|
||||
|
||||
> checkpoint can be produced in training process.
|
||||
|
|
|
|||
|
|
@ -61,11 +61,11 @@ After installing MindSpore via the official website, you can start training and
|
|||
|
||||
```python
|
||||
# enter script dir, train SimCLR
|
||||
sh run_standalone_train_ascend.sh [cifar10] [TRAIN_DATASET_PATH] [DEVICE_ID]
|
||||
bash run_standalone_train_ascend.sh [cifar10] [TRAIN_DATASET_PATH] [DEVICE_ID]
|
||||
or
|
||||
sh run_distribution_ascend.sh [DEVICENUM] [RANK_TABLE_FILE] [cifar10] [TRAIN_DATASET_PATH]
|
||||
bash run_distribution_ascend.sh [DEVICENUM] [RANK_TABLE_FILE] [cifar10] [TRAIN_DATASET_PATH]
|
||||
# enter script dir, evaluate SimCLR
|
||||
sh run_standalone_eval_ascend.sh [cifar10] [DEVICE_ID] [SIMCLR_MODEL_PATH] [TRAIN_DATASET_PATH] [EVAL_DATASET_PATH]
|
||||
bash run_standalone_eval_ascend.sh [cifar10] [DEVICE_ID] [SIMCLR_MODEL_PATH] [TRAIN_DATASET_PATH] [EVAL_DATASET_PATH]
|
||||
```
|
||||
|
||||
## [Script Description](#contents)
|
||||
|
|
@ -151,7 +151,7 @@ Major parameters in linear_eval.py as follows:
|
|||
- running on Ascend
|
||||
|
||||
```bash
|
||||
sh run_distribution_ascend.sh [DEVICENUM] [RANK_TABLE_FILE] [cifar10] [TRAIN_DATASET_PATH]
|
||||
bash run_distribution_ascend.sh [DEVICENUM] [RANK_TABLE_FILE] [cifar10] [TRAIN_DATASET_PATH]
|
||||
```
|
||||
|
||||
After training, the loss value will be achieved as follows:
|
||||
|
|
@ -185,7 +185,7 @@ Before running the command below, please check the checkpoint path used for eval
|
|||
- running on Ascend
|
||||
|
||||
```bash
|
||||
sh run_standalone_eval_ascend.sh [cifar10] [DEVICE_ID] [SIMCLR_MODEL_PATH] [TRAIN_DATASET_PATH] [EVAL_DATASET_PATH]
|
||||
bash run_standalone_eval_ascend.sh [cifar10] [DEVICE_ID] [SIMCLR_MODEL_PATH] [TRAIN_DATASET_PATH] [EVAL_DATASET_PATH]
|
||||
```
|
||||
|
||||
You can view the results through the file "eval_log". The accuracy of the test dataset will be as follows:
|
||||
|
|
|
|||
|
|
@ -105,7 +105,7 @@ Before you start your training process, you need to obtain mindspore imagenet pr
|
|||
To train the model, run the shell script `scripts/train_standalone.sh` with the format below:
|
||||
|
||||
```shell
|
||||
sh scripts/train_standalone.sh [CKPT_SAVE_DIR] [DEVICE_ID] [BATCH_SIZE]
|
||||
bash scripts/train_standalone.sh [CKPT_SAVE_DIR] [DEVICE_ID] [BATCH_SIZE]
|
||||
```
|
||||
|
||||
To validate the model, change the settings in `default_config.yaml` to the path of the model you want to validate or setting that on the terminal. For example:
|
||||
|
|
@ -119,7 +119,7 @@ Before you start your training process, you need to obtain mindspore imagenet pr
|
|||
Then, run the shell script `scripts/eval.sh` with the format below:
|
||||
|
||||
```shell
|
||||
sh scripts/eval.sh [TEST_MODEL_FILE] [COCO_BBOX_FILE] [DEVICE_ID]
|
||||
bash scripts/eval.sh [TEST_MODEL_FILE] [COCO_BBOX_FILE] [DEVICE_ID]
|
||||
```
|
||||
|
||||
- running on ModelArts
|
||||
|
|
@ -279,13 +279,13 @@ TEST:
|
|||
Run `scripts/train_standalone.sh` to train the model standalone. The usage of the script is:
|
||||
|
||||
```shell
|
||||
sh scripts/train_standalone.sh [CKPT_SAVE_DIR] [DEVICE_ID] [BATCH_SIZE]
|
||||
bash scripts/train_standalone.sh [CKPT_SAVE_DIR] [DEVICE_ID] [BATCH_SIZE]
|
||||
```
|
||||
|
||||
For example, you can run the shell command below to launch the training procedure.
|
||||
|
||||
```shell
|
||||
sh scripts/train_standalone.sh results/standalone/ 0 128
|
||||
bash scripts/train_standalone.sh results/standalone/ 0 128
|
||||
```
|
||||
|
||||
The script will run training in the background, you can view the results through the file `train_log[X].txt` as follows:
|
||||
|
|
@ -313,13 +313,13 @@ The model checkpoint will be saved into `[CKPT_SAVE_DIR]`.
|
|||
Run `scripts/train_distributed.sh` to train the model distributed. The usage of the script is:
|
||||
|
||||
```shell
|
||||
sh scripts/train_distributed.sh [MINDSPORE_HCCL_CONFIG_PATH] [CKPT_SAVE_DIR] [RANK_SIZE]
|
||||
bash scripts/train_distributed.sh [MINDSPORE_HCCL_CONFIG_PATH] [CKPT_SAVE_DIR] [RANK_SIZE]
|
||||
```
|
||||
|
||||
For example, you can run the shell command below to launch the distributed training procedure.
|
||||
|
||||
```shell
|
||||
sh scripts/train_distributed.sh /home/rank_table.json results/distributed/ 4
|
||||
bash scripts/train_distributed.sh /home/rank_table.json results/distributed/ 4
|
||||
```
|
||||
|
||||
The above shell script will run distribute training in the background. You can view the results through the file `train_parallel[X]/log.txt` as follows:
|
||||
|
|
@ -347,13 +347,13 @@ The model checkpoint will be saved into `[CKPT_SAVE_DIR]`.
|
|||
run `scripts/eval.sh` to evaluate the model with one Ascend processor. The usage of the script is:
|
||||
|
||||
```shell
|
||||
sh scripts/eval.sh [TEST_MODEL_FILE] [COCO_BBOX_FILE] [DEVICE_ID]
|
||||
bash scripts/eval.sh [TEST_MODEL_FILE] [COCO_BBOX_FILE] [DEVICE_ID]
|
||||
```
|
||||
|
||||
For example, you can run the shell command below to launch the validation procedure.
|
||||
|
||||
```shell
|
||||
sh scripts/eval.sh results/distributed/sim-140_1170.ckpt
|
||||
bash scripts/eval.sh results/distributed/sim-140_1170.ckpt
|
||||
```
|
||||
|
||||
The above shell command will run validation procedure in the background. You can view the results through the file `eval_log[X].txt`. The result will be achieved as follows:
|
||||
|
|
|
|||
|
|
@ -83,13 +83,13 @@ After installing MindSpore via the official website, you can start training and
|
|||
|
||||
```bash
|
||||
# distributed training
|
||||
Usage: sh scripts/run_distribute_train.sh [squeezenet|squeezenet_residual] [cifar10|imagenet] [RANK_TABLE_FILE] [DATA_PATH] [PRETRAINED_CKPT_PATH](optional)
|
||||
Usage: bash scripts/run_distribute_train.sh [squeezenet|squeezenet_residual] [cifar10|imagenet] [RANK_TABLE_FILE] [DATA_PATH] [PRETRAINED_CKPT_PATH](optional)
|
||||
|
||||
# standalone training
|
||||
Usage: sh scripts/run_standalone_train.sh [squeezenet|squeezenet_residual] [cifar10|imagenet] [DEVICE_ID] [DATA_PATH] [PRETRAINED_CKPT_PATH](optional)
|
||||
Usage: bash scripts/run_standalone_train.sh [squeezenet|squeezenet_residual] [cifar10|imagenet] [DEVICE_ID] [DATA_PATH] [PRETRAINED_CKPT_PATH](optional)
|
||||
|
||||
# run evaluation example
|
||||
Usage: sh scripts/run_eval.sh [squeezenet|squeezenet_residual] [cifar10|imagenet] [DEVICE_ID] [DATA_PATH] [CHECKPOINT_PATH]
|
||||
Usage: bash scripts/run_eval.sh [squeezenet|squeezenet_residual] [cifar10|imagenet] [DEVICE_ID] [DATA_PATH] [CHECKPOINT_PATH]
|
||||
```
|
||||
|
||||
- running on CPU
|
||||
|
|
@ -272,10 +272,10 @@ For more configuration details, please refer the script `config.py`.
|
|||
|
||||
```shell
|
||||
# distributed training
|
||||
Usage: sh scripts/run_distribute_train.sh [squeezenet|squeezenet_residual] [cifar10|imagenet] [RANK_TABLE_FILE] [DATA_PATH] [PRETRAINED_CKPT_PATH](optional)
|
||||
Usage: bash scripts/run_distribute_train.sh [squeezenet|squeezenet_residual] [cifar10|imagenet] [RANK_TABLE_FILE] [DATA_PATH] [PRETRAINED_CKPT_PATH](optional)
|
||||
|
||||
# standalone training
|
||||
Usage: sh scripts/run_standalone_train.sh [squeezenet|squeezenet_residual] [cifar10|imagenet] [DEVICE_ID] [DATA_PATH] [PRETRAINED_CKPT_PATH](optional)
|
||||
Usage: bash scripts/run_standalone_train.sh [squeezenet|squeezenet_residual] [cifar10|imagenet] [DEVICE_ID] [DATA_PATH] [PRETRAINED_CKPT_PATH](optional)
|
||||
```
|
||||
|
||||
For distributed training, a hccl configuration file with JSON format needs to be created in advance.
|
||||
|
|
@ -342,12 +342,12 @@ epoch: 5 step 5004, loss is 4.888848304748535
|
|||
|
||||
```shell
|
||||
# evaluation
|
||||
Usage: sh scripts/run_eval.sh [squeezenet|squeezenet_residual] [cifar10|imagenet] [DEVICE_ID] [DATA_PATH] [CHECKPOINT_PATH]
|
||||
Usage: bash scripts/run_eval.sh [squeezenet|squeezenet_residual] [cifar10|imagenet] [DEVICE_ID] [DATA_PATH] [CHECKPOINT_PATH]
|
||||
```
|
||||
|
||||
```shell
|
||||
# evaluation example
|
||||
sh scripts/run_eval.sh squeezenet cifar10 0 ~/cifar-10-verify-bin train/squeezenet_cifar10-120_1562.ckpt
|
||||
bash scripts/run_eval.sh squeezenet cifar10 0 ~/cifar-10-verify-bin train/squeezenet_cifar10-120_1562.ckpt
|
||||
```
|
||||
|
||||
checkpoint can be produced in training process.
|
||||
|
|
|
|||
|
|
@ -104,16 +104,16 @@ To create dataset, download the training dataset firstly and then convert them t
|
|||
|
||||
```bash
|
||||
GPU:
|
||||
sh run_distribute_train_gpu.sh DEVICE_NUM VISIABLE_DEVICES(0,1,2,3,4,5,6,7) DATASET_PATH
|
||||
bash run_distribute_train_gpu.sh DEVICE_NUM VISIABLE_DEVICES(0,1,2,3,4,5,6,7) DATASET_PATH
|
||||
```
|
||||
|
||||
### Launch
|
||||
|
||||
```bash
|
||||
# distributed training example(8p) for GPU
|
||||
sh run_distribute_train_gpu.sh 8 0,1,2,3,4,5,6,7 /dataset/train
|
||||
bash run_distribute_train_gpu.sh 8 0,1,2,3,4,5,6,7 /dataset/train
|
||||
# standalone training example for GPU
|
||||
sh run_distribute_train_gpu.sh 1 0 /dataset/train
|
||||
bash run_distribute_train_gpu.sh 1 0 /dataset/train
|
||||
```
|
||||
|
||||
You can find checkpoint file together with result in log.
|
||||
|
|
@ -124,14 +124,14 @@ You can find checkpoint file together with result in log.
|
|||
|
||||
```bash
|
||||
# Evaluation
|
||||
sh run_eval_gpu.sh DEVICE_ID DATASET_PATH CHECKPOINT_PATH
|
||||
bash run_eval_gpu.sh DEVICE_ID DATASET_PATH CHECKPOINT_PATH
|
||||
```
|
||||
|
||||
### Launch
|
||||
|
||||
```bash
|
||||
# Evaluation with checkpoint
|
||||
sh run_eval_gpu.sh 1 /dataset/val /ckpt_dir/srcnn-20_*.ckpt
|
||||
bash run_eval_gpu.sh 1 /dataset/val /ckpt_dir/srcnn-20_*.ckpt
|
||||
```
|
||||
|
||||
### Result
|
||||
|
|
|
|||
|
|
@ -107,7 +107,7 @@ SSD方法基于前向卷积网络,该网络产生固定大小的边界框集
|
|||
|
||||
```shell script
|
||||
# Ascend分布式训练
|
||||
sh run_distribute_train.sh [DEVICE_NUM] [EPOCH_SIZE] [LR] [DATASET] [RANK_TABLE_FILE] [CONFIG_PATH]
|
||||
bash run_distribute_train.sh [DEVICE_NUM] [EPOCH_SIZE] [LR] [DATASET] [RANK_TABLE_FILE] [CONFIG_PATH]
|
||||
```
|
||||
|
||||
```shell script
|
||||
|
|
@ -117,7 +117,7 @@ bash run_standalone_train.sh [DEVICE_ID] [EPOCH_SIZE] [LR] [DATASET] [CONFIG_PAT
|
|||
|
||||
```shell script
|
||||
# Ascend处理器环境运行eval
|
||||
sh run_eval.sh [DATASET] [CHECKPOINT_PATH] [DEVICE_ID] [CONFIG_PATH]
|
||||
bash run_eval.sh [DATASET] [CHECKPOINT_PATH] [DEVICE_ID] [CONFIG_PATH]
|
||||
```
|
||||
|
||||
- GPU处理器环境运行
|
||||
|
|
@ -129,7 +129,7 @@ bash run_distribute_train_gpu.sh [DEVICE_NUM] [EPOCH_SIZE] [LR] [DATASET] [CONFI
|
|||
|
||||
```shell script
|
||||
# GPU处理器环境运行eval
|
||||
sh run_eval_gpu.sh [DATASET] [CHECKPOINT_PATH] [DEVICE_ID] [CONFIG_PATH]
|
||||
bash run_eval_gpu.sh [DATASET] [CHECKPOINT_PATH] [DEVICE_ID] [CONFIG_PATH]
|
||||
```
|
||||
|
||||
如果要在modelarts上进行模型的训练,可以参考modelarts的官方指导文档(https://support.huaweicloud.com/modelarts/)
|
||||
|
|
@ -258,7 +258,7 @@ sh run_eval_gpu.sh [DATASET] [CHECKPOINT_PATH] [DEVICE_ID] [CONFIG_PATH]
|
|||
- 分布式
|
||||
|
||||
```shell script
|
||||
sh run_distribute_train.sh [DEVICE_NUM] [EPOCH_SIZE] [LR] [DATASET] [RANK_TABLE_FILE] [CONFIG_PATH] [PRE_TRAINED](optional) [PRE_TRAINED_EPOCH_SIZE](optional)
|
||||
bash run_distribute_train.sh [DEVICE_NUM] [EPOCH_SIZE] [LR] [DATASET] [RANK_TABLE_FILE] [CONFIG_PATH] [PRE_TRAINED](optional) [PRE_TRAINED_EPOCH_SIZE](optional)
|
||||
```
|
||||
|
||||
此脚本需要五或七个参数。
|
||||
|
|
@ -327,7 +327,7 @@ epoch time: 150753.701, per step time: 329.157
|
|||
### Ascend处理器环境评估
|
||||
|
||||
```shell script
|
||||
sh run_eval.sh [DATASET] [CHECKPOINT_PATH] [DEVICE_ID] [CONFIG_PATH]
|
||||
bash run_eval.sh [DATASET] [CHECKPOINT_PATH] [DEVICE_ID] [CONFIG_PATH]
|
||||
```
|
||||
|
||||
此脚本需要四个参数。
|
||||
|
|
@ -363,7 +363,7 @@ mAP: 0.23808886505483504
|
|||
### GPU处理器环境评估
|
||||
|
||||
```shell script
|
||||
sh run_eval_gpu.sh [DATASET] [CHECKPOINT_PATH] [DEVICE_ID] [CONFIG_PATH]
|
||||
bash run_eval_gpu.sh [DATASET] [CHECKPOINT_PATH] [DEVICE_ID] [CONFIG_PATH]
|
||||
```
|
||||
|
||||
此脚本需要四个参数。
|
||||
|
|
|
|||
|
|
@ -117,7 +117,7 @@ After installing MindSpore via the official website, you can start training and
|
|||
python train.py --config_path=[YAML_CONFIG_PATH] --data_dir=[DATA_PATH] --dataset=[DATASET_TYPE] > output.train.log 2>&1 &
|
||||
|
||||
# run distributed training example
|
||||
sh scripts/run_distribute_train.sh [RANL_TABLE_JSON] [DATA_PATH] --dataset=[DATASET_TYPE]
|
||||
bash scripts/run_distribute_train.sh [RANL_TABLE_JSON] [DATA_PATH] --dataset=[DATASET_TYPE]
|
||||
|
||||
# run evaluation example
|
||||
python eval.py --config_path=[YAML_CONFIG_PATH] --data_dir=[DATA_PATH] --pre_trained=[PRE_TRAINED] --dataset=[DATASET_TYPE] > output.eval.log 2>&1 &
|
||||
|
|
@ -134,7 +134,7 @@ Please follow the instructions in the link below:
|
|||
python train.py --config_path=[YAML_CONFIG_PATH] --device_target="GPU" --dataset=[DATASET_TYPE] --data_dir=[DATA_PATH] > output.train.log 2>&1 &
|
||||
|
||||
# run distributed training example
|
||||
sh scripts/run_distribute_train_gpu.sh [DATA_PATH] --dataset=[DATASET_TYPE]
|
||||
bash scripts/run_distribute_train_gpu.sh [DATA_PATH] --dataset=[DATASET_TYPE]
|
||||
|
||||
# run evaluation example
|
||||
python eval.py --config_path=[YAML_CONFIG_PATH] --device_target="GPU" --dataset=[DATASET_TYPE] --data_dir=[DATA_PATH] --pre_trained=[PRE_TRAINED] > output.eval.log 2>&1 &
|
||||
|
|
@ -435,7 +435,7 @@ epcoh: 2 step: 781, loss is 1.827582
|
|||
- Distributed Training
|
||||
|
||||
```bash
|
||||
sh run_distribute_train.sh rank_table.json your_data_path
|
||||
bash run_distribute_train.sh rank_table.json your_data_path
|
||||
```
|
||||
|
||||
The above shell script will run distribute training in the background, you can view the results through the file `train_parallel[X]/log`.
|
||||
|
|
|
|||
|
|
@ -119,7 +119,7 @@ VGG 16网络主要由几个基本模块(包括卷积层和池化层)和三
|
|||
python train.py --config_path=[YAML_CONFIG_PATH] --data_dir=[DATA_PATH] --dataset=[DATASET_TYPE] > output.train.log 2>&1 &
|
||||
|
||||
# 分布式训练示例
|
||||
sh scripts/run_distribute_train.sh [RANL_TABLE_JSON] [DATA_PATH] --dataset=[DATASET_TYPE]
|
||||
bash scripts/run_distribute_train.sh [RANL_TABLE_JSON] [DATA_PATH] --dataset=[DATASET_TYPE]
|
||||
|
||||
# 评估示例
|
||||
python eval.py --config_path=[YAML_CONFIG_PATH] --data_dir=[DATA_PATH] --pre_trained=[PRE_TRAINED] --dataset=[DATASET_TYPE] > output.eval.log 2>&1 &
|
||||
|
|
@ -136,7 +136,7 @@ python eval.py --config_path=[YAML_CONFIG_PATH] --data_dir=[DATA_PATH] --pre_tr
|
|||
python train.py --config_path=[YAML_CONFIG_PATH] --device_target="GPU" --dataset=[DATASET_TYPE] --data_dir=[DATA_PATH] > output.train.log 2>&1 &
|
||||
|
||||
# 分布式训练示例
|
||||
sh scripts/run_distribute_train_gpu.sh [DATA_PATH] --dataset=[DATASET_TYPE]
|
||||
bash scripts/run_distribute_train_gpu.sh [DATA_PATH] --dataset=[DATASET_TYPE]
|
||||
|
||||
# 评估示例
|
||||
python eval.py --config_path=[YAML_CONFIG_PATH] --device_target="GPU" --dataset=[DATASET_TYPE] --data_dir=[DATA_PATH] --pre_trained=[PRE_TRAINED] > output.eval.log 2>&1 &
|
||||
|
|
@ -437,7 +437,7 @@ epcoh: 2 step: 781, loss is 1.827582
|
|||
- 分布式训练
|
||||
|
||||
```bash
|
||||
sh scripts/run_distribute_train.sh rank_table.json your_data_path
|
||||
bash scripts/run_distribute_train.sh rank_table.json your_data_path
|
||||
```
|
||||
|
||||
上述shell脚本会在后台进行分布式训练,可通过`train_parallel[X]/log`文件查看结果。
|
||||
|
|
|
|||
|
|
@ -59,7 +59,7 @@ The dataset is self-generated using a third-party library called [captcha](https
|
|||
|
||||
```bash
|
||||
$ cd scripts
|
||||
$ sh run_process_data.sh
|
||||
$ bash run_process_data.sh
|
||||
|
||||
# after execution, you will find the dataset like the follows:
|
||||
.
|
||||
|
|
|
|||
|
|
@ -63,7 +63,7 @@ WarpCTC是带有一层FC神经网络的二层堆叠LSTM模型。详细信息请
|
|||
|
||||
```text
|
||||
$ cd scripts
|
||||
$ sh run_process_data.sh
|
||||
$ bash run_process_data.sh
|
||||
|
||||
# 执行后,数据集如下:
|
||||
.
|
||||
|
|
|
|||
|
|
@ -166,31 +166,31 @@ You can start training using python or shell scripts. The usage of shell scripts
|
|||
|
||||
```shell
|
||||
# distribute training example(8p)
|
||||
sh scripts/run_distribute_train.sh RANK_TABLE_FILE DATA_PATH
|
||||
bash scripts/run_distribute_train.sh RANK_TABLE_FILE DATA_PATH
|
||||
# standalone training
|
||||
sh scripts/run_standalone_train.sh DEVICE_ID DATA_PATH
|
||||
bash scripts/run_standalone_train.sh DEVICE_ID DATA_PATH
|
||||
```
|
||||
|
||||
- GPU:
|
||||
|
||||
```shell
|
||||
# fp32 distributed training example(8p)
|
||||
sh scripts/run_train_gpu_fp32.sh DEVICE_NUM DATASET_PATH PRETRAINED_CKPT_PATH(optional)
|
||||
bash scripts/run_train_gpu_fp32.sh DEVICE_NUM DATASET_PATH PRETRAINED_CKPT_PATH(optional)
|
||||
|
||||
# fp32 standalone training example
|
||||
sh scripts/run_train_gpu_fp32.sh 1 DATASET_PATH PRETRAINED_CKPT_PATH(optional)
|
||||
bash scripts/run_train_gpu_fp32.sh 1 DATASET_PATH PRETRAINED_CKPT_PATH(optional)
|
||||
|
||||
# fp16 distributed training example(8p)
|
||||
sh scripts/run_train_gpu_fp16.sh DEVICE_NUM DATASET_PATH PRETRAINED_CKPT_PATH(optional)
|
||||
bash scripts/run_train_gpu_fp16.sh DEVICE_NUM DATASET_PATH PRETRAINED_CKPT_PATH(optional)
|
||||
|
||||
# fp16 standalone training example
|
||||
sh scripts/run_train_gpu_fp16.sh 1 DATASET_PATH PRETRAINED_CKPT_PATH(optional)
|
||||
bash scripts/run_train_gpu_fp16.sh 1 DATASET_PATH PRETRAINED_CKPT_PATH(optional)
|
||||
|
||||
# infer example
|
||||
sh run_eval_gpu.sh DEVICE_ID DATASET_PATH CHECKPOINT_PATH
|
||||
bash run_eval_gpu.sh DEVICE_ID DATASET_PATH CHECKPOINT_PATH
|
||||
|
||||
#ascend310 infer example
|
||||
sh run_infer_310.sh MINDIR_PATH DATA_PATH LABEL_FILE DEVICE_ID
|
||||
bash run_infer_310.sh MINDIR_PATH DATA_PATH LABEL_FILE DEVICE_ID
|
||||
```
|
||||
|
||||
> Notes: RANK_TABLE_FILE can refer to [Link](https://www.mindspore.cn/docs/programming_guide/en/master/distributed_training_ascend.html), and the device_ip can be got as [Link](https://gitee.com/mindspore/mindspore/tree/master/model_zoo/utils/hccl_tools).
|
||||
|
|
@ -208,14 +208,14 @@ sh run_infer_310.sh MINDIR_PATH DATA_PATH LABEL_FILE DEVICE_ID
|
|||
shell:
|
||||
Ascend:
|
||||
# distribute training example(8p)
|
||||
sh scripts/run_distribute_train.sh RANK_TABLE_FILE DATA_PATH
|
||||
bash scripts/run_distribute_train.sh RANK_TABLE_FILE DATA_PATH
|
||||
# standalone training
|
||||
sh scripts/run_standalone_train.sh DEVICE_ID DATA_PATH
|
||||
bash scripts/run_standalone_train.sh DEVICE_ID DATA_PATH
|
||||
GPU:
|
||||
# fp16 training example(8p)
|
||||
sh scripts/run_train_gpu_fp16.sh DEVICE_NUM DATA_PATH
|
||||
bash scripts/run_train_gpu_fp16.sh DEVICE_NUM DATA_PATH
|
||||
# fp32 training example(8p)
|
||||
sh scripts/run_train_gpu_fp32.sh DEVICE_NUM DATA_PATH
|
||||
bash scripts/run_train_gpu_fp32.sh DEVICE_NUM DATA_PATH
|
||||
```
|
||||
|
||||
### Result
|
||||
|
|
@ -276,13 +276,13 @@ You can start training using python or shell scripts. The usage of shell scripts
|
|||
- Ascend:
|
||||
|
||||
```shell
|
||||
sh scripts/run_eval.sh DEVICE_ID DATA_DIR PATH_CHECKPOINT
|
||||
bash scripts/run_eval.sh DEVICE_ID DATA_DIR PATH_CHECKPOINT
|
||||
```
|
||||
|
||||
- GPU:
|
||||
|
||||
```shell
|
||||
sh scripts/run_eval_gpu.sh DEVICE_ID DATA_DIR PATH_CHECKPOINT
|
||||
bash scripts/run_eval_gpu.sh DEVICE_ID DATA_DIR PATH_CHECKPOINT
|
||||
```
|
||||
|
||||
### Launch
|
||||
|
|
@ -294,8 +294,8 @@ sh scripts/run_eval_gpu.sh DEVICE_ID DATA_DIR PATH_CHECKPOINT
|
|||
GPU: python eval.py --device_target GPU --checkpoint_path PATH_CHECKPOINT --dataset_path DATA_DIR
|
||||
|
||||
shell:
|
||||
Ascend: sh scripts/run_eval.sh DEVICE_ID DATA_DIR PATH_CHECKPOINT
|
||||
GPU: sh scripts/run_eval_gpu.sh DEVICE_ID DATA_DIR PATH_CHECKPOINT
|
||||
Ascend: bash scripts/run_eval.sh DEVICE_ID DATA_DIR PATH_CHECKPOINT
|
||||
GPU: bash scripts/run_eval_gpu.sh DEVICE_ID DATA_DIR PATH_CHECKPOINT
|
||||
```
|
||||
|
||||
> checkpoint can be produced in training process.
|
||||
|
|
|
|||
|
|
@ -83,10 +83,10 @@ python train.py \
|
|||
--lr_scheduler=cosine_annealing > log.txt 2>&1 &
|
||||
|
||||
# standalone training example(1p) by shell script
|
||||
sh run_standalone_train.sh dataset/coco2014 yolov3_darknet53_noquant.ckpt
|
||||
bash run_standalone_train.sh dataset/coco2014 yolov3_darknet53_noquant.ckpt
|
||||
|
||||
# distributed training example(8p) by shell script
|
||||
sh run_distribute_train.sh dataset/coco2014 yolov3_darknet53_noquant.ckpt rank_table_8p.json
|
||||
bash run_distribute_train.sh dataset/coco2014 yolov3_darknet53_noquant.ckpt rank_table_8p.json
|
||||
|
||||
# run evaluation by python command
|
||||
python eval.py \
|
||||
|
|
@ -95,7 +95,7 @@ python eval.py \
|
|||
--testing_shape=416 > log.txt 2>&1 &
|
||||
|
||||
# run evaluation by shell script
|
||||
sh run_eval.sh dataset/coco2014/ checkpoint/yolov3_quant.ckpt 0
|
||||
bash run_eval.sh dataset/coco2014/ checkpoint/yolov3_quant.ckpt 0
|
||||
```
|
||||
|
||||
## [Script Description](#contents)
|
||||
|
|
@ -198,7 +198,7 @@ optional arguments:
|
|||
##### Distributed Training
|
||||
|
||||
```bash
|
||||
sh run_distribute_train.sh dataset/coco2014 yolov3_darknet53_noquant.ckpt rank_table_8p.json
|
||||
bash run_distribute_train.sh dataset/coco2014 yolov3_darknet53_noquant.ckpt rank_table_8p.json
|
||||
```
|
||||
|
||||
The above shell script will run distribute training in the background. You can view the results through the file `train_parallel[X]/log.txt`. The loss value will be achieved as follows:
|
||||
|
|
@ -239,7 +239,7 @@ python eval.py \
|
|||
--pretrained=0-130_83330.ckpt \
|
||||
--testing_shape=416 > log.txt 2>&1 &
|
||||
OR
|
||||
sh run_eval.sh dataset/coco2014/ checkpoint/0-130_83330.ckpt 0
|
||||
bash run_eval.sh dataset/coco2014/ checkpoint/0-130_83330.ckpt 0
|
||||
```
|
||||
|
||||
The above python command will run in the background. You can view the results through the file "log.txt". The mAP of the test dataset will be as follows:
|
||||
|
|
|
|||
|
|
@ -89,12 +89,12 @@ python train.py \
|
|||
|
||||
```shell script
|
||||
# shell脚本单机训练示例(1卡)
|
||||
sh run_standalone_train.sh dataset/coco2014 yolov3_darknet53_noquant.ckpt
|
||||
bash run_standalone_train.sh dataset/coco2014 yolov3_darknet53_noquant.ckpt
|
||||
```
|
||||
|
||||
```shell script
|
||||
# shell脚本分布式训练示例(8卡)
|
||||
sh run_distribute_train.sh dataset/coco2014 yolov3_darknet53_noquant.ckpt rank_table_8p.json
|
||||
bash run_distribute_train.sh dataset/coco2014 yolov3_darknet53_noquant.ckpt rank_table_8p.json
|
||||
```
|
||||
|
||||
```python
|
||||
|
|
@ -107,7 +107,7 @@ python eval.py \
|
|||
|
||||
```shell script
|
||||
# 通过shell脚本运行评估
|
||||
sh run_eval.sh dataset/coco2014/ checkpoint/yolov3_quant.ckpt 0
|
||||
bash run_eval.sh dataset/coco2014/ checkpoint/yolov3_quant.ckpt 0
|
||||
```
|
||||
|
||||
## 脚本说明
|
||||
|
|
@ -205,7 +205,7 @@ train.py中主要参数如下:
|
|||
##### 分布式训练
|
||||
|
||||
```shell script
|
||||
sh run_distribute_train.sh dataset/coco2014 yolov3_darknet53_noquant.ckpt rank_table_8p.json
|
||||
bash run_distribute_train.sh dataset/coco2014 yolov3_darknet53_noquant.ckpt rank_table_8p.json
|
||||
```
|
||||
|
||||
上述shell脚本将在后台运行分布训练。您可以通过`train_parallel[X]/log.txt`文件查看结果。损失值的实现如下:
|
||||
|
|
@ -250,7 +250,7 @@ python eval.py \
|
|||
或者
|
||||
|
||||
```shell script
|
||||
sh run_eval.sh dataset/coco2014/ checkpoint/0-130_83330.ckpt 0
|
||||
bash run_eval.sh dataset/coco2014/ checkpoint/0-130_83330.ckpt 0
|
||||
```
|
||||
|
||||
上述python命令将在后台运行,您可以通过log.txt文件查看结果。测试数据集的mAP如下:
|
||||
|
|
|
|||
|
|
@ -86,13 +86,13 @@ After installing MindSpore via the official website, you can start training and
|
|||
|
||||
```shell script
|
||||
#run standalone training example
|
||||
sh run_standalone_train.sh [DEVICE_ID] [EPOCH_SIZE] [MINDRECORD_DIR] [IMAGE_DIR] [ANNO_PATH]
|
||||
bash run_standalone_train.sh [DEVICE_ID] [EPOCH_SIZE] [MINDRECORD_DIR] [IMAGE_DIR] [ANNO_PATH]
|
||||
|
||||
#run distributed training example
|
||||
sh run_distribute_train.sh [DEVICE_NUM] [EPOCH_SIZE] [MINDRECORD_DIR] [IMAGE_DIR] [ANNO_PATH] [RANK_TABLE_FILE]
|
||||
bash run_distribute_train.sh [DEVICE_NUM] [EPOCH_SIZE] [MINDRECORD_DIR] [IMAGE_DIR] [ANNO_PATH] [RANK_TABLE_FILE]
|
||||
|
||||
#run evaluation example
|
||||
sh run_eval.sh [DEVICE_ID] [CKPT_PATH] [MINDRECORD_DIR] [IMAGE_DIR] [ANNO_PATH]
|
||||
bash run_eval.sh [DEVICE_ID] [CKPT_PATH] [MINDRECORD_DIR] [IMAGE_DIR] [ANNO_PATH]
|
||||
```
|
||||
|
||||
- Running on [ModelArts](https://support.huaweicloud.com/modelarts/)
|
||||
|
|
@ -271,7 +271,7 @@ To train the model, run `train.py` with the dataset `image_dir`, `anno_path` and
|
|||
- Stand alone mode
|
||||
|
||||
```bash
|
||||
sh run_standalone_train.sh 0 50 ./Mindrecord_train ./dataset ./dataset/train.txt
|
||||
bash run_standalone_train.sh 0 50 ./Mindrecord_train ./dataset ./dataset/train.txt
|
||||
```
|
||||
|
||||
The input variables are device id, epoch size, mindrecord directory path, dataset directory path and train TXT file path.
|
||||
|
|
@ -279,7 +279,7 @@ To train the model, run `train.py` with the dataset `image_dir`, `anno_path` and
|
|||
- Distributed mode
|
||||
|
||||
```bash
|
||||
sh run_distribute_train.sh 8 150 /data/Mindrecord_train /data /data/train.txt /data/hccl.json
|
||||
bash run_distribute_train.sh 8 150 /data/Mindrecord_train /data /data/train.txt /data/hccl.json
|
||||
```
|
||||
|
||||
The input variables are device numbers, epoch size, mindrecord directory path, dataset directory path, train TXT file path and [hccl json configuration file](https://gitee.com/mindspore/mindspore/tree/master/model_zoo/utils/hccl_tools). **It is better to use absolute path.**
|
||||
|
|
@ -310,7 +310,7 @@ Note the results is two-classification(person and face) used our own annotations
|
|||
To eval, run `eval.py` with the dataset `image_dir`, `anno_path`(eval txt), `mindrecord_dir` and `ckpt_path`. `ckpt_path` is the path of [checkpoint](https://www.mindspore.cn/docs/programming_guide/en/master/save_model.html) file.
|
||||
|
||||
```bash
|
||||
sh run_eval.sh 0 yolo.ckpt ./Mindrecord_eval ./dataset ./dataset/eval.txt
|
||||
bash run_eval.sh 0 yolo.ckpt ./Mindrecord_eval ./dataset ./dataset/eval.txt
|
||||
```
|
||||
|
||||
The input variables are device id, checkpoint path, mindrecord directory path, dataset directory path and train TXT file path.
|
||||
|
|
|
|||
|
|
@ -88,11 +88,11 @@ YOLOv3整体网络架构如下:
|
|||
|
||||
```shell script
|
||||
# 运行单机训练示例
|
||||
sh run_standalone_train.sh [DEVICE_ID] [EPOCH_SIZE] [MINDRECORD_DIR] [IMAGE_DIR] [ANNO_PATH]
|
||||
bash run_standalone_train.sh [DEVICE_ID] [EPOCH_SIZE] [MINDRECORD_DIR] [IMAGE_DIR] [ANNO_PATH]
|
||||
# 运行分布式训练示例
|
||||
sh run_distribute_train.sh [DEVICE_NUM] [EPOCH_SIZE] [MINDRECORD_DIR] [IMAGE_DIR] [ANNO_PATH] [RANK_TABLE_FILE]
|
||||
bash run_distribute_train.sh [DEVICE_NUM] [EPOCH_SIZE] [MINDRECORD_DIR] [IMAGE_DIR] [ANNO_PATH] [RANK_TABLE_FILE]
|
||||
# 运行评估示例
|
||||
sh run_eval.sh [DEVICE_ID] [CKPT_PATH] [MINDRECORD_DIR] [IMAGE_DIR] [ANNO_PATH]
|
||||
bash run_eval.sh [DEVICE_ID] [CKPT_PATH] [MINDRECORD_DIR] [IMAGE_DIR] [ANNO_PATH]
|
||||
```
|
||||
|
||||
- 在 ModelArts 进行训练 (如果你想在modelarts上运行,可以参考以下文档 [modelarts](https://support.huaweicloud.com/modelarts/))
|
||||
|
|
@ -271,7 +271,7 @@ YOLOv3整体网络架构如下:
|
|||
- 单机模式
|
||||
|
||||
```shell script
|
||||
sh run_standalone_train.sh 0 50 ./Mindrecord_train ./dataset ./dataset/train.txt
|
||||
bash run_standalone_train.sh 0 50 ./Mindrecord_train ./dataset ./dataset/train.txt
|
||||
```
|
||||
|
||||
输入变量为设备编号、轮次大小、MindRecord目录路径、数据集目录路径、训练TXT文件路径。
|
||||
|
|
@ -279,7 +279,7 @@ YOLOv3整体网络架构如下:
|
|||
- 分布式模式
|
||||
|
||||
```shell script
|
||||
sh run_distribute_train.sh 8 150 /data/Mindrecord_train /data /data/train.txt /data/hccl.json
|
||||
bash run_distribute_train.sh 8 150 /data/Mindrecord_train /data /data/train.txt /data/hccl.json
|
||||
```
|
||||
|
||||
输入变量为设备编号、轮次大小、MindRecord目录路径、数据集目录路径、训练TXT文件路径和[hccl_tools配置文件](https://gitee.com/mindspore/mindspore/tree/master/model_zoo/utils/hccl_tools)。**最好使用绝对路径。**
|
||||
|
|
@ -310,7 +310,7 @@ YOLOv3整体网络架构如下:
|
|||
运行`eval.py`,数据集为`image_dir`、`anno_path`(评估TXT)、`mindrecord_dir`和`ckpt_path`。`ckpt_path`是[检查点](https://www.mindspore.cn/docs/programming_guide/zh-CN/master/save_model.html)文件的路径。
|
||||
|
||||
```shell script
|
||||
sh run_eval.sh 0 yolo.ckpt ./Mindrecord_eval ./dataset ./dataset/eval.txt
|
||||
bash run_eval.sh 0 yolo.ckpt ./Mindrecord_eval ./dataset ./dataset/eval.txt
|
||||
```
|
||||
|
||||
输入变量为设备编号、检查点路径、MindRecord目录路径、数据集目录路径、训练TXT文件路径。
|
||||
|
|
|
|||
|
|
@ -123,10 +123,10 @@ other datasets need to use the same format as MS COCO.
|
|||
--lr_scheduler=cosine_annealing > log.txt 2>&1 &
|
||||
|
||||
# standalone training example(1p) by shell script (Training with a single scale)
|
||||
sh run_standalone_train.sh dataset/xxx cspdarknet53_backbone.ckpt
|
||||
bash run_standalone_train.sh dataset/xxx cspdarknet53_backbone.ckpt
|
||||
|
||||
# For Ascend device, distributed training example(8p) by shell script (Training with multi scale)
|
||||
sh run_distribute_train.sh dataset/xxx cspdarknet53_backbone.ckpt rank_table_8p.json
|
||||
bash run_distribute_train.sh dataset/xxx cspdarknet53_backbone.ckpt rank_table_8p.json
|
||||
|
||||
# run evaluation by python command
|
||||
python eval.py \
|
||||
|
|
@ -135,7 +135,7 @@ other datasets need to use the same format as MS COCO.
|
|||
--testing_shape=608 > log.txt 2>&1 &
|
||||
|
||||
# run evaluation by shell script
|
||||
sh run_eval.sh dataset/xxx checkpoint/xxx.ckpt
|
||||
bash run_eval.sh dataset/xxx checkpoint/xxx.ckpt
|
||||
```
|
||||
|
||||
- Train on [ModelArts](https://support.huaweicloud.com/modelarts/)
|
||||
|
|
@ -344,7 +344,7 @@ Resnet50 is easy to get in mindspore model zoo.
|
|||
For Ascend device, standalone training example(1p) by shell script
|
||||
|
||||
```bash
|
||||
sh run_standalone_train.sh dataset/coco2017 cspdarknet53_backbone.ckpt
|
||||
bash run_standalone_train.sh dataset/coco2017 cspdarknet53_backbone.ckpt
|
||||
```
|
||||
|
||||
```text
|
||||
|
|
@ -384,7 +384,7 @@ After training, you'll get some checkpoint files under the outputs folder by def
|
|||
For Ascend device, distributed training example(8p) by shell script
|
||||
|
||||
```bash
|
||||
sh run_distribute_train.sh dataset/coco2017 cspdarknet53_backbone.ckpt rank_table_8p.json
|
||||
bash run_distribute_train.sh dataset/coco2017 cspdarknet53_backbone.ckpt rank_table_8p.json
|
||||
```
|
||||
|
||||
The above shell script will run distribute training in the background. You can view the results through the file train_parallel[X]/log.txt. The loss value will be achieved as follows:
|
||||
|
|
@ -427,7 +427,7 @@ python eval.py \
|
|||
--pretrained=yolov4.ckpt \
|
||||
--testing_shape=608 > log.txt 2>&1 &
|
||||
OR
|
||||
sh run_eval.sh dataset/coco2017 checkpoint/yolov4.ckpt
|
||||
bash run_eval.sh dataset/coco2017 checkpoint/yolov4.ckpt
|
||||
```
|
||||
|
||||
The above python command will run in the background. You can view the results through the file "log.txt". The mAP of the test dataset will be as follows:
|
||||
|
|
@ -457,7 +457,7 @@ python test.py \
|
|||
--pretrained=yolov4.ckpt \
|
||||
--testing_shape=608 > log.txt 2>&1 &
|
||||
OR
|
||||
sh run_test.sh dataset/coco2017 checkpoint/yolov4.ckpt
|
||||
bash run_test.sh dataset/coco2017 checkpoint/yolov4.ckpt
|
||||
```
|
||||
|
||||
The predict_xxx.json will be found in test/outputs/%Y-%m-%d_time_%H_%M_%S/.
|
||||
|
|
@ -504,7 +504,7 @@ Current batch_Size can only be set to 1. The precision calculation process needs
|
|||
|
||||
```shell
|
||||
# Ascend310 inference
|
||||
sh run_infer_310.sh [MINDIR_PATH] [DATA_PATH] [DEVICE_ID] [ANN_FILE]
|
||||
bash run_infer_310.sh [MINDIR_PATH] [DATA_PATH] [DEVICE_ID] [ANN_FILE]
|
||||
```
|
||||
|
||||
`DEVICE_ID` is optional, default value is 0.
|
||||
|
|
|
|||
|
|
@ -131,10 +131,10 @@ YOLOv4需要CSPDarknet53主干来提取图像特征进行检测。 您可以从
|
|||
--lr_scheduler=cosine_annealing > log.txt 2>&1 &
|
||||
|
||||
# 使用shell脚本执行单尺度单机训练示例(1卡)
|
||||
sh run_standalone_train.sh dataset/xxx cspdarknet53_backbone.ckpt
|
||||
bash run_standalone_train.sh dataset/xxx cspdarknet53_backbone.ckpt
|
||||
|
||||
# 在Ascend设备上,使用shell脚本执行多尺度分布式训练示例(8卡)
|
||||
sh run_distribute_train.sh dataset/xxx cspdarknet53_backbone.ckpt rank_table_8p.json
|
||||
bash run_distribute_train.sh dataset/xxx cspdarknet53_backbone.ckpt rank_table_8p.json
|
||||
|
||||
# 使用python命令评估
|
||||
python eval.py \
|
||||
|
|
@ -143,7 +143,7 @@ YOLOv4需要CSPDarknet53主干来提取图像特征进行检测。 您可以从
|
|||
--testing_shape=608 > log.txt 2>&1 &
|
||||
|
||||
# 使用shell脚本评估
|
||||
sh run_eval.sh dataset/xxx checkpoint/xxx.ckpt
|
||||
bash run_eval.sh dataset/xxx checkpoint/xxx.ckpt
|
||||
```
|
||||
|
||||
- [ModelArts](https://support.huaweicloud.com/modelarts/)上训练
|
||||
|
|
@ -352,7 +352,7 @@ Cspdarknet53是一个分类器,可以在ImageNet(ILSVRC2012)等数据集上训
|
|||
在Ascend设备上,使用shell脚本执行单机训练示例(1卡)
|
||||
|
||||
```bash
|
||||
sh run_standalone_train.sh dataset/coco2017 cspdarknet53_backbone.ckpt
|
||||
bash run_standalone_train.sh dataset/coco2017 cspdarknet53_backbone.ckpt
|
||||
```
|
||||
|
||||
```text
|
||||
|
|
@ -392,7 +392,7 @@ python train.py \
|
|||
在Ascend设备上,使用shell脚本执行分布式训练示例(8卡)
|
||||
|
||||
```bash
|
||||
sh run_distribute_train.sh dataset/coco2017 cspdarknet53_backbone.ckpt rank_table_8p.json
|
||||
bash run_distribute_train.sh dataset/coco2017 cspdarknet53_backbone.ckpt rank_table_8p.json
|
||||
```
|
||||
|
||||
上述shell脚本将在后台运行分布式训练。 您可以通过train_parallel[X]/log.txt文件查看结果。 得到如下损失值:
|
||||
|
|
@ -435,7 +435,7 @@ python eval.py \
|
|||
--pretrained=yolov4.ckpt \
|
||||
--testing_shape=608 > log.txt 2>&1 &
|
||||
OR
|
||||
sh run_eval.sh dataset/coco2017 checkpoint/yolov4.ckpt
|
||||
bash run_eval.sh dataset/coco2017 checkpoint/yolov4.ckpt
|
||||
```
|
||||
|
||||
上述python命令将在后台运行。 您可以通过log.txt文件查看结果。 测试数据集的mAP如下:
|
||||
|
|
@ -465,7 +465,7 @@ python test.py \
|
|||
--pretrained=yolov4.ckpt \
|
||||
--testing_shape=608 > log.txt 2>&1 &
|
||||
OR
|
||||
sh run_test.sh dataset/coco2017 checkpoint/yolov4.ckpt
|
||||
bash run_test.sh dataset/coco2017 checkpoint/yolov4.ckpt
|
||||
```
|
||||
|
||||
predict_xxx.json文件位于test/outputs/%Y-%m-%d_time_%H_%M_%S/。
|
||||
|
|
@ -511,7 +511,7 @@ python export.py --ckpt_file [CKPT_PATH] --file_name [FILE_NAME] --file_format [
|
|||
|
||||
```shell
|
||||
# Ascend 310推理
|
||||
sh run_infer_310.sh [MINDIR_PATH] [DATA_PATH] [DEVICE_ID] [ANN_FILE]
|
||||
bash run_infer_310.sh [MINDIR_PATH] [DATA_PATH] [DEVICE_ID] [ANN_FILE]
|
||||
```
|
||||
|
||||
`DEVICE_ID`是可选参数,默认值为0。
|
||||
|
|
|
|||
|
|
@ -99,12 +99,12 @@ python train.py \
|
|||
|
||||
```shell
|
||||
# standalone training example(1p) by shell script
|
||||
sh run_standalone_train.sh dataset/xxx
|
||||
bash run_standalone_train.sh dataset/xxx
|
||||
```
|
||||
|
||||
```shell
|
||||
# For Ascend device, distributed training example(8p) by shell script
|
||||
sh run_distribute_train.sh dataset/xxx rank_table_8p.json
|
||||
bash run_distribute_train.sh dataset/xxx rank_table_8p.json
|
||||
```
|
||||
|
||||
```python
|
||||
|
|
@ -117,7 +117,7 @@ python eval.py \
|
|||
|
||||
```python
|
||||
# run evaluation by shell script
|
||||
sh run_eval.sh dataset/xxx checkpoint/xxx.ckpt
|
||||
bash run_eval.sh dataset/xxx checkpoint/xxx.ckpt
|
||||
```
|
||||
|
||||
# [Script Description](#contents)
|
||||
|
|
@ -256,7 +256,7 @@ After training, you'll get some checkpoint files under the outputs folder by def
|
|||
For Ascend device, distributed training example(8p) by shell script
|
||||
|
||||
```shell
|
||||
sh run_distribute_train.sh dataset/coco2017 rank_table_8p.json
|
||||
bash run_distribute_train.sh dataset/coco2017 rank_table_8p.json
|
||||
```
|
||||
|
||||
The above shell script will run distribute training in the background. You can view the results through the file train_parallel[X]/log.txt. The loss value will be achieved as follows:
|
||||
|
|
@ -289,7 +289,7 @@ python eval.py \
|
|||
--pretrained=yolov5.ckpt \
|
||||
--testing_shape=640 > log.txt 2>&1 &
|
||||
OR
|
||||
sh run_eval.sh dataset/coco2017 checkpoint/yolov5.ckpt
|
||||
bash run_eval.sh dataset/coco2017 checkpoint/yolov5.ckpt
|
||||
```
|
||||
|
||||
The above python command will run in the background. You can view the results through the file "log.txt". The mAP of the test dataset will be as follows:
|
||||
|
|
|
|||
|
|
@ -99,12 +99,12 @@ python train.py \
|
|||
|
||||
```shell
|
||||
# shell脚本单机训练示例(1卡)
|
||||
sh run_standalone_train.sh dataset/xxx
|
||||
bash run_standalone_train.sh dataset/xxx
|
||||
```
|
||||
|
||||
```shell
|
||||
# 对于Ascend设备,使用shell脚本分布式训练示例(8卡)
|
||||
sh run_distribute_train.sh dataset/xxx rank_table_8p.json
|
||||
bash run_distribute_train.sh dataset/xxx rank_table_8p.json
|
||||
```
|
||||
|
||||
```python
|
||||
|
|
@ -117,7 +117,7 @@ python eval.py \
|
|||
|
||||
```python
|
||||
# shell脚本执行评估
|
||||
sh run_eval.sh dataset/xxx checkpoint/xxx.ckpt
|
||||
bash run_eval.sh dataset/xxx checkpoint/xxx.ckpt
|
||||
```
|
||||
|
||||
# [脚本说明](#目录)
|
||||
|
|
@ -258,7 +258,7 @@ python train.py \
|
|||
对于Ascend设备,使用shell脚本分布式训练示例(8卡)
|
||||
|
||||
```shell
|
||||
sh run_distribute_train.sh dataset/coco2017 rank_table_8p.json
|
||||
bash run_distribute_train.sh dataset/coco2017 rank_table_8p.json
|
||||
```
|
||||
|
||||
上述shell脚本将在后台运行分布式训练。 您可以通过train_parallel[X]/log.txt文件查看结果。 得到如下损失值:
|
||||
|
|
@ -291,7 +291,7 @@ python eval.py \
|
|||
--pretrained=yolov5.ckpt \
|
||||
--testing_shape=640 > log.txt 2>&1 &
|
||||
OR
|
||||
sh run_eval.sh dataset/coco2017 checkpoint/yolov5.ckpt
|
||||
bash run_eval.sh dataset/coco2017 checkpoint/yolov5.ckpt
|
||||
```
|
||||
|
||||
上述python命令将在后台运行。 您可以通过log.txt文件查看结果。 测试数据集的mAP如下:
|
||||
|
|
|
|||
|
|
@ -72,7 +72,7 @@ Note that you can run the scripts based on the dataset mentioned in original pap
|
|||
|
||||
cd ./scripts
|
||||
# SRC_PATH is the dataset file path you download.
|
||||
sh run_process_data_ascend.sh [SRC_PATH]
|
||||
bash run_process_data_ascend.sh [SRC_PATH]
|
||||
```
|
||||
|
||||
## [Features](#contents)
|
||||
|
|
@ -98,20 +98,20 @@ After installing MindSpore via the official website and Dataset is correctly gen
|
|||
|
||||
```python
|
||||
# run training example with Amazon-Beauty dataset
|
||||
sh run_train_ascend.sh dataset_path
|
||||
bash run_train_ascend.sh dataset_path
|
||||
|
||||
# run evaluation example with Amazon-Beauty dataset
|
||||
sh run_eval_ascend.sh dataset_path
|
||||
bash run_eval_ascend.sh dataset_path
|
||||
```
|
||||
|
||||
- Running on GPU
|
||||
|
||||
```python
|
||||
# run training example with Amazon-Beauty dataset
|
||||
sh run_train_gpu.sh 0 dataset_path
|
||||
bash run_train_gpu.sh 0 dataset_path
|
||||
|
||||
# run evaluation example with Amazon-Beauty dataset
|
||||
sh run_eval_gpu.sh 0 dataset_path
|
||||
bash run_eval_gpu.sh 0 dataset_path
|
||||
```
|
||||
|
||||
- Running on ModelArts (If you want to run in modelarts, please check the official documentation of [modelarts](https://support.huaweicloud.com/modelarts/), and you can start training as follows)
|
||||
|
|
@ -255,7 +255,7 @@ Parameters for both training and evaluation can be set in default_config.yaml.
|
|||
- running on Ascend
|
||||
|
||||
```python
|
||||
sh run_train_ascend.sh dataset_path
|
||||
bash run_train_ascend.sh dataset_path
|
||||
```
|
||||
|
||||
Training result will be stored in the scripts path, whose folder name begins with "train". You can find the result like the
|
||||
|
|
@ -278,7 +278,7 @@ Parameters for both training and evaluation can be set in default_config.yaml.
|
|||
- running on GPU
|
||||
|
||||
```python
|
||||
sh run_train_gpu.sh 0 dataset_path
|
||||
bash run_train_gpu.sh 0 dataset_path
|
||||
```
|
||||
|
||||
Training result will be stored in the scripts path, whose folder name begins with "train". You can find the result like the
|
||||
|
|
@ -298,7 +298,7 @@ Parameters for both training and evaluation can be set in default_config.yaml.
|
|||
- Evaluation on Ascend
|
||||
|
||||
```python
|
||||
sh run_eval_ascend.sh dataset_path
|
||||
bash run_eval_ascend.sh dataset_path
|
||||
```
|
||||
|
||||
Evaluation result will be stored in the scripts path, whose folder name begins with "eval". You can find the result like the
|
||||
|
|
@ -325,7 +325,7 @@ Parameters for both training and evaluation can be set in default_config.yaml.
|
|||
- Evaluation on GPU
|
||||
|
||||
```python
|
||||
sh run_eval_gpu.sh 0 dataset_path
|
||||
bash run_eval_gpu.sh 0 dataset_path
|
||||
```
|
||||
|
||||
Evaluation result will be stored in the scripts path, whose folder name begins with "eval". You can find the result like the
|
||||
|
|
|
|||
|
|
@ -71,7 +71,7 @@ BGCF包含两个主要模块。首先是抽样,它生成基于节点复制的
|
|||
|
||||
cd ./scripts
|
||||
# SRC_PATH是您下载的数据集文件路径
|
||||
sh run_process_data_ascend.sh [SRC_PATH]
|
||||
bash run_process_data_ascend.sh [SRC_PATH]
|
||||
|
||||
```
|
||||
|
||||
|
|
@ -80,7 +80,7 @@ BGCF包含两个主要模块。首先是抽样,它生成基于节点复制的
|
|||
```text
|
||||
|
||||
# 为Amazon-Beauty生成MindRecord格式的数据集
|
||||
sh ./run_process_data_ascend.sh ./data
|
||||
bash ./run_process_data_ascend.sh ./data
|
||||
|
||||
```
|
||||
|
||||
|
|
@ -108,10 +108,10 @@ BGCF包含两个主要模块。首先是抽样,它生成基于节点复制的
|
|||
```text
|
||||
|
||||
# 使用Amazon-Beauty数据集运行训练示例
|
||||
sh run_train_ascend.sh dataset_path
|
||||
bash run_train_ascend.sh dataset_path
|
||||
|
||||
# 使用Amazon-Beauty数据集运行评估示例
|
||||
sh run_eval_ascend.sh dataset_path
|
||||
bash run_eval_ascend.sh dataset_path
|
||||
|
||||
```
|
||||
|
||||
|
|
@ -120,10 +120,10 @@ BGCF包含两个主要模块。首先是抽样,它生成基于节点复制的
|
|||
```text
|
||||
|
||||
# 使用Amazon-Beauty数据集运行训练示例
|
||||
sh run_train_gpu.sh 0 dataset_path
|
||||
bash run_train_gpu.sh 0 dataset_path
|
||||
|
||||
# 使用Amazon-Beauty数据集运行评估示例
|
||||
sh run_eval_gpu.sh 0 dataset_path
|
||||
bash run_eval_gpu.sh 0 dataset_path
|
||||
|
||||
```
|
||||
|
||||
|
|
@ -269,7 +269,7 @@ BGCF包含两个主要模块。首先是抽样,它生成基于节点复制的
|
|||
|
||||
```python
|
||||
|
||||
sh run_train_ascend.sh dataset_path
|
||||
bash run_train_ascend.sh dataset_path
|
||||
|
||||
```
|
||||
|
||||
|
|
@ -294,7 +294,7 @@ BGCF包含两个主要模块。首先是抽样,它生成基于节点复制的
|
|||
|
||||
```python
|
||||
|
||||
sh run_train_gpu.sh 0 dataset_path
|
||||
bash run_train_gpu.sh 0 dataset_path
|
||||
|
||||
```
|
||||
|
||||
|
|
@ -317,7 +317,7 @@ BGCF包含两个主要模块。首先是抽样,它生成基于节点复制的
|
|||
|
||||
```python
|
||||
|
||||
sh run_eval_ascend.sh dataset_path
|
||||
bash run_eval_ascend.sh dataset_path
|
||||
|
||||
```
|
||||
|
||||
|
|
@ -346,7 +346,7 @@ BGCF包含两个主要模块。首先是抽样,它生成基于节点复制的
|
|||
|
||||
```python
|
||||
|
||||
sh run_eval_gpu.sh 0 dataset_path
|
||||
bash run_eval_gpu.sh 0 dataset_path
|
||||
|
||||
```
|
||||
|
||||
|
|
|
|||
|
|
@ -75,7 +75,7 @@ Note that you can run the scripts based on the dataset mentioned in original pap
|
|||
```buildoutcfg
|
||||
cd ./scripts
|
||||
# SRC_PATH is the dataset file path you downloaded, DATASET_NAME is cora or citeseer
|
||||
sh run_process_data_ascend.sh [SRC_PATH] [DATASET_NAME]
|
||||
bash run_process_data_ascend.sh [SRC_PATH] [DATASET_NAME]
|
||||
```
|
||||
|
||||
- Launch
|
||||
|
|
@ -110,7 +110,7 @@ After installing MindSpore via the official website and Dataset is correctly gen
|
|||
|
||||
```bash
|
||||
# run training example with cora dataset, DATASET_NAME is cora
|
||||
sh run_train_ascend.sh [DATASET_NAME]
|
||||
bash run_train_ascend.sh [DATASET_NAME]
|
||||
```
|
||||
|
||||
- Running on [ModelArts](https://support.huaweicloud.com/modelarts/)
|
||||
|
|
@ -211,7 +211,7 @@ Parameters for both training and evaluation can be set in default_config.yaml.
|
|||
- running on Ascend
|
||||
|
||||
```python
|
||||
sh run_train_ascend.sh [DATASET_NAME]
|
||||
bash run_train_ascend.sh [DATASET_NAME]
|
||||
```
|
||||
|
||||
Training result will be stored in the scripts path, whose folder name begins with "train". You can find the result like the
|
||||
|
|
|
|||
|
|
@ -74,7 +74,7 @@
|
|||
```buildoutcfg
|
||||
cd ./scripts
|
||||
# SRC_PATH为下载的数据集文件路径,DATASET_NAME为Cora或Citeseer
|
||||
sh run_process_data_ascend.sh [SRC_PATH] [DATASET_NAME]
|
||||
bash run_process_data_ascend.sh [SRC_PATH] [DATASET_NAME]
|
||||
```
|
||||
|
||||
- 启动
|
||||
|
|
@ -109,7 +109,7 @@
|
|||
|
||||
```text
|
||||
# 使用Cora数据集运行训练示例,DATASET_NAME为cora
|
||||
sh run_train_ascend.sh [DATASET_NAME]
|
||||
bash run_train_ascend.sh [DATASET_NAME]
|
||||
```
|
||||
|
||||
- 在 ModelArts 进行训练 (如果你想在modelarts上运行,可以参考以下文档 [modelarts](https://support.huaweicloud.com/modelarts/))
|
||||
|
|
@ -208,7 +208,7 @@
|
|||
- Ascend处理器环境运行
|
||||
|
||||
```python
|
||||
sh run_train_ascend.sh [DATASET_NAME]
|
||||
bash run_train_ascend.sh [DATASET_NAME]
|
||||
```
|
||||
|
||||
训练结果将保存在脚本路径下,文件夹名称以“train”开头。您可在日志中找到结果
|
||||
|
|
|
|||
|
|
@ -81,23 +81,23 @@ Note that you can run the scripts based on the dataset mentioned in original pap
|
|||
```buildoutcfg
|
||||
cd ./scripts
|
||||
# SRC_PATH is the dataset file path you downloaded, DATASET_NAME is cora or citeseer
|
||||
sh run_process_data.sh [SRC_PATH] [DATASET_NAME]
|
||||
bash run_process_data.sh [SRC_PATH] [DATASET_NAME]
|
||||
```
|
||||
|
||||
### Launch
|
||||
|
||||
```bash
|
||||
#Generate dataset in mindrecord format for cora
|
||||
sh run_process_data.sh ./data cora
|
||||
bash run_process_data.sh ./data cora
|
||||
#Generate dataset in mindrecord format for citeseer
|
||||
sh run_process_data.sh ./data citeseer
|
||||
bash run_process_data.sh ./data citeseer
|
||||
```
|
||||
|
||||
- Running on local with Ascend
|
||||
|
||||
```bash
|
||||
# run train with cora or citeseer dataset, DATASET_NAME is cora or citeseer
|
||||
sh run_train.sh [DATASET_NAME]
|
||||
bash run_train.sh [DATASET_NAME]
|
||||
```
|
||||
|
||||
- Running on [ModelArts](https://support.huaweicloud.com/modelarts/)
|
||||
|
|
@ -190,13 +190,13 @@ Parameters for training can be set in config.py.
|
|||
|
||||
```bash
|
||||
# run train with cora or citeseer dataset, DATASET_NAME is cora or citeseer
|
||||
sh run_train.sh [DATASET_NAME]
|
||||
bash run_train.sh [DATASET_NAME]
|
||||
```
|
||||
|
||||
#### Launch
|
||||
|
||||
```bash
|
||||
sh run_train.sh cora
|
||||
bash run_train.sh cora
|
||||
```
|
||||
|
||||
#### Result
|
||||
|
|
|
|||
|
|
@ -83,23 +83,23 @@ GCN包含两个图卷积层。每一层以节点特征和邻接矩阵为输入
|
|||
```buildoutcfg
|
||||
cd ./scripts
|
||||
# SRC_PATH为下载的数据集文件路径,DATASET_NAME为Cora或Citeseer
|
||||
sh run_process_data.sh [SRC_PATH] [DATASET_NAME]
|
||||
bash run_process_data.sh [SRC_PATH] [DATASET_NAME]
|
||||
```
|
||||
|
||||
### 启动
|
||||
|
||||
```text
|
||||
# 为Cora生成MindRecord格式的数据集
|
||||
sh run_process_data.sh ./data cora
|
||||
bash run_process_data.sh ./data cora
|
||||
# 为Citeseer生成MindRecord格式的数据集
|
||||
sh run_process_data.sh ./data citeseer
|
||||
bash run_process_data.sh ./data citeseer
|
||||
```
|
||||
|
||||
- Running on local with Ascend
|
||||
|
||||
```bash
|
||||
# 在 cora 或 citeseer 数据集上训练, DATASET_NAME 设置为 cora 或 citeseer
|
||||
sh run_train.sh [DATASET_NAME]
|
||||
bash run_train.sh [DATASET_NAME]
|
||||
```
|
||||
|
||||
- Running on [ModelArts](https://support.huaweicloud.com/modelarts/)
|
||||
|
|
@ -192,13 +192,13 @@ sh run_train.sh [DATASET_NAME]
|
|||
|
||||
```text
|
||||
# 使用Cora或Citeseer数据集进行训练,DATASET_NAME为Cora或Citeseer
|
||||
sh run_train.sh [DATASET_NAME]
|
||||
bash run_train.sh [DATASET_NAME]
|
||||
```
|
||||
|
||||
#### 启动
|
||||
|
||||
```bash
|
||||
sh run_train.sh cora
|
||||
bash run_train.sh cora
|
||||
```
|
||||
|
||||
#### 结果
|
||||
|
|
|
|||
|
|
@ -68,7 +68,7 @@ After installing MindSpore via the official website, you can start training and
|
|||
|
||||
```shell
|
||||
# run distributed training example
|
||||
sh scripts/run_distribute_pretrain.sh [DEVICE_NUM] [EPOCH_SIZE] [DATA_DIR] [SCHEMA_DIR] [RANK_TABLE_FILE]
|
||||
bash scripts/run_distribute_pretrain.sh [DEVICE_NUM] [EPOCH_SIZE] [DATA_DIR] [SCHEMA_DIR] [RANK_TABLE_FILE]
|
||||
|
||||
# run evaluation example
|
||||
python pretrain_eval.py
|
||||
|
|
@ -135,7 +135,7 @@ Parameters for both training and inference can be set in config.py.
|
|||
#### Ascend 910
|
||||
|
||||
```shell
|
||||
sh run_distribute_pretrain.sh [DEVICE_NUM] [EPOCH_SIZE] [DATA_DIR] [SCHEMA_DIR] [RANK_TABLE_FILE]
|
||||
bash run_distribute_pretrain.sh [DEVICE_NUM] [EPOCH_SIZE] [DATA_DIR] [SCHEMA_DIR] [RANK_TABLE_FILE]
|
||||
```
|
||||
|
||||
We need five parameters for this scripts.
|
||||
|
|
|
|||
|
|
@ -71,7 +71,7 @@ BERT的总体架构包含3个嵌入层,用于查找令牌嵌入、位置嵌入
|
|||
|
||||
```shell
|
||||
# 分布式运行训练示例
|
||||
sh scripts/run_distribute_pretrain.sh [DEVICE_NUM] [EPOCH_SIZE] [DATA_DIR] [SCHEMA_DIR] [RANK_TABLE_FILE]
|
||||
bash scripts/run_distribute_pretrain.sh [DEVICE_NUM] [EPOCH_SIZE] [DATA_DIR] [SCHEMA_DIR] [RANK_TABLE_FILE]
|
||||
|
||||
# 运行评估示例
|
||||
python pretrain_eval.py
|
||||
|
|
@ -139,7 +139,7 @@ python pretrain_eval.py
|
|||
#### Ascend 910
|
||||
|
||||
```shell
|
||||
sh run_distribute_pretrain.sh [DEVICE_NUM] [EPOCH_SIZE] [DATA_DIR] [SCHEMA_DIR] [RANK_TABLE_FILE]
|
||||
bash run_distribute_pretrain.sh [DEVICE_NUM] [EPOCH_SIZE] [DATA_DIR] [SCHEMA_DIR] [RANK_TABLE_FILE]
|
||||
```
|
||||
|
||||
此脚本需设置如下参数:
|
||||
|
|
|
|||
|
|
@ -62,11 +62,11 @@ After dataset preparation, you can start zero-shot inference, finetune and evalu
|
|||
```bash
|
||||
# run zero-shot inference example
|
||||
cd scripts
|
||||
sh run_zero-shot_inference_distribute_ascend.sh /path/test.mindrecord /path/true_labels.txt /path/cpm_mindspore_1p_fp32.ckpt /path/rank_table_2p.json
|
||||
bash run_zero-shot_inference_distribute_ascend.sh /path/test.mindrecord /path/true_labels.txt /path/cpm_mindspore_1p_fp32.ckpt /path/rank_table_2p.json
|
||||
|
||||
# run distributed finetune example
|
||||
cd scripts
|
||||
sh run_distribute_train_ascend_single_machine.sh /path/train.mindrecord /path/cpm_mindspore_1p_fp32.ckpt /path/rank_table_8p.json
|
||||
bash run_distribute_train_ascend_single_machine.sh /path/train.mindrecord /path/cpm_mindspore_1p_fp32.ckpt /path/rank_table_8p.json
|
||||
|
||||
# run evaluation example
|
||||
cd scripts
|
||||
|
|
|
|||
|
|
@ -63,11 +63,11 @@ CPM网络由GPT实现,GPT包括多层解码器模块。
|
|||
```bash
|
||||
# zero-shot推理示例
|
||||
cd scripts
|
||||
sh run_zero-shot_inference_distribute_ascend.sh /path/test.mindrecord /path/true_labels.txt /path/cpm_mindspore_1p_fp32.ckpt /path/rank_table_2p.json
|
||||
bash run_zero-shot_inference_distribute_ascend.sh /path/test.mindrecord /path/true_labels.txt /path/cpm_mindspore_1p_fp32.ckpt /path/rank_table_2p.json
|
||||
|
||||
# 运行分布式训练Finetune示例
|
||||
cd scripts
|
||||
sh run_distribute_train_ascend_single_machine.sh /path/train.mindrecord /path/cpm_mindspore_1p_fp32.ckpt /path/rank_table_8p.json
|
||||
bash run_distribute_train_ascend_single_machine.sh /path/train.mindrecord /path/cpm_mindspore_1p_fp32.ckpt /path/rank_table_8p.json
|
||||
|
||||
# Finetune模型评估示例
|
||||
cd scripts
|
||||
|
|
|
|||
|
|
@ -141,16 +141,16 @@ ERNIE 是百度自研的基于海量数据和先验知识训练的通用文本
|
|||
数据集下载使用如下命令:
|
||||
|
||||
```bash
|
||||
sh script/download_data.sh
|
||||
bash script/download_data.sh
|
||||
```
|
||||
|
||||
下载数据后,运行数据格式转换脚本, 将数据集转为MindRecord格式:
|
||||
|
||||
```bash
|
||||
sh scripts/convert_dataset.sh
|
||||
bash scripts/convert_dataset.sh
|
||||
# `convert_dataset.sh` depend on ERNIE vocabulary,
|
||||
# you should download ERNIE model first by:
|
||||
# sh script/download_model.sh
|
||||
# bash script/download_model.sh
|
||||
```
|
||||
|
||||
#### Ascend处理器或GPU上运行
|
||||
|
|
@ -158,21 +158,21 @@ sh scripts/convert_dataset.sh
|
|||
EmoTect基于海量数据训练好的对话情绪识别模型(基于TextCNN、ERNIE等模型训练),可供用户直接使用,可通过以下方式下载。
|
||||
|
||||
```shell
|
||||
sh script/download_model.sh
|
||||
bash script/download_model.sh
|
||||
```
|
||||
|
||||
预训练模型ERNIE下载后,将其转换为MindSpore可加载权重
|
||||
|
||||
```shell
|
||||
#--input_dir ./pretrain_models/ernie
|
||||
sh script/paddle_to_midnspore.sh
|
||||
bash script/paddle_to_midnspore.sh
|
||||
# only support x86 platform since Paddle don't support ARM
|
||||
```
|
||||
|
||||
将ERNIE迁移至Mindspore后,执行训练脚本:
|
||||
|
||||
```bash
|
||||
sh scripts/run_classifier_finetune_{platform}.sh
|
||||
bash scripts/run_classifier_finetune_{platform}.sh
|
||||
# platform: gpu or ascend
|
||||
```
|
||||
|
||||
|
|
@ -187,7 +187,7 @@ sh scripts/run_classifier_finetune_{platform}.sh
|
|||
根据训练结果,可选择最优的step进行评估,修改```scripts/run_classifier_eval.sh``` 脚本中```load_finetune_checkpoint_path``` 参数,然后执行
|
||||
|
||||
```shell
|
||||
sh scripts/run_classifier_eval_{platform}.sh
|
||||
bash scripts/run_classifier_eval_{platform}.sh
|
||||
# platform: gpu or ascend
|
||||
```
|
||||
|
||||
|
|
|
|||
|
|
@ -68,13 +68,13 @@ After dataset preparation, you can start training and evaluation as follows:
|
|||
```bash
|
||||
# run training example
|
||||
cd ./scripts
|
||||
sh run_standalone_train.sh [TRAIN_DATASET] [DEVICEID]
|
||||
bash run_standalone_train.sh [TRAIN_DATASET] [DEVICEID]
|
||||
|
||||
# run distributed training example
|
||||
sh run_distribute_train.sh [TRAIN_DATASET] [RANK_TABLE_PATH]
|
||||
bash run_distribute_train.sh [TRAIN_DATASET] [RANK_TABLE_PATH]
|
||||
|
||||
# run evaluation example
|
||||
sh run_eval.sh [EVAL_DATASET_PATH] [DATASET_NAME] [MODEL_CKPT] [DEVICEID]
|
||||
bash run_eval.sh [EVAL_DATASET_PATH] [DATASET_NAME] [MODEL_CKPT] [DEVICEID]
|
||||
```
|
||||
|
||||
- ModelArts (If you want to run in modelarts, please check the official documentation of [modelarts](https://support.huaweicloud.com/modelarts/), and you can start training as follows)
|
||||
|
|
@ -186,7 +186,7 @@ The FastText network script and code result are as follows:
|
|||
|
||||
``` bash
|
||||
cd scripts
|
||||
sh creat_dataset.sh [SOURCE_DATASET_PATH] [DATASET_NAME]
|
||||
bash creat_dataset.sh [SOURCE_DATASET_PATH] [DATASET_NAME]
|
||||
```
|
||||
|
||||
### [Configuration File](#content)
|
||||
|
|
@ -219,14 +219,14 @@ Parameters for both training and evaluation can be set in config.py. All the dat
|
|||
|
||||
```bash
|
||||
cd ./scripts
|
||||
sh run_standalone_train.sh [DATASET_PATH]
|
||||
bash run_standalone_train.sh [DATASET_PATH]
|
||||
```
|
||||
|
||||
- Running scripts for distributed training of FastText. Task training on multiple device and run the following command in bash to be executed in `scripts/`:
|
||||
|
||||
```bash
|
||||
cd ./scripts
|
||||
sh run_distributed_train.sh [DATASET_PATH] [RANK_TABLE_PATH]
|
||||
bash run_distributed_train.sh [DATASET_PATH] [RANK_TABLE_PATH]
|
||||
```
|
||||
|
||||
- Running on GPU
|
||||
|
|
@ -235,14 +235,14 @@ Parameters for both training and evaluation can be set in config.py. All the dat
|
|||
|
||||
```bash
|
||||
cd ./scripts
|
||||
sh run_standalone_train_gpu.sh [DATASET_PATH]
|
||||
bash run_standalone_train_gpu.sh [DATASET_PATH]
|
||||
```
|
||||
|
||||
- Running scripts for distributed training of FastText. Task training on multiple device and run the following command in bash to be executed in `scripts/`:
|
||||
|
||||
```bash
|
||||
cd ./scripts
|
||||
sh run_distributed_train_gpu.sh [DATASET_PATH] [NUM_OF_DEVICES]
|
||||
bash run_distributed_train_gpu.sh [DATASET_PATH] [NUM_OF_DEVICES]
|
||||
```
|
||||
|
||||
### [Inference Process](#content)
|
||||
|
|
@ -253,7 +253,7 @@ Parameters for both training and evaluation can be set in config.py. All the dat
|
|||
|
||||
```bash
|
||||
cd ./scripts
|
||||
sh run_eval.sh [DATASET_PATH] [DATASET_NAME] [MODEL_CKPT]
|
||||
bash run_eval.sh [DATASET_PATH] [DATASET_NAME] [MODEL_CKPT]
|
||||
```
|
||||
|
||||
Note: The `DATASET_PATH` is path to mindrecord. eg. `/dataset_path/*.mindrecord`
|
||||
|
|
@ -264,7 +264,7 @@ Parameters for both training and evaluation can be set in config.py. All the dat
|
|||
|
||||
```bash
|
||||
cd ./scripts
|
||||
sh run_eval_gpu.sh [DATASET_PATH] [DATASET_NAME] [MODEL_CKPT]
|
||||
bash run_eval_gpu.sh [DATASET_PATH] [DATASET_NAME] [MODEL_CKPT]
|
||||
```
|
||||
|
||||
Note: The `DATASET_PATH` is path to mindrecord. eg. `/dataset_path/*.mindrecord`
|
||||
|
|
@ -378,4 +378,4 @@ This model has been validated in the Ascend environment and is not validated on
|
|||
|
||||
## [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)
|
||||
|
|
|
|||
|
|
@ -79,15 +79,15 @@ After dataset preparation, you can start training and evaluation as follows:
|
|||
```bash
|
||||
# run training example
|
||||
cd ./scripts
|
||||
sh run_standalone_train_ascend.sh PRE_TRAIN_DATASET
|
||||
bash run_standalone_train_ascend.sh PRE_TRAIN_DATASET
|
||||
|
||||
# run distributed training example
|
||||
cd ./scripts
|
||||
sh run_distributed_train_ascend.sh RANK_TABLE_ADDR PRE_TRAIN_DATASET
|
||||
bash run_distributed_train_ascend.sh RANK_TABLE_ADDR PRE_TRAIN_DATASET
|
||||
|
||||
# run evaluation example
|
||||
cd ./scripts
|
||||
sh run_standalone_eval_ascend.sh TEST_DATASET EXISTED_CKPT_PATH \
|
||||
bash run_standalone_eval_ascend.sh TEST_DATASET EXISTED_CKPT_PATH \
|
||||
VOCAB_ADDR BPE_CODE_ADDR TEST_TARGET
|
||||
```
|
||||
|
||||
|
|
@ -273,7 +273,7 @@ Start task training on a single device and run the shell script `scripts/run_sta
|
|||
|
||||
```bash
|
||||
cd ./scripts
|
||||
sh run_standalone_train_ascend.sh PRE_TRAIN_DATASET
|
||||
bash run_standalone_train_ascend.sh PRE_TRAIN_DATASET
|
||||
```
|
||||
|
||||
In this script, the `PRE_TRAIN_DATASET` is the dataset address.
|
||||
|
|
@ -283,7 +283,7 @@ Task training on multiple devices and run the following command in bash to be ex
|
|||
|
||||
```bash
|
||||
cd ./scripts
|
||||
sh run_distributed_train_ascend.sh RANK_TABLE_ADDR PRE_TRAIN_DATASET
|
||||
bash run_distributed_train_ascend.sh RANK_TABLE_ADDR PRE_TRAIN_DATASET
|
||||
```
|
||||
|
||||
Note: the `RANK_TABLE_ADDR` is the hccl_json file assigned when distributed training is running.
|
||||
|
|
@ -298,8 +298,8 @@ Run the shell script `scripts/run_standalone_eval_ascend.sh` to process the outp
|
|||
|
||||
```bash
|
||||
cd ./scripts
|
||||
sh run_standalone_eval_ascend.sh
|
||||
sh run_standalone_eval_ascend.sh TEST_DATASET EXISTED_CKPT_PATH \
|
||||
bash run_standalone_eval_ascend.sh
|
||||
bash run_standalone_eval_ascend.sh TEST_DATASET EXISTED_CKPT_PATH \
|
||||
VOCAB_ADDR BPE_CODE_ADDR TEST_TARGET
|
||||
```
|
||||
|
||||
|
|
|
|||
|
|
@ -83,13 +83,13 @@ nltk.download()
|
|||
```bash
|
||||
# run training example
|
||||
cd ./scripts
|
||||
sh run_standalone_train.sh [TRAIN_DATASET_PATH]
|
||||
bash run_standalone_train.sh [TRAIN_DATASET_PATH]
|
||||
|
||||
# run distributed training example
|
||||
sh run_distribute_train_ascend.sh [RANK_TABLE_FILE] [TRAIN_DATASET_PATH]
|
||||
bash run_distribute_train_ascend.sh [RANK_TABLE_FILE] [TRAIN_DATASET_PATH]
|
||||
|
||||
# run evaluation example
|
||||
sh run_eval.sh [CKPT_FILE] [DATASET_PATH]
|
||||
bash run_eval.sh [CKPT_FILE] [DATASET_PATH]
|
||||
```
|
||||
|
||||
- Running on ModelArts (If you want to run in modelarts, please check the official documentation of [modelarts](https://support.huaweicloud.com/modelarts/), and you can start training as follows)
|
||||
|
|
@ -250,14 +250,14 @@ Parameters for both training and evaluation can be set in config.py. All the dat
|
|||
|
||||
```bash
|
||||
cd ./scripts
|
||||
sh run_standalone_train.sh [DATASET_PATH]
|
||||
bash run_standalone_train.sh [DATASET_PATH]
|
||||
```
|
||||
|
||||
- Running scripts for distributed training of GRU. Task training on multiple device and run the following command in bash to be executed in `scripts/`:
|
||||
|
||||
``` bash
|
||||
cd ./scripts
|
||||
sh run_distributed_train.sh [RANK_TABLE_PATH] [DATASET_PATH]
|
||||
bash run_distributed_train.sh [RANK_TABLE_PATH] [DATASET_PATH]
|
||||
```
|
||||
|
||||
## [Inference Process](#content)
|
||||
|
|
@ -266,14 +266,14 @@ Parameters for both training and evaluation can be set in config.py. All the dat
|
|||
|
||||
``` bash
|
||||
cd ./scripts
|
||||
sh run_eval.sh [CKPT_FILE] [DATASET_PATH]
|
||||
bash run_eval.sh [CKPT_FILE] [DATASET_PATH]
|
||||
```
|
||||
|
||||
- After evalulation, we will get eval/target.txt and eval/output.txt.Then we can use scripts/parse_output.sh to get the translation.
|
||||
|
||||
``` bash
|
||||
cp eval/*.txt ./
|
||||
sh parse_output.sh target.txt output.txt /path/vocab.en
|
||||
bash parse_output.sh target.txt output.txt /path/vocab.en
|
||||
```
|
||||
|
||||
Extra: We recommend doing this locally, but you can also do it on modelarts by running a python script with the following command "os.system("sh parse_output.sh target.txt output.txt /path/vocab.en")".
|
||||
|
|
@ -339,7 +339,7 @@ bash run_infer_310.sh [MINDIR_PATH] [DATASET_PATH] [NEED_PREPROCESS] [DEVICE_ID]
|
|||
we will get target.txt and output.txt.Then we can use scripts/parse_output.sh to get the translation.
|
||||
|
||||
``` bash
|
||||
sh parse_output.sh target.txt output.txt /path/vocab.en
|
||||
bash parse_output.sh target.txt output.txt /path/vocab.en
|
||||
```
|
||||
|
||||
After parse output, we will get target.txt.forbleu and output.txt.forbleu.To calculate BLEU score, you may use this [perl script](https://github.com/moses-smt/mosesdecoder/blob/master/scripts/generic/multi-bleu.perl) and run following command to get the BLEU score.
|
||||
|
|
|
|||
|
|
@ -380,13 +380,13 @@ You may start a task training with single device or multiple devices by assignin
|
|||
Ascend:
|
||||
|
||||
```ascend
|
||||
sh run_ascend.sh [--options]
|
||||
bash run_ascend.sh [--options]
|
||||
```
|
||||
|
||||
GPU:
|
||||
|
||||
```gpu
|
||||
sh run_gpu.sh [--options]
|
||||
bash run_gpu.sh [--options]
|
||||
```
|
||||
|
||||
The usage of `run_ascend.sh` is shown as below:
|
||||
|
|
@ -428,7 +428,7 @@ The command followed shows a example for training with 2 devices.
|
|||
Ascend:
|
||||
|
||||
```ascend
|
||||
sh run_ascend.sh --task t --device_num 2 --hccl_json /{path}/rank_table.json
|
||||
bash run_ascend.sh --task t --device_num 2 --hccl_json /{path}/rank_table.json
|
||||
```
|
||||
|
||||
ps. Discontinuous device id is not supported in `run_ascend.sh` at present, device id in `rank_table.json` must start from 0.
|
||||
|
|
@ -436,20 +436,20 @@ ps. Discontinuous device id is not supported in `run_ascend.sh` at present, devi
|
|||
GPU:
|
||||
|
||||
```gpu
|
||||
sh run_gpu.sh --task t --device_num 2
|
||||
bash run_gpu.sh --task t --device_num 2
|
||||
```
|
||||
|
||||
If use a single chip, it would be like this:
|
||||
Ascend:
|
||||
|
||||
```ascend
|
||||
sh run_ascend.sh --task t --device_num 1 --device_id 0
|
||||
bash run_ascend.sh --task t --device_num 1 --device_id 0
|
||||
```
|
||||
|
||||
GPU:
|
||||
|
||||
```gpu
|
||||
sh run_gpu.sh --task t --device_num 1 --device_id 0
|
||||
bash run_gpu.sh --task t --device_num 1 --device_id 0
|
||||
```
|
||||
|
||||
## Weights average
|
||||
|
|
@ -558,13 +558,13 @@ For pre-training a model, config the options in `default_config.yaml` firstly:
|
|||
If you use the ascend chip, run the shell script `run_ascend.sh` as followed:
|
||||
|
||||
```ascend
|
||||
sh run_ascend.sh -t t -n 1 -i 1
|
||||
bash run_ascend.sh -t t -n 1 -i 1
|
||||
```
|
||||
|
||||
You can also run the shell script `run_gpu.sh` on gpu as followed:
|
||||
|
||||
```gpu
|
||||
sh run_gpu.sh -t t -n 1 -i 1
|
||||
bash run_gpu.sh -t t -n 1 -i 1
|
||||
```
|
||||
|
||||
Get the log and output files under the path `./train_mass_*/`, and the model file under the path assigned in the `default_config.yaml` file.
|
||||
|
|
@ -582,13 +582,13 @@ For fine-tuning a model, config the options in `default_config.yaml` firstly:
|
|||
If you use the ascend chip, run the shell script `run_ascend.sh` as followed:
|
||||
|
||||
```ascend
|
||||
sh run_ascend.sh -t t -n 1 -i 1
|
||||
bash run_ascend.sh -t t -n 1 -i 1
|
||||
```
|
||||
|
||||
You can also run the shell script `run_gpu.sh` on gpu as followed:
|
||||
|
||||
```gpu
|
||||
sh run_gpu.sh -t t -n 1 -i 1
|
||||
bash run_gpu.sh -t t -n 1 -i 1
|
||||
```
|
||||
|
||||
Get the log and output files under the path `./train_mass_*/`, and the model file under the path assigned in the `default_config.yaml` file.
|
||||
|
|
@ -607,13 +607,13 @@ For inference, config the options in `default_config.yaml` firstly:
|
|||
If you use the ascend chip, run the shell script `run_ascend.sh` as followed:
|
||||
|
||||
```bash
|
||||
sh run_ascend.sh -t i -n 1 -i 1 -o {outputfile}
|
||||
bash run_ascend.sh -t i -n 1 -i 1 -o {outputfile}
|
||||
```
|
||||
|
||||
You can also run the shell script `run_gpu.sh` on gpu as followed:
|
||||
|
||||
```gpu
|
||||
sh run_gpu.sh -t i -n 1 -i 1 -o {outputfile}
|
||||
bash run_gpu.sh -t i -n 1 -i 1 -o {outputfile}
|
||||
```
|
||||
|
||||
## Mindir Inference Process
|
||||
|
|
|
|||
|
|
@ -383,13 +383,13 @@ python cornell_dialog.py --src_folder /{path}/cornell_dialog \
|
|||
Ascend处理器:
|
||||
|
||||
```ascend
|
||||
sh run_ascend.sh [--options]
|
||||
bash run_ascend.sh [--options]
|
||||
```
|
||||
|
||||
GPU处理器:
|
||||
|
||||
```gpu
|
||||
sh run_gpu.sh [--options]
|
||||
bash run_gpu.sh [--options]
|
||||
```
|
||||
|
||||
`run_ascend.sh`的用法如下:
|
||||
|
|
@ -432,7 +432,7 @@ options:
|
|||
Ascend处理器:
|
||||
|
||||
```ascend
|
||||
sh run_ascend.sh --task t --device_num 2 --hccl_json /{path}/rank_table.json
|
||||
bash run_ascend.sh --task t --device_num 2 --hccl_json /{path}/rank_table.json
|
||||
```
|
||||
|
||||
注:`run_ascend.sh`暂不支持不连续设备ID,`rank_table.json`中的设备ID必须从0开始。
|
||||
|
|
@ -440,20 +440,20 @@ sh run_ascend.sh --task t --device_num 2 --hccl_json /{path}/rank_table.json
|
|||
GPU处理器:
|
||||
|
||||
```gpu
|
||||
sh run_gpu.sh --task t --device_num 2
|
||||
bash run_gpu.sh --task t --device_num 2
|
||||
```
|
||||
|
||||
运行如下命令进行单卡训练:
|
||||
Ascend处理器:
|
||||
|
||||
```ascend
|
||||
sh run_ascend.sh --task t --device_num 1 --device_id 0
|
||||
bash run_ascend.sh --task t --device_num 1 --device_id 0
|
||||
```
|
||||
|
||||
GPU处理器:
|
||||
|
||||
```gpu
|
||||
sh run_gpu.sh --task t --device_num 1 --device_id 0
|
||||
bash run_gpu.sh --task t --device_num 1 --device_id 0
|
||||
```
|
||||
|
||||
## 权重平均值
|
||||
|
|
@ -562,13 +562,13 @@ MASS通过预测输入序列中被屏蔽的片段来预训练序列到序列模
|
|||
如使用Ascend芯片,执行`run_ascend.sh`这个shell脚本:
|
||||
|
||||
```ascend
|
||||
sh run_ascend.sh -t t -n 1 -i 1
|
||||
bash run_ascend.sh -t t -n 1 -i 1
|
||||
```
|
||||
|
||||
如使用GPU处理器,执行`run_gpu.sh`这个shell脚本:
|
||||
|
||||
```gpu
|
||||
sh run_gpu.sh -t t -n 1 -i 1
|
||||
bash run_gpu.sh -t t -n 1 -i 1
|
||||
```
|
||||
|
||||
日志和输出文件可以在`./train_mass_*/`路径下获取,模型文件可以在`default_config.yaml`配置文件中指定的路径下获取。
|
||||
|
|
@ -586,13 +586,13 @@ sh run_gpu.sh -t t -n 1 -i 1
|
|||
如使用Ascend芯片,执行`run_ascend.sh`这个shell脚本:
|
||||
|
||||
```ascend
|
||||
sh run_ascend.sh -t t -n 1 -i 1
|
||||
bash run_ascend.sh -t t -n 1 -i 1
|
||||
```
|
||||
|
||||
如使用GPU处理器,执行`run_gpu.sh`这个shell脚本:
|
||||
|
||||
```gpu
|
||||
sh run_gpu.sh -t t -n 1 -i 1
|
||||
bash run_gpu.sh -t t -n 1 -i 1
|
||||
```
|
||||
|
||||
日志和输出文件可以在`./train_mass_*/`路径下获取,模型文件可以在`default_config.yaml`配置文件中指定的路径下获取。
|
||||
|
|
@ -610,13 +610,13 @@ sh run_gpu.sh -t t -n 1 -i 1
|
|||
如使用Ascend芯片,执行`run_ascend.sh`这个shell脚本:
|
||||
|
||||
```bash
|
||||
sh run_ascend.sh -t i -n 1 -i 1 -o {outputfile}
|
||||
bash run_ascend.sh -t i -n 1 -i 1 -o {outputfile}
|
||||
```
|
||||
|
||||
如使用GPU处理器,执行`run_gpu.sh`这个shell脚本:
|
||||
|
||||
```gpu
|
||||
sh run_gpu.sh -t i -n 1 -i 1 -o {outputfile}
|
||||
bash run_gpu.sh -t i -n 1 -i 1 -o {outputfile}
|
||||
```
|
||||
|
||||
## Mindir推理
|
||||
|
|
|
|||
|
|
@ -331,13 +331,13 @@ You may start a task training with single device or multiple devices by assignin
|
|||
Ascend:
|
||||
|
||||
```ascend
|
||||
sh run_ascend.sh [--options]
|
||||
bash run_ascend.sh [--options]
|
||||
```
|
||||
|
||||
GPU:
|
||||
|
||||
```gpu
|
||||
sh run_gpu.sh [--options]
|
||||
bash run_gpu.sh [--options]
|
||||
```
|
||||
|
||||
The usage of `run_ascend.sh` is shown as below:
|
||||
|
|
@ -384,7 +384,7 @@ The command followed shows a example for training with 2 devices.
|
|||
Ascend:
|
||||
|
||||
```ascend
|
||||
sh run_ascend.sh --task t --device_num 2 --hccl_json /{path}/rank_table.json --config /{path}/config.json
|
||||
bash run_ascend.sh --task t --device_num 2 --hccl_json /{path}/rank_table.json --config /{path}/config.json
|
||||
```
|
||||
|
||||
ps. Discontinuous device id is not supported in `run_ascend.sh` at present, device id in `rank_table.json` must start from 0.
|
||||
|
|
@ -392,20 +392,20 @@ ps. Discontinuous device id is not supported in `run_ascend.sh` at present, devi
|
|||
GPU:
|
||||
|
||||
```gpu
|
||||
sh run_gpu.sh --task t --device_num 2 --config /{path}/config.json
|
||||
bash run_gpu.sh --task t --device_num 2 --config /{path}/config.json
|
||||
```
|
||||
|
||||
If use a single chip, it would be like this:
|
||||
Ascend:
|
||||
|
||||
```ascend
|
||||
sh run_ascend.sh --task t --device_num 1 --device_id 0 --config /{path}/config.json
|
||||
bash run_ascend.sh --task t --device_num 1 --device_id 0 --config /{path}/config.json
|
||||
```
|
||||
|
||||
GPU:
|
||||
|
||||
```gpu
|
||||
sh run_gpu.sh --task t --device_num 1 --device_id 0 --config /{path}/config.json
|
||||
bash run_gpu.sh --task t --device_num 1 --device_id 0 --config /{path}/config.json
|
||||
```
|
||||
|
||||
## Weights average
|
||||
|
|
@ -587,13 +587,13 @@ For pre-training a model, config the options in `config.json` firstly:
|
|||
If you use the ascend chip, run the shell script `run_ascend.sh` as followed:
|
||||
|
||||
```ascend
|
||||
sh run_ascend.sh -t t -n 1 -i 1 -c /mass/config/config.json
|
||||
bash run_ascend.sh -t t -n 1 -i 1 -c /mass/config/config.json
|
||||
```
|
||||
|
||||
You can also run the shell script `run_gpu.sh` on gpu as followed:
|
||||
|
||||
```gpu
|
||||
sh run_gpu.sh -t t -n 1 -i 1 -c /mass/config/config.json
|
||||
bash run_gpu.sh -t t -n 1 -i 1 -c /mass/config/config.json
|
||||
```
|
||||
|
||||
Get the log and output files under the path `./train_mass_*/`, and the model file under the path assigned in the `config/config.json` file.
|
||||
|
|
@ -611,13 +611,13 @@ For fine-tuning a model, config the options in `config.json` firstly:
|
|||
If you use the ascend chip, run the shell script `run_ascend.sh` as followed:
|
||||
|
||||
```ascend
|
||||
sh run_ascend.sh -t t -n 1 -i 1 -c config/config.json
|
||||
bash run_ascend.sh -t t -n 1 -i 1 -c config/config.json
|
||||
```
|
||||
|
||||
You can also run the shell script `run_gpu.sh` on gpu as followed:
|
||||
|
||||
```gpu
|
||||
sh run_gpu.sh -t t -n 1 -i 1 -c config/config.json
|
||||
bash run_gpu.sh -t t -n 1 -i 1 -c config/config.json
|
||||
```
|
||||
|
||||
Get the log and output files under the path `./train_mass_*/`, and the model file under the path assigned in the `config/config.json` file.
|
||||
|
|
@ -636,13 +636,13 @@ For inference, config the options in `config.json` firstly:
|
|||
If you use the ascend chip, run the shell script `run_ascend.sh` as followed:
|
||||
|
||||
```bash
|
||||
sh run_ascend.sh -t i -n 1 -i 1 -c config/config.json -o {outputfile}
|
||||
bash run_ascend.sh -t i -n 1 -i 1 -c config/config.json -o {outputfile}
|
||||
```
|
||||
|
||||
You can also run the shell script `run_gpu.sh` on gpu as followed:
|
||||
|
||||
```gpu
|
||||
sh run_gpu.sh -t i -n 1 -i 1 -c config/config.json -o {outputfile}
|
||||
bash run_gpu.sh -t i -n 1 -i 1 -c config/config.json -o {outputfile}
|
||||
```
|
||||
|
||||
# Description of random situation
|
||||
|
|
|
|||
|
|
@ -163,7 +163,7 @@ For more configuration details, please refer the script `*.yaml`.
|
|||
# need set config_path in config.py file and set data_path in yaml file
|
||||
python train.py > train.log 2>&1 &
|
||||
OR
|
||||
sh scripts/run_train.sh dataset
|
||||
bash scripts/run_train.sh dataset
|
||||
```
|
||||
|
||||
The python command above will run in the background, you can view the results through the file `train.log`.
|
||||
|
|
@ -189,7 +189,7 @@ For more configuration details, please refer the script `*.yaml`.
|
|||
# need set config_path and set data_path in yaml file, checkpoint_file_path in yaml file
|
||||
python eval.py > eval.log 2>&1 &
|
||||
OR
|
||||
sh scripts/run_eval.sh checkpoint_file_path dataset
|
||||
bash scripts/run_eval.sh checkpoint_file_path dataset
|
||||
```
|
||||
|
||||
The above python command will run in the background. You can view the results through the file "eval.log". The accuracy of the test dataset will be as follows:
|
||||
|
|
|
|||
|
|
@ -61,10 +61,10 @@ After dataset preparation, you can start training and evaluation as follows:
|
|||
|
||||
```bash
|
||||
# run training example
|
||||
sh scripts/run_standalone_train_ascend.sh 0 52 /path/ende-l128-mindrecord
|
||||
bash scripts/run_standalone_train_ascend.sh 0 52 /path/ende-l128-mindrecord
|
||||
|
||||
# run distributed training example
|
||||
sh scripts/run_distribute_train_ascend.sh 8 52 /path/ende-l128-mindrecord rank_table.json ./default_config.yaml
|
||||
bash scripts/run_distribute_train_ascend.sh 8 52 /path/ende-l128-mindrecord rank_table.json ./default_config.yaml
|
||||
|
||||
# run evaluation example
|
||||
python eval.py > eval.log 2>&1 &
|
||||
|
|
@ -318,13 +318,13 @@ Parameters for learning rate:
|
|||
- Run `run_standalone_train.sh` for non-distributed training of Transformer model.
|
||||
|
||||
``` bash
|
||||
sh scripts/run_standalone_train.sh DEVICE_TARGET DEVICE_ID EPOCH_SIZE GRADIENT_ACCUMULATE_STEP DATA_PATH
|
||||
bash scripts/run_standalone_train.sh DEVICE_TARGET DEVICE_ID EPOCH_SIZE GRADIENT_ACCUMULATE_STEP DATA_PATH
|
||||
```
|
||||
|
||||
- Run `run_distribute_train_ascend.sh` for distributed training of Transformer model.
|
||||
|
||||
``` bash
|
||||
sh scripts/run_distribute_train_ascend.sh DEVICE_NUM EPOCH_SIZE DATA_PATH RANK_TABLE_FILE CONFIG_PATH
|
||||
bash scripts/run_distribute_train_ascend.sh DEVICE_NUM EPOCH_SIZE DATA_PATH RANK_TABLE_FILE CONFIG_PATH
|
||||
```
|
||||
|
||||
**Attention**: data sink mode can not be used in transformer since the input data have different sequence lengths.
|
||||
|
|
@ -342,7 +342,7 @@ Parameters for learning rate:
|
|||
- Run `process_output.sh` to process the output token ids to get the real translation results.
|
||||
|
||||
```bash
|
||||
sh scripts/process_output.sh REF_DATA EVAL_OUTPUT VOCAB_FILE
|
||||
bash scripts/process_output.sh REF_DATA EVAL_OUTPUT VOCAB_FILE
|
||||
```
|
||||
|
||||
You will get two files, REF_DATA.forbleu and EVAL_OUTPUT.forbleu, for BLEU score calculation.
|
||||
|
|
|
|||
|
|
@ -63,10 +63,10 @@ Transformer具体包括六个编码模块和六个解码模块。每个编码模
|
|||
|
||||
```bash
|
||||
# 运行训练示例
|
||||
sh scripts/run_standalone_train_ascend.sh 0 52 /path/ende-l128-mindrecord
|
||||
bash scripts/run_standalone_train_ascend.sh 0 52 /path/ende-l128-mindrecord
|
||||
|
||||
# 运行分布式训练示例
|
||||
sh scripts/run_distribute_train_ascend.sh 8 52 /path/ende-l128-mindrecord rank_table.json ./default_config.yaml
|
||||
bash scripts/run_distribute_train_ascend.sh 8 52 /path/ende-l128-mindrecord rank_table.json ./default_config.yaml
|
||||
|
||||
# 运行评估示例
|
||||
python eval.py > eval.log 2>&1 &
|
||||
|
|
@ -321,13 +321,13 @@ Parameters for learning rate:
|
|||
- 运行`run_standalone_train.sh`,进行Transformer模型的非分布式训练。
|
||||
|
||||
``` bash
|
||||
sh scripts/run_standalone_train.sh DEVICE_TARGET DEVICE_ID EPOCH_SIZE GRADIENT_ACCUMULATE_STEP DATA_PATH
|
||||
bash scripts/run_standalone_train.sh DEVICE_TARGET DEVICE_ID EPOCH_SIZE GRADIENT_ACCUMULATE_STEP DATA_PATH
|
||||
```
|
||||
|
||||
- 运行`run_distribute_train_ascend.sh`,进行Transformer模型的非分布式训练。
|
||||
|
||||
``` bash
|
||||
sh scripts/run_distribute_train_ascend.sh DEVICE_NUM EPOCH_SIZE DATA_PATH RANK_TABLE_FILE CONFIG_PATH
|
||||
bash scripts/run_distribute_train_ascend.sh DEVICE_NUM EPOCH_SIZE DATA_PATH RANK_TABLE_FILE CONFIG_PATH
|
||||
```
|
||||
|
||||
**注意**:由于网络输入中有不同句长的数据,所以数据下沉模式不可使用。
|
||||
|
|
@ -345,7 +345,7 @@ Parameters for learning rate:
|
|||
- 运行`process_output.sh`,处理输出标记ids,获得真实翻译结果。
|
||||
|
||||
```bash
|
||||
sh scripts/process_output.sh REF_DATA EVAL_OUTPUT VOCAB_FILE
|
||||
bash scripts/process_output.sh REF_DATA EVAL_OUTPUT VOCAB_FILE
|
||||
```
|
||||
|
||||
您将会获得REF_DATA.forbleu和EVAL_OUTPUT.forbleu两个文件来进行BLEU分数计算。
|
||||
|
|
|
|||
|
|
@ -80,7 +80,7 @@ After installing MindSpore via the official website, you can start training and
|
|||
--do_eval=True > ms_log/output.log 2>&1 &
|
||||
|
||||
# run distributed training example
|
||||
sh scripts/run_distribute_train.sh 8 /dataset_path /rank_table_8p.json
|
||||
bash scripts/run_distribute_train.sh 8 /dataset_path /rank_table_8p.json
|
||||
|
||||
# run evaluation example
|
||||
python eval.py \
|
||||
|
|
@ -88,7 +88,7 @@ After installing MindSpore via the official website, you can start training and
|
|||
--checkpoint_path='./checkpoint/deepfm.ckpt' \
|
||||
--device_target='Ascend' > ms_log/eval_output.log 2>&1 &
|
||||
OR
|
||||
sh scripts/run_eval.sh 0 Ascend /dataset_path /checkpoint_path/deepfm.ckpt
|
||||
bash scripts/run_eval.sh 0 Ascend /dataset_path /checkpoint_path/deepfm.ckpt
|
||||
```
|
||||
|
||||
For distributed training, a hccl configuration file with JSON format needs to be created in advance.
|
||||
|
|
@ -112,7 +112,7 @@ After installing MindSpore via the official website, you can start training and
|
|||
--do_eval=True > ms_log/output.log 2>&1 &
|
||||
|
||||
# run distributed training example
|
||||
sh scripts/run_distribute_train.sh 8 /dataset_path
|
||||
bash scripts/run_distribute_train.sh 8 /dataset_path
|
||||
|
||||
# run evaluation example
|
||||
python eval.py \
|
||||
|
|
@ -120,7 +120,7 @@ After installing MindSpore via the official website, you can start training and
|
|||
--checkpoint_path='./checkpoint/deepfm.ckpt' \
|
||||
--device_target='GPU' > ms_log/eval_output.log 2>&1 &
|
||||
OR
|
||||
sh scripts/run_eval.sh 0 GPU /dataset_path /checkpoint_path/deepfm.ckpt
|
||||
bash scripts/run_eval.sh 0 GPU /dataset_path /checkpoint_path/deepfm.ckpt
|
||||
```
|
||||
|
||||
- running on CPU
|
||||
|
|
@ -341,7 +341,7 @@ Parameters for both training and evaluation can be set in config.py
|
|||
- running on Ascend
|
||||
|
||||
```shell
|
||||
sh scripts/run_distribute_train.sh 8 /dataset_path /rank_table_8p.json
|
||||
bash scripts/run_distribute_train.sh 8 /dataset_path /rank_table_8p.json
|
||||
```
|
||||
|
||||
The above shell script will run distribute training in the background. You can view the results through the file `log[X]/output.log`. The loss value are saved in loss.log file.
|
||||
|
|
@ -364,7 +364,7 @@ Parameters for both training and evaluation can be set in config.py
|
|||
--checkpoint_path='./checkpoint/deepfm.ckpt' \
|
||||
--device_target='Ascend' > ms_log/eval_output.log 2>&1 &
|
||||
OR
|
||||
sh scripts/run_eval.sh 0 Ascend /dataset_path /checkpoint_path/deepfm.ckpt
|
||||
bash scripts/run_eval.sh 0 Ascend /dataset_path /checkpoint_path/deepfm.ckpt
|
||||
```
|
||||
|
||||
The above python command will run in the background. You can view the results through the file "eval_output.log". The accuracy is saved in auc.log file.
|
||||
|
|
|
|||
|
|
@ -83,7 +83,7 @@ FM和深度学习部分拥有相同的输入原样特征向量,让DeepFM能从
|
|||
--do_eval=True > ms_log/output.log 2>&1 &
|
||||
|
||||
# 运行分布式训练示例
|
||||
sh scripts/run_distribute_train.sh 8 /dataset_path /rank_table_8p.json
|
||||
bash scripts/run_distribute_train.sh 8 /dataset_path /rank_table_8p.json
|
||||
|
||||
# 运行评估示例
|
||||
python eval.py \
|
||||
|
|
@ -91,7 +91,7 @@ FM和深度学习部分拥有相同的输入原样特征向量,让DeepFM能从
|
|||
--checkpoint_path='./checkpoint/deepfm.ckpt' \
|
||||
--device_target='Ascend' > ms_log/eval_output.log 2>&1 &
|
||||
OR
|
||||
sh scripts/run_eval.sh 0 Ascend /dataset_path /checkpoint_path/deepfm.ckpt
|
||||
bash scripts/run_eval.sh 0 Ascend /dataset_path /checkpoint_path/deepfm.ckpt
|
||||
```
|
||||
|
||||
在分布式训练中,JSON格式的HCCL配置文件需要提前创建。
|
||||
|
|
@ -115,7 +115,7 @@ FM和深度学习部分拥有相同的输入原样特征向量,让DeepFM能从
|
|||
--do_eval=True > ms_log/output.log 2>&1 &
|
||||
|
||||
# 运行分布式训练示例
|
||||
sh scripts/run_distribute_train.sh 8 /dataset_path
|
||||
bash scripts/run_distribute_train.sh 8 /dataset_path
|
||||
|
||||
# 运行评估示例
|
||||
python eval.py \
|
||||
|
|
@ -123,7 +123,7 @@ FM和深度学习部分拥有相同的输入原样特征向量,让DeepFM能从
|
|||
--checkpoint_path='./checkpoint/deepfm.ckpt' \
|
||||
--device_target='GPU' > ms_log/eval_output.log 2>&1 &
|
||||
OR
|
||||
sh scripts/run_eval.sh 0 GPU /dataset_path /checkpoint_path/deepfm.ckpt
|
||||
bash scripts/run_eval.sh 0 GPU /dataset_path /checkpoint_path/deepfm.ckpt
|
||||
```
|
||||
|
||||
- 在 ModelArts 进行训练 (如果你想在modelarts上运行,可以参考以下文档 [modelarts](https://support.huaweicloud.com/modelarts/))
|
||||
|
|
@ -324,7 +324,7 @@ FM和深度学习部分拥有相同的输入原样特征向量,让DeepFM能从
|
|||
- Ascend处理器上运行
|
||||
|
||||
```运行命令
|
||||
sh scripts/run_distribute_train.sh 8 /dataset_path /rank_table_8p.json
|
||||
bash scripts/run_distribute_train.sh 8 /dataset_path /rank_table_8p.json
|
||||
```
|
||||
|
||||
上述shell脚本将在后台运行分布式训练。请在`log[X]/output.log`文件中查看结果。损失值保存在loss.log文件中。
|
||||
|
|
@ -346,7 +346,7 @@ FM和深度学习部分拥有相同的输入原样特征向量,让DeepFM能从
|
|||
--checkpoint_path='./checkpoint/deepfm.ckpt' \
|
||||
--device_target='Ascend' > ms_log/eval_output.log 2>&1 &
|
||||
OR
|
||||
sh scripts/run_eval.sh 0 Ascend /dataset_path /checkpoint_path/deepfm.ckpt
|
||||
bash scripts/run_eval.sh 0 Ascend /dataset_path /checkpoint_path/deepfm.ckpt
|
||||
```
|
||||
|
||||
上述python命令将在后台运行,请在eval_output.log路径下查看结果。准确率保存在auc.log文件中。
|
||||
|
|
|
|||
|
|
@ -98,10 +98,10 @@ bash scripts/run_download_dataset.sh
|
|||
bash scripts/run_train.sh
|
||||
|
||||
# run distributed training example
|
||||
sh scripts/run_train.sh rank_table.json
|
||||
bash scripts/run_train.sh rank_table.json
|
||||
|
||||
# run evaluation example
|
||||
sh run_eval.sh
|
||||
bash run_eval.sh
|
||||
```
|
||||
|
||||
If you want to run in modelarts, please check the official documentation of [modelarts](https://support.huaweicloud.com/modelarts/), and you can start training and evaluation as follows:
|
||||
|
|
@ -230,7 +230,7 @@ Parameters for both training and evaluation can be set in config.py.
|
|||
Before running the command below, please check the checkpoint path used for evaluation. Please set the checkpoint path to be the absolute full path, e.g., "checkpoint/ncf-125_390.ckpt".
|
||||
|
||||
```python
|
||||
sh scripts/run_eval.sh
|
||||
bash scripts/run_eval.sh
|
||||
```
|
||||
|
||||
The above python command will run in the background. You can view the results through the file "eval.log". The accuracy of the test dataset will be as follows:
|
||||
|
|
|
|||
|
|
@ -86,8 +86,8 @@ pip install gym
|
|||
GPU: python train.py --device_target GPU --ckpt_path ckpt > log.txt 2>&1 &
|
||||
|
||||
shell:
|
||||
Ascend: sh run_standalone_train_ascend.sh ckpt
|
||||
GPU: sh run_standalone_train_gpu.sh ckpt
|
||||
Ascend:bash run_standalone_train_ascend.sh ckpt
|
||||
GPU: bash run_standalone_train_gpu.sh ckpt
|
||||
```
|
||||
|
||||
### [Evaluation Process](#content)
|
||||
|
|
@ -99,8 +99,8 @@ pip install gym
|
|||
GPU: python eval.py --device_target GPU --ckpt_path .ckpt/checkpoint_dqn.ckpt
|
||||
|
||||
shell:
|
||||
Ascend: sh run_standalone_eval_ascend.sh .ckpt/checkpoint_dqn.ckpt
|
||||
GPU: sh run_standalone_eval_gpu.sh .ckpt/checkpoint_dqn.ckpt
|
||||
Ascend: bash run_standalone_eval_ascend.sh .ckpt/checkpoint_dqn.ckpt
|
||||
GPU: bash run_standalone_eval_gpu.sh .ckpt/checkpoint_dqn.ckpt
|
||||
```
|
||||
|
||||
## [Performance](#content)
|
||||
|
|
@ -125,4 +125,4 @@ We use random seed in train.py.
|
|||
|
||||
## [ModeZoo 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).
|
||||
|
|
|
|||
|
|
@ -226,13 +226,13 @@ After installing MindSpore via the official website and finishing dataset proces
|
|||
```shell
|
||||
|
||||
# standalone training gpu
|
||||
sh ./scripts/run_standalone_train_gpu.sh [DEVICE_ID]
|
||||
bash ./scripts/run_standalone_train_gpu.sh [DEVICE_ID]
|
||||
|
||||
# standalone training cpu
|
||||
sh ./scripts/run_standalone_train_cpu.sh
|
||||
bash ./scripts/run_standalone_train_cpu.sh
|
||||
|
||||
# distributed training gpu
|
||||
sh ./scripts/run_distribute_train_gpu.sh
|
||||
bash ./scripts/run_distribute_train_gpu.sh
|
||||
|
||||
```
|
||||
|
||||
|
|
@ -243,10 +243,10 @@ deepspeech_pytorch into deepspeech2 directory. After that, the file directory wi
|
|||
```shell
|
||||
|
||||
# eval on cpu
|
||||
sh ./scripts/run_eval_cpu.sh [PATH_CHECKPOINT]
|
||||
bash ./scripts/run_eval_cpu.sh [PATH_CHECKPOINT]
|
||||
|
||||
# eval on gpu
|
||||
sh ./scripts/run_eval_gpu.sh [DEVICE_ID] [PATH_CHECKPOINT]
|
||||
bash ./scripts/run_eval_gpu.sh [DEVICE_ID] [PATH_CHECKPOINT]
|
||||
|
||||
```
|
||||
|
||||
|
|
|
|||
|
|
@ -210,13 +210,13 @@ you can run the following command to train the network:
|
|||
```bash
|
||||
Standalone training
|
||||
GPU:
|
||||
sh ./scripts/run_standalone_train_gpu.sh [CUDA_DEVICE_ID] [/path_to_egs/egs/gaussian/dump/lj/logmelspectrogram/norm/] [/path_to_egs/egs/gaussian/conf/gaussian_wavenet.json] [path_to_save_ckpt]
|
||||
bash ./scripts/run_standalone_train_gpu.sh [CUDA_DEVICE_ID] [/path_to_egs/egs/gaussian/dump/lj/logmelspectrogram/norm/] [/path_to_egs/egs/gaussian/conf/gaussian_wavenet.json] [path_to_save_ckpt]
|
||||
|
||||
CPU:
|
||||
sh ./scripts/run_standalone_train_cpu.sh [/path_to_egs/egs/gaussian/dump/lj/logmelspectrogram/norm/] [/path_to_egs/egs/gaussian/conf/gaussian_wavenet.json] [path_to_save_ckpt]
|
||||
bash ./scripts/run_standalone_train_cpu.sh [/path_to_egs/egs/gaussian/dump/lj/logmelspectrogram/norm/] [/path_to_egs/egs/gaussian/conf/gaussian_wavenet.json] [path_to_save_ckpt]
|
||||
|
||||
Distributed training(8p)
|
||||
sh ./scripts/run_distribute_train_gpu.sh [/path_to_egs/egs/gaussian/dump/lj/logmelspectrogram/norm/] [/path_to_egs/egs/gaussian/conf/gaussian_wavenet.json] [path_to_save_ckpt]
|
||||
bash ./scripts/run_distribute_train_gpu.sh [/path_to_egs/egs/gaussian/dump/lj/logmelspectrogram/norm/] [/path_to_egs/egs/gaussian/conf/gaussian_wavenet.json] [path_to_save_ckpt]
|
||||
```
|
||||
|
||||
## [Evaluation Process](#contents)
|
||||
|
|
@ -227,13 +227,13 @@ this [link](https://bbs.huaweicloud.com/forum/thread-94852-1-1.html)
|
|||
```bash
|
||||
Evaluation
|
||||
GPU (using numpy):
|
||||
sh ./scripts/run_eval_gpu.sh [CUDA_DEVICE_ID] [/path_to_egs/egs/gaussian/dump/lj/logmelspectrogram/norm/] [/path_to_egs/egs/gaussian/conf/gaussian_wavenet.json] [path_to_load_ckpt] is_numpy [path_to_save_audio]
|
||||
bash ./scripts/run_eval_gpu.sh [CUDA_DEVICE_ID] [/path_to_egs/egs/gaussian/dump/lj/logmelspectrogram/norm/] [/path_to_egs/egs/gaussian/conf/gaussian_wavenet.json] [path_to_load_ckpt] is_numpy [path_to_save_audio]
|
||||
|
||||
GPU (using mindspore):
|
||||
sh ./scripts/run_eval_gpu.sh [CUDA_DEVICE_ID] [/path_to_egs/egs/gaussian/dump/lj/logmelspectrogram/norm/] [/path_to_egs/egs/gaussian/conf/gaussian_wavenet.json] [path_to_load_ckpt] [path_to_save_audio]
|
||||
bash ./scripts/run_eval_gpu.sh [CUDA_DEVICE_ID] [/path_to_egs/egs/gaussian/dump/lj/logmelspectrogram/norm/] [/path_to_egs/egs/gaussian/conf/gaussian_wavenet.json] [path_to_load_ckpt] [path_to_save_audio]
|
||||
|
||||
CPU:
|
||||
sh ./scripts/run_eval_cpu.sh [/path_to_egs/egs/gaussian/dump/lj/logmelspectrogram/norm/] [/path_to_egs/egs/gaussian/conf/gaussian_wavenet.json] [path_to_load_ckpt] [is_numpy] [path_to_save_audio]
|
||||
bash ./scripts/run_eval_cpu.sh [/path_to_egs/egs/gaussian/dump/lj/logmelspectrogram/norm/] [/path_to_egs/egs/gaussian/conf/gaussian_wavenet.json] [path_to_load_ckpt] [is_numpy] [path_to_save_audio]
|
||||
```
|
||||
|
||||
## [Convert Process](#contents)
|
||||
|
|
|
|||
|
|
@ -89,7 +89,7 @@ After installing MindSpore via the official website, you can start training and
|
|||
```bash
|
||||
# distributed training
|
||||
Usage:
|
||||
sh run_distribute_train.sh se-resnet50 imagenet2012 [RANK_TABLE_FILE] [DATASET_PATH]
|
||||
bash run_distribute_train.sh se-resnet50 imagenet2012 [RANK_TABLE_FILE] [DATASET_PATH]
|
||||
|
||||
# standalone training
|
||||
Usage:
|
||||
|
|
|
|||
|
|
@ -168,11 +168,11 @@ MSCOCO2017
|
|||
# 八卡并行训练示例:
|
||||
|
||||
创建 RANK_TABLE_FILE
|
||||
sh run_distribute_train.sh DEVICE_NUM EPOCH_SIZE LR DATASET RANK_TABLE_FILE PRE_TRAINED(optional) PRE_TRAINED_EPOCH_SIZE(optional)
|
||||
bash run_distribute_train.sh DEVICE_NUM EPOCH_SIZE LR DATASET RANK_TABLE_FILE PRE_TRAINED(optional) PRE_TRAINED_EPOCH_SIZE(optional)
|
||||
|
||||
# 单卡训练示例:
|
||||
|
||||
sh run_distribute_train.sh DEVICE_ID EPOCH_SIZE LR DATASET PRE_TRAINED(optional) PRE_TRAINED_EPOCH_SIZE(optional)
|
||||
bash run_distribute_train.sh DEVICE_ID EPOCH_SIZE LR DATASET PRE_TRAINED(optional) PRE_TRAINED_EPOCH_SIZE(optional)
|
||||
|
||||
```
|
||||
|
||||
|
|
@ -196,12 +196,12 @@ sh run_distribute_train.sh DEVICE_ID EPOCH_SIZE LR DATASET PRE_TRAINED(optional)
|
|||
|
||||
# 八卡并行训练示例(在retinanet目录下运行):
|
||||
|
||||
sh scripts/run_distribute_train.sh 8 500 0.1 coco RANK_TABLE_FILE(创建的RANK_TABLE_FILE的地址) PRE_TRAINED(预训练checkpoint地址) PRE_TRAINED_EPOCH_SIZE(预训练EPOCH大小)
|
||||
例如:sh scripts/run_distribute_train.sh 8 500 0.1 coco scripts/rank_table_8pcs.json /dataset/retinanet-322_458.ckpt 322
|
||||
bash scripts/run_distribute_train.sh 8 500 0.1 coco RANK_TABLE_FILE(创建的RANK_TABLE_FILE的地址) PRE_TRAINED(预训练checkpoint地址) PRE_TRAINED_EPOCH_SIZE(预训练EPOCH大小)
|
||||
例如:bash scripts/run_distribute_train.sh 8 500 0.1 coco scripts/rank_table_8pcs.json /dataset/retinanet-322_458.ckpt 322
|
||||
|
||||
# 单卡训练示例(在retinanet目录下运行):
|
||||
|
||||
sh scripts/run_single_train.sh 0 500 0.1 coco /dataset/retinanet-322_458.ckpt 322
|
||||
bash scripts/run_single_train.sh 0 500 0.1 coco /dataset/retinanet-322_458.ckpt 322
|
||||
|
||||
```
|
||||
|
||||
|
|
@ -231,7 +231,7 @@ epoch time: 314138.455 ms, per step time: 685.892 ms
|
|||
您可以使用python或shell脚本进行训练。shell脚本的用法如下:
|
||||
|
||||
```eval
|
||||
sh scripts/run_eval.sh [DATASET] [DEVICE_ID]
|
||||
bash scripts/run_eval.sh [DATASET] [DEVICE_ID]
|
||||
```
|
||||
|
||||
#### <span id="running">运行</span>
|
||||
|
|
@ -243,7 +243,7 @@ sh scripts/run_eval.sh [DATASET] [DEVICE_ID]
|
|||
Ascend: python eval.py
|
||||
checkpoint 的路径在config里设置
|
||||
shell:
|
||||
Ascend: sh scripts/run_eval.sh coco 0
|
||||
Ascend: bash scripts/run_eval.sh coco 0
|
||||
```
|
||||
|
||||
> checkpoint 可以在训练过程中产生.
|
||||
|
|
@ -312,4 +312,4 @@ mAP: 0.3710347196613514
|
|||
|
||||
# [ModelZoo 主页](#内容)
|
||||
|
||||
请核对官方 [主页](https://gitee.com/mindspore/mindspore/tree/master/model_zoo).
|
||||
请核对官方 [主页](https://gitee.com/mindspore/mindspore/tree/master/model_zoo).
|
||||
|
|
|
|||
|
|
@ -168,11 +168,11 @@ MSCOCO2017
|
|||
# 八卡并行训练示例:
|
||||
|
||||
创建 RANK_TABLE_FILE
|
||||
sh run_distribute_train.sh DEVICE_NUM EPOCH_SIZE LR DATASET RANK_TABLE_FILE PRE_TRAINED(optional) PRE_TRAINED_EPOCH_SIZE(optional)
|
||||
bash run_distribute_train.sh DEVICE_NUM EPOCH_SIZE LR DATASET RANK_TABLE_FILE PRE_TRAINED(optional) PRE_TRAINED_EPOCH_SIZE(optional)
|
||||
|
||||
# 单卡训练示例:
|
||||
|
||||
sh run_distribute_train.sh DEVICE_ID EPOCH_SIZE LR DATASET PRE_TRAINED(optional) PRE_TRAINED_EPOCH_SIZE(optional)
|
||||
bash run_distribute_train.sh DEVICE_ID EPOCH_SIZE LR DATASET PRE_TRAINED(optional) PRE_TRAINED_EPOCH_SIZE(optional)
|
||||
|
||||
```
|
||||
|
||||
|
|
@ -196,12 +196,12 @@ sh run_distribute_train.sh DEVICE_ID EPOCH_SIZE LR DATASET PRE_TRAINED(optional)
|
|||
|
||||
# 八卡并行训练示例(在retinanet目录下运行):
|
||||
|
||||
sh scripts/run_distribute_train.sh 8 500 0.1 coco RANK_TABLE_FILE(创建的RANK_TABLE_FILE的地址) PRE_TRAINED(预训练checkpoint地址) PRE_TRAINED_EPOCH_SIZE(预训练EPOCH大小)
|
||||
例如:sh scripts/run_distribute_train.sh 8 500 0.1 coco scripts/rank_table_8pcs.json /dataset/retinanet-322_458.ckpt 322
|
||||
bash scripts/run_distribute_train.sh 8 500 0.1 coco RANK_TABLE_FILE(创建的RANK_TABLE_FILE的地址) PRE_TRAINED(预训练checkpoint地址) PRE_TRAINED_EPOCH_SIZE(预训练EPOCH大小)
|
||||
例如:bash scripts/run_distribute_train.sh 8 500 0.1 coco scripts/rank_table_8pcs.json /dataset/retinanet-322_458.ckpt 322
|
||||
|
||||
# 单卡训练示例(在retinanet目录下运行):
|
||||
|
||||
sh scripts/run_single_train.sh 0 500 0.1 coco /dataset/retinanet-322_458.ckpt 322
|
||||
bash scripts/run_single_train.sh 0 500 0.1 coco /dataset/retinanet-322_458.ckpt 322
|
||||
|
||||
```
|
||||
|
||||
|
|
@ -231,7 +231,7 @@ epoch time: 444237.851 ms, per step time: 484.976 ms
|
|||
您可以使用python或shell脚本进行训练。shell脚本的用法如下:
|
||||
|
||||
```eval
|
||||
sh scripts/run_eval.sh [DATASET] [DEVICE_ID]
|
||||
bash scripts/run_eval.sh [DATASET] [DEVICE_ID]
|
||||
```
|
||||
|
||||
#### <span id="running">运行</span>
|
||||
|
|
@ -243,7 +243,7 @@ sh scripts/run_eval.sh [DATASET] [DEVICE_ID]
|
|||
Ascend: python eval.py
|
||||
checkpoint 的路径在config里设置
|
||||
shell:
|
||||
Ascend: sh scripts/run_eval.sh coco 0
|
||||
Ascend: bash scripts/run_eval.sh coco 0
|
||||
```
|
||||
|
||||
> checkpoint 可以在训练过程中产生.
|
||||
|
|
@ -312,4 +312,4 @@ mAP: 0.3571988469737286
|
|||
|
||||
# [ModelZoo 主页](#内容)
|
||||
|
||||
请核对官方 [主页](https://gitee.com/mindspore/mindspore/tree/master/model_zoo).
|
||||
请核对官方 [主页](https://gitee.com/mindspore/mindspore/tree/master/model_zoo).
|
||||
|
|
|
|||
|
|
@ -78,26 +78,26 @@ After installing MindSpore via the official website, you can start training and
|
|||
|
||||
```bash
|
||||
# distributed training
|
||||
Usage: sh scripts/run_distribute_train.sh [squeezenet|squeezenet_residual] [cifar10|imagenet] [RANK_TABLE_FILE] [DATASET_PATH] [PRETRAINED_CKPT_PATH](optional)
|
||||
Usage: bash scripts/run_distribute_train.sh [squeezenet|squeezenet_residual] [cifar10|imagenet] [RANK_TABLE_FILE] [DATASET_PATH] [PRETRAINED_CKPT_PATH](optional)
|
||||
|
||||
# standalone training
|
||||
Usage: sh scripts/run_standalone_train.sh [squeezenet|squeezenet_residual] [cifar10|imagenet] [DEVICE_ID] [DATASET_PATH] [PRETRAINED_CKPT_PATH](optional)
|
||||
Usage: bash scripts/run_standalone_train.sh [squeezenet|squeezenet_residual] [cifar10|imagenet] [DEVICE_ID] [DATASET_PATH] [PRETRAINED_CKPT_PATH](optional)
|
||||
|
||||
# run evaluation example
|
||||
Usage: sh scripts/run_eval.sh [squeezenet|squeezenet_residual] [cifar10|imagenet] [DEVICE_ID] [DATASET_PATH] [CHECKPOINT_PATH]
|
||||
Usage: bash scripts/run_eval.sh [squeezenet|squeezenet_residual] [cifar10|imagenet] [DEVICE_ID] [DATASET_PATH] [CHECKPOINT_PATH]
|
||||
```
|
||||
|
||||
- running on GPU
|
||||
|
||||
```bash
|
||||
# distributed training example
|
||||
sh scripts/run_distribute_train_gpu.sh [squeezenet|squeezenet_residual] [cifar10|imagenet] [DATASET_PATH] [PRETRAINED_CKPT_PATH](optional)
|
||||
bash scripts/run_distribute_train_gpu.sh [squeezenet|squeezenet_residual] [cifar10|imagenet] [DATASET_PATH] [PRETRAINED_CKPT_PATH](optional)
|
||||
|
||||
# standalone training example
|
||||
sh scripts/run_standalone_train_gpu.sh [squeezenet|squeezenet_residual] [cifar10|imagenet] [DEVICE_ID] [DATASET_PATH] [PRETRAINED_CKPT_PATH](optional)
|
||||
bash scripts/run_standalone_train_gpu.sh [squeezenet|squeezenet_residual] [cifar10|imagenet] [DEVICE_ID] [DATASET_PATH] [PRETRAINED_CKPT_PATH](optional)
|
||||
|
||||
# run evaluation example
|
||||
sh scripts/run_eval_gpu.sh [squeezenet|squeezenet_residual] [cifar10|imagenet] [DEVICE_ID] [DATASET_PATH] [CHECKPOINT_PATH]
|
||||
bash scripts/run_eval_gpu.sh [squeezenet|squeezenet_residual] [cifar10|imagenet] [DEVICE_ID] [DATASET_PATH] [CHECKPOINT_PATH]
|
||||
```
|
||||
|
||||
# [Script Description](#contents)
|
||||
|
|
@ -228,10 +228,10 @@ For more configuration details, please refer the script `config.py`.
|
|||
|
||||
```bash
|
||||
# distributed training
|
||||
Usage: sh scripts/run_distribute_train.sh [squeezenet|squeezenet_residual] [cifar10|imagenet] [RANK_TABLE_FILE] [DATASET_PATH] [PRETRAINED_CKPT_PATH](optional)
|
||||
Usage: bash scripts/run_distribute_train.sh [squeezenet|squeezenet_residual] [cifar10|imagenet] [RANK_TABLE_FILE] [DATASET_PATH] [PRETRAINED_CKPT_PATH](optional)
|
||||
|
||||
# standalone training
|
||||
Usage: sh scripts/run_standalone_train.sh [squeezenet|squeezenet_residual] [cifar10|imagenet] [DEVICE_ID] [DATASET_PATH] [PRETRAINED_CKPT_PATH](optional)
|
||||
Usage: bash scripts/run_standalone_train.sh [squeezenet|squeezenet_residual] [cifar10|imagenet] [DEVICE_ID] [DATASET_PATH] [PRETRAINED_CKPT_PATH](optional)
|
||||
```
|
||||
|
||||
For distributed training, a hccl configuration file with JSON format needs to be created in advance.
|
||||
|
|
@ -244,10 +244,10 @@ Training result will be stored in the example path, whose folder name begins wit
|
|||
|
||||
```bash
|
||||
# distributed training example
|
||||
sh scripts/run_distribute_train_gpu.sh [squeezenet|squeezenet_residual] [cifar10|imagenet] [DATASET_PATH] [PRETRAINED_CKPT_PATH](optional)
|
||||
bash scripts/run_distribute_train_gpu.sh [squeezenet|squeezenet_residual] [cifar10|imagenet] [DATASET_PATH] [PRETRAINED_CKPT_PATH](optional)
|
||||
|
||||
# standalone training example
|
||||
sh scripts/run_standalone_train_gpu.sh [squeezenet|squeezenet_residual] [cifar10|imagenet] [DEVICE_ID] [DATASET_PATH] [PRETRAINED_CKPT_PATH](optional)
|
||||
bash scripts/run_standalone_train_gpu.sh [squeezenet|squeezenet_residual] [cifar10|imagenet] [DEVICE_ID] [DATASET_PATH] [PRETRAINED_CKPT_PATH](optional)
|
||||
```
|
||||
|
||||
### Result
|
||||
|
|
@ -308,12 +308,12 @@ epoch: 5 step 5004, loss is 4.888848304748535
|
|||
|
||||
```shell
|
||||
# evaluation
|
||||
Usage: sh scripts/run_eval.sh [squeezenet|squeezenet_residual] [cifar10|imagenet] [DEVICE_ID] [DATASET_PATH] [CHECKPOINT_PATH]
|
||||
Usage: bash scripts/run_eval.sh [squeezenet|squeezenet_residual] [cifar10|imagenet] [DEVICE_ID] [DATASET_PATH] [CHECKPOINT_PATH]
|
||||
```
|
||||
|
||||
```shell
|
||||
# evaluation example
|
||||
sh scripts/run_eval.sh squeezenet cifar10 0 ~/cifar-10-verify-bin train/squeezenet_cifar10-120_1562.ckpt
|
||||
bash scripts/run_eval.sh squeezenet cifar10 0 ~/cifar-10-verify-bin train/squeezenet_cifar10-120_1562.ckpt
|
||||
```
|
||||
|
||||
checkpoint can be produced in training process.
|
||||
|
|
@ -321,7 +321,7 @@ checkpoint can be produced in training process.
|
|||
#### Running on GPU
|
||||
|
||||
```shell
|
||||
sh scripts/run_eval_gpu.sh [squeezenet|squeezenet_residual] [cifar10|imagenet] [DEVICE_ID] [DATASET_PATH] [CHECKPOINT_PATH]
|
||||
bash scripts/run_eval_gpu.sh [squeezenet|squeezenet_residual] [cifar10|imagenet] [DEVICE_ID] [DATASET_PATH] [CHECKPOINT_PATH]
|
||||
```
|
||||
|
||||
### Result
|
||||
|
|
|
|||
|
|
@ -104,7 +104,7 @@ After installing MindSpore via the official website, you can start training and
|
|||
python train.py
|
||||
|
||||
# distributed training on Ascend
|
||||
sh run_distribute_train_ghostnet.sh [DEVICE_NUM] [EPOCH_SIZE] [LR] [DATASET] [RANK_TABLE_FILE]
|
||||
bash run_distribute_train_ghostnet.sh [DEVICE_NUM] [EPOCH_SIZE] [LR] [DATASET] [RANK_TABLE_FILE]
|
||||
|
||||
# run eval on Ascend
|
||||
python eval.py --device_id 0 --dataset coco --checkpoint_file_path LOG4/ssd-500_458.ckpt
|
||||
|
|
@ -209,7 +209,7 @@ To train the model, run `train.py`. If the `mindrecord_dir` is empty, it will ge
|
|||
- Distribute mode
|
||||
|
||||
```bash
|
||||
sh run_distribute_train_ghostnet.sh [DEVICE_NUM] [EPOCH_SIZE] [LR] [DATASET] [RANK_TABLE_FILE] [PRE_TRAINED](optional) [PRE_TRAINED_EPOCH_SIZE](optional)
|
||||
bash run_distribute_train_ghostnet.sh [DEVICE_NUM] [EPOCH_SIZE] [LR] [DATASET] [RANK_TABLE_FILE] [PRE_TRAINED](optional) [PRE_TRAINED_EPOCH_SIZE](optional)
|
||||
```
|
||||
|
||||
We need five or seven parameters for this scripts.
|
||||
|
|
|
|||
|
|
@ -125,10 +125,10 @@ After installing MindSpore via the official website, you can start training and
|
|||
|
||||
```shell
|
||||
# distributed training on Ascend
|
||||
sh scripts/run_distribute_train.sh [DEVICE_NUM] [EPOCH_SIZE] [LR] [DATASET] [RANK_TABLE_FILE]
|
||||
bash scripts/run_distribute_train.sh [DEVICE_NUM] [EPOCH_SIZE] [LR] [DATASET] [RANK_TABLE_FILE]
|
||||
|
||||
# run eval on Ascend
|
||||
sh scripts/run_eval.sh [DATASET] [CHECKPOINT_PATH] [DEVICE_ID]
|
||||
bash scripts/run_eval.sh [DATASET] [CHECKPOINT_PATH] [DEVICE_ID]
|
||||
```
|
||||
|
||||
## [Script Description](#contents)
|
||||
|
|
@ -193,7 +193,7 @@ To train the model, run `train.py`. If the `mindrecord_dir` is empty, it will ge
|
|||
- Distribute mode
|
||||
|
||||
```shell
|
||||
sh scripts/run_distribute_train.sh [DEVICE_NUM] [EPOCH_SIZE] [LR] [DATASET] [RANK_TABLE_FILE] [PRE_TRAINED](optional) [PRE_TRAINED_EPOCH_SIZE](optional)
|
||||
bash scripts/run_distribute_train.sh [DEVICE_NUM] [EPOCH_SIZE] [LR] [DATASET] [RANK_TABLE_FILE] [PRE_TRAINED](optional) [PRE_TRAINED_EPOCH_SIZE](optional)
|
||||
```
|
||||
|
||||
We need five or seven parameters for this scripts.
|
||||
|
|
@ -228,7 +228,7 @@ epoch time: 32848.501 ms, per step time: 71.722 ms
|
|||
- single mode
|
||||
|
||||
```shell
|
||||
sh scripts/run_1p_train.sh [DEVICE_ID] [EPOCH_SIZE] [LR] [DATASET] [PRE_TRAINED](optional) [PRE_TRAINED_EPOCH_SIZE](optional)
|
||||
bash scripts/run_1p_train.sh [DEVICE_ID] [EPOCH_SIZE] [LR] [DATASET] [PRE_TRAINED](optional) [PRE_TRAINED_EPOCH_SIZE](optional)
|
||||
```
|
||||
|
||||
We need five or seven parameters for this scripts.
|
||||
|
|
@ -254,7 +254,7 @@ epoch time: 227088.618 ms, per step time: 61.978 ms
|
|||
#### Evaluation on Ascend
|
||||
|
||||
```shell
|
||||
sh scripts/run_eval.sh [DATASET] [CHECKPOINT_PATH] [DEVICE_ID]
|
||||
bash scripts/run_eval.sh [DATASET] [CHECKPOINT_PATH] [DEVICE_ID]
|
||||
```
|
||||
|
||||
We need two parameters for this scripts.
|
||||
|
|
|
|||
|
|
@ -127,10 +127,10 @@ After installing MindSpore via the official website, you can start training and
|
|||
|
||||
```shell
|
||||
# distributed training on Ascend
|
||||
sh scripts/run_distribute_train.sh [DEVICE_NUM] [EPOCH_SIZE] [LR] [DATASET] [RANK_TABLE_FILE]
|
||||
bash scripts/run_distribute_train.sh [DEVICE_NUM] [EPOCH_SIZE] [LR] [DATASET] [RANK_TABLE_FILE]
|
||||
|
||||
# run eval on Ascend
|
||||
sh scripts/run_eval.sh [DATASET] [CHECKPOINT_PATH] [DEVICE_ID]
|
||||
bash scripts/run_eval.sh [DATASET] [CHECKPOINT_PATH] [DEVICE_ID]
|
||||
```
|
||||
|
||||
## [Script Description](#contents)
|
||||
|
|
@ -197,7 +197,7 @@ To train the model, run `train.py`. If the `mindrecord_dir` is empty, it will ge
|
|||
- Distribute mode
|
||||
|
||||
```shell
|
||||
sh scripts/run_distribute_train.sh [DEVICE_NUM] [EPOCH_SIZE] [LR] [DATASET] [RANK_TABLE_FILE] [PRE_TRAINED](optional) [PRE_TRAINED_EPOCH_SIZE](optional)
|
||||
bash scripts/run_distribute_train.sh [DEVICE_NUM] [EPOCH_SIZE] [LR] [DATASET] [RANK_TABLE_FILE] [PRE_TRAINED](optional) [PRE_TRAINED_EPOCH_SIZE](optional)
|
||||
```
|
||||
|
||||
We need five or seven parameters for this scripts.
|
||||
|
|
@ -232,7 +232,7 @@ epoch time: 50429.043 ms, per step time: 110.107 ms
|
|||
- single mode
|
||||
|
||||
```shell
|
||||
sh scripts/run_1p_train.sh [DEVICE_ID] [EPOCH_SIZE] [LR] [DATASET] [PRE_TRAINED](optional) [PRE_TRAINED_EPOCH_SIZE](optional)
|
||||
bash scripts/run_1p_train.sh [DEVICE_ID] [EPOCH_SIZE] [LR] [DATASET] [PRE_TRAINED](optional) [PRE_TRAINED_EPOCH_SIZE](optional)
|
||||
```
|
||||
|
||||
We need five or seven parameters for this scripts.
|
||||
|
|
@ -258,7 +258,7 @@ epoch time: 286335.369 ms, per step time: 78.148 ms
|
|||
#### Evaluation on Ascend
|
||||
|
||||
```shell
|
||||
sh scripts/run_eval.sh [DATASET] [CHECKPOINT_PATH] [DEVICE_ID]
|
||||
bash scripts/run_eval.sh [DATASET] [CHECKPOINT_PATH] [DEVICE_ID]
|
||||
```
|
||||
|
||||
We need two parameters for this scripts.
|
||||
|
|
@ -374,4 +374,4 @@ In dataset.py, we set the seed inside “create_dataset" function. We also use r
|
|||
|
||||
## [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).
|
||||
|
|
|
|||
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue