mindspore/model_zoo/alexnet/README.md

58 lines
1.3 KiB
Markdown
Raw Normal View History

2020-04-21 17:36:11 +08:00
# AlexNet Example
## Description
2020-06-19 12:32:51 +08:00
Training AlexNet with dataset in MindSpore.
2020-04-21 17:36:11 +08:00
This is the simple tutorial for training AlexNet in MindSpore.
## Requirements
- Install [MindSpore](https://www.mindspore.cn/install/en).
2020-06-19 12:32:51 +08:00
- Download the dataset, the directory structure is as follows:
2020-04-21 17:36:11 +08:00
```
2020-06-19 12:32:51 +08:00
├─10-batches-bin
2020-04-21 17:36:11 +08:00
2020-06-19 12:32:51 +08:00
└─10-verify-bin
2020-04-21 17:36:11 +08:00
```
## Running the example
```python
# train AlexNet, hyperparameter setting in config.py
2020-06-19 12:32:51 +08:00
python train.py --data_path 10-batches-bin
2020-04-21 17:36:11 +08:00
```
2020-04-23 16:10:32 +08:00
You will get the loss value of each step as following:
2020-04-21 17:36:11 +08:00
```bash
epoch: 1 step: 1, loss is 2.2791853
...
epoch: 1 step: 1536, loss is 1.9366643
epoch: 1 step: 1537, loss is 1.6983616
epoch: 1 step: 1538, loss is 1.0221305
...
```
2020-04-23 16:10:32 +08:00
Then, evaluate AlexNet according to network model
2020-04-21 17:36:11 +08:00
```python
2020-06-19 12:32:51 +08:00
# evaluate AlexNet
python eval.py --data_path 10-verify-bin --ckpt_path checkpoint_alexnet-1_1562.ckpt
2020-04-21 17:36:11 +08:00
```
## Note
2020-04-23 16:10:32 +08:00
Here are some optional parameters:
2020-04-21 17:36:11 +08:00
```bash
--device_target {Ascend,GPU}
device where the code will be implemented (default: Ascend)
--data_path DATA_PATH
path where the dataset is saved
--dataset_sink_mode DATASET_SINK_MODE
dataset_sink_mode is False or True
```
You can run ```python train.py -h``` or ```python eval.py -h``` to get more information.