You can not select more than 25 topics Topics must start with a chinese character,a letter or number, can include dashes ('-') and can be up to 35 characters long.

README.md 2.1 kB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. # VGG16 Example
  2. ## Description
  3. This example is for VGG16 model training and evaluation.
  4. ## Requirements
  5. - Install [MindSpore](https://www.mindspore.cn/install/en).
  6. - Download the dataset [CIFAR-10](http://www.cs.toronto.edu/~kriz/cifar-10-binary.tar.gz).
  7. > Unzip the CIFAR-10 dataset to any path you want and the folder structure should be as follows:
  8. > ```
  9. > .
  10. > ├── cifar-10-batches-bin # train dataset
  11. > └── cifar-10-verify-bin # infer dataset
  12. > ```
  13. ## Running the Example
  14. ### Training
  15. ```
  16. python train.py --data_path=your_data_path --device_id=6 > out.train.log 2>&1 &
  17. ```
  18. The python command above will run in the background, you can view the results through the file `out.train.log`.
  19. After training, you'll get some checkpoint files under the script folder by default.
  20. You will get the loss value as following:
  21. ```
  22. # grep "loss is " out.train.log
  23. epoch: 1 step: 781, loss is 2.093086
  24. epcoh: 2 step: 781, loss is 1.827582
  25. ...
  26. ```
  27. ### Evaluation
  28. ```
  29. python eval.py --data_path=your_data_path --device_id=6 --checkpoint_path=./train_vgg_cifar10-70-781.ckpt > out.eval.log 2>&1 &
  30. ```
  31. The above python command will run in the background, you can view the results through the file `out.eval.log`.
  32. You will get the accuracy as following:
  33. ```
  34. # grep "result: " out.eval.log
  35. result: {'acc': 0.92}
  36. ```
  37. ## Usage:
  38. ### Training
  39. ```
  40. usage: train.py [--device_target TARGET][--data_path DATA_PATH]
  41. [--device_id DEVICE_ID]
  42. parameters/options:
  43. --device_target the training backend type, default is Ascend.
  44. --data_path the storage path of dataset
  45. --device_id the device which used to train model.
  46. ```
  47. ### Evaluation
  48. ```
  49. usage: eval.py [--device_target TARGET][--data_path DATA_PATH]
  50. [--device_id DEVICE_ID][--checkpoint_path CKPT_PATH]
  51. parameters/options:
  52. --device_target the evaluation backend type, default is Ascend.
  53. --data_path the storage path of datasetd
  54. --device_id the device which used to evaluate model.
  55. --checkpoint_path the checkpoint file path used to evaluate model.
  56. ```