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

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191
  1. # Copyright 2020 Huawei Technologies Co., Ltd
  2. # Licensed under the Apache License, Version 2.0 (the "License");
  3. # you may not use this file except in compliance with the License.
  4. # You may obtain a copy of the License at
  5. # http://www.apache.org/licenses/LICENSE-2.0
  6. # Unless required by applicable law or agreed to in writing, software
  7. # distributed under the License is distributed on an "AS IS" BASIS,
  8. # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  9. # See the License for the specific language governing permissions and
  10. # limitations under the License.
  11. # ============================================================================
  12. from enum import IntEnum
  13. class JointType(IntEnum):
  14. Nose = 0
  15. Neck = 1
  16. RightShoulder = 2
  17. RightElbow = 3
  18. RightHand = 4
  19. LeftShoulder = 5
  20. LeftElbow = 6
  21. LeftHand = 7
  22. RightWaist = 8
  23. RightKnee = 9
  24. RightFoot = 10
  25. LeftWaist = 11
  26. LeftKnee = 12
  27. LeftFoot = 13
  28. RightEye = 14
  29. LeftEye = 15
  30. RightEar = 16
  31. LeftEar = 17
  32. params = {
  33. # paths
  34. 'data_dir': './dataset',
  35. 'save_model_path': './checkpoints/',
  36. 'load_pretrain': False,
  37. 'pretrained_model_path': "",
  38. # train type
  39. 'train_type': 'fix_loss_scale', # chose in ['clip_grad', 'fix_loss_scale']
  40. 'train_type_NP': 'clip_grad',
  41. # vgg bn
  42. 'vgg_with_bn': False,
  43. 'vgg_path': './vgg_model/vgg19-0-97_5004.ckpt',
  44. # if clip_grad
  45. 'GRADIENT_CLIP_TYPE': 1,
  46. 'GRADIENT_CLIP_VALUE': 10.0,
  47. # optimizer and lr
  48. 'optimizer': "Adam", # chose in ['Momentum', 'Adam']
  49. 'optimizer_NP': "Momentum",
  50. 'group_params': True,
  51. 'group_params_NP': False,
  52. 'lr': 1e-4,
  53. 'lr_type': 'default', # chose in ["default", "cosine"]
  54. 'lr_gamma': 0.1, # if default
  55. 'lr_steps': '100000,200000,250000', # if default
  56. 'lr_steps_NP': '250000,300000', # if default
  57. 'warmup_epoch': 5, # if cosine
  58. 'max_epoch_train': 60,
  59. 'max_epoch_train_NP': 80,
  60. 'loss_scale': 16384,
  61. # default param
  62. 'batch_size': 10,
  63. 'min_keypoints': 5,
  64. 'min_area': 32 * 32,
  65. 'insize': 368,
  66. 'downscale': 8,
  67. 'paf_sigma': 8,
  68. 'heatmap_sigma': 7,
  69. 'eva_num': 100,
  70. 'keep_checkpoint_max': 1,
  71. 'log_interval': 100,
  72. 'ckpt_interval': 5304,
  73. 'min_box_size': 64,
  74. 'max_box_size': 512,
  75. 'min_scale': 0.5,
  76. 'max_scale': 2.0,
  77. 'max_rotate_degree': 40,
  78. 'center_perterb_max': 40,
  79. # inference params
  80. 'inference_img_size': 368,
  81. 'inference_scales': [0.5, 1, 1.5, 2],
  82. # 'inference_scales': [1.0],
  83. 'heatmap_size': 320,
  84. 'gaussian_sigma': 2.5,
  85. 'ksize': 17,
  86. 'n_integ_points': 10,
  87. 'n_integ_points_thresh': 8,
  88. 'heatmap_peak_thresh': 0.05,
  89. 'inner_product_thresh': 0.05,
  90. 'limb_length_ratio': 1.0,
  91. 'length_penalty_value': 1,
  92. 'n_subset_limbs_thresh': 3,
  93. 'subset_score_thresh': 0.2,
  94. 'limbs_point': [
  95. [JointType.Neck, JointType.RightWaist],
  96. [JointType.RightWaist, JointType.RightKnee],
  97. [JointType.RightKnee, JointType.RightFoot],
  98. [JointType.Neck, JointType.LeftWaist],
  99. [JointType.LeftWaist, JointType.LeftKnee],
  100. [JointType.LeftKnee, JointType.LeftFoot],
  101. [JointType.Neck, JointType.RightShoulder],
  102. [JointType.RightShoulder, JointType.RightElbow],
  103. [JointType.RightElbow, JointType.RightHand],
  104. [JointType.RightShoulder, JointType.RightEar],
  105. [JointType.Neck, JointType.LeftShoulder],
  106. [JointType.LeftShoulder, JointType.LeftElbow],
  107. [JointType.LeftElbow, JointType.LeftHand],
  108. [JointType.LeftShoulder, JointType.LeftEar],
  109. [JointType.Neck, JointType.Nose],
  110. [JointType.Nose, JointType.RightEye],
  111. [JointType.Nose, JointType.LeftEye],
  112. [JointType.RightEye, JointType.RightEar],
  113. [JointType.LeftEye, JointType.LeftEar]
  114. ],
  115. 'joint_indices': [
  116. JointType.Nose,
  117. JointType.LeftEye,
  118. JointType.RightEye,
  119. JointType.LeftEar,
  120. JointType.RightEar,
  121. JointType.LeftShoulder,
  122. JointType.RightShoulder,
  123. JointType.LeftElbow,
  124. JointType.RightElbow,
  125. JointType.LeftHand,
  126. JointType.RightHand,
  127. JointType.LeftWaist,
  128. JointType.RightWaist,
  129. JointType.LeftKnee,
  130. JointType.RightKnee,
  131. JointType.LeftFoot,
  132. JointType.RightFoot
  133. ],
  134. # face params
  135. 'face_inference_img_size': 368,
  136. 'face_heatmap_peak_thresh': 0.1,
  137. 'face_crop_scale': 1.5,
  138. 'face_line_indices': [
  139. [0, 1], [1, 2], [2, 3], [3, 4], [4, 5], [5, 6], [6, 7], [7, 8], [8, 9], [9, 10], [10, 11], [11, 12], [12, 13], [13, 14], [14, 15], [15, 16], # 轮廓
  140. [17, 18], [18, 19], [19, 20], [20, 21],
  141. [22, 23], [23, 24], [24, 25], [25, 26],
  142. [27, 28], [28, 29], [29, 30],
  143. [31, 32], [32, 33], [33, 34], [34, 35],
  144. [36, 37], [37, 38], [38, 39], [39, 40], [40, 41], [41, 36],
  145. [42, 43], [43, 44], [44, 45], [45, 46], [46, 47], [47, 42],
  146. [48, 49], [49, 50], [50, 51], [51, 52], [52, 53], [53, 54], [54, 55], [55, 56], [56, 57], [57, 58], [58, 59], [59, 48], # 唇外廓
  147. [60, 61], [61, 62], [62, 63], [63, 64], [64, 65], [65, 66], [66, 67], [67, 60]
  148. ],
  149. # hand params
  150. 'hand_inference_img_size': 368,
  151. 'hand_heatmap_peak_thresh': 0.1,
  152. 'fingers_indices': [
  153. [[0, 1], [1, 2], [2, 3], [3, 4]],
  154. [[0, 5], [5, 6], [6, 7], [7, 8]],
  155. [[0, 9], [9, 10], [10, 11], [11, 12]],
  156. [[0, 13], [13, 14], [14, 15], [15, 16]],
  157. [[0, 17], [17, 18], [18, 19], [19, 20]],
  158. ],
  159. }