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

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137
  1. # Contents
  2. - [GhostNet Description](#ghostnet-description)
  3. - [Quantization Description](#ghostnet-quantization-description)
  4. - [Model Architecture](#model-architecture)
  5. - [Dataset](#dataset)
  6. - [Environment Requirements](#environment-requirements)
  7. - [Script Description](#script-description)
  8. - [Script and Sample Code](#script-and-sample-code)
  9. - [Training Process](#training-process)
  10. - [Evaluation Process](#evaluation-process)
  11. - [Evaluation](#evaluation)
  12. - [Model Description](#model-description)
  13. - [Performance](#performance)
  14. - [Training Performance](#evaluation-performance)
  15. - [Inference Performance](#evaluation-performance)
  16. - [Description of Random Situation](#description-of-random-situation)
  17. - [ModelZoo Homepage](#modelzoo-homepage)
  18. ## [GhostNet Description](#contents)
  19. The GhostNet architecture is based on an Ghost module structure which generate more features from cheap operations. Based on a set of intrinsic feature maps, a series of cheap operations are applied to generate many ghost feature maps that could fully reveal information underlying intrinsic features.
  20. [Paper](https://openaccess.thecvf.com/content_CVPR_2020/papers/Han_GhostNet_More_Features_From_Cheap_Operations_CVPR_2020_paper.pdf): Kai Han, Yunhe Wang, Qi Tian, Jianyuan Guo, Chunjing Xu, Chang Xu. GhostNet: More Features from Cheap Operations. CVPR 2020.
  21. ## [Quantization Description](#contents)
  22. Quantization refers to techniques for performing computations and storing tensors at lower bitwidths than floating point precision. For 8bit quantization, we quantize the weights into [-128,127] and the activations into [0,255]. We finetune the model a few epochs after post-quantization to achieve better performance.
  23. ## [Model architecture](#contents)
  24. The overall network architecture of GhostNet is show below:
  25. [Link](https://openaccess.thecvf.com/content_CVPR_2020/papers/Han_GhostNet_More_Features_From_Cheap_Operations_CVPR_2020_paper.pdf)
  26. ## [Dataset](#contents)
  27. Dataset used: [Oxford-IIIT Pet](https://www.robots.ox.ac.uk/~vgg/data/pets/)
  28. - Dataset size: 7049 colorful images in 1000 classes
  29. - Train: 3680 images
  30. - Test: 3369 images
  31. - Data format: RGB images.
  32. - Note: Data will be processed in src/dataset.py
  33. ## [Environment Requirements](#contents)
  34. - Hardware(Ascend/GPU)
  35. - Prepare hardware environment with Ascend or GPU processor.
  36. - Framework
  37. - [MindSpore](https://www.mindspore.cn/install/en)
  38. - For more information, please check the resources below:
  39. - [MindSpore Tutorials](https://www.mindspore.cn/tutorial/training/en/master/index.html)
  40. - [MindSpore Python API](https://www.mindspore.cn/doc/api_python/en/master/index.html)
  41. ## [Script description](#contents)
  42. ### [Script and sample code](#contents)
  43. ```python
  44. ├── GhostNet
  45. ├── Readme.md # descriptions about GhostNet # shell script for evaluation with CPU, GPU or Ascend
  46. ├── src
  47. │ ├──config.py # parameter configuration
  48. │ ├──dataset.py # creating dataset
  49. │ ├──launch.py # start python script
  50. │ ├──lr_generator.py # learning rate config
  51. │ ├──ghostnet.py # GhostNet architecture
  52. │ ├──quant.py # GhostNet quantization
  53. ├── eval.py # evaluation script
  54. ├── mindspore_hub_conf.py # export model for hub
  55. ```
  56. ## [Training process](#contents)
  57. To Be Done
  58. ## [Eval process](#contents)
  59. ### Usage
  60. After installing MindSpore via the official website, you can start evaluation as follows:
  61. ### Launch
  62. ```bash
  63. # infer example
  64. Ascend: python eval.py --dataset_path ~/Pets/test.mindrecord --platform Ascend --checkpoint_path [CHECKPOINT_PATH]
  65. GPU: python eval.py --dataset_path ~/Pets/test.mindrecord --platform GPU --checkpoint_path [CHECKPOINT_PATH]
  66. ```
  67. > checkpoint can be produced in training process.
  68. ### Result
  69. ```bash
  70. result: {'acc': 0.825} ckpt= ./ghostnet_1x_pets_int8.ckpt
  71. ```
  72. ## [Model Description](#contents)
  73. ### [Performance](#contents)
  74. #### Evaluation Performance
  75. ##### GhostNet on ImageNet2012
  76. | Parameters | | |
  77. | -------------------------- | -------------------------------------- |---------------------------------- |
  78. | Model Version | GhostNet |GhostNet-int8|
  79. | uploaded Date | 09/08/2020 (month/day/year) ; | 09/08/2020 (month/day/year) |
  80. | MindSpore Version | 0.6.0-alpha |0.6.0-alpha |
  81. | Dataset | ImageNet2012 | ImageNet2012|
  82. | Parameters (M) | 5.2 | / |
  83. | FLOPs (M) | 142 | / |
  84. | Accuracy (Top1) | 73.9 | w/o finetune:72.2, w finetune:73.6 |
  85. ##### GhostNet on Oxford-IIIT Pet
  86. | Parameters | | |
  87. | -------------------------- | -------------------------------------- |---------------------------------- |
  88. | Model Version | GhostNet |GhostNet-int8|
  89. | uploaded Date | 09/08/2020 (month/day/year) ; | 09/08/2020 (month/day/year) |
  90. | MindSpore Version | 0.6.0-alpha |0.6.0-alpha |
  91. | Dataset | Oxford-IIIT Pet | Oxford-IIIT Pet|
  92. | Parameters (M) | 3.9 | / |
  93. | FLOPs (M) | 140 | / |
  94. | Accuracy (Top1) | 82.4 | w/o finetune:81.66, w finetune:82.45 |
  95. ## [Description of Random Situation](#contents)
  96. In dataset.py, we set the seed inside “create_dataset" function. We also use random seed in train.py.
  97. ## [ModelZoo Homepage](#contents)
  98. Please check the official [homepage](https://gitee.com/mindspore/mindspore/tree/master/model_zoo).