Skip to content
Snippets Groups Projects
Commit 0a33d32b authored by zhanghuiyao's avatar zhanghuiyao
Browse files

modify alexnet&resnet readme file.

parent b4203a18
No related branches found
No related tags found
No related merge requests found
......@@ -68,12 +68,12 @@ After installing MindSpore via the official website, you can start training and
```python
# enter script dir, train AlexNet
bash run_standalone_train_ascend.sh [DATA_PATH] [CKPT_SAVE_PATH]
# example: bash run_standalone_train_ascend.sh /home/DataSet/Cifar10/cifar-10-batches-bin/ /home/model/alexnet/ckpt/
bash run_standalone_train_ascend.sh [cifar10|imagenet] [DATA_PATH] [DEVICE_ID] [CKPT_PATH]
# example: bash run_standalone_train_ascend.sh cifar10 /home/DataSet/Cifar10/cifar-10-batches-bin/ 0 /home/model/alexnet/ckpt/
# enter script dir, evaluate AlexNet
bash run_standalone_eval_ascend.sh [DATA_PATH] [CKPT_NAME]
# example: bash run_standalone_eval_ascend.sh /home/DataSet/cifar10/cifar-10-verify-bin /home/model/cv/alxnet/ckpt/checkpoint_alexnet-1_1562.ckpt
bash run_standalone_eval_ascend.sh [cifar10|imagenet] [DATA_PATH] [CKPT_NAME] [DEVICE_ID]
# example: bash run_standalone_eval_ascend.sh cifar10 /home/DataSet/cifar10/cifar-10-verify-bin /home/model/cv/alxnet/ckpt/checkpoint_alexnet-1_1562.ckpt 0
```
- Running on [ModelArts](https://support.huaweicloud.com/modelarts/)
......@@ -231,7 +231,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
bash run_standalone_train_ascend.sh /home/DataSet/Cifar10/cifar-10-batches-bin/ /home/model/alexnet/ckpt/
bash run_standalone_train_ascend.sh cifar10 /home/DataSet/Cifar10/cifar-10-batches-bin/ 0 /home/model/alexnet/ckpt/
```
After training, the loss value will be achieved as follows:
......@@ -253,7 +253,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
bash run_standalone_train_for_gpu.sh cifar-10-batches-bin ckpt
bash run_standalone_train_gpu.sh cifar10 cifar-10-batches-bin ckpt
```
After training, the loss value will be achieved as follows:
......@@ -278,7 +278,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
bash run_standalone_eval_ascend.sh cifar-10-verify-bin ckpt/checkpoint_alexnet-1_1562.ckpt
bash run_standalone_eval_ascend.sh cifar10 cifar-10-verify-bin ckpt/checkpoint_alexnet-1_1562.ckpt 0
```
You can view the results through the file "eval_log". The accuracy of the test dataset will be as follows:
......@@ -293,7 +293,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
bash run_standalone_eval_for_gpu.sh cifar-10-verify-bin ckpt/checkpoint_alexnet-30_1562.ckpt
bash run_standalone_eval_gpu.sh cifar10 cifar-10-verify-bin ckpt/checkpoint_alexnet-30_1562.ckpt 0
```
You can view the results through the file "eval_log". The accuracy of the test dataset will be as follows:
......
......@@ -70,14 +70,14 @@ AlexNet由5个卷积层和3个全连接层组成。多个卷积核用于提取
```python
# 进入脚本目录,训练AlexNet
bash run_standalone_train_ascend.sh [DATA_PATH] [CKPT_SAVE_PATH]
# example: bash run_standalone_train_ascend.sh /home/DataSet/Cifar10/cifar-10-batches-bin/ /home/model/alexnet/ckpt/
bash run_standalone_train_ascend.sh [cifar10|imagenet] [DATA_PATH] [DEVICE_ID] [CKPT_PATH]
# example: bash run_standalone_train_ascend.sh cifar10 /home/DataSet/Cifar10/cifar-10-batches-bin/ 0 /home/model/alexnet/ckpt/
# 分布式训练AlexNet
# 进入脚本目录,评估AlexNet
bash run_standalone_eval_ascend.sh [DATA_PATH] [CKPT_NAME]
# example: bash run_standalone_eval_ascend.sh /home/DataSet/cifar10/cifar-10-verify-bin /home/model/cv/alxnet/ckpt/checkpoint_alexnet-1_1562.ckpt
bash run_standalone_eval_ascend.sh [cifar10|imagenet] [DATA_PATH] [CKPT_NAME] [DEVICE_ID]
# example: bash run_standalone_eval_ascend.sh cifar10 /home/DataSet/cifar10/cifar-10-verify-bin /home/model/cv/alxnet/ckpt/checkpoint_alexnet-1_1562.ckpt 0
```
- 在 ModelArts 进行训练 (如果你想在modelarts上运行,可以参考以下文档 [modelarts](https://support.huaweicloud.com/modelarts/))
......@@ -221,7 +221,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 &
# 或进入脚本目录,执行脚本
bash run_standalone_train_ascend.sh /home/DataSet/Cifar10/cifar-10-batches-bin/ /home/model/alexnet/ckpt/
bash run_standalone_train_ascend.sh cifar10 /home/DataSet/Cifar10/cifar-10-batches-bin/ 0 /home/model/alexnet/ckpt/
```
经过训练后,损失值如下:
......@@ -243,7 +243,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 &
# 或进入脚本目录,执行脚本
bash run_standalone_train_for_gpu.sh cifar-10-batches-bin ckpt
bash run_standalone_train_gpu.sh cifar10 cifar-10-batches-bin ckpt
```
经过训练后,损失值如下:
......@@ -268,7 +268,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 &
#或进入脚本目录,执行脚本
bash run_standalone_eval_ascend.sh /home/DataSet/cifar10/cifar-10-verify-bin /home/model/cv/alxnet/ckpt/checkpoint_alexnet-1_1562.ckpt
bash run_standalone_eval_ascend.sh cifar10 cifar-10-verify-bin ckpt/checkpoint_alexnet-1_1562.ckpt 0
```
可通过"eval_log”文件查看结果。测试数据集的准确率如下:
......@@ -283,7 +283,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 &
#或进入脚本目录,执行脚本
bash run_standalone_eval_for_gpu.sh cifar-10-verify-bin ckpt/checkpoint_alexnet-30_1562.ckpt
bash run_standalone_eval_gpu.sh cifar10 cifar-10-verify-bin ckpt/checkpoint_alexnet-30_1562.ckpt 0
```
可通过"eval_log”文件查看结果。测试数据集的准确率如下:
......
......@@ -167,27 +167,27 @@ If you want to run in modelarts, please check the official documentation of [mod
```python
# run distributed training on modelarts example
# (1) First, Perform a or b.
# (1) Add "config_path='/path_to_code/config/resnet50_imagenet2021_config.yaml'" on the website UI interface.
# (2) First, Perform a or b.
# a. Set "enable_modelarts=True" on yaml file.
# Set other parameters on yaml file you need.
# b. Add "enable_modelarts=True" on the website UI interface.
# Add other parameters on the website UI interface.
# (2) Set the config directory to "config_path=/The path of config in S3/"
# (3) Set the code directory to "/path/resnet" on the website UI interface.
# (4) Set the startup file to "train.py" on the website UI interface.
# (5) Set the "Dataset path" and "Output file path" and "Job log path" to your path on the website UI interface.
# (6) Create your job.
# run evaluation on modelarts example
# (1) Copy or upload your trained model to S3 bucket.
# (2) Perform a or b.
# (1) Add "config_path='/path_to_code/config/resnet50_imagenet2021_config.yaml'" on the website UI interface.
# (2) Copy or upload your trained model to S3 bucket.
# (3) Perform a or b.
# a. Set "enable_modelarts=True" on yaml file.
# Set "checkpoint_file_path='/cache/checkpoint_path/model.ckpt'" on yaml file.
# Set "checkpoint_url=/The path of checkpoint in S3/" on yaml file.
# b. Add "enable_modelarts=True" on the website UI interface.
# Add "checkpoint_file_path='/cache/checkpoint_path/model.ckpt'" on the website UI interface.
# Add "checkpoint_url=/The path of checkpoint in S3/" on the website UI interface.
# (3) Set the config directory to "config_path=/The path of config in S3/"
# (4) Set the code directory to "/path/resnet" on the website UI interface.
# (5) Set the startup file to "eval.py" on the website UI interface.
# (6) Set the "Dataset path" and "Output file path" and "Job log path" to your path on the website UI interface.
......@@ -702,7 +702,9 @@ Export on ModelArts (If you want to run in modelarts, please check the official
```python
# Export on ModelArts
# (1) Perform a or b.
# (1) Add "config_path='/path_to_code/config/resnet50_imagenet2021_config.yaml'" on the website UI interface.
# (2) Upload or copy your trained model to S3 bucket.
# (3) Perform a or b.
# a. Set "enable_modelarts=True" on default_config.yaml file.
# Set "checkpoint_file_path='/cache/checkpoint_path/model.ckpt'" on default_config.yaml file.
# Set "checkpoint_url='s3://dir_to_trained_ckpt/'" on default_config.yaml file.
......@@ -715,11 +717,10 @@ Export on ModelArts (If you want to run in modelarts, please check the official
# Add "file_name='./resnet'" on the website UI interface.
# Add "file_format='AIR'" on the website UI interface.
# Add other parameters on the website UI interface.
# (2) Set the config_path="/path/yaml file" on the website UI interface.
# (3) Set the code directory to "/path/resnet" on the website UI interface.
# (4) Set the startup file to "export.py" on the website UI interface.
# (5) Set the "Output file path" and "Job log path" to your path on the website UI interface.
# (6) Create your job.
# (4) Set the code directory to "/path/resnet" on the website UI interface.
# (5) Set the startup file to "export.py" on the website UI interface.
# (6) Set the "Output file path" and "Job log path" to your path on the website UI interface.
# (7) Create your job.
```
### Infer on Ascend310
......
......@@ -151,12 +151,12 @@ bash run_eval_gpu.sh [DATASET_PATH] [CHECKPOINT_PATH] [CONFIG_PATH]
```python
# 在modelarts上使用分布式训练的示例:
# (1) 选址a或者b其中一种方式。
# (1) 在网页上设置 "config_path='/path_to_code/config/resnet50_imagenet2021_config.yaml'"
# (2) 选址a或者b其中一种方式。
# a. 设置 "enable_modelarts=True" 。
# 在yaml文件上设置网络所需的参数。
# b. 增加 "enable_modelarts=True" 参数在modearts的界面上。
# 在modelarts的界面上设置网络所需的参数。
# (2) 在modelarts的界面上设置配置文件的路径"config_path=/The path of config in S3/"
# (3) 在modelarts的界面上设置代码的路径 "/path/resnet"。
# (4) 在modelarts的界面上设置模型的启动文件 "train.py" 。
# (5) 在modelarts的界面上设置模型的数据路径 "Dataset path" ,
......@@ -164,20 +164,20 @@ bash run_eval_gpu.sh [DATASET_PATH] [CHECKPOINT_PATH] [CONFIG_PATH]
# (6) 开始模型的训练。
# 在modelarts上使用模型推理的示例
# (1) 把训练好的模型地方到桶的对应位置。
# (2) 选址a或者b其中一种方式。
# (1) 在网页上设置 "config_path='/path_to_code/config/resnet50_imagenet2021_config.yaml'"
# (2) 把训练好的模型地方到桶的对应位置。
# (3) 选址a或者b其中一种方式。
# a. 设置 "enable_modelarts=True"
# 设置 "checkpoint_file_path='/cache/checkpoint_path/model.ckpt" 在 yaml 文件.
# 设置 "checkpoint_url=/The path of checkpoint in S3/" 在 yaml 文件.
# b. 增加 "enable_modelarts=True" 参数在modearts的界面上。
# 增加 "checkpoint_file_path='/cache/checkpoint_path/model.ckpt'" 参数在modearts的界面上。
# 增加 "checkpoint_url=/The path of checkpoint in S3/" 参数在modearts的界面上。
# (2) 在modelarts的界面上设置配置文件的路径"config_path=/The path of config in S3/"
# (3) 在modelarts的界面上设置代码的路径 "/path/resnet"。
# (4) 在modelarts的界面上设置模型的启动文件 "eval.py" 。
# (5) 在modelarts的界面上设置模型的数据路径 "Dataset path" ,
# (4) 在modelarts的界面上设置代码的路径 "/path/resnet"。
# (5) 在modelarts的界面上设置模型的启动文件 "eval.py" 。
# (6) 在modelarts的界面上设置模型的数据路径 "Dataset path" ,
# 模型的输出路径"Output file path" 和模型的日志路径 "Job log path" 。
# (6) 开始模型的推理。
# (7) 开始模型的推理。
```
# 脚本说明
......@@ -667,8 +667,9 @@ python export.py --checkpoint_file_path [CKPT_PATH] --file_name [FILE_NAME] --fi
ModelArts导出mindir
```python
# (1) 把训练好的模型地方到桶的对应位置。
# (2) 选址a或者b其中一种方式。
# (1) 在网页上设置 "config_path='/path_to_code/config/resnet50_imagenet2021_config.yaml'"
# (2) 把训练好的模型地方到桶的对应位置。
# (3) 选址a或者b其中一种方式。
# a. 设置 "enable_modelarts=True"
# 设置 "checkpoint_file_path='/cache/checkpoint_path/model.ckpt" 在 yaml 文件。
# 设置 "checkpoint_url=/The path of checkpoint in S3/" 在 yaml 文件。
......@@ -679,7 +680,6 @@ ModelArts导出mindir
# 增加 "checkpoint_url=/The path of checkpoint in S3/" 参数在modearts的界面上。
# 设置 "file_name='./resnet'"参数在modearts的界面上。
# 设置 "file_format='AIR'" 参数在modearts的界面上。
# (3) 设置网络配置文件的路径 "config_path=/The path of config in S3/"
# (4) 在modelarts的界面上设置代码的路径 "/path/resnet"。
# (5) 在modelarts的界面上设置模型的启动文件 "export.py" 。
# 模型的输出路径"Output file path" 和模型的日志路径 "Job log path" 。
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment