rtmdet_nano_320-8xb32_hand.py 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171
  1. _base_ = 'mmdet::rtmdet/rtmdet_l_8xb32-300e_coco.py'
  2. input_shape = 320
  3. model = dict(
  4. backbone=dict(
  5. deepen_factor=0.33,
  6. widen_factor=0.25,
  7. use_depthwise=True,
  8. ),
  9. neck=dict(
  10. in_channels=[64, 128, 256],
  11. out_channels=64,
  12. num_csp_blocks=1,
  13. use_depthwise=True,
  14. ),
  15. bbox_head=dict(
  16. in_channels=64,
  17. feat_channels=64,
  18. share_conv=False,
  19. exp_on_reg=False,
  20. use_depthwise=True,
  21. num_classes=1),
  22. test_cfg=dict(
  23. nms_pre=1000,
  24. min_bbox_size=0,
  25. score_thr=0.05,
  26. nms=dict(type='nms', iou_threshold=0.6),
  27. max_per_img=100))
  28. # file_client_args = dict(
  29. # backend='petrel',
  30. # path_mapping=dict({'data/': 's3://openmmlab/datasets/'}))
  31. train_pipeline = [
  32. dict(type='LoadImageFromFile'),
  33. dict(type='LoadAnnotations', with_bbox=True),
  34. dict(
  35. type='CachedMosaic',
  36. img_scale=(input_shape, input_shape),
  37. pad_val=114.0,
  38. max_cached_images=20,
  39. random_pop=False),
  40. dict(
  41. type='RandomResize',
  42. scale=(input_shape * 2, input_shape * 2),
  43. ratio_range=(0.5, 1.5),
  44. keep_ratio=True),
  45. dict(type='RandomCrop', crop_size=(input_shape, input_shape)),
  46. dict(type='YOLOXHSVRandomAug'),
  47. dict(type='RandomFlip', prob=0.5),
  48. dict(
  49. type='Pad',
  50. size=(input_shape, input_shape),
  51. pad_val=dict(img=(114, 114, 114))),
  52. dict(type='PackDetInputs')
  53. ]
  54. train_pipeline_stage2 = [
  55. dict(type='LoadImageFromFile'),
  56. dict(type='LoadAnnotations', with_bbox=True),
  57. dict(
  58. type='RandomResize',
  59. scale=(input_shape, input_shape),
  60. ratio_range=(0.5, 1.5),
  61. keep_ratio=True),
  62. dict(type='RandomCrop', crop_size=(input_shape, input_shape)),
  63. dict(type='YOLOXHSVRandomAug'),
  64. dict(type='RandomFlip', prob=0.5),
  65. dict(
  66. type='Pad',
  67. size=(input_shape, input_shape),
  68. pad_val=dict(img=(114, 114, 114))),
  69. dict(type='PackDetInputs')
  70. ]
  71. test_pipeline = [
  72. dict(type='LoadImageFromFile'),
  73. dict(type='Resize', scale=(input_shape, input_shape), keep_ratio=True),
  74. dict(
  75. type='Pad',
  76. size=(input_shape, input_shape),
  77. pad_val=dict(img=(114, 114, 114))),
  78. dict(
  79. type='PackDetInputs',
  80. meta_keys=('img_id', 'img_path', 'ori_shape', 'img_shape',
  81. 'scale_factor'))
  82. ]
  83. data_mode = 'topdown'
  84. data_root = 'data/'
  85. train_dataset = dict(
  86. _delete_=True,
  87. type='ConcatDataset',
  88. datasets=[
  89. dict(
  90. type='mmpose.OneHand10KDataset',
  91. data_root=data_root,
  92. data_mode=data_mode,
  93. pipeline=train_pipeline,
  94. ann_file='onehand10k/annotations/onehand10k_train.json',
  95. data_prefix=dict(img='pose/OneHand10K/')),
  96. dict(
  97. type='mmpose.FreiHandDataset',
  98. data_root=data_root,
  99. data_mode=data_mode,
  100. pipeline=train_pipeline,
  101. ann_file='freihand/annotations/freihand_train.json',
  102. data_prefix=dict(img='pose/FreiHand/')),
  103. dict(
  104. type='mmpose.Rhd2DDataset',
  105. data_root=data_root,
  106. data_mode=data_mode,
  107. pipeline=train_pipeline,
  108. ann_file='rhd/annotations/rhd_train.json',
  109. data_prefix=dict(img='pose/RHD/')),
  110. dict(
  111. type='mmpose.HalpeHandDataset',
  112. data_root=data_root,
  113. data_mode=data_mode,
  114. pipeline=train_pipeline,
  115. ann_file='halpe/annotations/halpe_train_v1.json',
  116. data_prefix=dict(
  117. img='pose/Halpe/hico_20160224_det/images/train2015/') # noqa
  118. )
  119. ],
  120. ignore_keys=[
  121. 'CLASSES', 'dataset_keypoint_weights', 'dataset_name', 'flip_indices',
  122. 'flip_pairs', 'keypoint_colors', 'keypoint_id2name',
  123. 'keypoint_name2id', 'lower_body_ids', 'num_keypoints',
  124. 'num_skeleton_links', 'sigmas', 'skeleton_link_colors',
  125. 'skeleton_links', 'upper_body_ids'
  126. ],
  127. )
  128. test_dataset = dict(
  129. _delete_=True,
  130. type='mmpose.OneHand10KDataset',
  131. data_root=data_root,
  132. data_mode=data_mode,
  133. pipeline=test_pipeline,
  134. ann_file='onehand10k/annotations/onehand10k_test.json',
  135. data_prefix=dict(img='pose/OneHand10K/'),
  136. )
  137. train_dataloader = dict(dataset=train_dataset)
  138. val_dataloader = dict(dataset=test_dataset)
  139. test_dataloader = val_dataloader
  140. custom_hooks = [
  141. dict(
  142. type='EMAHook',
  143. ema_type='ExpMomentumEMA',
  144. momentum=0.0002,
  145. update_buffers=True,
  146. priority=49),
  147. dict(
  148. type='PipelineSwitchHook',
  149. switch_epoch=280,
  150. switch_pipeline=train_pipeline_stage2)
  151. ]
  152. val_evaluator = dict(
  153. type='CocoMetric',
  154. ann_file=data_root + 'onehand10k/annotations/onehand10k_test.json',
  155. metric='bbox',
  156. format_only=False)
  157. test_evaluator = val_evaluator
  158. train_cfg = dict(val_interval=1)