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 5.6 kB

5 years ago
5 years ago
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153
  1. # Contents
  2. - [ShuffleNetV2 Description](#shufflenetv2-description)
  3. - [Model Architecture](#model-architecture)
  4. - [Dataset](#dataset)
  5. - [Environment Requirements](#environment-requirements)
  6. - [Script Description](#script-description)
  7. - [Script and Sample Code](#script-and-sample-code)
  8. - [Training Process](#training-process)
  9. - [Evaluation Process](#evaluation-process)
  10. - [Evaluation](#evaluation)
  11. - [Model Description](#model-description)
  12. - [Performance](#performance)
  13. - [Training Performance](#evaluation-performance)
  14. - [Inference Performance](#evaluation-performance)
  15. - [ModelZoo Homepage](#modelzoo-homepage)
  16. # [ShuffleNetV2 Description](#contents)
  17. ShuffleNetV2 is a much faster and more accurate network than the previous networks on different platforms such as Ascend or GPU.
  18. [Paper](https://arxiv.org/pdf/1807.11164.pdf) Ma, N., Zhang, X., Zheng, H. T., & Sun, J. (2018). Shufflenet v2: Practical guidelines for efficient cnn architecture design. In Proceedings of the European conference on computer vision (ECCV) (pp. 116-131).
  19. # [Model architecture](#contents)
  20. The overall network architecture of ShuffleNetV2 is show below:
  21. [Link](https://arxiv.org/pdf/1807.11164.pdf)
  22. # [Dataset](#contents)
  23. Dataset used: [imagenet](http://www.image-net.org/)
  24. - Dataset size: ~125G, 1.2W colorful images in 1000 classes
  25. - Train: 120G, 1.2W images
  26. - Test: 5G, 50000 images
  27. - Data format: RGB images.
  28. - Note: Data will be processed in src/dataset.py
  29. # [Environment Requirements](#contents)
  30. - Hardware(GPU)
  31. - Prepare hardware environment with GPU processor.
  32. - Framework
  33. - [MindSpore](https://www.mindspore.cn/install/en)
  34. - For more information, please check the resources below:
  35. - [MindSpore Tutorials](https://www.mindspore.cn/tutorial/training/en/master/index.html)
  36. - [MindSpore Python API](https://www.mindspore.cn/doc/api_python/en/master/index.html)
  37. # [Script description](#contents)
  38. ## [Script and sample code](#contents)
  39. ```python
  40. +-- ShuffleNetV2
  41. +-- Readme.md # descriptions about ShuffleNetV2
  42. +-- scripts
  43. +--run_distribute_train_for_gpu.sh # shell script for distributed training
  44. +--run_eval_for_gpu.sh # shell script for evaluation
  45. +--run_standalone_train_for_gpu.sh # shell script for standalone training
  46. +-- src
  47. +--config.py # parameter configuration
  48. +--dataset.py # creating dataset
  49. +--loss.py # loss function for network
  50. +--lr_generator.py # learning rate config
  51. +-- train.py # training script
  52. +-- eval.py # evaluation script
  53. +-- blocks.py # ShuffleNetV2 blocks
  54. +-- network.py # ShuffleNetV2 model network
  55. ```
  56. ## [Training process](#contents)
  57. ### Usage
  58. You can start training using python or shell scripts. The usage of shell scripts as follows:
  59. - Distributed training on GPU: sh run_standalone_train_for_gpu.sh [DEVICE_NUM] [VISIABLE_DEVICES(0,1,2,3,4,5,6,7)] [DATASET_PATH]
  60. - Standalone training on GPU: sh run_standalone_train_for_gpu.sh [DATASET_PATH]
  61. ### Launch
  62. ```bash
  63. # training example
  64. python:
  65. GPU: mpirun --allow-run-as-root -n 8 --output-filename log_output --merge-stderr-to-stdout python train.py --is_distributed=True --platform='GPU' --dataset_path='~/imagenet/train/' > train.log 2>&1 &
  66. shell:
  67. GPU: cd scripts & sh run_distribute_train_for_gpu.sh 8 0,1,2,3,4,5,6,7 ~/imagenet/train/
  68. ```
  69. ### Result
  70. Training result will be stored in the example path. Checkpoints will be stored at `./checkpoint` by default, and training log will be redirected to `./train/train.log`.
  71. ## [Eval process](#contents)
  72. ### Usage
  73. You can start evaluation using python or shell scripts. The usage of shell scripts as follows:
  74. - GPU: sh run_eval_for_gpu.sh [DATASET_PATH] [CHECKPOINT_PATH]
  75. ### Launch
  76. ```bash
  77. # infer example
  78. python:
  79. GPU: CUDA_VISIBLE_DEVICES=0 python eval.py --platform='GPU' --dataset_path='~/imagenet/val/' > eval.log 2>&1 &
  80. shell:
  81. GPU: cd scripts & sh run_eval_for_gpu.sh '~/imagenet/val/' 'checkpoint_file'
  82. ```
  83. > checkpoint can be produced in training process.
  84. ### Result
  85. Inference result will be stored in the example path, you can find result in `eval.log`.
  86. # [Model description](#contents)
  87. ## [Performance](#contents)
  88. ### Training Performance
  89. | Parameters | ShuffleNetV2 |
  90. | -------------------------- | ------------------------- |
  91. | Resource | NV SMX2 V100-32G |
  92. | uploaded Date | 09/24/2020 |
  93. | MindSpore Version | 1.0.0 |
  94. | Dataset | ImageNet |
  95. | Training Parameters | src/config.py |
  96. | Optimizer | Momentum |
  97. | Loss Function | CrossEntropySmooth |
  98. | Accuracy | 69.4%(TOP1) |
  99. | Total time | 49 h 8ps |
  100. ### Inference Performance
  101. | Parameters | |
  102. | -------------------------- | ------------------------- |
  103. | Resource | NV SMX2 V100-32G |
  104. | uploaded Date | 09/24/2020 |
  105. | MindSpore Version | 1.0.0 |
  106. | Dataset | ImageNet, 1.2W |
  107. | batch_size | 128 |
  108. | outputs | probability |
  109. | Accuracy | acc=69.4%(TOP1) |
  110. # [ModelZoo Homepage](#contents)
  111. Please check the official [homepage](https://gitee.com/mindspore/mindspore/tree/master/model_zoo).