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.

config.py 2.8 kB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103
  1. # Copyright 2020 Huawei Technologies Co., Ltd
  2. #
  3. # Licensed under the Apache License, Version 2.0 (the "License");
  4. # you may not use this file except in compliance with the License.
  5. # You may obtain a copy of the License at
  6. #
  7. # http://www.apache.org/licenses/LICENSE-2.0
  8. #
  9. # Unless required by applicable law or agreed to in writing, software
  10. # distributed under the License is distributed on an "AS IS" BASIS,
  11. # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  12. # See the License for the specific language governing permissions and
  13. # limitations under the License.
  14. # ============================================================================
  15. """
  16. network config setting, will be used in train.py and eval.py
  17. """
  18. from easydict import EasyDict as ed
  19. # config for resent50, cifar10
  20. config1 = ed({
  21. "class_num": 10,
  22. "batch_size": 32,
  23. "loss_scale": 1024,
  24. "momentum": 0.9,
  25. "weight_decay": 1e-4,
  26. "epoch_size": 90,
  27. "pretrain_epoch_size": 0,
  28. "save_checkpoint": True,
  29. "save_checkpoint_epochs": 5,
  30. "keep_checkpoint_max": 10,
  31. "save_checkpoint_path": "./",
  32. "warmup_epochs": 5,
  33. "lr_decay_mode": "poly",
  34. "lr_init": 0.01,
  35. "lr_end": 0.00001,
  36. "lr_max": 0.1
  37. })
  38. # config for resnet50, imagenet2012
  39. config2 = ed({
  40. "class_num": 1001,
  41. "batch_size": 256,
  42. "loss_scale": 1024,
  43. "momentum": 0.9,
  44. "weight_decay": 1e-4,
  45. "epoch_size": 90,
  46. "pretrain_epoch_size": 0,
  47. "save_checkpoint": True,
  48. "save_checkpoint_epochs": 5,
  49. "keep_checkpoint_max": 10,
  50. "save_checkpoint_path": "./",
  51. "warmup_epochs": 0,
  52. "lr_decay_mode": "linear",
  53. "use_label_smooth": True,
  54. "label_smooth_factor": 0.1,
  55. "lr_init": 0,
  56. "lr_max": 0.8,
  57. "lr_end": 0.0
  58. })
  59. # config for resent101, imagenet2012
  60. config3 = ed({
  61. "class_num": 1001,
  62. "batch_size": 32,
  63. "loss_scale": 1024,
  64. "momentum": 0.9,
  65. "weight_decay": 1e-4,
  66. "epoch_size": 120,
  67. "pretrain_epoch_size": 0,
  68. "save_checkpoint": True,
  69. "save_checkpoint_epochs": 5,
  70. "keep_checkpoint_max": 10,
  71. "save_checkpoint_path": "./",
  72. "warmup_epochs": 0,
  73. "lr_decay_mode": "cosine",
  74. "use_label_smooth": True,
  75. "label_smooth_factor": 0.1,
  76. "lr": 0.1
  77. })
  78. # config for se-resnet50, imagenet2012
  79. config4 = ed({
  80. "class_num": 1001,
  81. "batch_size": 32,
  82. "loss_scale": 1024,
  83. "momentum": 0.9,
  84. "weight_decay": 1e-4,
  85. "epoch_size": 28,
  86. "train_epoch_size": 24,
  87. "pretrain_epoch_size": 0,
  88. "save_checkpoint": True,
  89. "save_checkpoint_epochs": 4,
  90. "keep_checkpoint_max": 10,
  91. "save_checkpoint_path": "./",
  92. "warmup_epochs": 3,
  93. "lr_decay_mode": "cosine",
  94. "use_label_smooth": True,
  95. "label_smooth_factor": 0.1,
  96. "lr_init": 0.0,
  97. "lr_max": 0.3,
  98. "lr_end": 0.0001
  99. })