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

4 years ago
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175
  1. # Contents
  2. - [SRCNN Description](#srcnn-description)
  3. - [Model Architecture](#model-architecture)
  4. - [Dataset](#dataset)
  5. - [Environment Requirements](#environment-requirements)
  6. - [Quick Start](#quick-start)
  7. - [Script Description](#script-description)
  8. - [Script and Sample Code](#script-and-sample-code)
  9. - [Script Parameters](#script-parameters)
  10. - [Training Process](#training-process)
  11. - [Evaluation Process](#evaluation-process)
  12. - [Model Description](#model-description)
  13. - [Performance](#performance)
  14. - [Training Performance](#evaluation-performance)
  15. - [Inference Performance](#evaluation-performance)
  16. - [ModelZoo Homepage](#modelzoo-homepage)
  17. # [NASNet Description](#contents)
  18. SRCNN learns an end-to-end mapping between low- and high-resolution images, with little extra pre/post-processing beyond the optimization. With a lightweight structure, the SRCNN has achieved superior performance than the state-of-the-art methods.
  19. [Paper](https://arxiv.org/pdf/1501.00092.pdf): Chao Dong, Chen Change Loy, Kaiming He, Xiaoou Tang. Image Super-Resolution Using Deep Convolutional Networks. 2014.
  20. # [Model architecture](#contents)
  21. The overall network architecture of SRCNN is show below:
  22. [Link](https://arxiv.org/pdf/1501.00092.pdf)
  23. # [Dataset](#contents)
  24. - Training Dataset
  25. - ILSVRC2013_DET_train: 395918 images, 200 classes
  26. - Evaluation Dataset
  27. - Set5: 5 images
  28. - Set14: 14 images
  29. - Set5 & Set14 download url: http://vllab.ucmerced.edu/wlai24/LapSRN/results/SR_testing_datasets.zip
  30. - BSDS200: 200 images
  31. - BSDS200 download url: http://vllab.ucmerced.edu/wlai24/LapSRN/results/SR_training_datasets.zip
  32. - Data format: RGB images.
  33. - Note: Data will be processed in src/dataset.py
  34. # [Environment Requirements](#contents)
  35. - Hardware GPU
  36. - Prepare hardware environment with GPU processor.
  37. - Framework
  38. - [MindSpore](https://www.mindspore.cn/install/en)
  39. - For more information, please check the resources below:
  40. - [MindSpore Tutorials](https://www.mindspore.cn/tutorial/training/en/master/index.html)
  41. - [MindSpore Python API](https://www.mindspore.cn/doc/api_python/en/master/index.html)
  42. # [Script description](#contents)
  43. ## [Script and sample code](#contents)
  44. ```python
  45. .
  46. └─srcnn
  47. ├─README.md
  48. ├─scripts
  49. ├─run_distribute_train_gpu.sh # launch distributed training with gpu platform
  50. └─run_eval_gpu.sh # launch evaluating with gpu platform
  51. ├─src
  52. ├─config.py # parameter configuration
  53. ├─dataset.py # data preprocessing
  54. ├─metric.py # accuracy metric
  55. ├─utils.py # some functions which is commonly used
  56. ├─srcnn.py # network definition
  57. ├─create_dataset.py # generating mindrecord training dataset
  58. ├─eval.py # eval net
  59. └─train.py # train net
  60. ```
  61. ## [Script Parameters](#contents)
  62. Parameters for both training and evaluating can be set in config.py.
  63. ```python
  64. 'lr': 1e-4, # learning rate
  65. 'patch_size': 33, # patch_size
  66. 'stride': 99, # stride
  67. 'scale': 2, # image scale
  68. 'epoch_size': 20, # total epoch numbers
  69. 'batch_size': 16, # input batchsize
  70. 'save_checkpoint': True, # whether saving ckpt file
  71. 'keep_checkpoint_max': 10, # max numbers to keep checkpoints
  72. 'save_checkpoint_path': 'outputs/' # save checkpoint path
  73. ```
  74. ## [Training Process](#contents)
  75. ### Dataset
  76. To create dataset, download the training dataset firstly and then convert them to mindrecord files. We can deal with it as follows.
  77. ```shell
  78. python create_dataset.py --src_folder=/dataset/ILSVRC2013_DET_train --output_folder=/dataset/mindrecord_dir
  79. ```
  80. ### Usage
  81. ```bash
  82. GPU:
  83. sh run_distribute_train_gpu.sh DEVICE_NUM VISIABLE_DEVICES(0,1,2,3,4,5,6,7) DATASET_PATH
  84. ```
  85. ### Launch
  86. ```bash
  87. # distributed training example(8p) for GPU
  88. sh run_distribute_train_gpu.sh 8 0,1,2,3,4,5,6,7 /dataset/train
  89. # standalone training example for GPU
  90. sh run_distribute_train_gpu.sh 1 0 /dataset/train
  91. ```
  92. You can find checkpoint file together with result in log.
  93. ## [Evaluation Process](#contents)
  94. ### Usage
  95. ```bash
  96. # Evaluation
  97. sh run_eval_gpu.sh DEVICE_ID DATASET_PATH CHECKPOINT_PATH
  98. ```
  99. ### Launch
  100. ```bash
  101. # Evaluation with checkpoint
  102. sh run_eval_gpu.sh 1 /dataset/val /ckpt_dir/srcnn-20_*.ckpt
  103. ```
  104. ### Result
  105. Evaluation result will be stored in the scripts path. Under this, you can find result like the followings in log.
  106. result {'PSNR': 36.72421418219669}
  107. # [Model description](#contents)
  108. ## [Performance](#contents)
  109. ### Training Performance
  110. | Parameters | SRCNN |
  111. | -------------------------- | ------------------------- |
  112. | Resource | NV PCIE V100-32G |
  113. | uploaded Date | 03/02/2021 |
  114. | MindSpore Version | master |
  115. | Dataset | ImageNet2013 scale:2 |
  116. | Training Parameters | src/config.py |
  117. | Optimizer | Adam |
  118. | Loss Function | MSELoss |
  119. | Loss | 0.00179 |
  120. | Total time | 1 h 8ps |
  121. | Checkpoint for Fine tuning | 671 K(.ckpt file) |
  122. ### Inference Performance
  123. | Parameters | |
  124. | -------------------------- | -------------------------- |
  125. | Resource | NV PCIE V100-32G |
  126. | uploaded Date | 03/02/2021 |
  127. | MindSpore Version | master |
  128. | Dataset | Set5/Set14/BSDS200 scale:2 |
  129. | batch_size | 1 |
  130. | PSNR | 36.72/32.58/33.81 |
  131. # [ModelZoo Homepage](#contents)
  132. Please check the official [homepage](https://gitee.com/mindspore/mindspore/tree/master/model_zoo).