forked from mindspore-Ecosystem/mindspore
update nasnet readme_cn
This commit is contained in:
parent
aa5d4e08a9
commit
3903e5797a
|
@ -4,7 +4,7 @@
|
|||
- [Model Architecture](#model-architecture)
|
||||
- [Dataset](#dataset)
|
||||
- [Environment Requirements](#environment-requirements)
|
||||
- [Quick Start](#quick-start)
|
||||
- [Quick Start](#quick-start)
|
||||
- [Script Description](#script-description)
|
||||
- [Script and Sample Code](#script-and-sample-code)
|
||||
- [Script Parameters](#script-parameters)
|
||||
|
@ -18,7 +18,6 @@
|
|||
|
||||
# [NASNet Description](#contents)
|
||||
|
||||
|
||||
[Paper](https://arxiv.org/abs/1707.07012): Barret Zoph, Vijay Vasudevan, Jonathon Shlens, Quoc V. Le. Learning Transferable Architectures for Scalable Image Recognition. 2017.
|
||||
|
||||
# [Model architecture](#contents)
|
||||
|
@ -27,27 +26,25 @@ The overall network architecture of NASNet is show below:
|
|||
|
||||
[Link](https://arxiv.org/abs/1707.07012)
|
||||
|
||||
|
||||
# [Dataset](#contents)
|
||||
|
||||
Dataset used: [imagenet](http://www.image-net.org/)
|
||||
|
||||
- Dataset size: ~125G, 1.2W colorful images in 1000 classes
|
||||
- Train: 120G, 1.2W images
|
||||
- Test: 5G, 50000 images
|
||||
- Train: 120G, 1.2W images
|
||||
- Test: 5G, 50000 images
|
||||
- Data format: RGB images.
|
||||
- Note: Data will be processed in src/dataset.py
|
||||
|
||||
- Note: Data will be processed in src/dataset.py
|
||||
|
||||
# [Environment Requirements](#contents)
|
||||
|
||||
- Hardware GPU
|
||||
- Prepare hardware environment with GPU processor.
|
||||
- Prepare hardware environment with GPU processor.
|
||||
- Framework
|
||||
- [MindSpore](https://www.mindspore.cn/install/en)
|
||||
- [MindSpore](https://www.mindspore.cn/install/en)
|
||||
- For more information, please check the resources below:
|
||||
- [MindSpore Tutorials](https://www.mindspore.cn/tutorial/training/en/master/index.html)
|
||||
- [MindSpore Python API](https://www.mindspore.cn/doc/api_python/en/master/index.html)
|
||||
- [MindSpore Tutorials](https://www.mindspore.cn/tutorial/training/en/master/index.html)
|
||||
- [MindSpore Python API](https://www.mindspore.cn/doc/api_python/en/master/index.html)
|
||||
|
||||
# [Script description](#contents)
|
||||
|
||||
|
@ -77,7 +74,7 @@ Dataset used: [imagenet](http://www.image-net.org/)
|
|||
|
||||
Parameters for both training and evaluating can be set in config.py.
|
||||
|
||||
```
|
||||
```python
|
||||
'random_seed': 1, # fix random seed
|
||||
'rank': 0, # local rank of distributed
|
||||
'group_size': 1, # world size of distributed
|
||||
|
@ -102,9 +99,9 @@ Parameters for both training and evaluating can be set in config.py.
|
|||
|
||||
## [Training Process](#contents)
|
||||
|
||||
#### Usage
|
||||
### Usage
|
||||
|
||||
```
|
||||
```bash
|
||||
GPU:
|
||||
# distribute training example(8p)
|
||||
sh run_distribute_train_for_gpu.sh DATA_DIR
|
||||
|
@ -112,7 +109,7 @@ GPU:
|
|||
sh run_standalone_train_for_gpu.sh DEVICE_ID DATA_DIR
|
||||
```
|
||||
|
||||
#### Launch
|
||||
### Launch
|
||||
|
||||
```bash
|
||||
# distributed training example(8p) for GPU
|
||||
|
@ -127,25 +124,23 @@ You can find checkpoint file together with result in log.
|
|||
|
||||
### Usage
|
||||
|
||||
```
|
||||
```bash
|
||||
# Evaluation
|
||||
sh run_eval_for_gpu.sh DEVICE_ID DATA_DIR PATH_CHECKPOINT
|
||||
```
|
||||
|
||||
#### Launch
|
||||
### Launch
|
||||
|
||||
```bash
|
||||
# Evaluation with checkpoint
|
||||
sh scripts/run_eval_for_gpu.sh 0 /dataset/val ./checkpoint/nasnet-a-mobile-rank0-248_10009.ckpt
|
||||
```
|
||||
|
||||
#### Result
|
||||
### Result
|
||||
|
||||
Evaluation result will be stored in the scripts path. Under this, you can find result like the followings in log.
|
||||
|
||||
```
|
||||
|
||||
acc=73.5%(TOP1)
|
||||
```
|
||||
|
||||
# [Model description](#contents)
|
||||
|
||||
|
@ -163,7 +158,6 @@ acc=73.5%(TOP1)
|
|||
| Optimizer | Momentum |
|
||||
| Loss Function | SoftmaxCrossEntropyWithLogits |
|
||||
| Loss | 1.8965 |
|
||||
| Accuracy | 73.5%(TOP1) |
|
||||
| Total time | 144 h 8ps |
|
||||
| Checkpoint for Fine tuning | 89 M(.ckpt file) |
|
||||
|
||||
|
@ -173,13 +167,12 @@ acc=73.5%(TOP1)
|
|||
| -------------------------- | ------------------------- |
|
||||
| Resource | NV SMX2 V100-32G |
|
||||
| uploaded Date | 09/24/2020 |
|
||||
| MindSpore Version | 1.0.0 |
|
||||
| Dataset | ImageNet, 1.2W |
|
||||
| MindSpore Version | 1.0.0 |
|
||||
| Dataset | ImageNet, 1.2W |
|
||||
| batch_size | 32 |
|
||||
| outputs | probability |
|
||||
| Accuracy | acc=73.5%(TOP1) |
|
||||
|
||||
|
||||
# [ModelZoo Homepage](#contents)
|
||||
|
||||
Please check the official [homepage](https://gitee.com/mindspore/mindspore/tree/master/model_zoo).
|
||||
|
||||
Please check the official [homepage](https://gitee.com/mindspore/mindspore/tree/master/model_zoo).
|
||||
|
|
|
@ -1,60 +1,86 @@
|
|||
# NASNet示例
|
||||
# 目录
|
||||
|
||||
<!-- TOC -->
|
||||
|
||||
- [NASNet示例](#nasnet示例)
|
||||
- [概述](#概述)
|
||||
- [要求](#要求)
|
||||
- [结构](#结构)
|
||||
- [参数配置](#参数配置)
|
||||
- [运行示例](#运行示例)
|
||||
- [训练](#训练)
|
||||
- [用法](#用法)
|
||||
- [运行](#运行)
|
||||
- [结果](#结果)
|
||||
- [评估](#评估)
|
||||
- [用法](#用法-1)
|
||||
- [启动](#启动)
|
||||
- [结果](#结果-1)
|
||||
- [目录](#目录)
|
||||
- [NASNet概述](#NASNet概述)
|
||||
- [模型架构](#模型架构)
|
||||
- [数据集](#数据集)
|
||||
- [环境要求](#环境要求)
|
||||
- [脚本说明](#脚本说明)
|
||||
- [脚本和样例代码](#脚本和样例代码)
|
||||
- [脚本参数](#脚本参数)
|
||||
- [训练过程](#训练过程)
|
||||
- [评估过程](#评估过程)
|
||||
- [模型描述](#模型描述)
|
||||
- [性能](#性能)
|
||||
- [训练性能](#训练性能)
|
||||
- [评估性能](#评估性能)
|
||||
- [ModelZoo主页](#modelzoo主页)
|
||||
|
||||
<!-- /TOC -->
|
||||
|
||||
## 概述
|
||||
# NASNet概述
|
||||
|
||||
此为MindSpore中训练NASNet-A-Mobile的示例。
|
||||
[论文](https://arxiv.org/abs/1707.07012): Barret Zoph, Vijay Vasudevan, Jonathon Shlens, Quoc V. Le. Learning Transferable Architectures for Scalable Image Recognition. 2017.
|
||||
|
||||
## 要求
|
||||
# 模型架构
|
||||
|
||||
- 安装[Mindspore](http://www.mindspore.cn/install/en)。
|
||||
- 下载数据集。
|
||||
NASNet总体网络架构如下:
|
||||
|
||||
## 结构
|
||||
[链接](https://arxiv.org/abs/1707.07012)
|
||||
|
||||
```shell
|
||||
# 数据集
|
||||
|
||||
使用的数据集:[imagenet](http://www.image-net.org/)
|
||||
|
||||
- 数据集大小:125G,共1000个类、1.2万张彩色图像
|
||||
- 训练集:120G,共1.2万张图像
|
||||
- 测试集:5G,共5万张图像
|
||||
- 数据格式:RGB
|
||||
* 注:数据在src/dataset.py中处理。
|
||||
|
||||
# 环境要求
|
||||
|
||||
- 硬件:GPU
|
||||
- 使用GPU处理器来搭建硬件环境。
|
||||
|
||||
- 框架
|
||||
- [MindSpore](https://www.mindspore.cn/install)
|
||||
|
||||
- 如需查看详情,请参见如下资源:
|
||||
- [MindSpore教程](https://www.mindspore.cn/tutorial/training/en/master/index.html)
|
||||
- [MindSpore Python API](https://www.mindspore.cn/doc/api_python/en/master/index.html)
|
||||
|
||||
# 脚本说明
|
||||
|
||||
## 脚本及样例代码
|
||||
|
||||
```python
|
||||
.
|
||||
└─nasnet
|
||||
└─nasnet
|
||||
├─README.md
|
||||
├─scripts
|
||||
├─run_standalone_train_for_gpu.sh # 使用GPU平台启动单机训练(单卡)
|
||||
├─Run_distribute_train_for_gpu.sh # 使用GPU平台启动分布式训练(8卡)
|
||||
└─Run_eval_for_gpu.sh # 使用GPU平台进行启动评估
|
||||
├─README_CN.md
|
||||
├─scripts
|
||||
├─run_standalone_train_for_gpu.sh # 使用GPU平台启动单机训练(单卡)
|
||||
├─run_distribute_train_for_gpu.sh # 使用GPU平台启动分布式训练(8卡)
|
||||
└─run_eval_for_gpu.sh # 使用GPU平台进行启动评估
|
||||
├─src
|
||||
├─config.py # 参数配置
|
||||
├─dataset.py # 数据预处理
|
||||
├─loss.py # 自定义交叉熵损失函数
|
||||
├─lr_generator.py # 学习率生成器
|
||||
├─nasnet_a_mobile.py # 网络定义
|
||||
├─eval.py # 评估网络
|
||||
├─export.py # 转换检查点
|
||||
└─train.py # 训练网络
|
||||
|
||||
├─nasnet_a_mobile.py # 网络定义
|
||||
├─eval.py # 评估网络
|
||||
├─export.py # 转换检查点
|
||||
└─train.py # 训练网络
|
||||
```
|
||||
|
||||
## 参数配置
|
||||
## 脚本参数
|
||||
|
||||
在config.py中可以同时配置训练参数和评估参数。
|
||||
|
||||
```
|
||||
```python
|
||||
'random_seed':1, # 固定随机种子
|
||||
'rank':0, # 分布式训练进程序号
|
||||
'group_size':1, # 分布式训练分组大小
|
||||
|
@ -75,25 +101,20 @@
|
|||
'opt_eps':1.0, # epsilon参数
|
||||
'rmsprop_decay':0.9, # rmsprop衰减
|
||||
'loss_scale':1, # 损失规模
|
||||
|
||||
```
|
||||
|
||||
## 训练过程
|
||||
|
||||
### 用法
|
||||
|
||||
## 运行示例
|
||||
|
||||
### 训练
|
||||
|
||||
#### 用法
|
||||
|
||||
```
|
||||
```bash
|
||||
# 分布式训练示例(8卡)
|
||||
sh run_distribute_train_for_gpu.sh DATA_DIR
|
||||
sh run_distribute_train_for_gpu.sh DATA_DIR
|
||||
# 单机训练
|
||||
sh run_standalone_train_for_gpu.sh DEVICE_ID DATA_DIR
|
||||
```
|
||||
|
||||
#### 运行
|
||||
### 运行
|
||||
|
||||
```bash
|
||||
# GPU分布式训练示例(8卡)
|
||||
|
@ -102,20 +123,20 @@ sh scripts/run_distribute_train_for_gpu.sh /dataset/train
|
|||
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
|
||||
# 检查点评估
|
||||
|
@ -124,7 +145,43 @@ sh scripts/run_eval_for_gpu.sh 0 /dataset/val ./checkpoint/nasnet-a-mobile-rank0
|
|||
|
||||
> 训练过程中可以生成检查点。
|
||||
|
||||
#### 结果
|
||||
### 结果
|
||||
|
||||
评估结果保存在脚本路径下。路径下的日志中,可以找到如下结果:
|
||||
|
||||
|
||||
acc=73.5%(TOP1)
|
||||
|
||||
# 模型描述
|
||||
|
||||
## 性能
|
||||
|
||||
### 训练性能
|
||||
|
||||
| 参数 | NASNet |
|
||||
| -------------------------- | ------------------------- |
|
||||
| 资源 | NV SMX2 V100-32G |
|
||||
| 上传日期 | 2020-09-24 |
|
||||
| MindSpore版本 | 1.0.0 |
|
||||
| 数据集 | ImageNet |
|
||||
| 训练参数 | src/config.py |
|
||||
| 优化器 | Momentum |
|
||||
| 损失函数 | SoftmaxCrossEntropyWithLogits |
|
||||
| 损失值 | 1.8965 |
|
||||
| 总时间 | 8卡运行约144个小时 |
|
||||
| 检查点文件大小 | 89 M(.ckpt文件) |
|
||||
|
||||
### 评估性能
|
||||
|
||||
| 参数 | |
|
||||
| -------------------------- | ------------------------- |
|
||||
| 资源 | NV SMX2 V100-32G |
|
||||
| 上传日期 | 2020-09-24 |
|
||||
| MindSpore版本 | 1.0.0 |
|
||||
| 数据及 | ImageNet, 1.2W |
|
||||
| batch_size | 32 |
|
||||
| 输出 | 概率 |
|
||||
| 精确度 | acc=73.5%(TOP1) |
|
||||
|
||||
# ModelZoo主页
|
||||
|
||||
请浏览官网[主页](https://gitee.com/mindspore/mindspore/tree/master/model_zoo)。
|
||||
|
|
Loading…
Reference in New Issue