mindspore/model_zoo/alexnet
anzhengqi 008b91b2a1 inject epoch ctrl op in the execution tree and send eos at the end of epoch 2020-07-20 13:02:47 +08:00
..
src change name to create_dataset_cifar10 2020-07-13 11:49:12 +08:00
README.md add src dir 2020-06-19 20:14:37 +08:00
eval.py change name to create_dataset_cifar10 2020-07-13 11:49:12 +08:00
train.py inject epoch ctrl op in the execution tree and send eos at the end of epoch 2020-07-20 13:02:47 +08:00

README.md

AlexNet Example

Description

Training AlexNet with dataset in MindSpore.

This is the simple tutorial for training AlexNet in MindSpore.

Requirements

  • Install MindSpore.

  • Download the dataset, the directory structure is as follows:

├─10-batches-bin
│
└─10-verify-bin

Running the example

# train AlexNet, hyperparameter setting in config.py
python train.py --data_path 10-batches-bin

You will get the loss value of each step as following:

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
...

Then, evaluate AlexNet according to network model

# evaluate AlexNet
python eval.py --data_path 10-verify-bin --ckpt_path checkpoint_alexnet-1_1562.ckpt

Note

Here are some optional parameters:

--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.