benchmark_filter.py 6.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167
  1. # Copyright (c) OpenMMLab. All rights reserved.
  2. import argparse
  3. import os
  4. import os.path as osp
  5. def parse_args():
  6. parser = argparse.ArgumentParser(description='Filter configs to train')
  7. parser.add_argument(
  8. '--basic-arch',
  9. action='store_true',
  10. help='to train models in basic arch')
  11. parser.add_argument(
  12. '--datasets', action='store_true', help='to train models in dataset')
  13. parser.add_argument(
  14. '--data-pipeline',
  15. action='store_true',
  16. help='to train models related to data pipeline, e.g. augmentations')
  17. parser.add_argument(
  18. '--nn-module',
  19. action='store_true',
  20. help='to train models related to neural network modules')
  21. parser.add_argument(
  22. '--model-options',
  23. nargs='+',
  24. help='custom options to special model benchmark')
  25. parser.add_argument(
  26. '--out',
  27. type=str,
  28. default='batch_train_list.txt',
  29. help='output path of gathered metrics to be stored')
  30. args = parser.parse_args()
  31. return args
  32. basic_arch_root = [
  33. 'atss', 'autoassign', 'cascade_rcnn', 'cascade_rpn', 'centripetalnet',
  34. 'cornernet', 'detectors', 'deformable_detr', 'detr', 'double_heads',
  35. 'dynamic_rcnn', 'faster_rcnn', 'fcos', 'foveabox', 'fp16', 'free_anchor',
  36. 'fsaf', 'gfl', 'ghm', 'grid_rcnn', 'guided_anchoring', 'htc', 'ld',
  37. 'libra_rcnn', 'mask_rcnn', 'ms_rcnn', 'nas_fcos', 'paa', 'pisa',
  38. 'point_rend', 'reppoints', 'retinanet', 'rpn', 'sabl', 'ssd', 'tridentnet',
  39. 'vfnet', 'yolact', 'yolo', 'sparse_rcnn', 'scnet', 'yolof', 'centernet'
  40. ]
  41. datasets_root = [
  42. 'wider_face', 'pascal_voc', 'cityscapes', 'lvis', 'deepfashion'
  43. ]
  44. data_pipeline_root = ['albu_example', 'instaboost']
  45. nn_module_root = [
  46. 'carafe', 'dcn', 'empirical_attention', 'gcnet', 'gn', 'gn+ws', 'hrnet',
  47. 'pafpn', 'nas_fpn', 'regnet', 'resnest', 'res2net', 'groie'
  48. ]
  49. benchmark_pool = [
  50. 'configs/albu_example/mask_rcnn_r50_fpn_albu_1x_coco.py',
  51. 'configs/atss/atss_r50_fpn_1x_coco.py',
  52. 'configs/autoassign/autoassign_r50_fpn_8x2_1x_coco.py',
  53. 'configs/carafe/mask_rcnn_r50_fpn_carafe_1x_coco.py',
  54. 'configs/cascade_rcnn/cascade_mask_rcnn_r50_fpn_1x_coco.py',
  55. 'configs/cascade_rpn/crpn_faster_rcnn_r50_caffe_fpn_1x_coco.py',
  56. 'configs/centernet/centernet_resnet18_dcnv2_140e_coco.py',
  57. 'configs/centripetalnet/'
  58. 'centripetalnet_hourglass104_mstest_16x6_210e_coco.py',
  59. 'configs/cityscapes/mask_rcnn_r50_fpn_1x_cityscapes.py',
  60. 'configs/cornernet/'
  61. 'cornernet_hourglass104_mstest_8x6_210e_coco.py',
  62. 'configs/dcn/mask_rcnn_r50_fpn_mdconv_c3-c5_1x_coco.py',
  63. 'configs/dcn/faster_rcnn_r50_fpn_dpool_1x_coco.py',
  64. 'configs/dcn/faster_rcnn_r50_fpn_mdpool_1x_coco.py',
  65. 'configs/dcn/mask_rcnn_r50_fpn_dconv_c3-c5_1x_coco.py',
  66. 'configs/deformable_detr/deformable_detr_r50_16x2_50e_coco.py',
  67. 'configs/detectors/detectors_htc_r50_1x_coco.py',
  68. 'configs/detr/detr_r50_8x2_150e_coco.py',
  69. 'configs/double_heads/dh_faster_rcnn_r50_fpn_1x_coco.py',
  70. 'configs/dynamic_rcnn/dynamic_rcnn_r50_fpn_1x_coco.py',
  71. 'configs/empirical_attention/faster_rcnn_r50_fpn_attention_1111_dcn_1x_coco.py', # noqa
  72. 'configs/faster_rcnn/faster_rcnn_r50_fpn_1x_coco.py',
  73. 'configs/faster_rcnn/faster_rcnn_r50_fpn_ohem_1x_coco.py',
  74. 'configs/faster_rcnn/faster_rcnn_r50_caffe_fpn_1x_coco.py',
  75. 'configs/faster_rcnn/faster_rcnn_r50_caffe_fpn_mstrain_1x_coco.py',
  76. 'configs/faster_rcnn/faster_rcnn_r50_caffe_dc5_mstrain_1x_coco.py',
  77. 'configs/fcos/fcos_center_r50_caffe_fpn_gn-head_4x4_1x_coco.py',
  78. 'configs/foveabox/fovea_align_r50_fpn_gn-head_4x4_2x_coco.py',
  79. 'configs/retinanet/retinanet_r50_fpn_fp16_1x_coco.py',
  80. 'configs/mask_rcnn/mask_rcnn_r50_fpn_fp16_1x_coco.py',
  81. 'configs/free_anchor/retinanet_free_anchor_r50_fpn_1x_coco.py',
  82. 'configs/fsaf/fsaf_r50_fpn_1x_coco.py',
  83. 'configs/gcnet/mask_rcnn_r50_fpn_r4_gcb_c3-c5_1x_coco.py',
  84. 'configs/gfl/gfl_r50_fpn_1x_coco.py',
  85. 'configs/ghm/retinanet_ghm_r50_fpn_1x_coco.py',
  86. 'configs/gn/mask_rcnn_r50_fpn_gn-all_2x_coco.py',
  87. 'configs/gn+ws/mask_rcnn_r50_fpn_gn_ws-all_2x_coco.py',
  88. 'configs/grid_rcnn/grid_rcnn_r50_fpn_gn-head_2x_coco.py',
  89. 'configs/groie/faster_rcnn_r50_fpn_groie_1x_coco.py',
  90. 'configs/guided_anchoring/ga_faster_r50_caffe_fpn_1x_coco.py',
  91. 'configs/hrnet/mask_rcnn_hrnetv2p_w18_1x_coco.py',
  92. 'configs/htc/htc_r50_fpn_1x_coco.py',
  93. 'configs/instaboost/mask_rcnn_r50_fpn_instaboost_4x_coco.py',
  94. 'configs/ld/ld_r18_gflv1_r101_fpn_coco_1x.py',
  95. 'configs/libra_rcnn/libra_faster_rcnn_r50_fpn_1x_coco.py',
  96. 'configs/lvis/mask_rcnn_r50_fpn_sample1e-3_mstrain_1x_lvis_v1.py',
  97. 'configs/mask_rcnn/mask_rcnn_r50_caffe_fpn_mstrain-poly_1x_coco.py',
  98. 'configs/ms_rcnn/ms_rcnn_r50_caffe_fpn_1x_coco.py',
  99. 'configs/nas_fcos/nas_fcos_nashead_r50_caffe_fpn_gn-head_4x4_1x_coco.py',
  100. 'configs/nas_fpn/retinanet_r50_nasfpn_crop640_50e_coco.py',
  101. 'configs/paa/paa_r50_fpn_1x_coco.py',
  102. 'configs/pafpn/faster_rcnn_r50_pafpn_1x_coco.py',
  103. 'configs/pisa/pisa_mask_rcnn_r50_fpn_1x_coco.py',
  104. 'configs/point_rend/point_rend_r50_caffe_fpn_mstrain_1x_coco.py',
  105. 'configs/regnet/mask_rcnn_regnetx-3.2GF_fpn_1x_coco.py',
  106. 'configs/reppoints/reppoints_moment_r50_fpn_gn-neck+head_1x_coco.py',
  107. 'configs/res2net/faster_rcnn_r2_101_fpn_2x_coco.py',
  108. 'configs/resnest/'
  109. 'mask_rcnn_s50_fpn_syncbn-backbone+head_mstrain_1x_coco.py',
  110. 'configs/retinanet/retinanet_r50_caffe_fpn_1x_coco.py',
  111. 'configs/rpn/rpn_r50_fpn_1x_coco.py',
  112. 'configs/sabl/sabl_retinanet_r50_fpn_1x_coco.py',
  113. 'configs/ssd/ssd300_coco.py',
  114. 'configs/tridentnet/tridentnet_r50_caffe_1x_coco.py',
  115. 'configs/vfnet/vfnet_r50_fpn_1x_coco.py',
  116. 'configs/yolact/yolact_r50_1x8_coco.py',
  117. 'configs/yolo/yolov3_d53_320_273e_coco.py',
  118. 'configs/sparse_rcnn/sparse_rcnn_r50_fpn_1x_coco.py',
  119. 'configs/scnet/scnet_r50_fpn_1x_coco.py',
  120. 'configs/yolof/yolof_r50_c5_8x8_1x_coco.py',
  121. ]
  122. def main():
  123. args = parse_args()
  124. benchmark_type = []
  125. if args.basic_arch:
  126. benchmark_type += basic_arch_root
  127. if args.datasets:
  128. benchmark_type += datasets_root
  129. if args.data_pipeline:
  130. benchmark_type += data_pipeline_root
  131. if args.nn_module:
  132. benchmark_type += nn_module_root
  133. special_model = args.model_options
  134. if special_model is not None:
  135. benchmark_type += special_model
  136. config_dpath = 'configs/'
  137. benchmark_configs = []
  138. for cfg_root in benchmark_type:
  139. cfg_dir = osp.join(config_dpath, cfg_root)
  140. configs = os.scandir(cfg_dir)
  141. for cfg in configs:
  142. config_path = osp.join(cfg_dir, cfg.name)
  143. if (config_path in benchmark_pool
  144. and config_path not in benchmark_configs):
  145. benchmark_configs.append(config_path)
  146. print(f'Totally found {len(benchmark_configs)} configs to benchmark')
  147. with open(args.out, 'w') as f:
  148. for config in benchmark_configs:
  149. f.write(config + '\n')
  150. if __name__ == '__main__':
  151. main()