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

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148
  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. """network config setting, will be used in train.py and eval.py."""
  16. from easydict import EasyDict as edict
  17. config_base = edict({
  18. # dataset related
  19. 'data_dir': "your_dataset_path",
  20. 'num_classes': 1,
  21. 'per_batch_size': 192,
  22. # network structure related
  23. 'backbone': 'r100',
  24. 'use_se': 1,
  25. 'emb_size': 512,
  26. 'act_type': 'relu',
  27. 'fp16': 1,
  28. 'pre_bn': 1,
  29. 'inference': 0,
  30. 'use_drop': 1,
  31. 'nc_16': 1,
  32. # loss related
  33. 'margin_a': 1.0,
  34. 'margin_b': 0.2,
  35. 'margin_m': 0.3,
  36. 'margin_s': 64,
  37. # optimizer related
  38. 'lr': 0.4,
  39. 'lr_scale': 1,
  40. 'lr_epochs': '8,14,18',
  41. 'weight_decay': 0.0002,
  42. 'momentum': 0.9,
  43. 'max_epoch': 20,
  44. 'pretrained': '',
  45. 'warmup_epochs': 2,
  46. # distributed parameter
  47. 'is_distributed': 1,
  48. 'local_rank': 0,
  49. 'world_size': 1,
  50. 'model_parallel': 0,
  51. # logging related
  52. 'log_interval': 100,
  53. 'ckpt_path': 'outputs',
  54. 'max_ckpts': -1,
  55. 'dynamic_init_loss_scale': 65536,
  56. 'ckpt_steps': 1000
  57. })
  58. config_beta = edict({
  59. # dataset related
  60. 'data_dir': "your_dataset_path",
  61. 'num_classes': 1,
  62. 'per_batch_size': 192,
  63. # network structure related
  64. 'backbone': 'r100',
  65. 'use_se': 0,
  66. 'emb_size': 256,
  67. 'act_type': 'relu',
  68. 'fp16': 1,
  69. 'pre_bn': 0,
  70. 'inference': 0,
  71. 'use_drop': 1,
  72. 'nc_16': 1,
  73. # loss related
  74. 'margin_a': 1.0,
  75. 'margin_b': 0.2,
  76. 'margin_m': 0.3,
  77. 'margin_s': 64,
  78. # optimizer related
  79. 'lr': 0.04,
  80. 'lr_scale': 1,
  81. 'lr_epochs': '8,14,18',
  82. 'weight_decay': 0.0002,
  83. 'momentum': 0.9,
  84. 'max_epoch': 20,
  85. 'pretrained': 'your_pretrained_model',
  86. 'warmup_epochs': 2,
  87. # distributed parameter
  88. 'is_distributed': 1,
  89. 'local_rank': 0,
  90. 'world_size': 1,
  91. 'model_parallel': 0,
  92. # logging related
  93. 'log_interval': 100,
  94. 'ckpt_path': 'outputs',
  95. 'max_ckpts': -1,
  96. 'dynamic_init_loss_scale': 65536,
  97. 'ckpt_steps': 1000
  98. })
  99. config_inference = edict({
  100. # distributed parameter
  101. 'is_distributed': 0,
  102. 'local_rank': 0,
  103. 'world_size': 1,
  104. # test weight
  105. 'weight': 'your_test_model',
  106. 'test_dir': 'your_dataset_path',
  107. # model define
  108. 'backbone': 'r100',
  109. 'use_se': 0,
  110. 'emb_size': 256,
  111. 'act_type': 'relu',
  112. 'fp16': 1,
  113. 'pre_bn': 0,
  114. 'inference': 1,
  115. 'use_drop': 0,
  116. # test and dis batch size
  117. 'test_batch_size': 128,
  118. 'dis_batch_size': 512,
  119. # log
  120. 'log_interval': 100,
  121. 'ckpt_path': 'outputs/models',
  122. # test and dis image list
  123. 'test_img_predix': '',
  124. 'test_img_list': '',
  125. 'dis_img_predix': '',
  126. 'dis_img_list': ''
  127. })