├── Classification ├── cifar-10 │ └── vision-transformers-cifar10 │ │ ├── README.md │ │ ├── models │ │ ├── __init__.py │ │ ├── vit.py │ │ └── vit_small.py │ │ ├── randomaug.py │ │ ├── requirements.txt │ │ ├── train_cifar10.py │ │ ├── train_cifar10_denoise.py │ │ └── utils.py └── imagenet │ └── Swin-Transformer │ ├── config.py │ ├── configs │ └── swinv2 │ │ ├── swinv2_base_patch4_window12_192_22k.yaml │ │ ├── swinv2_base_patch4_window12to16_192to256_22kto1k_ft.yaml │ │ ├── swinv2_base_patch4_window12to24_192to384_22kto1k_ft.yaml │ │ ├── swinv2_base_patch4_window16_256.yaml │ │ ├── swinv2_base_patch4_window8_256.yaml │ │ ├── swinv2_large_patch4_window12_192_22k.yaml │ │ ├── swinv2_large_patch4_window12to16_192to256_22kto1k_ft.yaml │ │ ├── swinv2_large_patch4_window12to24_192to384_22kto1k_ft.yaml │ │ ├── swinv2_small_patch4_window16_256.yaml │ │ ├── swinv2_small_patch4_window8_256.yaml │ │ ├── swinv2_tiny_patch4_window16_256.yaml │ │ └── swinv2_tiny_patch4_window8_256.yaml │ ├── data │ ├── __init__.py │ ├── build.py │ ├── cached_image_folder.py │ ├── data_simmim_ft.py │ ├── data_simmim_pt.py │ ├── imagenet22k_dataset.py │ ├── map22kto1k.txt │ ├── samplers.py │ └── zipreader.py │ ├── kernels │ └── window_process │ │ ├── setup.py │ │ ├── swin_window_process.cpp │ │ ├── swin_window_process_kernel.cu │ │ ├── unit_test.py │ │ └── window_process.py │ ├── logger.py │ ├── lr_scheduler.py │ ├── main.py │ ├── models │ ├── __init__.py │ ├── build.py │ └── swin_transformer_v2.py │ ├── optimizer.py │ ├── readme.md │ ├── utils.py │ └── utils_simmim.py ├── Detection └── mmdetection │ ├── README.md │ ├── configs │ ├── _base_ │ │ ├── datasets │ │ │ ├── ade20k_instance.py │ │ │ ├── ade20k_panoptic.py │ │ │ ├── ade20k_semantic.py │ │ │ ├── cityscapes_detection.py │ │ │ ├── cityscapes_instance.py │ │ │ ├── coco_caption.py │ │ │ ├── coco_detection.py │ │ │ ├── coco_instance.py │ │ │ ├── coco_instance_semantic.py │ │ │ ├── coco_panoptic.py │ │ │ ├── coco_semantic.py │ │ │ ├── deepfashion.py │ │ │ ├── dsdl.py │ │ │ ├── isaid_instance.py │ │ │ ├── lvis_v0.5_instance.py │ │ │ ├── lvis_v1_instance.py │ │ │ ├── mot_challenge.py │ │ │ ├── mot_challenge_det.py │ │ │ ├── mot_challenge_reid.py │ │ │ ├── objects365v1_detection.py │ │ │ ├── objects365v2_detection.py │ │ │ ├── openimages_detection.py │ │ │ ├── refcoco+.py │ │ │ ├── refcoco.py │ │ │ ├── refcocog.py │ │ │ ├── semi_coco_detection.py │ │ │ ├── v3det.py │ │ │ ├── voc0712.py │ │ │ ├── wider_face.py │ │ │ └── youtube_vis.py │ │ ├── default_runtime.py │ │ ├── models │ │ │ ├── cascade-mask-rcnn_r50_fpn.py │ │ │ ├── cascade-rcnn_r50_fpn.py │ │ │ ├── fast-rcnn_r50_fpn.py │ │ │ ├── faster-rcnn_r50-caffe-c4.py │ │ │ ├── faster-rcnn_r50-caffe-dc5.py │ │ │ ├── faster-rcnn_r50_fpn.py │ │ │ ├── mask-rcnn_r50-caffe-c4.py │ │ │ ├── mask-rcnn_r50_fpn.py │ │ │ ├── retinanet_r50_fpn.py │ │ │ ├── rpn_r50-caffe-c4.py │ │ │ ├── rpn_r50_fpn.py │ │ │ └── ssd300.py │ │ └── schedules │ │ │ ├── schedule_1x.py │ │ │ ├── schedule_20e.py │ │ │ └── schedule_2x.py │ ├── mask_rcnn │ │ ├── README.md │ │ ├── mask-rcnn_r101-caffe_fpn_1x_coco.py │ │ ├── mask-rcnn_r101-caffe_fpn_ms-poly-3x_coco.py │ │ ├── mask-rcnn_r101_fpn_1x_coco.py │ │ ├── mask-rcnn_r101_fpn_2x_coco.py │ │ ├── mask-rcnn_r101_fpn_8xb8-amp-lsj-200e_coco.py │ │ ├── mask-rcnn_r101_fpn_ms-poly-3x_coco.py │ │ ├── mask-rcnn_r18_fpn_8xb8-amp-lsj-200e_coco.py │ │ ├── mask-rcnn_r50-caffe-c4_1x_coco.py │ │ ├── mask-rcnn_r50-caffe_fpn_1x_coco.py │ │ ├── mask-rcnn_r50-caffe_fpn_ms-1x_coco.py │ │ ├── mask-rcnn_r50-caffe_fpn_ms-poly-1x_coco.py │ │ ├── mask-rcnn_r50-caffe_fpn_ms-poly-2x_coco.py │ │ ├── mask-rcnn_r50-caffe_fpn_ms-poly-3x_coco.py │ │ ├── mask-rcnn_r50-caffe_fpn_poly-1x_coco_v1.py │ │ ├── mask-rcnn_r50_fpn_1x-wandb_coco.py │ │ ├── mask-rcnn_r50_fpn_1x_coco.py │ │ ├── mask-rcnn_r50_fpn_2x_coco.py │ │ ├── mask-rcnn_r50_fpn_8xb8-amp-lsj-200e_coco.py │ │ ├── mask-rcnn_r50_fpn_amp-1x_coco.py │ │ ├── mask-rcnn_r50_fpn_ms-poly-3x_coco.py │ │ ├── mask-rcnn_r50_fpn_poly-1x_coco.py │ │ ├── mask-rcnn_x101-32x4d_fpn_1x_coco.py │ │ ├── mask-rcnn_x101-32x4d_fpn_2x_coco.py │ │ ├── mask-rcnn_x101-32x4d_fpn_ms-poly-3x_coco.py │ │ ├── mask-rcnn_x101-32x8d_fpn_1x_coco.py │ │ ├── mask-rcnn_x101-32x8d_fpn_ms-poly-1x_coco.py │ │ ├── mask-rcnn_x101-32x8d_fpn_ms-poly-3x_coco.py │ │ ├── mask-rcnn_x101-64x4d_fpn_1x_coco.py │ │ ├── mask-rcnn_x101-64x4d_fpn_2x_coco.py │ │ ├── mask-rcnn_x101-64x4d_fpn_ms-poly_3x_coco.py │ │ └── metafile.yml │ └── swin │ │ ├── README.md │ │ ├── mask-rcnn_swin-s-p4-w7_fpn_amp-ms-crop-3x_coco.py │ │ ├── mask-rcnn_swin-t-p4-w7_fpn_1x_coco.py │ │ ├── mask-rcnn_swin-t-p4-w7_fpn_amp-ms-crop-3x_coco.py │ │ ├── mask-rcnn_swin-t-p4-w7_fpn_ms-crop-3x_coco.py │ │ ├── metafile.yml │ │ └── retinanet_swin-t-p4-w7_fpn_1x_coco.py │ ├── demo │ ├── MMDet_InstanceSeg_Tutorial.ipynb │ ├── MMDet_Tutorial.ipynb │ ├── create_result_gif.py │ ├── demo.jpg │ ├── demo.mp4 │ ├── demo_mot.mp4 │ ├── demo_multi_model.py │ ├── image_demo.py │ ├── inference_demo.ipynb │ ├── large_image.jpg │ ├── large_image_demo.py │ ├── mot_demo.py │ ├── video_demo.py │ ├── video_gpuaccel_demo.py │ └── webcam_demo.py │ ├── docker │ ├── Dockerfile │ ├── serve │ │ ├── Dockerfile │ │ ├── config.properties │ │ └── entrypoint.sh │ └── serve_cn │ │ └── Dockerfile │ ├── mmdet │ ├── __init__.py │ ├── apis │ │ ├── __init__.py │ │ ├── det_inferencer.py │ │ └── inference.py │ ├── configs │ │ ├── _base_ │ │ │ ├── datasets │ │ │ │ ├── coco_detection.py │ │ │ │ ├── coco_instance.py │ │ │ │ ├── coco_instance_semantic.py │ │ │ │ ├── coco_panoptic.py │ │ │ │ └── mot_challenge.py │ │ │ ├── default_runtime.py │ │ │ ├── models │ │ │ │ ├── cascade_mask_rcnn_r50_fpn.py │ │ │ │ ├── cascade_rcnn_r50_fpn.py │ │ │ │ ├── faster_rcnn_r50_fpn.py │ │ │ │ ├── mask_rcnn_r50_caffe_c4.py │ │ │ │ ├── mask_rcnn_r50_fpn.py │ │ │ │ └── retinanet_r50_fpn.py │ │ │ └── schedules │ │ │ │ ├── schedule_1x.py │ │ │ │ └── schedule_2x.py │ │ ├── cascade_rcnn │ │ │ ├── cascade_mask_rcnn_r50_fpn_1x_coco.py │ │ │ └── cascade_rcnn_r50_fpn_1x_coco.py │ │ ├── common │ │ │ ├── lsj_100e_coco_detection.py │ │ │ ├── lsj_100e_coco_instance.py │ │ │ ├── lsj_200e_coco_detection.py │ │ │ ├── lsj_200e_coco_instance.py │ │ │ ├── ms_3x_coco.py │ │ │ ├── ms_3x_coco_instance.py │ │ │ ├── ms_90k_coco.py │ │ │ ├── ms_poly_3x_coco_instance.py │ │ │ ├── ms_poly_90k_coco_instance.py │ │ │ ├── ssj_270_coco_instance.py │ │ │ └── ssj_scp_270k_coco_instance.py │ │ ├── deformable_detr │ │ │ ├── deformable_detr_r50_16xb2_50e_coco.py │ │ │ ├── deformable_detr_refine_r50_16xb2_50e_coco.py │ │ │ └── deformable_detr_refine_twostage_r50_16xb2_50e_coco.py │ │ ├── detr │ │ │ ├── detr_r101_8xb2_500e_coco.py │ │ │ ├── detr_r18_8xb2_500e_coco.py │ │ │ ├── detr_r50_8xb2_150e_coco.py │ │ │ └── detr_r50_8xb2_500e_coco.py │ │ ├── dino │ │ │ ├── dino_4scale_r50_8xb2_12e_coco.py │ │ │ ├── dino_4scale_r50_8xb2_24e_coco.py │ │ │ ├── dino_4scale_r50_8xb2_36e_coco.py │ │ │ ├── dino_4scale_r50_improved_8xb2_12e_coco.py │ │ │ ├── dino_5scale_swin_l_8xb2_12e_coco.py │ │ │ └── dino_5scale_swin_l_8xb2_36e_coco.py │ │ ├── faster_rcnn │ │ │ └── faster_rcnn_r50_fpn_1x_coco.py │ │ ├── mask_rcnn │ │ │ ├── mask_rcnn_r101_caffe_fpn_1x_coco.py │ │ │ ├── mask_rcnn_r101_caffe_fpn_ms_poly_3x_coco.py │ │ │ ├── mask_rcnn_r101_fpn_1x_coco.py │ │ │ ├── mask_rcnn_r101_fpn_2x_coco.py │ │ │ ├── mask_rcnn_r101_fpn_8xb8_amp_lsj_200e_coco.py │ │ │ ├── mask_rcnn_r101_fpn_ms_poly_3x_coco.py │ │ │ ├── mask_rcnn_r18_fpn_8xb8_amp_lsj_200e_coco.py │ │ │ ├── mask_rcnn_r50_caffe_c4_1x_coco.py │ │ │ ├── mask_rcnn_r50_caffe_fpn_1x_coco.py │ │ │ ├── mask_rcnn_r50_caffe_fpn_ms_1x_coco.py │ │ │ ├── mask_rcnn_r50_caffe_fpn_ms_poly_1x_coco.py │ │ │ ├── mask_rcnn_r50_caffe_fpn_ms_poly_2x_coco.py │ │ │ ├── mask_rcnn_r50_caffe_fpn_ms_poly_3x_coco.py │ │ │ ├── mask_rcnn_r50_caffe_fpn_poly_1x_coco_v1.py │ │ │ ├── mask_rcnn_r50_fpn_1x_coco.py │ │ │ ├── mask_rcnn_r50_fpn_1x_wandb_coco.py │ │ │ ├── mask_rcnn_r50_fpn_2x_coco.py │ │ │ ├── mask_rcnn_r50_fpn_8xb8_amp_lsj_200e_coco.py │ │ │ ├── mask_rcnn_r50_fpn_amp_1x_coco.py │ │ │ ├── mask_rcnn_r50_fpn_ms_poly_-3x_coco.py │ │ │ ├── mask_rcnn_r50_fpn_poly_1x_coco.py │ │ │ ├── mask_rcnn_x101_32x4d_fpn_1x_coco.py │ │ │ ├── mask_rcnn_x101_32x4d_fpn_2x_coco.py │ │ │ ├── mask_rcnn_x101_32x4d_fpn_ms_poly_3x_coco.py │ │ │ ├── mask_rcnn_x101_32x8d_fpn_1x_coco.py │ │ │ ├── mask_rcnn_x101_32x8d_fpn_ms_poly_1x_coco.py │ │ │ ├── mask_rcnn_x101_32x8d_fpn_ms_poly_3x_coco.py │ │ │ ├── mask_rcnn_x101_64_4d_fpn_1x_coco.py │ │ │ ├── mask_rcnn_x101_64x4d_fpn_2x_coco.py │ │ │ └── mask_rcnn_x101_64x4d_fpn_ms_poly_3x_coco.py │ │ ├── maskformer │ │ │ ├── maskformer_r50_ms_16xb1_75e_coco.py │ │ │ └── maskformer_swin_l_p4_w12_64xb1_ms_300e_coco.py │ │ ├── panoptic_fpn │ │ │ ├── panoptic_fpn_r101_fpn_1x_coco.py │ │ │ ├── panoptic_fpn_r101_fpn_ms_3x_coco.py │ │ │ ├── panoptic_fpn_r50_fpn_1x_coco.py │ │ │ └── panoptic_fpn_r50_fpn_ms_3x_coco.py │ │ ├── qdtrack │ │ │ ├── qdtrack_faster_rcnn_r50_fpn_4e_base.py │ │ │ └── qdtrack_faster_rcnn_r50_fpn_8xb2-4e_mot17halftrain_test-mot17halfval.py │ │ ├── retinanet │ │ │ ├── retinanet_r50_fpn_1x_coco.py │ │ │ └── retinanet_tta.py │ │ └── rtmdet │ │ │ ├── rtmdet_ins_l_8xb32_300e_coco.py │ │ │ ├── rtmdet_ins_m_8xb32_300e_coco.py │ │ │ ├── rtmdet_ins_s_8xb32_300e_coco.py │ │ │ ├── rtmdet_ins_tiny_8xb32_300e_coco.py │ │ │ ├── rtmdet_ins_x_8xb16_300e_coco.py │ │ │ ├── rtmdet_l_8xb32_300e_coco.py │ │ │ ├── rtmdet_m_8xb32_300e_coco.py │ │ │ ├── rtmdet_s_8xb32_300e_coco.py │ │ │ ├── rtmdet_tiny_8xb32_300e_coco.py │ │ │ ├── rtmdet_tta.py │ │ │ └── rtmdet_x_8xb32_300e_coco.py │ ├── datasets │ │ ├── __init__.py │ │ ├── ade20k.py │ │ ├── api_wrappers │ │ │ ├── __init__.py │ │ │ ├── coco_api.py │ │ │ └── cocoeval_mp.py │ │ ├── base_det_dataset.py │ │ ├── base_semseg_dataset.py │ │ ├── base_video_dataset.py │ │ ├── cityscapes.py │ │ ├── coco.py │ │ ├── coco_caption.py │ │ ├── coco_panoptic.py │ │ ├── coco_semantic.py │ │ ├── crowdhuman.py │ │ ├── dataset_wrappers.py │ │ ├── deepfashion.py │ │ ├── dod.py │ │ ├── dsdl.py │ │ ├── flickr30k.py │ │ ├── isaid.py │ │ ├── lvis.py │ │ ├── mdetr_style_refcoco.py │ │ ├── mot_challenge_dataset.py │ │ ├── objects365.py │ │ ├── odvg.py │ │ ├── openimages.py │ │ ├── refcoco.py │ │ ├── reid_dataset.py │ │ ├── samplers │ │ │ ├── __init__.py │ │ │ ├── batch_sampler.py │ │ │ ├── class_aware_sampler.py │ │ │ ├── custom_sample_size_sampler.py │ │ │ ├── multi_data_sampler.py │ │ │ ├── multi_source_sampler.py │ │ │ └── track_img_sampler.py │ │ ├── transforms │ │ │ ├── __init__.py │ │ │ ├── augment_wrappers.py │ │ │ ├── colorspace.py │ │ │ ├── formatting.py │ │ │ ├── frame_sampling.py │ │ │ ├── geometric.py │ │ │ ├── instaboost.py │ │ │ ├── loading.py │ │ │ ├── text_transformers.py │ │ │ ├── transformers_glip.py │ │ │ ├── transforms.py │ │ │ └── wrappers.py │ │ ├── utils.py │ │ ├── v3det.py │ │ ├── voc.py │ │ ├── wider_face.py │ │ ├── xml_style.py │ │ └── youtube_vis_dataset.py │ ├── engine │ │ ├── __init__.py │ │ ├── hooks │ │ │ ├── __init__.py │ │ │ ├── checkloss_hook.py │ │ │ ├── mean_teacher_hook.py │ │ │ ├── memory_profiler_hook.py │ │ │ ├── num_class_check_hook.py │ │ │ ├── pipeline_switch_hook.py │ │ │ ├── set_epoch_info_hook.py │ │ │ ├── sync_norm_hook.py │ │ │ ├── utils.py │ │ │ ├── visualization_hook.py │ │ │ └── yolox_mode_switch_hook.py │ │ ├── optimizers │ │ │ ├── __init__.py │ │ │ └── layer_decay_optimizer_constructor.py │ │ ├── runner │ │ │ ├── __init__.py │ │ │ └── loops.py │ │ └── schedulers │ │ │ ├── __init__.py │ │ │ └── quadratic_warmup.py │ ├── evaluation │ │ ├── __init__.py │ │ ├── evaluator │ │ │ ├── __init__.py │ │ │ └── multi_datasets_evaluator.py │ │ ├── functional │ │ │ ├── __init__.py │ │ │ ├── bbox_overlaps.py │ │ │ ├── cityscapes_utils.py │ │ │ ├── class_names.py │ │ │ ├── mean_ap.py │ │ │ ├── panoptic_utils.py │ │ │ ├── recall.py │ │ │ ├── ytvis.py │ │ │ └── ytviseval.py │ │ └── metrics │ │ │ ├── __init__.py │ │ │ ├── base_video_metric.py │ │ │ ├── cityscapes_metric.py │ │ │ ├── coco_caption_metric.py │ │ │ ├── coco_metric.py │ │ │ ├── coco_occluded_metric.py │ │ │ ├── coco_panoptic_metric.py │ │ │ ├── coco_video_metric.py │ │ │ ├── crowdhuman_metric.py │ │ │ ├── dod_metric.py │ │ │ ├── dump_det_results.py │ │ │ ├── dump_odvg_results.py │ │ │ ├── dump_proposals_metric.py │ │ │ ├── flickr30k_metric.py │ │ │ ├── grefcoco_metric.py │ │ │ ├── lvis_metric.py │ │ │ ├── mot_challenge_metric.py │ │ │ ├── openimages_metric.py │ │ │ ├── ov_coco_metric.py │ │ │ ├── refexp_metric.py │ │ │ ├── refseg_metric.py │ │ │ ├── reid_metric.py │ │ │ ├── semseg_metric.py │ │ │ ├── voc_metric.py │ │ │ └── youtube_vis_metric.py │ ├── models │ │ ├── __init__.py │ │ ├── backbones │ │ │ ├── __init__.py │ │ │ ├── csp_darknet.py │ │ │ ├── cspnext.py │ │ │ ├── darknet.py │ │ │ ├── detectors_resnet.py │ │ │ ├── detectors_resnext.py │ │ │ ├── efficientnet.py │ │ │ ├── hourglass.py │ │ │ ├── hrnet.py │ │ │ ├── mobilenet_v2.py │ │ │ ├── pvt.py │ │ │ ├── regnet.py │ │ │ ├── res2net.py │ │ │ ├── resnest.py │ │ │ ├── resnet.py │ │ │ ├── resnext.py │ │ │ ├── ssd_vgg.py │ │ │ ├── swin.py │ │ │ └── trident_resnet.py │ │ ├── data_preprocessors │ │ │ ├── __init__.py │ │ │ ├── data_preprocessor.py │ │ │ ├── reid_data_preprocessor.py │ │ │ └── track_data_preprocessor.py │ │ ├── dense_heads │ │ │ ├── __init__.py │ │ │ ├── anchor_free_head.py │ │ │ ├── anchor_head.py │ │ │ ├── atss_head.py │ │ │ ├── atss_vlfusion_head.py │ │ │ ├── autoassign_head.py │ │ │ ├── base_dense_head.py │ │ │ ├── base_mask_head.py │ │ │ ├── boxinst_head.py │ │ │ ├── cascade_rpn_head.py │ │ │ ├── centernet_head.py │ │ │ ├── centernet_update_head.py │ │ │ ├── centripetal_head.py │ │ │ ├── condinst_head.py │ │ │ ├── conditional_detr_head.py │ │ │ ├── corner_head.py │ │ │ ├── dab_detr_head.py │ │ │ ├── ddod_head.py │ │ │ ├── ddq_detr_head.py │ │ │ ├── deformable_detr_head.py │ │ │ ├── dense_test_mixins.py │ │ │ ├── detr_head.py │ │ │ ├── dino_head.py │ │ │ ├── embedding_rpn_head.py │ │ │ ├── fcos_head.py │ │ │ ├── fovea_head.py │ │ │ ├── free_anchor_retina_head.py │ │ │ ├── fsaf_head.py │ │ │ ├── ga_retina_head.py │ │ │ ├── ga_rpn_head.py │ │ │ ├── gfl_head.py │ │ │ ├── grounding_dino_head.py │ │ │ ├── guided_anchor_head.py │ │ │ ├── lad_head.py │ │ │ ├── ld_head.py │ │ │ ├── mask2former_head.py │ │ │ ├── maskformer_head.py │ │ │ ├── nasfcos_head.py │ │ │ ├── paa_head.py │ │ │ ├── pisa_retinanet_head.py │ │ │ ├── pisa_ssd_head.py │ │ │ ├── reppoints_head.py │ │ │ ├── retina_head.py │ │ │ ├── retina_sepbn_head.py │ │ │ ├── rpn_head.py │ │ │ ├── rtmdet_head.py │ │ │ ├── rtmdet_ins_head.py │ │ │ ├── sabl_retina_head.py │ │ │ ├── solo_head.py │ │ │ ├── solov2_head.py │ │ │ ├── ssd_head.py │ │ │ ├── tood_head.py │ │ │ ├── vfnet_head.py │ │ │ ├── yolact_head.py │ │ │ ├── yolo_head.py │ │ │ ├── yolof_head.py │ │ │ └── yolox_head.py │ │ ├── detectors │ │ │ ├── __init__.py │ │ │ ├── atss.py │ │ │ ├── autoassign.py │ │ │ ├── base.py │ │ │ ├── base_detr.py │ │ │ ├── boxinst.py │ │ │ ├── cascade_rcnn.py │ │ │ ├── centernet.py │ │ │ ├── condinst.py │ │ │ ├── conditional_detr.py │ │ │ ├── cornernet.py │ │ │ ├── crowddet.py │ │ │ ├── d2_wrapper.py │ │ │ ├── dab_detr.py │ │ │ ├── ddod.py │ │ │ ├── ddq_detr.py │ │ │ ├── deformable_detr.py │ │ │ ├── detr.py │ │ │ ├── dino.py │ │ │ ├── fast_rcnn.py │ │ │ ├── faster_rcnn.py │ │ │ ├── fcos.py │ │ │ ├── fovea.py │ │ │ ├── fsaf.py │ │ │ ├── gfl.py │ │ │ ├── glip.py │ │ │ ├── grid_rcnn.py │ │ │ ├── grounding_dino.py │ │ │ ├── htc.py │ │ │ ├── kd_one_stage.py │ │ │ ├── lad.py │ │ │ ├── mask2former.py │ │ │ ├── mask_rcnn.py │ │ │ ├── mask_scoring_rcnn.py │ │ │ ├── maskformer.py │ │ │ ├── nasfcos.py │ │ │ ├── paa.py │ │ │ ├── panoptic_fpn.py │ │ │ ├── panoptic_two_stage_segmentor.py │ │ │ ├── point_rend.py │ │ │ ├── queryinst.py │ │ │ ├── reppoints_detector.py │ │ │ ├── retinanet.py │ │ │ ├── rpn.py │ │ │ ├── rtmdet.py │ │ │ ├── scnet.py │ │ │ ├── semi_base.py │ │ │ ├── single_stage.py │ │ │ ├── single_stage_instance_seg.py │ │ │ ├── soft_teacher.py │ │ │ ├── solo.py │ │ │ ├── solov2.py │ │ │ ├── sparse_rcnn.py │ │ │ ├── tood.py │ │ │ ├── trident_faster_rcnn.py │ │ │ ├── two_stage.py │ │ │ ├── vfnet.py │ │ │ ├── yolact.py │ │ │ ├── yolo.py │ │ │ ├── yolof.py │ │ │ └── yolox.py │ │ ├── language_models │ │ │ ├── __init__.py │ │ │ └── bert.py │ │ ├── layers │ │ │ ├── __init__.py │ │ │ ├── activations.py │ │ │ ├── bbox_nms.py │ │ │ ├── brick_wrappers.py │ │ │ ├── conv_upsample.py │ │ │ ├── csp_layer.py │ │ │ ├── dropblock.py │ │ │ ├── ema.py │ │ │ ├── inverted_residual.py │ │ │ ├── matrix_nms.py │ │ │ ├── msdeformattn_pixel_decoder.py │ │ │ ├── normed_predictor.py │ │ │ ├── pixel_decoder.py │ │ │ ├── positional_encoding.py │ │ │ ├── res_layer.py │ │ │ ├── se_layer.py │ │ │ └── transformer │ │ │ │ ├── __init__.py │ │ │ │ ├── conditional_detr_layers.py │ │ │ │ ├── dab_detr_layers.py │ │ │ │ ├── ddq_detr_layers.py │ │ │ │ ├── deformable_detr_layers.py │ │ │ │ ├── detr_layers.py │ │ │ │ ├── dino_layers.py │ │ │ │ ├── grounding_dino_layers.py │ │ │ │ ├── mask2former_layers.py │ │ │ │ └── utils.py │ │ ├── losses │ │ │ ├── __init__.py │ │ │ ├── accuracy.py │ │ │ ├── ae_loss.py │ │ │ ├── balanced_l1_loss.py │ │ │ ├── cross_entropy_loss.py │ │ │ ├── ddq_detr_aux_loss.py │ │ │ ├── dice_loss.py │ │ │ ├── eqlv2_loss.py │ │ │ ├── focal_loss.py │ │ │ ├── gaussian_focal_loss.py │ │ │ ├── gfocal_loss.py │ │ │ ├── ghm_loss.py │ │ │ ├── iou_loss.py │ │ │ ├── kd_loss.py │ │ │ ├── l2_loss.py │ │ │ ├── margin_loss.py │ │ │ ├── mse_loss.py │ │ │ ├── multipos_cross_entropy_loss.py │ │ │ ├── pisa_loss.py │ │ │ ├── seesaw_loss.py │ │ │ ├── smooth_l1_loss.py │ │ │ ├── triplet_loss.py │ │ │ ├── utils.py │ │ │ └── varifocal_loss.py │ │ ├── mot │ │ │ ├── __init__.py │ │ │ ├── base.py │ │ │ ├── bytetrack.py │ │ │ ├── deep_sort.py │ │ │ ├── ocsort.py │ │ │ ├── qdtrack.py │ │ │ └── strongsort.py │ │ ├── necks │ │ │ ├── __init__.py │ │ │ ├── bfp.py │ │ │ ├── channel_mapper.py │ │ │ ├── cspnext_pafpn.py │ │ │ ├── ct_resnet_neck.py │ │ │ ├── dilated_encoder.py │ │ │ ├── dyhead.py │ │ │ ├── fpg.py │ │ │ ├── fpn.py │ │ │ ├── fpn_carafe.py │ │ │ ├── fpn_dropblock.py │ │ │ ├── hrfpn.py │ │ │ ├── nas_fpn.py │ │ │ ├── nasfcos_fpn.py │ │ │ ├── pafpn.py │ │ │ ├── rfp.py │ │ │ ├── ssd_neck.py │ │ │ ├── ssh.py │ │ │ ├── yolo_neck.py │ │ │ └── yolox_pafpn.py │ │ ├── reid │ │ │ ├── __init__.py │ │ │ ├── base_reid.py │ │ │ ├── fc_module.py │ │ │ ├── gap.py │ │ │ └── linear_reid_head.py │ │ ├── roi_heads │ │ │ ├── __init__.py │ │ │ ├── base_roi_head.py │ │ │ ├── bbox_heads │ │ │ │ ├── __init__.py │ │ │ │ ├── bbox_head.py │ │ │ │ ├── convfc_bbox_head.py │ │ │ │ ├── dii_head.py │ │ │ │ ├── double_bbox_head.py │ │ │ │ ├── multi_instance_bbox_head.py │ │ │ │ ├── sabl_head.py │ │ │ │ └── scnet_bbox_head.py │ │ │ ├── cascade_roi_head.py │ │ │ ├── double_roi_head.py │ │ │ ├── dynamic_roi_head.py │ │ │ ├── grid_roi_head.py │ │ │ ├── htc_roi_head.py │ │ │ ├── mask_heads │ │ │ │ ├── __init__.py │ │ │ │ ├── coarse_mask_head.py │ │ │ │ ├── dynamic_mask_head.py │ │ │ │ ├── fcn_mask_head.py │ │ │ │ ├── feature_relay_head.py │ │ │ │ ├── fused_semantic_head.py │ │ │ │ ├── global_context_head.py │ │ │ │ ├── grid_head.py │ │ │ │ ├── htc_mask_head.py │ │ │ │ ├── mask_point_head.py │ │ │ │ ├── maskiou_head.py │ │ │ │ ├── scnet_mask_head.py │ │ │ │ └── scnet_semantic_head.py │ │ │ ├── mask_scoring_roi_head.py │ │ │ ├── multi_instance_roi_head.py │ │ │ ├── pisa_roi_head.py │ │ │ ├── point_rend_roi_head.py │ │ │ ├── roi_extractors │ │ │ │ ├── __init__.py │ │ │ │ ├── base_roi_extractor.py │ │ │ │ ├── generic_roi_extractor.py │ │ │ │ └── single_level_roi_extractor.py │ │ │ ├── scnet_roi_head.py │ │ │ ├── shared_heads │ │ │ │ ├── __init__.py │ │ │ │ └── res_layer.py │ │ │ ├── sparse_roi_head.py │ │ │ ├── standard_roi_head.py │ │ │ ├── test_mixins.py │ │ │ └── trident_roi_head.py │ │ ├── seg_heads │ │ │ ├── __init__.py │ │ │ ├── base_semantic_head.py │ │ │ ├── panoptic_fpn_head.py │ │ │ └── panoptic_fusion_heads │ │ │ │ ├── __init__.py │ │ │ │ ├── base_panoptic_fusion_head.py │ │ │ │ ├── heuristic_fusion_head.py │ │ │ │ └── maskformer_fusion_head.py │ │ ├── task_modules │ │ │ ├── __init__.py │ │ │ ├── assigners │ │ │ │ ├── __init__.py │ │ │ │ ├── approx_max_iou_assigner.py │ │ │ │ ├── assign_result.py │ │ │ │ ├── atss_assigner.py │ │ │ │ ├── base_assigner.py │ │ │ │ ├── center_region_assigner.py │ │ │ │ ├── dynamic_soft_label_assigner.py │ │ │ │ ├── grid_assigner.py │ │ │ │ ├── hungarian_assigner.py │ │ │ │ ├── iou2d_calculator.py │ │ │ │ ├── match_cost.py │ │ │ │ ├── max_iou_assigner.py │ │ │ │ ├── multi_instance_assigner.py │ │ │ │ ├── point_assigner.py │ │ │ │ ├── region_assigner.py │ │ │ │ ├── sim_ota_assigner.py │ │ │ │ ├── task_aligned_assigner.py │ │ │ │ ├── topk_hungarian_assigner.py │ │ │ │ └── uniform_assigner.py │ │ │ ├── builder.py │ │ │ ├── coders │ │ │ │ ├── __init__.py │ │ │ │ ├── base_bbox_coder.py │ │ │ │ ├── bucketing_bbox_coder.py │ │ │ │ ├── delta_xywh_bbox_coder.py │ │ │ │ ├── distance_point_bbox_coder.py │ │ │ │ ├── legacy_delta_xywh_bbox_coder.py │ │ │ │ ├── pseudo_bbox_coder.py │ │ │ │ ├── tblr_bbox_coder.py │ │ │ │ └── yolo_bbox_coder.py │ │ │ ├── prior_generators │ │ │ │ ├── __init__.py │ │ │ │ ├── anchor_generator.py │ │ │ │ ├── point_generator.py │ │ │ │ └── utils.py │ │ │ ├── samplers │ │ │ │ ├── __init__.py │ │ │ │ ├── base_sampler.py │ │ │ │ ├── combined_sampler.py │ │ │ │ ├── instance_balanced_pos_sampler.py │ │ │ │ ├── iou_balanced_neg_sampler.py │ │ │ │ ├── mask_pseudo_sampler.py │ │ │ │ ├── mask_sampling_result.py │ │ │ │ ├── multi_instance_random_sampler.py │ │ │ │ ├── multi_instance_sampling_result.py │ │ │ │ ├── ohem_sampler.py │ │ │ │ ├── pseudo_sampler.py │ │ │ │ ├── random_sampler.py │ │ │ │ ├── sampling_result.py │ │ │ │ └── score_hlr_sampler.py │ │ │ └── tracking │ │ │ │ ├── __init__.py │ │ │ │ ├── aflink.py │ │ │ │ ├── camera_motion_compensation.py │ │ │ │ ├── interpolation.py │ │ │ │ ├── kalman_filter.py │ │ │ │ └── similarity.py │ │ ├── test_time_augs │ │ │ ├── __init__.py │ │ │ ├── det_tta.py │ │ │ └── merge_augs.py │ │ ├── trackers │ │ │ ├── __init__.py │ │ │ ├── base_tracker.py │ │ │ ├── byte_tracker.py │ │ │ ├── masktrack_rcnn_tracker.py │ │ │ ├── ocsort_tracker.py │ │ │ ├── quasi_dense_tracker.py │ │ │ ├── sort_tracker.py │ │ │ └── strongsort_tracker.py │ │ ├── tracking_heads │ │ │ ├── __init__.py │ │ │ ├── mask2former_track_head.py │ │ │ ├── quasi_dense_embed_head.py │ │ │ ├── quasi_dense_track_head.py │ │ │ ├── roi_embed_head.py │ │ │ └── roi_track_head.py │ │ ├── utils │ │ │ ├── __init__.py │ │ │ ├── gaussian_target.py │ │ │ ├── image.py │ │ │ ├── make_divisible.py │ │ │ ├── misc.py │ │ │ ├── panoptic_gt_processing.py │ │ │ ├── point_sample.py │ │ │ ├── vlfuse_helper.py │ │ │ └── wbf.py │ │ └── vis │ │ │ ├── __init__.py │ │ │ ├── mask2former_vis.py │ │ │ └── masktrack_rcnn.py │ ├── registry.py │ ├── structures │ │ ├── __init__.py │ │ ├── bbox │ │ │ ├── __init__.py │ │ │ ├── base_boxes.py │ │ │ ├── bbox_overlaps.py │ │ │ ├── box_type.py │ │ │ ├── horizontal_boxes.py │ │ │ └── transforms.py │ │ ├── det_data_sample.py │ │ ├── mask │ │ │ ├── __init__.py │ │ │ ├── mask_target.py │ │ │ ├── structures.py │ │ │ └── utils.py │ │ ├── reid_data_sample.py │ │ └── track_data_sample.py │ ├── testing │ │ ├── __init__.py │ │ ├── _fast_stop_training_hook.py │ │ └── _utils.py │ ├── utils │ │ ├── __init__.py │ │ ├── benchmark.py │ │ ├── collect_env.py │ │ ├── compat_config.py │ │ ├── contextmanagers.py │ │ ├── dist_utils.py │ │ ├── large_image.py │ │ ├── logger.py │ │ ├── memory.py │ │ ├── misc.py │ │ ├── mot_error_visualize.py │ │ ├── profiling.py │ │ ├── replace_cfg_vals.py │ │ ├── setup_env.py │ │ ├── split_batch.py │ │ ├── typing_utils.py │ │ ├── util_mixins.py │ │ └── util_random.py │ ├── version.py │ └── visualization │ │ ├── __init__.py │ │ ├── local_visualizer.py │ │ └── palette.py │ ├── projects │ ├── AlignDETR │ │ ├── README.md │ │ ├── align_detr │ │ │ ├── __init__.py │ │ │ ├── align_detr_head.py │ │ │ ├── mixed_hungarian_assigner.py │ │ │ └── utils.py │ │ └── configs │ │ │ ├── align_detr-4scale_r50_8xb2-12e_coco.py │ │ │ └── align_detr-4scale_r50_8xb2-24e_coco.py │ ├── CO-DETR │ │ ├── README.md │ │ ├── codetr │ │ │ ├── __init__.py │ │ │ ├── co_atss_head.py │ │ │ ├── co_dino_head.py │ │ │ ├── co_roi_head.py │ │ │ ├── codetr.py │ │ │ └── transformer.py │ │ └── configs │ │ │ └── codino │ │ │ ├── co_dino_5scale_r50_8xb2_1x_coco.py │ │ │ ├── co_dino_5scale_r50_lsj_8xb2_1x_coco.py │ │ │ ├── co_dino_5scale_r50_lsj_8xb2_3x_coco.py │ │ │ ├── co_dino_5scale_swin_l_16xb1_16e_o365tococo.py │ │ │ ├── co_dino_5scale_swin_l_16xb1_1x_coco.py │ │ │ ├── co_dino_5scale_swin_l_16xb1_3x_coco.py │ │ │ ├── co_dino_5scale_swin_l_lsj_16xb1_1x_coco.py │ │ │ └── co_dino_5scale_swin_l_lsj_16xb1_3x_coco.py │ ├── ConvNeXt-V2 │ │ ├── README.md │ │ └── configs │ │ │ └── mask-rcnn_convnext-v2-b_fpn_lsj-3x-fcmae_coco.py │ ├── Detic │ │ ├── README.md │ │ ├── configs │ │ │ └── detic_centernet2_swin-b_fpn_4x_lvis-coco-in21k.py │ │ ├── demo.py │ │ └── detic │ │ │ ├── __init__.py │ │ │ ├── centernet_rpn_head.py │ │ │ ├── detic_bbox_head.py │ │ │ ├── detic_roi_head.py │ │ │ ├── text_encoder.py │ │ │ ├── utils.py │ │ │ └── zero_shot_classifier.py │ ├── Detic_new │ │ ├── README.md │ │ ├── configs │ │ │ ├── detic_centernet2_r50_fpn_4x_lvis-base_boxsup.py │ │ │ ├── detic_centernet2_r50_fpn_4x_lvis-base_in21k-lvis.py │ │ │ ├── detic_centernet2_r50_fpn_4x_lvis_boxsup.py │ │ │ ├── detic_centernet2_r50_fpn_4x_lvis_in21k-lvis.py │ │ │ ├── detic_centernet2_swin-b_fpn_4x_lvis-base_boxsup.py │ │ │ ├── detic_centernet2_swin-b_fpn_4x_lvis-base_in21k-lvis.py │ │ │ ├── detic_centernet2_swin-b_fpn_4x_lvis_boxsup.py │ │ │ ├── detic_centernet2_swin-b_fpn_4x_lvis_coco_in21k.py │ │ │ └── detic_centernet2_swin-b_fpn_4x_lvis_in21k-lvis.py │ │ └── detic │ │ │ ├── __init__.py │ │ │ ├── centernet_rpn_head.py │ │ │ ├── detic.py │ │ │ ├── detic_bbox_head.py │ │ │ ├── detic_roi_head.py │ │ │ ├── heatmap_focal_loss.py │ │ │ ├── imagenet_lvis.py │ │ │ ├── iou_loss.py │ │ │ └── zero_shot_classifier.py │ ├── DiffusionDet │ │ ├── README.md │ │ ├── configs │ │ │ └── diffusiondet_r50_fpn_500-proposals_1-step_crop-ms-480-800-450k_coco.py │ │ ├── diffusiondet │ │ │ ├── __init__.py │ │ │ ├── diffusiondet.py │ │ │ ├── head.py │ │ │ └── loss.py │ │ └── model_converters │ │ │ └── diffusiondet_resnet_to_mmdet.py │ ├── EfficientDet │ │ ├── README.md │ │ ├── configs │ │ │ ├── efficientdet_effb0_bifpn_8xb16-crop512-300e_coco.py │ │ │ ├── efficientdet_effb3_bifpn_8xb16-crop896-300e_coco-90cls.py │ │ │ ├── efficientdet_effb3_bifpn_8xb16-crop896-300e_coco.py │ │ │ └── tensorflow │ │ │ │ └── efficientdet_effb0_bifpn_8xb16-crop512-300e_coco_tf.py │ │ ├── convert_tf_to_pt.py │ │ └── efficientdet │ │ │ ├── __init__.py │ │ │ ├── bifpn.py │ │ │ ├── efficientdet.py │ │ │ ├── efficientdet_head.py │ │ │ ├── huber_loss.py │ │ │ ├── tensorflow │ │ │ ├── anchor_generator.py │ │ │ ├── api_wrappers │ │ │ │ ├── __init__.py │ │ │ │ └── coco_api.py │ │ │ ├── coco_90class.py │ │ │ ├── coco_90metric.py │ │ │ ├── trans_max_iou_assigner.py │ │ │ └── yxyx_bbox_coder.py │ │ │ └── utils.py │ ├── HDINO │ │ ├── README.md │ │ ├── __init__.py │ │ ├── h-dino-4scale_r50_8xb2-12e_coco.py │ │ ├── h_dino.py │ │ └── h_dino_head.py │ ├── LabelStudio │ │ ├── backend_template │ │ │ ├── _wsgi.py │ │ │ └── mmdetection.py │ │ └── readme.md │ ├── RF100-Benchmark │ │ ├── README.md │ │ ├── README_zh-CN.md │ │ ├── __init__.py │ │ ├── coco.py │ │ ├── coco_metric.py │ │ ├── configs │ │ │ ├── dino_r50_fpn_ms_8xb8_tweeter-profile.py │ │ │ ├── faster-rcnn_r50_fpn_ms_8xb8_tweeter-profile.py │ │ │ └── tood_r50_fpn_ms_8xb8_tweeter-profile.py │ │ └── scripts │ │ │ ├── create_new_config.py │ │ │ ├── datasets_links_640.txt │ │ │ ├── dist_train.sh │ │ │ ├── download_dataset.py │ │ │ ├── download_datasets.sh │ │ │ ├── labels_names.json │ │ │ ├── log_extract.py │ │ │ ├── parse_dataset_link.py │ │ │ └── slurm_train.sh │ ├── SparseInst │ │ ├── README.md │ │ ├── configs │ │ │ └── sparseinst_r50_iam_8xb8-ms-270k_coco.py │ │ └── sparseinst │ │ │ ├── __init__.py │ │ │ ├── decoder.py │ │ │ ├── encoder.py │ │ │ ├── loss.py │ │ │ └── sparseinst.py │ ├── VISION-Datasets │ │ ├── README.md │ │ └── README_zh-CN.md │ ├── ViTDet │ │ ├── README.md │ │ ├── configs │ │ │ ├── lsj-100e_coco-instance.py │ │ │ └── vitdet_mask-rcnn_vit-b-mae_lsj-100e.py │ │ └── vitdet │ │ │ ├── __init__.py │ │ │ ├── fp16_compression_hook.py │ │ │ ├── layer_decay_optimizer_constructor.py │ │ │ ├── simple_fpn.py │ │ │ └── vit.py │ ├── XDecoder │ │ ├── README.md │ │ ├── configs │ │ │ ├── _base_ │ │ │ │ ├── xdecoder-tiny_caption.py │ │ │ │ ├── xdecoder-tiny_open-vocab-instance.py │ │ │ │ ├── xdecoder-tiny_open-vocab-panoptic.py │ │ │ │ ├── xdecoder-tiny_open-vocab-semseg.py │ │ │ │ └── xdecoder-tiny_ref-seg.py │ │ │ ├── xdecoder-tiny_zeroshot_caption_coco2014.py │ │ │ ├── xdecoder-tiny_zeroshot_open-vocab-instance_ade20k.py │ │ │ ├── xdecoder-tiny_zeroshot_open-vocab-instance_coco.py │ │ │ ├── xdecoder-tiny_zeroshot_open-vocab-panoptic_ade20k.py │ │ │ ├── xdecoder-tiny_zeroshot_open-vocab-panoptic_coco.py │ │ │ ├── xdecoder-tiny_zeroshot_open-vocab-ref-seg_refcoco+.py │ │ │ ├── xdecoder-tiny_zeroshot_open-vocab-ref-seg_refcoco.py │ │ │ ├── xdecoder-tiny_zeroshot_open-vocab-ref-seg_refcocog.py │ │ │ ├── xdecoder-tiny_zeroshot_open-vocab-semseg_ade20k.py │ │ │ ├── xdecoder-tiny_zeroshot_open-vocab-semseg_coco.py │ │ │ ├── xdecoder-tiny_zeroshot_ref-caption.py │ │ │ └── xdecoder-tiny_zeroshot_text-image-retrieval.py │ │ ├── demo.py │ │ └── xdecoder │ │ │ ├── __init__.py │ │ │ ├── focalnet.py │ │ │ ├── inference │ │ │ ├── __init__.py │ │ │ ├── image_caption.py │ │ │ └── texttoimage_regionretrieval_inferencer.py │ │ │ ├── language_model.py │ │ │ ├── pixel_decoder.py │ │ │ ├── transformer_blocks.py │ │ │ ├── transformer_decoder.py │ │ │ ├── unified_head.py │ │ │ ├── utils.py │ │ │ └── xdecoder.py │ ├── example_largemodel │ │ ├── README.md │ │ ├── README_zh-CN.md │ │ ├── __init__.py │ │ ├── dino-5scale_swin-l_deepspeed_8xb2-12e_coco.py │ │ ├── dino-5scale_swin-l_fsdp_8xb2-12e_coco.py │ │ └── fsdp_utils.py │ ├── example_project │ │ ├── README.md │ │ ├── configs │ │ │ └── faster-rcnn_dummy-resnet_fpn_1x_coco.py │ │ └── dummy │ │ │ ├── __init__.py │ │ │ └── dummy_resnet.py │ ├── gradio_demo │ │ ├── README.md │ │ └── launch.py │ └── iSAID │ │ ├── README.md │ │ ├── README_zh-CN.md │ │ ├── configs │ │ └── mask_rcnn_r50_fpn_1x_isaid.py │ │ └── isaid_json.py │ ├── requirements.txt │ ├── requirements │ ├── albu.txt │ ├── build.txt │ ├── docs.txt │ ├── mminstall.txt │ ├── multimodal.txt │ ├── optional.txt │ ├── readthedocs.txt │ ├── runtime.txt │ ├── tests.txt │ └── tracking.txt │ ├── resources │ ├── coco_test_12510.jpg │ ├── corruptions_sev_3.png │ ├── data_pipeline.png │ ├── loss_curve.png │ ├── miaomiao_qrcode.jpg │ ├── mmdet-logo.png │ └── zhihu_qrcode.jpg │ ├── setup.cfg │ ├── setup.py │ ├── tests │ ├── data │ │ ├── Objects365 │ │ │ └── unsorted_obj365_sample.json │ │ ├── OpenImages │ │ │ ├── annotations │ │ │ │ ├── annotations-human-imagelabels-boxable.csv │ │ │ │ ├── bbox_labels_600_hierarchy.json │ │ │ │ ├── class-descriptions-boxable.csv │ │ │ │ ├── image-metas.pkl │ │ │ │ └── oidv6-train-annotations-bbox.csv │ │ │ └── challenge2019 │ │ │ │ ├── annotations-human-imagelabels-boxable.csv │ │ │ │ ├── challenge-2019-train-detection-bbox.txt │ │ │ │ ├── class_label_tree.np │ │ │ │ └── cls-label-description.csv │ │ ├── VOCdevkit │ │ │ ├── VOC2007 │ │ │ │ ├── Annotations │ │ │ │ │ └── 000001.xml │ │ │ │ ├── ImageSets │ │ │ │ │ └── Main │ │ │ │ │ │ ├── test.txt │ │ │ │ │ │ └── trainval.txt │ │ │ │ └── JPEGImages │ │ │ │ │ └── 000001.jpg │ │ │ └── VOC2012 │ │ │ │ ├── Annotations │ │ │ │ └── 000001.xml │ │ │ │ ├── ImageSets │ │ │ │ └── Main │ │ │ │ │ ├── test.txt │ │ │ │ │ └── trainval.txt │ │ │ │ └── JPEGImages │ │ │ │ └── 000001.jpg │ │ ├── WIDERFace │ │ │ ├── WIDER_train │ │ │ │ ├── 0--Parade │ │ │ │ │ └── .gitkeep │ │ │ │ └── Annotations │ │ │ │ │ └── 0_Parade_marchingband_1_5.xml │ │ │ └── train.txt │ │ ├── coco_batched_sample.json │ │ ├── coco_sample.json │ │ ├── coco_wrong_format_sample.json │ │ ├── color.jpg │ │ ├── configs_mmtrack │ │ │ ├── faster_rcnn_r50_dc5.py │ │ │ ├── faster_rcnn_r50_fpn.py │ │ │ ├── mot_challenge.py │ │ │ ├── selsa_faster_rcnn_r101_dc5_1x.py │ │ │ └── tracktor_faster-rcnn_r50_fpn_4e.py │ │ ├── crowdhuman_dataset │ │ │ ├── id_hw_train.json │ │ │ └── test_annotation_train.odgt │ │ ├── custom_dataset │ │ │ ├── images │ │ │ │ ├── 000001.jpg │ │ │ │ └── 000001.xml │ │ │ ├── test.txt │ │ │ └── trainval.txt │ │ ├── demo_reid_data │ │ │ └── mot17_reid │ │ │ │ └── ann.txt │ │ ├── dsdl_det │ │ │ ├── config.py │ │ │ ├── defs │ │ │ │ ├── class-domain.yaml │ │ │ │ └── obejct-detection-def.yaml │ │ │ └── set-train │ │ │ │ ├── train.yaml │ │ │ │ └── train_samples.json │ │ ├── gray.jpg │ │ ├── mot_sample.json │ │ └── vis_sample.json │ ├── test_apis │ │ ├── test_det_inferencer.py │ │ └── test_inference.py │ ├── test_datasets │ │ ├── test_cityscapes.py │ │ ├── test_coco.py │ │ ├── test_coco_api_wrapper.py │ │ ├── test_coco_panoptic.py │ │ ├── test_crowdhuman.py │ │ ├── test_dsdldet.py │ │ ├── test_lvis.py │ │ ├── test_mot_challenge_dataset.py │ │ ├── test_objects365.py │ │ ├── test_openimages.py │ │ ├── test_pascal_voc.py │ │ ├── test_reid_dataset.py │ │ ├── test_samplers │ │ │ ├── test_batch_sampler.py │ │ │ ├── test_multi_source_sampler.py │ │ │ └── test_track_img_sampler.py │ │ ├── test_transforms │ │ │ ├── __init__.py │ │ │ ├── test_augment_wrappers.py │ │ │ ├── test_colorspace.py │ │ │ ├── test_formatting.py │ │ │ ├── test_frame_sampling.py │ │ │ ├── test_geometric.py │ │ │ ├── test_instaboost.py │ │ │ ├── test_loading.py │ │ │ ├── test_transforms.py │ │ │ ├── test_wrappers.py │ │ │ └── utils.py │ │ ├── test_tta.py │ │ ├── test_wider_face.py │ │ └── test_youtube_vis_dataset.py │ ├── test_engine │ │ ├── __init__.py │ │ ├── test_hooks │ │ │ ├── test_checkloss_hook.py │ │ │ ├── test_mean_teacher_hook.py │ │ │ ├── test_memory_profiler_hook.py │ │ │ ├── test_num_class_check_hook.py │ │ │ ├── test_pipeline_switch_hook.py │ │ │ ├── test_sync_norm_hook.py │ │ │ ├── test_visualization_hook.py │ │ │ └── test_yolox_mode_switch_hook.py │ │ ├── test_optimizers │ │ │ ├── __init__.py │ │ │ └── test_layer_decay_optimizer_constructor.py │ │ ├── test_runner │ │ │ └── test_loops.py │ │ └── test_schedulers │ │ │ └── test_quadratic_warmup.py │ ├── test_evaluation │ │ └── test_metrics │ │ │ ├── __init__.py │ │ │ ├── test_cityscapes_metric.py │ │ │ ├── test_coco_metric.py │ │ │ ├── test_coco_occluded_metric.py │ │ │ ├── test_coco_panoptic_metric.py │ │ │ ├── test_coco_video_metric.py │ │ │ ├── test_crowdhuman_metric.py │ │ │ ├── test_dump_det_results.py │ │ │ ├── test_lvis_metric.py │ │ │ ├── test_mot_challenge_metrics.py │ │ │ ├── test_openimages_metric.py │ │ │ ├── test_reid_metric.py │ │ │ └── test_youtube_vis_metric.py │ ├── test_models │ │ ├── test_backbones │ │ │ ├── __init__.py │ │ │ ├── test_csp_darknet.py │ │ │ ├── test_detectors_resnet.py │ │ │ ├── test_efficientnet.py │ │ │ ├── test_hourglass.py │ │ │ ├── test_hrnet.py │ │ │ ├── test_mobilenet_v2.py │ │ │ ├── test_pvt.py │ │ │ ├── test_regnet.py │ │ │ ├── test_renext.py │ │ │ ├── test_res2net.py │ │ │ ├── test_resnest.py │ │ │ ├── test_resnet.py │ │ │ ├── test_swin.py │ │ │ ├── test_trident_resnet.py │ │ │ └── utils.py │ │ ├── test_data_preprocessors │ │ │ ├── test_batch_resize.py │ │ │ ├── test_boxinst_preprocessor.py │ │ │ ├── test_data_preprocessor.py │ │ │ └── test_track_data_preprocessor.py │ │ ├── test_dense_heads │ │ │ ├── test_anchor_head.py │ │ │ ├── test_atss_head.py │ │ │ ├── test_autoassign_head.py │ │ │ ├── test_boxinst_head.py │ │ │ ├── test_cascade_rpn_head.py │ │ │ ├── test_centernet_head.py │ │ │ ├── test_centernet_update_head.py │ │ │ ├── test_centripetal_head.py │ │ │ ├── test_condinst_head.py │ │ │ ├── test_corner_head.py │ │ │ ├── test_ddod_head.py │ │ │ ├── test_ddq_detr_head.py │ │ │ ├── test_embedding_rpn_head.py │ │ │ ├── test_fcos_head.py │ │ │ ├── test_fovea_head.py │ │ │ ├── test_free_anchor_head.py │ │ │ ├── test_fsaf_head.py │ │ │ ├── test_ga_retina_head.py │ │ │ ├── test_ga_rpn_head.py │ │ │ ├── test_gfl_head.py │ │ │ ├── test_guided_anchor_head.py │ │ │ ├── test_lad_head.py │ │ │ ├── test_ld_head.py │ │ │ ├── test_nasfcos_head.py │ │ │ ├── test_paa_head.py │ │ │ ├── test_pisa_retinanet_head.py │ │ │ ├── test_pisa_ssd_head.py │ │ │ ├── test_reppoints_head.py │ │ │ ├── test_retina_sepBN_head.py │ │ │ ├── test_rpn_head.py │ │ │ ├── test_sabl_retina_head.py │ │ │ ├── test_solo_head.py │ │ │ ├── test_solov2_head.py │ │ │ ├── test_ssd_head.py │ │ │ ├── test_tood_head.py │ │ │ ├── test_vfnet_head.py │ │ │ ├── test_yolo_head.py │ │ │ ├── test_yolof_head.py │ │ │ └── test_yolox_head.py │ │ ├── test_detectors │ │ │ ├── test_conditional_detr.py │ │ │ ├── test_cornernet.py │ │ │ ├── test_dab_detr.py │ │ │ ├── test_ddq_detr.py │ │ │ ├── test_deformable_detr.py │ │ │ ├── test_detr.py │ │ │ ├── test_dino.py │ │ │ ├── test_glip.py │ │ │ ├── test_kd_single_stage.py │ │ │ ├── test_maskformer.py │ │ │ ├── test_panoptic_two_stage_segmentor.py │ │ │ ├── test_rpn.py │ │ │ ├── test_semi_base.py │ │ │ ├── test_single_stage.py │ │ │ ├── test_single_stage_instance_seg.py │ │ │ └── test_two_stage.py │ │ ├── test_layers │ │ │ ├── __init__.py │ │ │ ├── test_brick_wrappers.py │ │ │ ├── test_conv_upsample.py │ │ │ ├── test_ema.py │ │ │ ├── test_inverted_residual.py │ │ │ ├── test_plugins.py │ │ │ ├── test_position_encoding.py │ │ │ ├── test_se_layer.py │ │ │ └── test_transformer.py │ │ ├── test_losses │ │ │ ├── test_gaussian_focal_loss.py │ │ │ ├── test_l2_loss.py │ │ │ ├── test_loss.py │ │ │ ├── test_multi_pos_cross_entropy_loss.py │ │ │ └── test_triplet_loss.py │ │ ├── test_mot │ │ │ ├── test_byte_track.py │ │ │ ├── test_deep_sort.py │ │ │ ├── test_oc_sort.py │ │ │ ├── test_qdtrack.py │ │ │ ├── test_sort.py │ │ │ └── test_strong_sort.py │ │ ├── test_necks │ │ │ ├── test_ct_resnet_neck.py │ │ │ └── test_necks.py │ │ ├── test_reid │ │ │ ├── test_base_reid.py │ │ │ ├── test_fc_module.py │ │ │ ├── test_gap.py │ │ │ └── test_linear_reid_head.py │ │ ├── test_roi_heads │ │ │ ├── test_bbox_heads │ │ │ │ ├── test_bbox_head.py │ │ │ │ ├── test_double_bbox_head.py │ │ │ │ ├── test_multi_instance_bbox_head.py │ │ │ │ ├── test_sabl_bbox_head.py │ │ │ │ └── test_scnet_bbox_head.py │ │ │ ├── test_cascade_roi_head.py │ │ │ ├── test_dynamic_roi_head.py │ │ │ ├── test_grid_roi_head.py │ │ │ ├── test_htc_roi_head.py │ │ │ ├── test_mask_heads │ │ │ │ ├── test_coarse_mask_head.py │ │ │ │ ├── test_fcn_mask_head.py │ │ │ │ ├── test_feature_relay_head.py │ │ │ │ ├── test_fused_semantic_head.py │ │ │ │ ├── test_global_context_head.py │ │ │ │ ├── test_grid_head.py │ │ │ │ ├── test_htc_mask_head.py │ │ │ │ ├── test_maskiou_head.py │ │ │ │ ├── test_scnet_mask_head.py │ │ │ │ └── test_scnet_semantic_head.py │ │ │ ├── test_mask_scoring_roI_head.py │ │ │ ├── test_multi_instance_roi_head.py │ │ │ ├── test_pisa_roi_head.py │ │ │ ├── test_point_rend_roi_head.py │ │ │ ├── test_roi_extractors │ │ │ │ ├── test_generic_roi_extractor.py │ │ │ │ └── test_single_level_roi_extractor.py │ │ │ ├── test_scnet_roi_head.py │ │ │ ├── test_sparse_roi_head.py │ │ │ ├── test_standard_roi_head.py │ │ │ └── test_trident_roi_head.py │ │ ├── test_seg_heads │ │ │ ├── test_heuristic_fusion_head.py │ │ │ ├── test_maskformer_fusion_head.py │ │ │ └── test_panoptic_fpn_head.py │ │ ├── test_task_modules │ │ │ ├── __init__.py │ │ │ ├── test_assigners │ │ │ │ ├── test_approx_max_iou_assigner.py │ │ │ │ ├── test_atss_assigner.py │ │ │ │ ├── test_center_region_assigner.py │ │ │ │ ├── test_dynamic_soft_label_assigner.py │ │ │ │ ├── test_grid_assigner.py │ │ │ │ ├── test_hungarian_assigner.py │ │ │ │ ├── test_max_iou_assigner.py │ │ │ │ ├── test_point_assigner.py │ │ │ │ ├── test_region_assigner.py │ │ │ │ ├── test_simota_assigner.py │ │ │ │ ├── test_task_aligned_assigner.py │ │ │ │ ├── test_task_uniform_assigner.py │ │ │ │ └── test_topk_hungarian_assigner.py │ │ │ ├── test_coder │ │ │ │ └── test_delta_xywh_bbox_coder.py │ │ │ ├── test_iou2d_calculator.py │ │ │ ├── test_prior_generators │ │ │ │ └── test_anchor_generator.py │ │ │ ├── test_samplers │ │ │ │ └── test_pesudo_sampler.py │ │ │ └── test_track │ │ │ │ ├── test_aflink.py │ │ │ │ ├── test_interpolation.py │ │ │ │ ├── test_kalman_filter.py │ │ │ │ └── test_similarity.py │ │ ├── test_trackers │ │ │ ├── test_byte_tracker.py │ │ │ ├── test_masktrack_rcnn_tracker.py │ │ │ ├── test_oc_sort_tracker.py │ │ │ ├── test_sort_tracker.py │ │ │ └── test_strong_sort_tracker.py │ │ ├── test_tracking_heads │ │ │ ├── test_mask2former_track_head.py │ │ │ ├── test_quasi_dense_embed_head.py │ │ │ ├── test_quasi_dense_track_head.py │ │ │ └── test_roi_embed_head.py │ │ ├── test_tta │ │ │ └── test_det_tta.py │ │ ├── test_utils │ │ │ ├── test_misc.py │ │ │ └── test_model_misc.py │ │ └── test_vis │ │ │ ├── test_mask2former.py │ │ │ └── test_masktrack_rcnn.py │ ├── test_structures │ │ ├── __init__.py │ │ ├── test_bbox │ │ │ ├── __init__.py │ │ │ ├── test_base_boxes.py │ │ │ ├── test_box_type.py │ │ │ ├── test_horizontal_boxes.py │ │ │ └── utils.py │ │ ├── test_det_data_sample.py │ │ ├── test_mask │ │ │ └── test_mask_structures.py │ │ ├── test_reid_data_sample.py │ │ └── test_track_data_sample.py │ ├── test_utils │ │ ├── test_benchmark.py │ │ ├── test_memory.py │ │ ├── test_replace_cfg_vals.py │ │ └── test_setup_env.py │ └── test_visualization │ │ ├── test_local_visualizer.py │ │ └── test_palette.py │ └── tools │ ├── analysis_tools │ ├── analyze_logs.py │ ├── analyze_results.py │ ├── benchmark.py │ ├── browse_dataset.py │ ├── browse_grounding_dataset.py │ ├── browse_grounding_raw.py │ ├── coco_error_analysis.py │ ├── coco_occluded_separated_recall.py │ ├── confusion_matrix.py │ ├── eval_metric.py │ ├── fuse_results.py │ ├── get_flops.py │ ├── mot │ │ ├── browse_dataset.py │ │ ├── dist_mot_search.sh │ │ ├── mot_error_visualize.py │ │ ├── mot_param_search.py │ │ └── slurm_mot_search.sh │ ├── optimize_anchors.py │ ├── robustness_eval.py │ └── test_robustness.py │ ├── dataset_converters │ ├── ade20k2coco.py │ ├── cityscapes.py │ ├── coco2odvg.py │ ├── coco2ovd.py │ ├── coco_stuff164k.py │ ├── crowdhuman2coco.py │ ├── extract_coco_from_mixed.py │ ├── fix_o365_names.py │ ├── goldg2odvg.py │ ├── grit2odvg.py │ ├── grit_processing.py │ ├── images2coco.py │ ├── lvis2odvg.py │ ├── lvis2ovd.py │ ├── mot2coco.py │ ├── mot2reid.py │ ├── openimages2odvg.py │ ├── pascal_voc.py │ ├── prepare_coco_semantic_annos_from_panoptic_annos.py │ ├── refcoco2odvg.py │ ├── remove_cocotrain2017_from_refcoco.py │ ├── scripts │ │ ├── preprocess_coco2017.sh │ │ ├── preprocess_voc2007.sh │ │ └── preprocess_voc2012.sh │ ├── youtubevis2coco.py │ └── zhiyuan_objv2_train_names_fix.csv │ ├── deployment │ ├── mmdet2torchserve.py │ ├── mmdet_handler.py │ └── test_torchserver.py │ ├── dist_test.sh │ ├── dist_test_tracking.sh │ ├── dist_train.sh │ ├── misc │ ├── download_dataset.py │ ├── gen_coco_panoptic_test_info.py │ ├── get_crowdhuman_id_hw.py │ ├── get_image_metas.py │ ├── print_config.py │ ├── split_coco.py │ └── split_odvg.py │ ├── model_converters │ ├── detectron2_to_mmdet.py │ ├── detectron2pytorch.py │ ├── detic_to_mmdet.py │ ├── glip_to_mmdet.py │ ├── groundingdino_to_mmdet.py │ ├── publish_model.py │ ├── regnet2mmdet.py │ ├── selfsup2mmdet.py │ ├── swinv1_to_mmdet.py │ ├── upgrade_model_version.py │ └── upgrade_ssd_version.py │ ├── slurm_test.sh │ ├── slurm_test_tracking.sh │ ├── slurm_train.sh │ ├── test.py │ ├── test_tracking.py │ └── train.py ├── LICENSE ├── Person-ReID └── TransReID-SSL │ ├── README.md │ ├── requirements.txt │ └── transreid_pytorch │ ├── config │ ├── __init__.py │ └── defaults.py │ ├── configs │ ├── cuhk03 │ │ ├── vit_base_ics_384.yml │ │ └── vit_small.yml │ ├── dukemtmc │ │ ├── vit_base_ics_384.yml │ │ └── vit_small.yml │ ├── market │ │ ├── vit_base_ics_384.yml │ │ └── vit_small.yml │ └── msmt17 │ │ ├── vit_base_ics_384.yml │ │ └── vit_small.yml │ ├── datasets │ ├── __init__.py │ ├── all.py │ ├── bases.py │ ├── cuhk03.py │ ├── dukemtmcreid.py │ ├── make_dataloader.py │ ├── market1501.py │ ├── mm.py │ ├── msmt17.py │ ├── preprocessing.py │ ├── sampler.py │ ├── sampler_ddp.py │ ├── tools.py │ └── transforms.py │ ├── loss │ ├── __init__.py │ ├── arcface.py │ ├── center_loss.py │ ├── make_loss.py │ ├── metric_learning.py │ ├── softmax_loss.py │ └── triplet_loss.py │ ├── model │ ├── __init__.py │ ├── backbones │ │ ├── __init__.py │ │ ├── resnet.py │ │ ├── resnet_ibn_a.py │ │ ├── swin_transformer.py │ │ ├── transformer_layers.py │ │ └── vit_pytorch.py │ └── make_model.py │ ├── processor │ ├── __init__.py │ └── processor.py │ ├── run.sh │ ├── setup.py │ ├── solver │ ├── __init__.py │ ├── cosine_lr.py │ ├── lr_scheduler.py │ ├── make_optimizer.py │ ├── scheduler.py │ └── scheduler_factory.py │ ├── test.py │ ├── train.py │ └── utils │ ├── __init__.py │ ├── faiss_rerank.py │ ├── faiss_utils.py │ ├── iotools.py │ ├── logger.py │ ├── meter.py │ ├── metrics.py │ └── reranking.py ├── README.md ├── denoiserep_op ├── denoiserep │ ├── __init__.py │ ├── denoise_conv2d.py │ ├── denoise_layer.py │ └── denoise_linear.py ├── make.sh └── setup.py └── fig ├── idea.png ├── method.png ├── tutorial-load-convert.jpg ├── tutorial-loss.jpeg └── tutorial-trick.jpg /Classification/cifar-10/vision-transformers-cifar10/models/__init__.py: -------------------------------------------------------------------------------- 1 | from models.vit_small import * 2 | from models.vit import * -------------------------------------------------------------------------------- /Classification/cifar-10/vision-transformers-cifar10/requirements.txt: -------------------------------------------------------------------------------- 1 | vit-pytorch 2 | einops 3 | odach 4 | wandb 5 | -------------------------------------------------------------------------------- /Classification/imagenet/Swin-Transformer/configs/swinv2/swinv2_base_patch4_window12_192_22k.yaml: -------------------------------------------------------------------------------- 1 | DATA: 2 | DATASET: imagenet22K 3 | IMG_SIZE: 192 4 | MODEL: 5 | TYPE: swinv2 6 | NAME: swinv2_base_patch4_window12_192_22k 7 | DROP_PATH_RATE: 0.2 8 | SWINV2: 9 | EMBED_DIM: 128 10 | DEPTHS: [ 2, 2, 18, 2 ] 11 | NUM_HEADS: [ 4, 8, 16, 32 ] 12 | WINDOW_SIZE: 12 13 | TRAIN: 14 | EPOCHS: 90 15 | WARMUP_EPOCHS: 5 16 | WEIGHT_DECAY: 0.1 17 | BASE_LR: 1.25e-4 # 4096 batch-size 18 | WARMUP_LR: 1.25e-7 19 | MIN_LR: 1.25e-6 -------------------------------------------------------------------------------- /Classification/imagenet/Swin-Transformer/configs/swinv2/swinv2_base_patch4_window12to16_192to256_22kto1k_ft.yaml: -------------------------------------------------------------------------------- 1 | DATA: 2 | IMG_SIZE: 256 3 | MODEL: 4 | TYPE: swinv2 5 | NAME: swinv2_base_patch4_window12to16_192to256_22kto1k_ft 6 | DROP_PATH_RATE: 0.2 7 | SWINV2: 8 | EMBED_DIM: 128 9 | DEPTHS: [ 2, 2, 18, 2 ] 10 | NUM_HEADS: [ 4, 8, 16, 32 ] 11 | WINDOW_SIZE: 16 12 | PRETRAINED_WINDOW_SIZES: [ 12, 12, 12, 6 ] 13 | TRAIN: 14 | EPOCHS: 30 15 | WARMUP_EPOCHS: 5 16 | WEIGHT_DECAY: 1e-8 17 | BASE_LR: 2e-05 18 | WARMUP_LR: 2e-08 19 | MIN_LR: 2e-07 -------------------------------------------------------------------------------- /Classification/imagenet/Swin-Transformer/configs/swinv2/swinv2_base_patch4_window12to24_192to384_22kto1k_ft.yaml: -------------------------------------------------------------------------------- 1 | DATA: 2 | IMG_SIZE: 384 3 | MODEL: 4 | TYPE: swinv2 5 | NAME: swinv2_base_patch4_window12to24_192to384_22kto1k_ft 6 | DROP_PATH_RATE: 0.2 7 | SWINV2: 8 | EMBED_DIM: 128 9 | DEPTHS: [ 2, 2, 18, 2 ] 10 | NUM_HEADS: [ 4, 8, 16, 32 ] 11 | WINDOW_SIZE: 24 12 | PRETRAINED_WINDOW_SIZES: [ 12, 12, 12, 6 ] 13 | TRAIN: 14 | EPOCHS: 30 15 | WARMUP_EPOCHS: 5 16 | WEIGHT_DECAY: 1e-8 17 | BASE_LR: 2e-05 18 | WARMUP_LR: 2e-08 19 | MIN_LR: 2e-07 20 | TEST: 21 | CROP: False -------------------------------------------------------------------------------- /Classification/imagenet/Swin-Transformer/configs/swinv2/swinv2_base_patch4_window16_256.yaml: -------------------------------------------------------------------------------- 1 | DATA: 2 | IMG_SIZE: 256 3 | MODEL: 4 | TYPE: swinv2 5 | NAME: swinv2_base_patch4_window16_256 6 | DROP_PATH_RATE: 0.5 7 | SWINV2: 8 | EMBED_DIM: 128 9 | DEPTHS: [ 2, 2, 18, 2 ] 10 | NUM_HEADS: [ 4, 8, 16, 32 ] 11 | WINDOW_SIZE: 16 -------------------------------------------------------------------------------- /Classification/imagenet/Swin-Transformer/configs/swinv2/swinv2_base_patch4_window8_256.yaml: -------------------------------------------------------------------------------- 1 | DATA: 2 | IMG_SIZE: 256 3 | MODEL: 4 | TYPE: swinv2 5 | NAME: swinv2_base_patch4_window8_256 6 | DROP_PATH_RATE: 0.5 7 | SWINV2: 8 | EMBED_DIM: 128 9 | DEPTHS: [ 2, 2, 18, 2 ] 10 | NUM_HEADS: [ 4, 8, 16, 32 ] 11 | WINDOW_SIZE: 8 -------------------------------------------------------------------------------- /Classification/imagenet/Swin-Transformer/configs/swinv2/swinv2_large_patch4_window12_192_22k.yaml: -------------------------------------------------------------------------------- 1 | DATA: 2 | DATASET: imagenet22K 3 | IMG_SIZE: 192 4 | MODEL: 5 | TYPE: swinv2 6 | NAME: swinv2_large_patch4_window12_192_22k 7 | DROP_PATH_RATE: 0.2 8 | SWINV2: 9 | EMBED_DIM: 192 10 | DEPTHS: [ 2, 2, 18, 2 ] 11 | NUM_HEADS: [ 6, 12, 24, 48 ] 12 | WINDOW_SIZE: 12 13 | TRAIN: 14 | EPOCHS: 90 15 | WARMUP_EPOCHS: 5 16 | WEIGHT_DECAY: 0.1 17 | BASE_LR: 1.25e-4 # 4096 batch-size 18 | WARMUP_LR: 1.25e-7 19 | MIN_LR: 1.25e-6 -------------------------------------------------------------------------------- /Classification/imagenet/Swin-Transformer/configs/swinv2/swinv2_large_patch4_window12to16_192to256_22kto1k_ft.yaml: -------------------------------------------------------------------------------- 1 | DATA: 2 | IMG_SIZE: 256 3 | MODEL: 4 | TYPE: swinv2 5 | NAME: swinv2_base_patch4_window12to16_192to256_22kto1k_ft 6 | DROP_PATH_RATE: 0.2 7 | SWINV2: 8 | EMBED_DIM: 192 9 | DEPTHS: [ 2, 2, 18, 2 ] 10 | NUM_HEADS: [ 6, 12, 24, 48 ] 11 | WINDOW_SIZE: 16 12 | PRETRAINED_WINDOW_SIZES: [ 12, 12, 12, 6 ] 13 | TRAIN: 14 | EPOCHS: 30 15 | WARMUP_EPOCHS: 5 16 | WEIGHT_DECAY: 1e-8 17 | BASE_LR: 2e-05 18 | WARMUP_LR: 2e-08 19 | MIN_LR: 2e-07 -------------------------------------------------------------------------------- /Classification/imagenet/Swin-Transformer/configs/swinv2/swinv2_large_patch4_window12to24_192to384_22kto1k_ft.yaml: -------------------------------------------------------------------------------- 1 | DATA: 2 | IMG_SIZE: 384 3 | MODEL: 4 | TYPE: swinv2 5 | NAME: swinv2_large_patch4_window12to24_192to384_22kto1k_ft 6 | DROP_PATH_RATE: 0.2 7 | SWINV2: 8 | EMBED_DIM: 192 9 | DEPTHS: [ 2, 2, 18, 2 ] 10 | NUM_HEADS: [ 6, 12, 24, 48 ] 11 | WINDOW_SIZE: 24 12 | PRETRAINED_WINDOW_SIZES: [ 12, 12, 12, 6 ] 13 | TRAIN: 14 | EPOCHS: 30 15 | WARMUP_EPOCHS: 5 16 | WEIGHT_DECAY: 1e-8 17 | BASE_LR: 2e-05 18 | WARMUP_LR: 2e-08 19 | MIN_LR: 2e-07 20 | TEST: 21 | CROP: False -------------------------------------------------------------------------------- /Classification/imagenet/Swin-Transformer/configs/swinv2/swinv2_small_patch4_window16_256.yaml: -------------------------------------------------------------------------------- 1 | DATA: 2 | IMG_SIZE: 256 3 | MODEL: 4 | TYPE: swinv2 5 | NAME: swinv2_small_patch4_window16_256 6 | DROP_PATH_RATE: 0.3 7 | SWINV2: 8 | EMBED_DIM: 96 9 | DEPTHS: [ 2, 2, 18, 2 ] 10 | NUM_HEADS: [ 3, 6, 12, 24 ] 11 | WINDOW_SIZE: 16 -------------------------------------------------------------------------------- /Classification/imagenet/Swin-Transformer/configs/swinv2/swinv2_small_patch4_window8_256.yaml: -------------------------------------------------------------------------------- 1 | DATA: 2 | IMG_SIZE: 256 3 | MODEL: 4 | TYPE: swinv2 5 | NAME: swinv2_small_patch4_window8_256 6 | DROP_PATH_RATE: 0.3 7 | SWINV2: 8 | EMBED_DIM: 96 9 | DEPTHS: [ 2, 2, 18, 2 ] 10 | NUM_HEADS: [ 3, 6, 12, 24 ] 11 | WINDOW_SIZE: 8 -------------------------------------------------------------------------------- /Classification/imagenet/Swin-Transformer/configs/swinv2/swinv2_tiny_patch4_window16_256.yaml: -------------------------------------------------------------------------------- 1 | DATA: 2 | IMG_SIZE: 256 3 | MODEL: 4 | TYPE: swinv2 5 | NAME: swinv2_tiny_patch4_window16_256 6 | DROP_PATH_RATE: 0.2 7 | SWINV2: 8 | EMBED_DIM: 96 9 | DEPTHS: [ 2, 2, 6, 2 ] 10 | NUM_HEADS: [ 3, 6, 12, 24 ] 11 | WINDOW_SIZE: 16 -------------------------------------------------------------------------------- /Classification/imagenet/Swin-Transformer/configs/swinv2/swinv2_tiny_patch4_window8_256.yaml: -------------------------------------------------------------------------------- 1 | DATA: 2 | IMG_SIZE: 256 3 | MODEL: 4 | TYPE: swinv2 5 | NAME: swinv2_tiny_patch4_window8_256 6 | DROP_PATH_RATE: 0.2 7 | SWINV2: 8 | EMBED_DIM: 96 9 | DEPTHS: [ 2, 2, 6, 2 ] 10 | NUM_HEADS: [ 3, 6, 12, 24 ] 11 | WINDOW_SIZE: 8 -------------------------------------------------------------------------------- /Classification/imagenet/Swin-Transformer/data/__init__.py: -------------------------------------------------------------------------------- 1 | from .build import build_loader as _build_loader 2 | from .data_simmim_pt import build_loader_simmim 3 | from .data_simmim_ft import build_loader_finetune 4 | 5 | 6 | def build_loader(config, simmim=False, is_pretrain=False): 7 | if not simmim: 8 | return _build_loader(config) 9 | if is_pretrain: 10 | return build_loader_simmim(config) 11 | else: 12 | return build_loader_finetune(config) 13 | -------------------------------------------------------------------------------- /Classification/imagenet/Swin-Transformer/data/samplers.py: -------------------------------------------------------------------------------- 1 | # -------------------------------------------------------- 2 | # Swin Transformer 3 | # Copyright (c) 2021 Microsoft 4 | # Licensed under The MIT License [see LICENSE for details] 5 | # Written by Ze Liu 6 | # -------------------------------------------------------- 7 | 8 | import torch 9 | 10 | 11 | class SubsetRandomSampler(torch.utils.data.Sampler): 12 | r"""Samples elements randomly from a given list of indices, without replacement. 13 | 14 | Arguments: 15 | indices (sequence): a sequence of indices 16 | """ 17 | 18 | def __init__(self, indices): 19 | self.epoch = 0 20 | self.indices = indices 21 | 22 | def __iter__(self): 23 | return (self.indices[i] for i in torch.randperm(len(self.indices))) 24 | 25 | def __len__(self): 26 | return len(self.indices) 27 | 28 | def set_epoch(self, epoch): 29 | self.epoch = epoch 30 | -------------------------------------------------------------------------------- /Classification/imagenet/Swin-Transformer/kernels/window_process/setup.py: -------------------------------------------------------------------------------- 1 | from setuptools import setup 2 | from torch.utils.cpp_extension import BuildExtension, CUDAExtension 3 | 4 | 5 | setup(name='swin_window_process', 6 | ext_modules=[ 7 | CUDAExtension('swin_window_process', [ 8 | 'swin_window_process.cpp', 9 | 'swin_window_process_kernel.cu', 10 | ]) 11 | ], 12 | cmdclass={'build_ext': BuildExtension}) -------------------------------------------------------------------------------- /Classification/imagenet/Swin-Transformer/models/__init__.py: -------------------------------------------------------------------------------- 1 | from .build import build_model -------------------------------------------------------------------------------- /Detection/mmdetection/configs/_base_/datasets/lvis_v1_instance.py: -------------------------------------------------------------------------------- 1 | # dataset settings 2 | _base_ = 'lvis_v0.5_instance.py' 3 | dataset_type = 'LVISV1Dataset' 4 | data_root = 'data/lvis_v1/' 5 | 6 | train_dataloader = dict( 7 | dataset=dict( 8 | dataset=dict( 9 | type=dataset_type, 10 | data_root=data_root, 11 | ann_file='annotations/lvis_v1_train.json', 12 | data_prefix=dict(img='')))) 13 | val_dataloader = dict( 14 | dataset=dict( 15 | type=dataset_type, 16 | data_root=data_root, 17 | ann_file='annotations/lvis_v1_val.json', 18 | data_prefix=dict(img=''))) 19 | test_dataloader = val_dataloader 20 | 21 | val_evaluator = dict(ann_file=data_root + 'annotations/lvis_v1_val.json') 22 | test_evaluator = val_evaluator 23 | -------------------------------------------------------------------------------- /Detection/mmdetection/configs/_base_/default_runtime.py: -------------------------------------------------------------------------------- 1 | default_scope = 'mmdet' 2 | 3 | default_hooks = dict( 4 | timer=dict(type='IterTimerHook'), 5 | logger=dict(type='LoggerHook', interval=50), 6 | param_scheduler=dict(type='ParamSchedulerHook'), 7 | checkpoint=dict(type='CheckpointHook', interval=1), 8 | sampler_seed=dict(type='DistSamplerSeedHook'), 9 | visualization=dict(type='DetVisualizationHook')) 10 | 11 | env_cfg = dict( 12 | cudnn_benchmark=False, 13 | mp_cfg=dict(mp_start_method='fork', opencv_num_threads=0), 14 | dist_cfg=dict(backend='nccl'), 15 | ) 16 | 17 | vis_backends = [dict(type='LocalVisBackend')] 18 | visualizer = dict( 19 | type='DetLocalVisualizer', vis_backends=vis_backends, name='visualizer') 20 | log_processor = dict(type='LogProcessor', window_size=50, by_epoch=True) 21 | 22 | log_level = 'INFO' 23 | load_from = None 24 | resume = False 25 | -------------------------------------------------------------------------------- /Detection/mmdetection/configs/_base_/schedules/schedule_1x.py: -------------------------------------------------------------------------------- 1 | # training schedule for 1x 2 | train_cfg = dict(type='EpochBasedTrainLoop', max_epochs=12, val_interval=1) 3 | val_cfg = dict(type='ValLoop') 4 | test_cfg = dict(type='TestLoop') 5 | 6 | # learning rate 7 | param_scheduler = [ 8 | dict( 9 | type='LinearLR', start_factor=0.001, by_epoch=False, begin=0, end=500), 10 | dict( 11 | type='MultiStepLR', 12 | begin=0, 13 | end=12, 14 | by_epoch=True, 15 | milestones=[8, 11], 16 | gamma=0.1) 17 | ] 18 | 19 | # optimizer 20 | optim_wrapper = dict( 21 | type='OptimWrapper', 22 | optimizer=dict(type='SGD', lr=0.02, momentum=0.9, weight_decay=0.0001)) 23 | 24 | # Default setting for scaling LR automatically 25 | # - `enable` means enable scaling LR automatically 26 | # or not by default. 27 | # - `base_batch_size` = (8 GPUs) x (2 samples per GPU). 28 | auto_scale_lr = dict(enable=False, base_batch_size=16) 29 | -------------------------------------------------------------------------------- /Detection/mmdetection/configs/_base_/schedules/schedule_20e.py: -------------------------------------------------------------------------------- 1 | # training schedule for 20e 2 | train_cfg = dict(type='EpochBasedTrainLoop', max_epochs=20, val_interval=1) 3 | val_cfg = dict(type='ValLoop') 4 | test_cfg = dict(type='TestLoop') 5 | 6 | # learning rate 7 | param_scheduler = [ 8 | dict( 9 | type='LinearLR', start_factor=0.001, by_epoch=False, begin=0, end=500), 10 | dict( 11 | type='MultiStepLR', 12 | begin=0, 13 | end=20, 14 | by_epoch=True, 15 | milestones=[16, 19], 16 | gamma=0.1) 17 | ] 18 | 19 | # optimizer 20 | optim_wrapper = dict( 21 | type='OptimWrapper', 22 | optimizer=dict(type='SGD', lr=0.02, momentum=0.9, weight_decay=0.0001)) 23 | 24 | # Default setting for scaling LR automatically 25 | # - `enable` means enable scaling LR automatically 26 | # or not by default. 27 | # - `base_batch_size` = (8 GPUs) x (2 samples per GPU). 28 | auto_scale_lr = dict(enable=False, base_batch_size=16) 29 | -------------------------------------------------------------------------------- /Detection/mmdetection/configs/_base_/schedules/schedule_2x.py: -------------------------------------------------------------------------------- 1 | # training schedule for 2x 2 | train_cfg = dict(type='EpochBasedTrainLoop', max_epochs=24, val_interval=1) 3 | val_cfg = dict(type='ValLoop') 4 | test_cfg = dict(type='TestLoop') 5 | 6 | # learning rate 7 | param_scheduler = [ 8 | dict( 9 | type='LinearLR', start_factor=0.001, by_epoch=False, begin=0, end=500), 10 | dict( 11 | type='MultiStepLR', 12 | begin=0, 13 | end=24, 14 | by_epoch=True, 15 | milestones=[16, 22], 16 | gamma=0.1) 17 | ] 18 | 19 | # optimizer 20 | optim_wrapper = dict( 21 | type='OptimWrapper', 22 | optimizer=dict(type='SGD', lr=0.02, momentum=0.9, weight_decay=0.0001)) 23 | 24 | # Default setting for scaling LR automatically 25 | # - `enable` means enable scaling LR automatically 26 | # or not by default. 27 | # - `base_batch_size` = (8 GPUs) x (2 samples per GPU). 28 | auto_scale_lr = dict(enable=False, base_batch_size=16) 29 | -------------------------------------------------------------------------------- /Detection/mmdetection/configs/mask_rcnn/mask-rcnn_r101-caffe_fpn_1x_coco.py: -------------------------------------------------------------------------------- 1 | _base_ = './mask-rcnn_r50-caffe_fpn_1x_coco.py' 2 | model = dict( 3 | backbone=dict( 4 | depth=101, 5 | init_cfg=dict( 6 | type='Pretrained', 7 | checkpoint='open-mmlab://detectron2/resnet101_caffe'))) 8 | -------------------------------------------------------------------------------- /Detection/mmdetection/configs/mask_rcnn/mask-rcnn_r101-caffe_fpn_ms-poly-3x_coco.py: -------------------------------------------------------------------------------- 1 | _base_ = [ 2 | '../common/ms-poly_3x_coco-instance.py', 3 | '../_base_/models/mask-rcnn_r50_fpn.py' 4 | ] 5 | 6 | model = dict( 7 | # use caffe img_norm 8 | data_preprocessor=dict( 9 | mean=[103.530, 116.280, 123.675], 10 | std=[1.0, 1.0, 1.0], 11 | bgr_to_rgb=False), 12 | backbone=dict( 13 | depth=101, 14 | norm_cfg=dict(requires_grad=False), 15 | norm_eval=True, 16 | style='caffe', 17 | init_cfg=dict( 18 | type='Pretrained', 19 | checkpoint='open-mmlab://detectron2/resnet101_caffe'))) 20 | -------------------------------------------------------------------------------- /Detection/mmdetection/configs/mask_rcnn/mask-rcnn_r101_fpn_1x_coco.py: -------------------------------------------------------------------------------- 1 | _base_ = './mask-rcnn_r50_fpn_1x_coco.py' 2 | model = dict( 3 | backbone=dict( 4 | depth=101, 5 | init_cfg=dict(type='Pretrained', 6 | checkpoint='torchvision://resnet101'))) 7 | -------------------------------------------------------------------------------- /Detection/mmdetection/configs/mask_rcnn/mask-rcnn_r101_fpn_2x_coco.py: -------------------------------------------------------------------------------- 1 | _base_ = './mask-rcnn_r50_fpn_2x_coco.py' 2 | model = dict( 3 | backbone=dict( 4 | depth=101, 5 | init_cfg=dict(type='Pretrained', 6 | checkpoint='torchvision://resnet101'))) 7 | -------------------------------------------------------------------------------- /Detection/mmdetection/configs/mask_rcnn/mask-rcnn_r101_fpn_8xb8-amp-lsj-200e_coco.py: -------------------------------------------------------------------------------- 1 | _base_ = './mask-rcnn_r50_fpn_8xb8-amp-lsj-200e_coco.py' 2 | 3 | model = dict( 4 | backbone=dict( 5 | depth=101, 6 | init_cfg=dict(type='Pretrained', 7 | checkpoint='torchvision://resnet101'))) 8 | -------------------------------------------------------------------------------- /Detection/mmdetection/configs/mask_rcnn/mask-rcnn_r101_fpn_ms-poly-3x_coco.py: -------------------------------------------------------------------------------- 1 | _base_ = [ 2 | '../common/ms-poly_3x_coco-instance.py', 3 | '../_base_/models/mask-rcnn_r50_fpn.py' 4 | ] 5 | 6 | model = dict( 7 | backbone=dict( 8 | depth=101, 9 | init_cfg=dict(type='Pretrained', 10 | checkpoint='torchvision://resnet101'))) 11 | -------------------------------------------------------------------------------- /Detection/mmdetection/configs/mask_rcnn/mask-rcnn_r18_fpn_8xb8-amp-lsj-200e_coco.py: -------------------------------------------------------------------------------- 1 | _base_ = './mask-rcnn_r50_fpn_8xb8-amp-lsj-200e_coco.py' 2 | 3 | model = dict( 4 | backbone=dict( 5 | depth=18, 6 | init_cfg=dict(type='Pretrained', checkpoint='torchvision://resnet18')), 7 | neck=dict(in_channels=[64, 128, 256, 512])) 8 | -------------------------------------------------------------------------------- /Detection/mmdetection/configs/mask_rcnn/mask-rcnn_r50-caffe-c4_1x_coco.py: -------------------------------------------------------------------------------- 1 | _base_ = [ 2 | '../_base_/models/mask-rcnn_r50-caffe-c4.py', 3 | '../_base_/datasets/coco_instance.py', 4 | '../_base_/schedules/schedule_1x.py', '../_base_/default_runtime.py' 5 | ] 6 | -------------------------------------------------------------------------------- /Detection/mmdetection/configs/mask_rcnn/mask-rcnn_r50-caffe_fpn_1x_coco.py: -------------------------------------------------------------------------------- 1 | _base_ = './mask-rcnn_r50_fpn_1x_coco.py' 2 | model = dict( 3 | # use caffe img_norm 4 | data_preprocessor=dict( 5 | mean=[103.530, 116.280, 123.675], 6 | std=[1.0, 1.0, 1.0], 7 | bgr_to_rgb=False), 8 | backbone=dict( 9 | norm_cfg=dict(requires_grad=False), 10 | style='caffe', 11 | init_cfg=dict( 12 | type='Pretrained', 13 | checkpoint='open-mmlab://detectron2/resnet50_caffe'))) 14 | -------------------------------------------------------------------------------- /Detection/mmdetection/configs/mask_rcnn/mask-rcnn_r50-caffe_fpn_ms-1x_coco.py: -------------------------------------------------------------------------------- 1 | _base_ = './mask-rcnn_r50_fpn_1x_coco.py' 2 | 3 | model = dict( 4 | # use caffe img_norm 5 | data_preprocessor=dict( 6 | mean=[103.530, 116.280, 123.675], 7 | std=[1.0, 1.0, 1.0], 8 | bgr_to_rgb=False), 9 | backbone=dict( 10 | norm_cfg=dict(requires_grad=False), 11 | style='caffe', 12 | init_cfg=dict( 13 | type='Pretrained', 14 | checkpoint='open-mmlab://detectron2/resnet50_caffe'))) 15 | 16 | train_pipeline = [ 17 | dict(type='LoadImageFromFile', backend_args={{_base_.backend_args}}), 18 | dict(type='LoadAnnotations', with_bbox=True, with_mask=True), 19 | dict( 20 | type='RandomChoiceResize', 21 | scales=[(1333, 640), (1333, 672), (1333, 704), (1333, 736), 22 | (1333, 768), (1333, 800)], 23 | keep_ratio=True), 24 | dict(type='RandomFlip', prob=0.5), 25 | dict(type='PackDetInputs'), 26 | ] 27 | 28 | train_dataloader = dict(dataset=dict(pipeline=train_pipeline)) 29 | -------------------------------------------------------------------------------- /Detection/mmdetection/configs/mask_rcnn/mask-rcnn_r50-caffe_fpn_ms-poly-1x_coco.py: -------------------------------------------------------------------------------- 1 | _base_ = './mask-rcnn_r50_fpn_1x_coco.py' 2 | 3 | model = dict( 4 | # use caffe img_norm 5 | data_preprocessor=dict( 6 | mean=[103.530, 116.280, 123.675], 7 | std=[1.0, 1.0, 1.0], 8 | bgr_to_rgb=False), 9 | backbone=dict( 10 | norm_cfg=dict(requires_grad=False), 11 | style='caffe', 12 | init_cfg=dict( 13 | type='Pretrained', 14 | checkpoint='open-mmlab://detectron2/resnet50_caffe'))) 15 | train_pipeline = [ 16 | dict(type='LoadImageFromFile', backend_args={{_base_.backend_args}}), 17 | dict( 18 | type='LoadAnnotations', 19 | with_bbox=True, 20 | with_mask=True, 21 | poly2mask=False), 22 | dict( 23 | type='RandomChoiceResize', 24 | scales=[(1333, 640), (1333, 672), (1333, 704), (1333, 736), 25 | (1333, 768), (1333, 800)], 26 | keep_ratio=True), 27 | dict(type='RandomFlip', prob=0.5), 28 | dict(type='PackDetInputs') 29 | ] 30 | 31 | train_dataloader = dict(dataset=dict(pipeline=train_pipeline)) 32 | -------------------------------------------------------------------------------- /Detection/mmdetection/configs/mask_rcnn/mask-rcnn_r50-caffe_fpn_ms-poly-2x_coco.py: -------------------------------------------------------------------------------- 1 | _base_ = './mask-rcnn_r50-caffe_fpn_ms-poly-1x_coco.py' 2 | 3 | train_cfg = dict(max_epochs=24) 4 | # learning rate 5 | param_scheduler = [ 6 | dict( 7 | type='LinearLR', start_factor=0.001, by_epoch=False, begin=0, end=500), 8 | dict( 9 | type='MultiStepLR', 10 | begin=0, 11 | end=24, 12 | by_epoch=True, 13 | milestones=[16, 22], 14 | gamma=0.1) 15 | ] 16 | -------------------------------------------------------------------------------- /Detection/mmdetection/configs/mask_rcnn/mask-rcnn_r50-caffe_fpn_ms-poly-3x_coco.py: -------------------------------------------------------------------------------- 1 | _base_ = './mask-rcnn_r50-caffe_fpn_ms-poly-1x_coco.py' 2 | 3 | train_cfg = dict(max_epochs=36) 4 | # learning rate 5 | param_scheduler = [ 6 | dict( 7 | type='LinearLR', start_factor=0.001, by_epoch=False, begin=0, end=500), 8 | dict( 9 | type='MultiStepLR', 10 | begin=0, 11 | end=24, 12 | by_epoch=True, 13 | milestones=[28, 34], 14 | gamma=0.1) 15 | ] 16 | -------------------------------------------------------------------------------- /Detection/mmdetection/configs/mask_rcnn/mask-rcnn_r50_fpn_1x-wandb_coco.py: -------------------------------------------------------------------------------- 1 | _base_ = [ 2 | '../_base_/models/mask-rcnn_r50_fpn.py', 3 | '../_base_/datasets/coco_instance.py', 4 | '../_base_/schedules/schedule_1x.py', '../_base_/default_runtime.py' 5 | ] 6 | 7 | vis_backends = [dict(type='LocalVisBackend'), dict(type='WandbVisBackend')] 8 | visualizer = dict(vis_backends=vis_backends) 9 | 10 | # MMEngine support the following two ways, users can choose 11 | # according to convenience 12 | # default_hooks = dict(checkpoint=dict(interval=4)) 13 | _base_.default_hooks.checkpoint.interval = 4 14 | 15 | # train_cfg = dict(val_interval=2) 16 | _base_.train_cfg.val_interval = 2 17 | -------------------------------------------------------------------------------- /Detection/mmdetection/configs/mask_rcnn/mask-rcnn_r50_fpn_1x_coco.py: -------------------------------------------------------------------------------- 1 | _base_ = [ 2 | '../_base_/models/mask-rcnn_r50_fpn.py', 3 | '../_base_/datasets/coco_instance.py', 4 | '../_base_/schedules/schedule_1x.py', '../_base_/default_runtime.py' 5 | ] 6 | -------------------------------------------------------------------------------- /Detection/mmdetection/configs/mask_rcnn/mask-rcnn_r50_fpn_2x_coco.py: -------------------------------------------------------------------------------- 1 | _base_ = [ 2 | '../_base_/models/mask-rcnn_r50_fpn.py', 3 | '../_base_/datasets/coco_instance.py', 4 | '../_base_/schedules/schedule_2x.py', '../_base_/default_runtime.py' 5 | ] 6 | -------------------------------------------------------------------------------- /Detection/mmdetection/configs/mask_rcnn/mask-rcnn_r50_fpn_8xb8-amp-lsj-200e_coco.py: -------------------------------------------------------------------------------- 1 | _base_ = [ 2 | '../_base_/models/mask-rcnn_r50_fpn.py', 3 | '../common/lsj-100e_coco-instance.py' 4 | ] 5 | image_size = (1024, 1024) 6 | batch_augments = [ 7 | dict(type='BatchFixedSizePad', size=image_size, pad_mask=True) 8 | ] 9 | 10 | model = dict(data_preprocessor=dict(batch_augments=batch_augments)) 11 | 12 | train_dataloader = dict(batch_size=8, num_workers=4) 13 | # Enable automatic-mixed-precision training with AmpOptimWrapper. 14 | optim_wrapper = dict( 15 | type='AmpOptimWrapper', 16 | optimizer=dict( 17 | type='SGD', lr=0.02 * 4, momentum=0.9, weight_decay=0.00004)) 18 | 19 | # NOTE: `auto_scale_lr` is for automatically scaling LR, 20 | # USER SHOULD NOT CHANGE ITS VALUES. 21 | # base_batch_size = (8 GPUs) x (8 samples per GPU) 22 | auto_scale_lr = dict(base_batch_size=64) 23 | -------------------------------------------------------------------------------- /Detection/mmdetection/configs/mask_rcnn/mask-rcnn_r50_fpn_amp-1x_coco.py: -------------------------------------------------------------------------------- 1 | _base_ = './mask-rcnn_r50_fpn_1x_coco.py' 2 | 3 | # Enable automatic-mixed-precision training with AmpOptimWrapper. 4 | optim_wrapper = dict(type='AmpOptimWrapper') 5 | -------------------------------------------------------------------------------- /Detection/mmdetection/configs/mask_rcnn/mask-rcnn_r50_fpn_ms-poly-3x_coco.py: -------------------------------------------------------------------------------- 1 | _base_ = [ 2 | '../common/ms-poly_3x_coco-instance.py', 3 | '../_base_/models/mask-rcnn_r50_fpn.py' 4 | ] 5 | -------------------------------------------------------------------------------- /Detection/mmdetection/configs/mask_rcnn/mask-rcnn_r50_fpn_poly-1x_coco.py: -------------------------------------------------------------------------------- 1 | _base_ = [ 2 | '../_base_/models/mask-rcnn_r50_fpn.py', 3 | '../_base_/datasets/coco_instance.py', 4 | '../_base_/schedules/schedule_1x.py', '../_base_/default_runtime.py' 5 | ] 6 | 7 | train_pipeline = [ 8 | dict(type='LoadImageFromFile', backend_args={{_base_.backend_args}}), 9 | dict( 10 | type='LoadAnnotations', 11 | with_bbox=True, 12 | with_mask=True, 13 | poly2mask=False), 14 | dict(type='Resize', scale=(1333, 800), keep_ratio=True), 15 | dict(type='RandomFlip', prob=0.5), 16 | dict(type='PackDetInputs'), 17 | ] 18 | train_dataloader = dict(dataset=dict(pipeline=train_pipeline)) 19 | -------------------------------------------------------------------------------- /Detection/mmdetection/configs/mask_rcnn/mask-rcnn_x101-32x4d_fpn_1x_coco.py: -------------------------------------------------------------------------------- 1 | _base_ = './mask-rcnn_r101_fpn_1x_coco.py' 2 | model = dict( 3 | backbone=dict( 4 | type='ResNeXt', 5 | depth=101, 6 | groups=32, 7 | base_width=4, 8 | num_stages=4, 9 | out_indices=(0, 1, 2, 3), 10 | frozen_stages=1, 11 | norm_cfg=dict(type='BN', requires_grad=True), 12 | style='pytorch', 13 | init_cfg=dict( 14 | type='Pretrained', checkpoint='open-mmlab://resnext101_32x4d'))) 15 | -------------------------------------------------------------------------------- /Detection/mmdetection/configs/mask_rcnn/mask-rcnn_x101-32x4d_fpn_2x_coco.py: -------------------------------------------------------------------------------- 1 | _base_ = './mask-rcnn_r101_fpn_2x_coco.py' 2 | model = dict( 3 | backbone=dict( 4 | type='ResNeXt', 5 | depth=101, 6 | groups=32, 7 | base_width=4, 8 | num_stages=4, 9 | out_indices=(0, 1, 2, 3), 10 | frozen_stages=1, 11 | norm_cfg=dict(type='BN', requires_grad=True), 12 | style='pytorch', 13 | init_cfg=dict( 14 | type='Pretrained', checkpoint='open-mmlab://resnext101_32x4d'))) 15 | -------------------------------------------------------------------------------- /Detection/mmdetection/configs/mask_rcnn/mask-rcnn_x101-32x4d_fpn_ms-poly-3x_coco.py: -------------------------------------------------------------------------------- 1 | _base_ = [ 2 | '../common/ms-poly_3x_coco-instance.py', 3 | '../_base_/models/mask-rcnn_r50_fpn.py' 4 | ] 5 | 6 | model = dict( 7 | backbone=dict( 8 | type='ResNeXt', 9 | depth=101, 10 | groups=32, 11 | base_width=4, 12 | num_stages=4, 13 | out_indices=(0, 1, 2, 3), 14 | frozen_stages=1, 15 | norm_cfg=dict(type='BN', requires_grad=True), 16 | style='pytorch', 17 | init_cfg=dict( 18 | type='Pretrained', checkpoint='open-mmlab://resnext101_32x4d'))) 19 | -------------------------------------------------------------------------------- /Detection/mmdetection/configs/mask_rcnn/mask-rcnn_x101-32x8d_fpn_1x_coco.py: -------------------------------------------------------------------------------- 1 | _base_ = './mask-rcnn_r101_fpn_1x_coco.py' 2 | 3 | model = dict( 4 | # ResNeXt-101-32x8d model trained with Caffe2 at FB, 5 | # so the mean and std need to be changed. 6 | data_preprocessor=dict( 7 | mean=[103.530, 116.280, 123.675], 8 | std=[57.375, 57.120, 58.395], 9 | bgr_to_rgb=False), 10 | backbone=dict( 11 | type='ResNeXt', 12 | depth=101, 13 | groups=32, 14 | base_width=8, 15 | num_stages=4, 16 | out_indices=(0, 1, 2, 3), 17 | frozen_stages=1, 18 | norm_cfg=dict(type='BN', requires_grad=False), 19 | style='pytorch', 20 | init_cfg=dict( 21 | type='Pretrained', 22 | checkpoint='open-mmlab://detectron2/resnext101_32x8d'))) 23 | -------------------------------------------------------------------------------- /Detection/mmdetection/configs/mask_rcnn/mask-rcnn_x101-32x8d_fpn_ms-poly-3x_coco.py: -------------------------------------------------------------------------------- 1 | _base_ = [ 2 | '../common/ms-poly_3x_coco-instance.py', 3 | '../_base_/models/mask-rcnn_r50_fpn.py' 4 | ] 5 | 6 | model = dict( 7 | # ResNeXt-101-32x8d model trained with Caffe2 at FB, 8 | # so the mean and std need to be changed. 9 | data_preprocessor=dict( 10 | mean=[103.530, 116.280, 123.675], 11 | std=[57.375, 57.120, 58.395], 12 | bgr_to_rgb=False), 13 | backbone=dict( 14 | type='ResNeXt', 15 | depth=101, 16 | groups=32, 17 | base_width=8, 18 | num_stages=4, 19 | out_indices=(0, 1, 2, 3), 20 | frozen_stages=1, 21 | norm_cfg=dict(type='BN', requires_grad=False), 22 | style='pytorch', 23 | init_cfg=dict( 24 | type='Pretrained', 25 | checkpoint='open-mmlab://detectron2/resnext101_32x8d'))) 26 | -------------------------------------------------------------------------------- /Detection/mmdetection/configs/mask_rcnn/mask-rcnn_x101-64x4d_fpn_1x_coco.py: -------------------------------------------------------------------------------- 1 | _base_ = './mask-rcnn_x101-32x4d_fpn_1x_coco.py' 2 | model = dict( 3 | backbone=dict( 4 | type='ResNeXt', 5 | depth=101, 6 | groups=64, 7 | base_width=4, 8 | num_stages=4, 9 | out_indices=(0, 1, 2, 3), 10 | frozen_stages=1, 11 | norm_cfg=dict(type='BN', requires_grad=True), 12 | style='pytorch', 13 | init_cfg=dict( 14 | type='Pretrained', checkpoint='open-mmlab://resnext101_64x4d'))) 15 | -------------------------------------------------------------------------------- /Detection/mmdetection/configs/mask_rcnn/mask-rcnn_x101-64x4d_fpn_2x_coco.py: -------------------------------------------------------------------------------- 1 | _base_ = './mask-rcnn_x101-32x4d_fpn_2x_coco.py' 2 | model = dict( 3 | backbone=dict( 4 | type='ResNeXt', 5 | depth=101, 6 | groups=64, 7 | base_width=4, 8 | num_stages=4, 9 | out_indices=(0, 1, 2, 3), 10 | frozen_stages=1, 11 | norm_cfg=dict(type='BN', requires_grad=True), 12 | style='pytorch', 13 | init_cfg=dict( 14 | type='Pretrained', checkpoint='open-mmlab://resnext101_64x4d'))) 15 | -------------------------------------------------------------------------------- /Detection/mmdetection/configs/mask_rcnn/mask-rcnn_x101-64x4d_fpn_ms-poly_3x_coco.py: -------------------------------------------------------------------------------- 1 | _base_ = [ 2 | '../common/ms-poly_3x_coco-instance.py', 3 | '../_base_/models/mask-rcnn_r50_fpn.py' 4 | ] 5 | 6 | model = dict( 7 | backbone=dict( 8 | type='ResNeXt', 9 | depth=101, 10 | groups=64, 11 | base_width=4, 12 | num_stages=4, 13 | out_indices=(0, 1, 2, 3), 14 | frozen_stages=1, 15 | norm_cfg=dict(type='BN', requires_grad=True), 16 | style='pytorch', 17 | init_cfg=dict( 18 | type='Pretrained', checkpoint='open-mmlab://resnext101_64x4d'))) 19 | -------------------------------------------------------------------------------- /Detection/mmdetection/configs/swin/mask-rcnn_swin-s-p4-w7_fpn_amp-ms-crop-3x_coco.py: -------------------------------------------------------------------------------- 1 | _base_ = './mask-rcnn_swin-t-p4-w7_fpn_amp-ms-crop-3x_coco.py' 2 | pretrained = 'https://github.com/SwinTransformer/storage/releases/download/v1.0.0/swin_small_patch4_window7_224.pth' # noqa 3 | model = dict( 4 | backbone=dict( 5 | depths=[2, 2, 18, 2], 6 | init_cfg=dict(type='Pretrained', checkpoint=pretrained))) 7 | -------------------------------------------------------------------------------- /Detection/mmdetection/configs/swin/mask-rcnn_swin-t-p4-w7_fpn_amp-ms-crop-3x_coco.py: -------------------------------------------------------------------------------- 1 | _base_ = './mask-rcnn_swin-t-p4-w7_fpn_ms-crop-3x_coco.py' 2 | # Enable automatic-mixed-precision training with AmpOptimWrapper. 3 | optim_wrapper = dict(type='AmpOptimWrapper') 4 | -------------------------------------------------------------------------------- /Detection/mmdetection/demo/demo.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wangguanan/DenoiseRep/14cfbf0706510710a9e5eab3bffb694ac58be00f/Detection/mmdetection/demo/demo.jpg -------------------------------------------------------------------------------- /Detection/mmdetection/demo/demo.mp4: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wangguanan/DenoiseRep/14cfbf0706510710a9e5eab3bffb694ac58be00f/Detection/mmdetection/demo/demo.mp4 -------------------------------------------------------------------------------- /Detection/mmdetection/demo/demo_mot.mp4: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wangguanan/DenoiseRep/14cfbf0706510710a9e5eab3bffb694ac58be00f/Detection/mmdetection/demo/demo_mot.mp4 -------------------------------------------------------------------------------- /Detection/mmdetection/demo/large_image.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wangguanan/DenoiseRep/14cfbf0706510710a9e5eab3bffb694ac58be00f/Detection/mmdetection/demo/large_image.jpg -------------------------------------------------------------------------------- /Detection/mmdetection/docker/serve/config.properties: -------------------------------------------------------------------------------- 1 | inference_address=http://0.0.0.0:8080 2 | management_address=http://0.0.0.0:8081 3 | metrics_address=http://0.0.0.0:8082 4 | model_store=/home/model-server/model-store 5 | load_models=all 6 | -------------------------------------------------------------------------------- /Detection/mmdetection/docker/serve/entrypoint.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | set -e 3 | 4 | if [[ "$1" = "serve" ]]; then 5 | shift 1 6 | torchserve --start --ts-config /home/model-server/config.properties 7 | else 8 | eval "$@" 9 | fi 10 | 11 | # prevent docker exit 12 | tail -f /dev/null 13 | -------------------------------------------------------------------------------- /Detection/mmdetection/mmdet/__init__.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) OpenMMLab. All rights reserved. 2 | import mmcv 3 | import mmengine 4 | from mmengine.utils import digit_version 5 | 6 | from .version import __version__, version_info 7 | 8 | mmcv_minimum_version = '2.0.0rc4' 9 | mmcv_maximum_version = '2.2.0' 10 | mmcv_version = digit_version(mmcv.__version__) 11 | 12 | mmengine_minimum_version = '0.7.1' 13 | mmengine_maximum_version = '1.0.0' 14 | mmengine_version = digit_version(mmengine.__version__) 15 | 16 | assert (mmcv_version >= digit_version(mmcv_minimum_version) 17 | and mmcv_version < digit_version(mmcv_maximum_version)), \ 18 | f'MMCV=={mmcv.__version__} is used but incompatible. ' \ 19 | f'Please install mmcv>={mmcv_minimum_version}, <{mmcv_maximum_version}.' 20 | 21 | assert (mmengine_version >= digit_version(mmengine_minimum_version) 22 | and mmengine_version < digit_version(mmengine_maximum_version)), \ 23 | f'MMEngine=={mmengine.__version__} is used but incompatible. ' \ 24 | f'Please install mmengine>={mmengine_minimum_version}, ' \ 25 | f'<{mmengine_maximum_version}.' 26 | 27 | __all__ = ['__version__', 'version_info', 'digit_version'] 28 | -------------------------------------------------------------------------------- /Detection/mmdetection/mmdet/apis/__init__.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) OpenMMLab. All rights reserved. 2 | from .det_inferencer import DetInferencer 3 | from .inference import (async_inference_detector, inference_detector, 4 | inference_mot, init_detector, init_track_model) 5 | 6 | __all__ = [ 7 | 'init_detector', 'async_inference_detector', 'inference_detector', 8 | 'DetInferencer', 'inference_mot', 'init_track_model' 9 | ] 10 | -------------------------------------------------------------------------------- /Detection/mmdetection/mmdet/configs/cascade_rcnn/cascade_mask_rcnn_r50_fpn_1x_coco.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) OpenMMLab. All rights reserved. 2 | 3 | # Please refer to https://mmengine.readthedocs.io/en/latest/advanced_tutorials/config.html#a-pure-python-style-configuration-file-beta for more details. # noqa 4 | # mmcv >= 2.0.1 5 | # mmengine >= 0.8.0 6 | 7 | from mmengine.config import read_base 8 | 9 | with read_base(): 10 | from .._base_.datasets.coco_instance import * 11 | from .._base_.default_runtime import * 12 | from .._base_.models.cascade_mask_rcnn_r50_fpn import * 13 | from .._base_.schedules.schedule_1x import * 14 | -------------------------------------------------------------------------------- /Detection/mmdetection/mmdet/configs/cascade_rcnn/cascade_rcnn_r50_fpn_1x_coco.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) OpenMMLab. All rights reserved. 2 | 3 | # Please refer to https://mmengine.readthedocs.io/en/latest/advanced_tutorials/config.html#a-pure-python-style-configuration-file-beta for more details. # noqa 4 | # mmcv >= 2.0.1 5 | # mmengine >= 0.8.0 6 | 7 | from mmengine.config import read_base 8 | 9 | with read_base(): 10 | from .._base_.datasets.coco_detection import * 11 | from .._base_.default_runtime import * 12 | from .._base_.models.cascade_rcnn_r50_fpn import * 13 | from .._base_.schedules.schedule_1x import * 14 | -------------------------------------------------------------------------------- /Detection/mmdetection/mmdet/configs/common/lsj_200e_coco_detection.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) OpenMMLab. All rights reserved. 2 | 3 | # Please refer to https://mmengine.readthedocs.io/en/latest/advanced_tutorials/config.html#a-pure-python-style-configuration-file-beta for more details. # noqa 4 | # mmcv >= 2.0.1 5 | # mmengine >= 0.8.0 6 | 7 | from mmengine.config import read_base 8 | 9 | with read_base(): 10 | from .lsj_100e_coco_detection import * 11 | 12 | # 8x25=200e 13 | train_dataloader.update(dict(dataset=dict(times=8))) 14 | 15 | # learning rate 16 | param_scheduler = [ 17 | dict(type=LinearLR, start_factor=0.067, by_epoch=False, begin=0, end=1000), 18 | dict( 19 | type=MultiStepLR, 20 | begin=0, 21 | end=25, 22 | by_epoch=True, 23 | milestones=[22, 24], 24 | gamma=0.1) 25 | ] 26 | -------------------------------------------------------------------------------- /Detection/mmdetection/mmdet/configs/common/lsj_200e_coco_instance.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) OpenMMLab. All rights reserved. 2 | 3 | # Please refer to https://mmengine.readthedocs.io/en/latest/advanced_tutorials/config.html#a-pure-python-style-configuration-file-beta for more details. # noqa 4 | # mmcv >= 2.0.1 5 | # mmengine >= 0.8.0 6 | 7 | from mmengine.config import read_base 8 | 9 | with read_base(): 10 | from .lsj_100e_coco_instance import * 11 | 12 | # 8x25=200e 13 | train_dataloader.update(dict(dataset=dict(times=8))) 14 | 15 | # learning rate 16 | param_scheduler = [ 17 | dict(type=LinearLR, start_factor=0.067, by_epoch=False, begin=0, end=1000), 18 | dict( 19 | type=MultiStepLR, 20 | begin=0, 21 | end=25, 22 | by_epoch=True, 23 | milestones=[22, 24], 24 | gamma=0.1) 25 | ] 26 | -------------------------------------------------------------------------------- /Detection/mmdetection/mmdet/configs/deformable_detr/deformable_detr_refine_r50_16xb2_50e_coco.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) OpenMMLab. All rights reserved. 2 | 3 | # Please refer to https://mmengine.readthedocs.io/en/latest/advanced_tutorials/config.html#a-pure-python-style-configuration-file-beta for more details. # noqa 4 | # mmcv >= 2.0.1 5 | # mmengine >= 0.8.0 6 | 7 | from mmengine.config import read_base 8 | 9 | with read_base(): 10 | from .deformable_detr_r50_16xb2_50e_coco import * 11 | 12 | model.update(dict(with_box_refine=True)) 13 | -------------------------------------------------------------------------------- /Detection/mmdetection/mmdet/configs/deformable_detr/deformable_detr_refine_twostage_r50_16xb2_50e_coco.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) OpenMMLab. All rights reserved. 2 | 3 | # Please refer to https://mmengine.readthedocs.io/en/latest/advanced_tutorials/config.html#a-pure-python-style-configuration-file-beta for more details. # noqa 4 | # mmcv >= 2.0.1 5 | # mmengine >= 0.8.0 6 | 7 | from mmengine.config import read_base 8 | 9 | with read_base(): 10 | from .deformable_detr_refine_r50_16xb2_50e_coco import * 11 | 12 | model.update(dict(as_two_stage=True)) 13 | -------------------------------------------------------------------------------- /Detection/mmdetection/mmdet/configs/detr/detr_r101_8xb2_500e_coco.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) OpenMMLab. All rights reserved. 2 | from mmengine.config import read_base 3 | from mmengine.model.weight_init import PretrainedInit 4 | 5 | with read_base(): 6 | from .detr_r50_8xb2_500e_coco import * 7 | 8 | model.update( 9 | dict( 10 | backbone=dict( 11 | depth=101, 12 | init_cfg=dict( 13 | type=PretrainedInit, checkpoint='torchvision://resnet101')))) 14 | -------------------------------------------------------------------------------- /Detection/mmdetection/mmdet/configs/detr/detr_r18_8xb2_500e_coco.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) OpenMMLab. All rights reserved. 2 | from mmengine.config import read_base 3 | from mmengine.model.weight_init import PretrainedInit 4 | 5 | with read_base(): 6 | from .detr_r50_8xb2_500e_coco import * 7 | 8 | model.update( 9 | dict( 10 | backbone=dict( 11 | depth=18, 12 | init_cfg=dict( 13 | type=PretrainedInit, checkpoint='torchvision://resnet18')), 14 | neck=dict(in_channels=[512]))) 15 | -------------------------------------------------------------------------------- /Detection/mmdetection/mmdet/configs/detr/detr_r50_8xb2_500e_coco.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) OpenMMLab. All rights reserved. 2 | from mmengine.config import read_base 3 | from mmengine.optim.scheduler.lr_scheduler import MultiStepLR 4 | from mmengine.runner.loops import EpochBasedTrainLoop 5 | 6 | with read_base(): 7 | from .detr_r50_8xb2_150e_coco import * 8 | 9 | # learning policy 10 | max_epochs = 500 11 | train_cfg.update( 12 | type=EpochBasedTrainLoop, max_epochs=max_epochs, val_interval=10) 13 | 14 | param_scheduler = [ 15 | dict( 16 | type=MultiStepLR, 17 | begin=0, 18 | end=max_epochs, 19 | by_epoch=True, 20 | milestones=[334], 21 | gamma=0.1) 22 | ] 23 | 24 | # only keep latest 2 checkpoints 25 | default_hooks.update(checkpoint=dict(max_keep_ckpts=2)) 26 | -------------------------------------------------------------------------------- /Detection/mmdetection/mmdet/configs/dino/dino_4scale_r50_8xb2_24e_coco.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) OpenMMLab. All rights reserved. 2 | from mmengine.config import read_base 3 | from mmengine.runner.loops import EpochBasedTrainLoop 4 | 5 | with read_base(): 6 | from .dino_4scale_r50_8xb2_12e_coco import * 7 | 8 | max_epochs = 24 9 | train_cfg.update( 10 | dict(type=EpochBasedTrainLoop, max_epochs=max_epochs, val_interval=1)) 11 | 12 | param_scheduler[0].update(dict(milestones=[20])) 13 | -------------------------------------------------------------------------------- /Detection/mmdetection/mmdet/configs/dino/dino_4scale_r50_8xb2_36e_coco.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) OpenMMLab. All rights reserved. 2 | from mmengine.config import read_base 3 | from mmengine.runner.loops import EpochBasedTrainLoop 4 | 5 | with read_base(): 6 | from .dino_4scale_r50_8xb2_12e_coco import * 7 | 8 | max_epochs = 36 9 | train_cfg.update( 10 | dict(type=EpochBasedTrainLoop, max_epochs=max_epochs, val_interval=1)) 11 | 12 | param_scheduler[0].update(dict(milestones=[30])) 13 | -------------------------------------------------------------------------------- /Detection/mmdetection/mmdet/configs/dino/dino_4scale_r50_improved_8xb2_12e_coco.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) OpenMMLab. All rights reserved. 2 | from mmengine.config import read_base 3 | 4 | with read_base(): 5 | from .dino_4scale_r50_8xb2_12e_coco import * 6 | 7 | # from deformable detr hyper 8 | model.update( 9 | dict( 10 | backbone=dict(frozen_stages=-1), 11 | bbox_head=dict(loss_cls=dict(loss_weight=2.0)), 12 | positional_encoding=dict(offset=-0.5, temperature=10000), 13 | dn_cfg=dict(group_cfg=dict(num_dn_queries=300)))) 14 | 15 | # optimizer 16 | optim_wrapper.update( 17 | dict( 18 | optimizer=dict(lr=0.0002), 19 | paramwise_cfg=dict( 20 | custom_keys={ 21 | 'backbone': dict(lr_mult=0.1), 22 | 'sampling_offsets': dict(lr_mult=0.1), 23 | 'reference_points': dict(lr_mult=0.1) 24 | }))) 25 | -------------------------------------------------------------------------------- /Detection/mmdetection/mmdet/configs/dino/dino_5scale_swin_l_8xb2_36e_coco.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) OpenMMLab. All rights reserved. 2 | from mmengine.config import read_base 3 | from mmengine.runner.loops import EpochBasedTrainLoop 4 | 5 | with read_base(): 6 | from .dino_5scale_swin_l_8xb2_12e_coco import * 7 | 8 | max_epochs = 36 9 | train_cfg.update( 10 | dict(type=EpochBasedTrainLoop, max_epochs=max_epochs, val_interval=1)) 11 | 12 | param_scheduler[0].update(dict(milestones=[27, 33])) 13 | -------------------------------------------------------------------------------- /Detection/mmdetection/mmdet/configs/faster_rcnn/faster_rcnn_r50_fpn_1x_coco.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) OpenMMLab. All rights reserved. 2 | 3 | # Please refer to https://mmengine.readthedocs.io/en/latest/advanced_tutorials/config.html#a-pure-python-style-configuration-file-beta for more details. # noqa 4 | # mmcv >= 2.0.1 5 | # mmengine >= 0.8.0 6 | 7 | from mmengine.config import read_base 8 | 9 | with read_base(): 10 | from .._base_.datasets.coco_detection import * 11 | from .._base_.default_runtime import * 12 | from .._base_.models.faster_rcnn_r50_fpn import * 13 | from .._base_.schedules.schedule_1x import * 14 | -------------------------------------------------------------------------------- /Detection/mmdetection/mmdet/configs/mask_rcnn/mask_rcnn_r101_caffe_fpn_1x_coco.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) OpenMMLab. All rights reserved. 2 | 3 | # Please refer to https://mmengine.readthedocs.io/en/latest/advanced_tutorials/config.html#a-pure-python-style-configuration-file-beta for more details. # noqa 4 | # mmcv >= 2.0.1 5 | # mmengine >= 0.8.0 6 | 7 | from mmengine.config import read_base 8 | 9 | with read_base(): 10 | from .mask_rcnn_r50_fpn_poly_1x_coco import * 11 | 12 | from mmengine.model.weight_init import PretrainedInit 13 | 14 | model = dict( 15 | backbone=dict( 16 | depth=101, 17 | init_cfg=dict( 18 | type=PretrainedInit, 19 | checkpoint='open-mmlab://detectron2/resnet101_caffe'))) 20 | -------------------------------------------------------------------------------- /Detection/mmdetection/mmdet/configs/mask_rcnn/mask_rcnn_r101_caffe_fpn_ms_poly_3x_coco.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) OpenMMLab. All rights reserved. 2 | 3 | # Please refer to https://mmengine.readthedocs.io/en/latest/advanced_tutorials/config.html#a-pure-python-style-configuration-file-beta for more details. # noqa 4 | # mmcv >= 2.0.1 5 | # mmengine >= 0.8.0 6 | 7 | from mmengine.config import read_base 8 | 9 | with read_base(): 10 | from ..common.ms_poly_3x_coco_instance import * 11 | from .._base_.models.mask_rcnn_r50_fpn import * 12 | 13 | from mmengine.model.weight_init import PretrainedInit 14 | 15 | model = dict( 16 | # use caffe img_norm 17 | data_preprocessor=dict( 18 | mean=[103.530, 116.280, 123.675], 19 | std=[1.0, 1.0, 1.0], 20 | bgr_to_rgb=False), 21 | backbone=dict( 22 | depth=101, 23 | norm_cfg=dict(requires_grad=False), 24 | norm_eval=True, 25 | style='caffe', 26 | init_cfg=dict( 27 | type=PretrainedInit, 28 | checkpoint='open-mmlab://detectron2/resnet101_caffe'))) 29 | -------------------------------------------------------------------------------- /Detection/mmdetection/mmdet/configs/mask_rcnn/mask_rcnn_r101_fpn_1x_coco.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) OpenMMLab. All rights reserved. 2 | 3 | # Please refer to https://mmengine.readthedocs.io/en/latest/advanced_tutorials/config.html#a-pure-python-style-configuration-file-beta for more details. # noqa 4 | # mmcv >= 2.0.1 5 | # mmengine >= 0.8.0 6 | 7 | from mmengine.config import read_base 8 | 9 | with read_base(): 10 | from .._base_.models.mask_rcnn_r50_fpn import * 11 | 12 | from mmengine.model.weight_init import PretrainedInit 13 | 14 | model = dict( 15 | backbone=dict( 16 | depth=101, 17 | init_cfg=dict( 18 | type=PretrainedInit, checkpoint='torchvision://resnet101'))) 19 | -------------------------------------------------------------------------------- /Detection/mmdetection/mmdet/configs/mask_rcnn/mask_rcnn_r101_fpn_2x_coco.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) OpenMMLab. All rights reserved. 2 | 3 | # Please refer to https://mmengine.readthedocs.io/en/latest/advanced_tutorials/config.html#a-pure-python-style-configuration-file-beta for more details. # noqa 4 | # mmcv >= 2.0.1 5 | # mmengine >= 0.8.0 6 | 7 | from mmengine.config import read_base 8 | 9 | with read_base(): 10 | from .mask_rcnn_r50_fpn_2x_coco import * 11 | 12 | from mmengine.model.weight_init import PretrainedInit 13 | 14 | model = dict( 15 | backbone=dict( 16 | depth=101, 17 | init_cfg=dict( 18 | type=PretrainedInit, checkpoint='torchvision://resnet101'))) 19 | -------------------------------------------------------------------------------- /Detection/mmdetection/mmdet/configs/mask_rcnn/mask_rcnn_r101_fpn_8xb8_amp_lsj_200e_coco.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) OpenMMLab. All rights reserved. 2 | 3 | # Please refer to https://mmengine.readthedocs.io/en/latest/advanced_tutorials/config.html#a-pure-python-style-configuration-file-beta for more details. # noqa 4 | # mmcv >= 2.0.1 5 | # mmengine >= 0.8.0 6 | 7 | from mmengine.config import read_base 8 | 9 | with read_base(): 10 | from .mask_rcnn_r18_fpn_8xb8_amp_lsj_200e_coco import * 11 | 12 | from mmengine.model.weight_init import PretrainedInit 13 | 14 | model = dict( 15 | backbone=dict( 16 | depth=101, 17 | init_cfg=dict( 18 | type=PretrainedInit, checkpoint='torchvision://resnet101'))) 19 | -------------------------------------------------------------------------------- /Detection/mmdetection/mmdet/configs/mask_rcnn/mask_rcnn_r101_fpn_ms_poly_3x_coco.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) OpenMMLab. All rights reserved. 2 | 3 | # Please refer to https://mmengine.readthedocs.io/en/latest/advanced_tutorials/config.html#a-pure-python-style-configuration-file-beta for more details. # noqa 4 | # mmcv >= 2.0.1 5 | # mmengine >= 0.8.0 6 | 7 | from mmengine.config import read_base 8 | 9 | with read_base(): 10 | from ..common.ms_poly_3x_coco_instance import * 11 | from .._base_.models.mask_rcnn_r50_fpn import * 12 | 13 | from mmengine.model.weight_init import PretrainedInit 14 | 15 | model = dict( 16 | backbone=dict( 17 | depth=101, 18 | init_cfg=dict( 19 | type=PretrainedInit, checkpoint='torchvision://resnet101'))) 20 | -------------------------------------------------------------------------------- /Detection/mmdetection/mmdet/configs/mask_rcnn/mask_rcnn_r18_fpn_8xb8_amp_lsj_200e_coco.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) OpenMMLab. All rights reserved. 2 | 3 | # Please refer to https://mmengine.readthedocs.io/en/latest/advanced_tutorials/config.html#a-pure-python-style-configuration-file-beta for more details. # noqa 4 | # mmcv >= 2.0.1 5 | # mmengine >= 0.8.0 6 | 7 | from mmengine.config import read_base 8 | 9 | with read_base(): 10 | from .mask_rcnn_r50_fpn_8xb8_amp_lsj_200e_coco import * 11 | 12 | from mmengine.model.weight_init import PretrainedInit 13 | 14 | model = dict( 15 | backbone=dict( 16 | depth=18, 17 | init_cfg=dict( 18 | type=PretrainedInit, checkpoint='torchvision://resnet18')), 19 | neck=dict(in_channels=[64, 128, 256, 512])) 20 | -------------------------------------------------------------------------------- /Detection/mmdetection/mmdet/configs/mask_rcnn/mask_rcnn_r50_caffe_c4_1x_coco.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) OpenMMLab. All rights reserved. 2 | 3 | # Please refer to https://mmengine.readthedocs.io/en/latest/advanced_tutorials/config.html#a-pure-python-style-configuration-file-beta for more details. # noqa 4 | # mmcv >= 2.0.1 5 | # mmengine >= 0.8.0 6 | 7 | from mmengine.config import read_base 8 | 9 | with read_base(): 10 | from .._base_.datasets.coco_instance import * 11 | from .._base_.default_runtime import * 12 | from .._base_.models.mask_rcnn_r50_caffe_c4 import * 13 | from .._base_.schedules.schedule_1x import * 14 | -------------------------------------------------------------------------------- /Detection/mmdetection/mmdet/configs/mask_rcnn/mask_rcnn_r50_caffe_fpn_1x_coco.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) OpenMMLab. All rights reserved. 2 | 3 | # Please refer to https://mmengine.readthedocs.io/en/latest/advanced_tutorials/config.html#a-pure-python-style-configuration-file-beta for more details. # noqa 4 | # mmcv >= 2.0.1 5 | # mmengine >= 0.8.0 6 | 7 | from mmengine.config import read_base 8 | 9 | with read_base(): 10 | from .mask_rcnn_r50_fpn_1x_coco import * 11 | 12 | from mmengine.model.weight_init import PretrainedInit 13 | 14 | model = dict( 15 | # use caffe img_norm 16 | data_preprocessor=dict( 17 | mean=[103.530, 116.280, 123.675], 18 | std=[1.0, 1.0, 1.0], 19 | bgr_to_rgb=False), 20 | backbone=dict( 21 | norm_cfg=dict(requires_grad=False), 22 | style='caffe', 23 | init_cfg=dict( 24 | type=PretrainedInit, 25 | checkpoint='open-mmlab://detectron2/resnet50_caffe'))) 26 | -------------------------------------------------------------------------------- /Detection/mmdetection/mmdet/configs/mask_rcnn/mask_rcnn_r50_caffe_fpn_ms_poly_2x_coco.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) OpenMMLab. All rights reserved. 2 | 3 | # Please refer to https://mmengine.readthedocs.io/en/latest/advanced_tutorials/config.html#a-pure-python-style-configuration-file-beta for more details. # noqa 4 | # mmcv >= 2.0.1 5 | # mmengine >= 0.8.0 6 | 7 | from mmengine.config import read_base 8 | 9 | with read_base(): 10 | from .mask_rcnn_r50_caffe_fpn_ms_poly_1x_coco import * 11 | 12 | train_cfg = dict(max_epochs=24) 13 | # learning rate 14 | param_scheduler = [ 15 | dict(type=LinearLR, start_factor=0.001, by_epoch=False, begin=0, end=500), 16 | dict( 17 | type=MultiStepLR, 18 | begin=0, 19 | end=24, 20 | by_epoch=True, 21 | milestones=[16, 22], 22 | gamma=0.1) 23 | ] 24 | -------------------------------------------------------------------------------- /Detection/mmdetection/mmdet/configs/mask_rcnn/mask_rcnn_r50_caffe_fpn_ms_poly_3x_coco.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) OpenMMLab. All rights reserved. 2 | 3 | # Please refer to https://mmengine.readthedocs.io/en/latest/advanced_tutorials/config.html#a-pure-python-style-configuration-file-beta for more details. # noqa 4 | # mmcv >= 2.0.1 5 | # mmengine >= 0.8.0 6 | 7 | from mmengine.config import read_base 8 | 9 | with read_base(): 10 | from .mask_rcnn_r50_caffe_fpn_ms_poly_1x_coco import * 11 | 12 | train_cfg = dict(max_epochs=36) 13 | # learning rate 14 | param_scheduler = [ 15 | dict(type=LinearLR, start_factor=0.001, by_epoch=False, begin=0, end=500), 16 | dict( 17 | type=MultiStepLR, 18 | begin=0, 19 | end=24, 20 | by_epoch=True, 21 | milestones=[28, 34], 22 | gamma=0.1) 23 | ] 24 | -------------------------------------------------------------------------------- /Detection/mmdetection/mmdet/configs/mask_rcnn/mask_rcnn_r50_fpn_1x_coco.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) OpenMMLab. All rights reserved. 2 | 3 | # Please refer to https://mmengine.readthedocs.io/en/latest/advanced_tutorials/config.html#a-pure-python-style-configuration-file-beta for more details. # noqa 4 | # mmcv >= 2.0.1 5 | # mmengine >= 0.8.0 6 | 7 | from mmengine.config import read_base 8 | 9 | with read_base(): 10 | from .._base_.datasets.coco_instance import * 11 | from .._base_.default_runtime import * 12 | from .._base_.models.mask_rcnn_r50_fpn import * 13 | from .._base_.schedules.schedule_1x import * 14 | -------------------------------------------------------------------------------- /Detection/mmdetection/mmdet/configs/mask_rcnn/mask_rcnn_r50_fpn_2x_coco.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) OpenMMLab. All rights reserved. 2 | 3 | # Please refer to https://mmengine.readthedocs.io/en/latest/advanced_tutorials/config.html#a-pure-python-style-configuration-file-beta for more details. # noqa 4 | # mmcv >= 2.0.1 5 | # mmengine >= 0.8.0 6 | 7 | from mmengine.config import read_base 8 | 9 | with read_base(): 10 | from .._base_.datasets.coco_instance import * 11 | from .._base_.default_runtime import * 12 | from .._base_.models.mask_rcnn_r50_fpn import * 13 | from .._base_.schedules.schedule_2x import * 14 | -------------------------------------------------------------------------------- /Detection/mmdetection/mmdet/configs/mask_rcnn/mask_rcnn_r50_fpn_8xb8_amp_lsj_200e_coco.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) OpenMMLab. All rights reserved. 2 | -------------------------------------------------------------------------------- /Detection/mmdetection/mmdet/configs/mask_rcnn/mask_rcnn_r50_fpn_amp_1x_coco.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) OpenMMLab. All rights reserved. 2 | 3 | # Please refer to https://mmengine.readthedocs.io/en/latest/advanced_tutorials/config.html#a-pure-python-style-configuration-file-beta for more details. # noqa 4 | # mmcv >= 2.0.1 5 | # mmengine >= 0.8.0 6 | 7 | from mmengine.config import read_base 8 | 9 | with read_base(): 10 | from .mask_rcnn_r50_fpn_1x_coco import * 11 | 12 | from mmengine.optim.optimizer.amp_optimizer_wrapper import AmpOptimWrapper 13 | 14 | optim_wrapper.update(dict(type=AmpOptimWrapper)) 15 | -------------------------------------------------------------------------------- /Detection/mmdetection/mmdet/configs/mask_rcnn/mask_rcnn_r50_fpn_ms_poly_-3x_coco.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) OpenMMLab. All rights reserved. 2 | 3 | # Please refer to https://mmengine.readthedocs.io/en/latest/advanced_tutorials/config.html#a-pure-python-style-configuration-file-beta for more details. # noqa 4 | # mmcv >= 2.0.1 5 | # mmengine >= 0.8.0 6 | 7 | from mmengine.config import read_base 8 | 9 | with read_base(): 10 | from .._base_.models.mask_rcnn_r50_fpn import * 11 | from ..common.ms_poly_3x_coco_instance import * 12 | -------------------------------------------------------------------------------- /Detection/mmdetection/mmdet/configs/mask_rcnn/mask_rcnn_r50_fpn_poly_1x_coco.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) OpenMMLab. All rights reserved. 2 | 3 | # Please refer to https://mmengine.readthedocs.io/en/latest/advanced_tutorials/config.html#a-pure-python-style-configuration-file-beta for more details. # noqa 4 | # mmcv >= 2.0.1 5 | # mmengine >= 0.8.0 6 | 7 | from mmengine.config import read_base 8 | 9 | with read_base(): 10 | from .._base_.datasets.coco_instance import * 11 | from .._base_.default_runtime import * 12 | from .._base_.models.mask_rcnn_r50_fpn import * 13 | from .._base_.schedules.schedule_1x import * 14 | 15 | train_pipeline = [ 16 | dict(type=LoadImageFromFile, backend_args=backend_args), 17 | dict( 18 | type=LoadAnnotations, with_bbox=True, with_mask=True, poly2mask=False), 19 | dict(type=Resize, scale=(1333, 800), keep_ratio=True), 20 | dict(type=RandomFlip, prob=0.5), 21 | dict(type=PackDetInputs), 22 | ] 23 | train_dataloader.update(dict(dataset=dict(pipeline=train_pipeline))) 24 | -------------------------------------------------------------------------------- /Detection/mmdetection/mmdet/configs/mask_rcnn/mask_rcnn_x101_32x4d_fpn_1x_coco.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) OpenMMLab. All rights reserved. 2 | 3 | # Please refer to https://mmengine.readthedocs.io/en/latest/advanced_tutorials/config.html#a-pure-python-style-configuration-file-beta for more details. # noqa 4 | # mmcv >= 2.0.1 5 | # mmengine >= 0.8.0 6 | 7 | from mmengine.config import read_base 8 | 9 | with read_base(): 10 | from .mask_rcnn_r101_fpn_1x_coco import * 11 | 12 | from mmengine.model.weight_init import PretrainedInit 13 | 14 | from mmdet.models.backbones.resnext import ResNeXt 15 | 16 | model = dict( 17 | backbone=dict( 18 | type=ResNeXt, 19 | depth=101, 20 | groups=32, 21 | base_width=4, 22 | num_stages=4, 23 | out_indices=(0, 1, 2, 3), 24 | frozen_stages=1, 25 | norm_cfg=dict(type=BatchNorm2d, requires_grad=True), 26 | style='pytorch', 27 | init_cfg=dict( 28 | type=PretrainedInit, checkpoint='open-mmlab://resnext101_32x4d'))) 29 | -------------------------------------------------------------------------------- /Detection/mmdetection/mmdet/configs/mask_rcnn/mask_rcnn_x101_32x4d_fpn_2x_coco.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) OpenMMLab. All rights reserved. 2 | 3 | # Please refer to https://mmengine.readthedocs.io/en/latest/advanced_tutorials/config.html#a-pure-python-style-configuration-file-beta for more details. # noqa 4 | # mmcv >= 2.0.1 5 | # mmengine >= 0.8.0 6 | 7 | from mmengine.config import read_base 8 | 9 | with read_base(): 10 | from .mask_rcnn_r50_fpn_2x_coco import * 11 | 12 | from mmengine.model.weight_init import PretrainedInit 13 | 14 | from mmdet.models import ResNeXt 15 | 16 | model = dict( 17 | backbone=dict( 18 | type=ResNeXt, 19 | depth=101, 20 | groups=32, 21 | base_width=4, 22 | num_stages=4, 23 | out_indices=(0, 1, 2, 3), 24 | frozen_stages=1, 25 | norm_cfg=dict(type=BatchNorm2d, requires_grad=True), 26 | style='pytorch', 27 | init_cfg=dict( 28 | type=PretrainedInit, checkpoint='open-mmlab://resnext101_32x4d'))) 29 | -------------------------------------------------------------------------------- /Detection/mmdetection/mmdet/configs/mask_rcnn/mask_rcnn_x101_32x4d_fpn_ms_poly_3x_coco.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) OpenMMLab. All rights reserved. 2 | 3 | # Please refer to https://mmengine.readthedocs.io/en/latest/advanced_tutorials/config.html#a-pure-python-style-configuration-file-beta for more details. # noqa 4 | # mmcv >= 2.0.1 5 | # mmengine >= 0.8.0 6 | 7 | from mmengine.config import read_base 8 | 9 | with read_base(): 10 | from ..common.ms_poly_3x_coco_instance import * 11 | from .._base_.models.mask_rcnn_r50_fpn import * 12 | 13 | from mmengine.model.weight_init import PretrainedInit 14 | 15 | from mmdet.models.backbones import ResNeXt 16 | 17 | model = dict( 18 | backbone=dict( 19 | type=ResNeXt, 20 | depth=101, 21 | groups=32, 22 | base_width=4, 23 | num_stages=4, 24 | out_indices=(0, 1, 2, 3), 25 | frozen_stages=1, 26 | norm_cfg=dict(type=BatchNorm2d, requires_grad=True), 27 | style='pytorch', 28 | init_cfg=dict( 29 | type=PretrainedInit, checkpoint='open-mmlab://resnext101_32x4d'))) 30 | -------------------------------------------------------------------------------- /Detection/mmdetection/mmdet/configs/mask_rcnn/mask_rcnn_x101_32x8d_fpn_1x_coco.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) OpenMMLab. All rights reserved. 2 | 3 | # Please refer to https://mmengine.readthedocs.io/en/latest/advanced_tutorials/config.html#a-pure-python-style-configuration-file-beta for more details. # noqa 4 | # mmcv >= 2.0.1 5 | # mmengine >= 0.8.0 6 | 7 | from mmengine.config import read_base 8 | 9 | with read_base(): 10 | from .mask_rcnn_x101_32x4d_fpn_1x_coco import * 11 | 12 | model = dict( 13 | # ResNeXt-101-32x8d model trained with Caffe2 at FB, 14 | # so the mean and std need to be changed. 15 | data_preprocessor=dict( 16 | mean=[103.530, 116.280, 123.675], 17 | std=[57.375, 57.120, 58.395], 18 | bgr_to_rgb=False), 19 | backbone=dict( 20 | type=ResNeXt, 21 | depth=101, 22 | groups=32, 23 | base_width=8, 24 | num_stages=4, 25 | out_indices=(0, 1, 2, 3), 26 | frozen_stages=1, 27 | norm_cfg=dict(type=BatchNorm2d, requires_grad=False), 28 | style='pytorch', 29 | init_cfg=dict( 30 | type=PretrainedInit, 31 | checkpoint='open-mmlab://detectron2/resnext101_32x8d'))) 32 | -------------------------------------------------------------------------------- /Detection/mmdetection/mmdet/configs/mask_rcnn/mask_rcnn_x101_64_4d_fpn_1x_coco.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) OpenMMLab. All rights reserved. 2 | 3 | # Please refer to https://mmengine.readthedocs.io/en/latest/advanced_tutorials/config.html#a-pure-python-style-configuration-file-beta for more details. # noqa 4 | # mmcv >= 2.0.1 5 | # mmengine >= 0.8.0 6 | 7 | from mmengine.config import read_base 8 | 9 | with read_base(): 10 | from .mask_rcnn_x101_32x4d_fpn_1x_coco import * 11 | 12 | model = dict( 13 | backbone=dict( 14 | type=ResNeXt, 15 | depth=101, 16 | groups=64, 17 | base_width=4, 18 | num_stages=4, 19 | out_indices=(0, 1, 2, 3), 20 | frozen_stages=1, 21 | norm_cfg=dict(type=BatchNorm2d, requires_grad=True), 22 | style='pytorch', 23 | init_cfg=dict( 24 | type=PretrainedInit, checkpoint='open-mmlab://resnext101_64x4d'))) 25 | -------------------------------------------------------------------------------- /Detection/mmdetection/mmdet/configs/mask_rcnn/mask_rcnn_x101_64x4d_fpn_2x_coco.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) OpenMMLab. All rights reserved. 2 | 3 | # Please refer to https://mmengine.readthedocs.io/en/latest/advanced_tutorials/config.html#a-pure-python-style-configuration-file-beta for more details. # noqa 4 | # mmcv >= 2.0.1 5 | # mmengine >= 0.8.0 6 | 7 | from mmengine.config import read_base 8 | 9 | with read_base(): 10 | from .mask_rcnn_x101_32x4d_fpn_2x_coco import * 11 | 12 | model = dict( 13 | backbone=dict( 14 | type=ResNeXt, 15 | depth=101, 16 | groups=64, 17 | base_width=4, 18 | num_stages=4, 19 | out_indices=(0, 1, 2, 3), 20 | frozen_stages=1, 21 | norm_cfg=dict(type=BatchNorm2d, requires_grad=True), 22 | style='pytorch', 23 | init_cfg=dict( 24 | type=PretrainedInit, checkpoint='open-mmlab://resnext101_64x4d'))) 25 | -------------------------------------------------------------------------------- /Detection/mmdetection/mmdet/configs/mask_rcnn/mask_rcnn_x101_64x4d_fpn_ms_poly_3x_coco.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) OpenMMLab. All rights reserved. 2 | 3 | # Please refer to https://mmengine.readthedocs.io/en/latest/advanced_tutorials/config.html#a-pure-python-style-configuration-file-beta for more details. # noqa 4 | # mmcv >= 2.0.1 5 | # mmengine >= 0.8.0 6 | 7 | from mmengine.config import read_base 8 | 9 | with read_base(): 10 | from ..common.ms_poly_3x_coco_instance import * 11 | from .._base_.models.mask_rcnn_r50_fpn import * 12 | 13 | from mmdet.models.backbones import ResNeXt 14 | 15 | model = dict( 16 | backbone=dict( 17 | type=ResNeXt, 18 | depth=101, 19 | groups=64, 20 | base_width=4, 21 | num_stages=4, 22 | out_indices=(0, 1, 2, 3), 23 | frozen_stages=1, 24 | norm_cfg=dict(type=BatchNorm2d, requires_grad=True), 25 | style='pytorch', 26 | init_cfg=dict( 27 | type=PretrainedInit, checkpoint='open-mmlab://resnext101_64x4d'))) 28 | -------------------------------------------------------------------------------- /Detection/mmdetection/mmdet/configs/panoptic_fpn/panoptic_fpn_r101_fpn_1x_coco.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) OpenMMLab. All rights reserved. 2 | from mmengine.config import read_base 3 | from mmengine.model.weight_init import PretrainedInit 4 | 5 | with read_base(): 6 | from .panoptic_fpn_r50_fpn_1x_coco import * 7 | 8 | model.update( 9 | dict( 10 | backbone=dict( 11 | depth=101, 12 | init_cfg=dict( 13 | type=PretrainedInit, checkpoint='torchvision://resnet101')))) 14 | -------------------------------------------------------------------------------- /Detection/mmdetection/mmdet/configs/panoptic_fpn/panoptic_fpn_r101_fpn_ms_3x_coco.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) OpenMMLab. All rights reserved. 2 | from mmengine.config import read_base 3 | from mmengine.model.weight_init import PretrainedInit 4 | 5 | with read_base(): 6 | from .panoptic_fpn_r50_fpn_ms_3x_coco import * 7 | 8 | model.update( 9 | dict( 10 | backbone=dict( 11 | depth=101, 12 | init_cfg=dict( 13 | type=PretrainedInit, checkpoint='torchvision://resnet101')))) 14 | -------------------------------------------------------------------------------- /Detection/mmdetection/mmdet/configs/qdtrack/qdtrack_faster_rcnn_r50_fpn_8xb2-4e_mot17halftrain_test-mot17halfval.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) OpenMMLab. All rights reserved. 2 | from mmengine.config import read_base 3 | 4 | with read_base(): 5 | from .._base_.datasets.mot_challenge import * 6 | from .qdtrack_faster_rcnn_r50_fpn_4e_base import * 7 | 8 | from mmdet.evaluation import CocoVideoMetric, MOTChallengeMetric 9 | 10 | # evaluator 11 | val_evaluator = [ 12 | dict(type=CocoVideoMetric, metric=['bbox'], classwise=True), 13 | dict(type=MOTChallengeMetric, metric=['HOTA', 'CLEAR', 'Identity']) 14 | ] 15 | -------------------------------------------------------------------------------- /Detection/mmdetection/mmdet/configs/retinanet/retinanet_r50_fpn_1x_coco.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) OpenMMLab. All rights reserved. 2 | 3 | # Please refer to https://mmengine.readthedocs.io/en/latest/advanced_tutorials/config.html#a-pure-python-style-configuration-file-beta for more details. # noqa 4 | # mmcv >= 2.0.1 5 | # mmengine >= 0.8.0 6 | 7 | from mmengine.config import read_base 8 | 9 | with read_base(): 10 | from .._base_.models.retinanet_r50_fpn import * 11 | from .._base_.datasets.coco_detection import * 12 | from .._base_.schedules.schedule_1x import * 13 | from .._base_.default_runtime import * 14 | from .retinanet_tta import * 15 | 16 | from torch.optim.sgd import SGD 17 | 18 | # optimizer 19 | optim_wrapper.update( 20 | dict(optimizer=dict(type=SGD, lr=0.01, momentum=0.9, weight_decay=0.0001))) 21 | -------------------------------------------------------------------------------- /Detection/mmdetection/mmdet/configs/rtmdet/rtmdet_ins_m_8xb32_300e_coco.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) OpenMMLab. All rights reserved. 2 | 3 | # Please refer to https://mmengine.readthedocs.io/en/latest/advanced_tutorials/config.html#a-pure-python-style-configuration-file-beta for more details. # noqa 4 | # mmcv >= 2.0.1 5 | # mmengine >= 0.8.0 6 | 7 | from mmengine.config import read_base 8 | 9 | with read_base(): 10 | from .rtmdet_ins_l_8xb32_300e_coco import * 11 | 12 | model.update( 13 | dict( 14 | backbone=dict(deepen_factor=0.67, widen_factor=0.75), 15 | neck=dict( 16 | in_channels=[192, 384, 768], out_channels=192, num_csp_blocks=2), 17 | bbox_head=dict(in_channels=192, feat_channels=192))) 18 | -------------------------------------------------------------------------------- /Detection/mmdetection/mmdet/configs/rtmdet/rtmdet_m_8xb32_300e_coco.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) OpenMMLab. All rights reserved. 2 | 3 | # Please refer to https://mmengine.readthedocs.io/en/latest/advanced_tutorials/config.html#a-pure-python-style-configuration-file-beta for more details. # noqa 4 | # mmcv >= 2.0.1 5 | # mmengine >= 0.8.0 6 | 7 | from mmengine.config import read_base 8 | 9 | with read_base(): 10 | from .rtmdet_l_8xb32_300e_coco import * 11 | 12 | model.update( 13 | dict( 14 | backbone=dict(deepen_factor=0.67, widen_factor=0.75), 15 | neck=dict( 16 | in_channels=[192, 384, 768], out_channels=192, num_csp_blocks=2), 17 | bbox_head=dict(in_channels=192, feat_channels=192))) 18 | -------------------------------------------------------------------------------- /Detection/mmdetection/mmdet/configs/rtmdet/rtmdet_x_8xb32_300e_coco.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) OpenMMLab. All rights reserved. 2 | 3 | # Please refer to https://mmengine.readthedocs.io/en/latest/advanced_tutorials/config.html#a-pure-python-style-configuration-file-beta for more details. # noqa 4 | # mmcv >= 2.0.1 5 | # mmengine >= 0.8.0 6 | 7 | from mmengine.config import read_base 8 | 9 | with read_base(): 10 | from .rtmdet_l_8xb32_300e_coco import * 11 | 12 | model.update( 13 | dict( 14 | backbone=dict(deepen_factor=1.33, widen_factor=1.25), 15 | neck=dict( 16 | in_channels=[320, 640, 1280], out_channels=320, num_csp_blocks=4), 17 | bbox_head=dict(in_channels=320, feat_channels=320))) 18 | -------------------------------------------------------------------------------- /Detection/mmdetection/mmdet/datasets/api_wrappers/__init__.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) OpenMMLab. All rights reserved. 2 | from .coco_api import COCO, COCOeval, COCOPanoptic 3 | from .cocoeval_mp import COCOevalMP 4 | 5 | __all__ = ['COCO', 'COCOeval', 'COCOPanoptic', 'COCOevalMP'] 6 | -------------------------------------------------------------------------------- /Detection/mmdetection/mmdet/datasets/coco_caption.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) OpenMMLab. All rights reserved. 2 | from pathlib import Path 3 | from typing import List 4 | 5 | import mmengine 6 | from mmengine.dataset import BaseDataset 7 | from mmengine.fileio import get_file_backend 8 | 9 | from mmdet.registry import DATASETS 10 | 11 | 12 | @DATASETS.register_module() 13 | class CocoCaptionDataset(BaseDataset): 14 | """COCO2014 Caption dataset.""" 15 | 16 | def load_data_list(self) -> List[dict]: 17 | """Load data list.""" 18 | img_prefix = self.data_prefix['img_path'] 19 | annotations = mmengine.load(self.ann_file) 20 | file_backend = get_file_backend(img_prefix) 21 | 22 | data_list = [] 23 | for ann in annotations: 24 | data_info = { 25 | 'img_id': Path(ann['image']).stem.split('_')[-1], 26 | 'img_path': file_backend.join_path(img_prefix, ann['image']), 27 | 'gt_caption': ann['caption'], 28 | } 29 | 30 | data_list.append(data_info) 31 | 32 | return data_list 33 | -------------------------------------------------------------------------------- /Detection/mmdetection/mmdet/datasets/deepfashion.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) OpenMMLab. All rights reserved. 2 | from mmdet.registry import DATASETS 3 | from .coco import CocoDataset 4 | 5 | 6 | @DATASETS.register_module() 7 | class DeepFashionDataset(CocoDataset): 8 | """Dataset for DeepFashion.""" 9 | 10 | METAINFO = { 11 | 'classes': ('top', 'skirt', 'leggings', 'dress', 'outer', 'pants', 12 | 'bag', 'neckwear', 'headwear', 'eyeglass', 'belt', 13 | 'footwear', 'hair', 'skin', 'face'), 14 | # palette is a list of color tuples, which is used for visualization. 15 | 'palette': [(0, 192, 64), (0, 64, 96), (128, 192, 192), (0, 64, 64), 16 | (0, 192, 224), (0, 192, 192), (128, 192, 64), (0, 192, 96), 17 | (128, 32, 192), (0, 0, 224), (0, 0, 64), (0, 160, 192), 18 | (128, 0, 96), (128, 0, 192), (0, 32, 192)] 19 | } 20 | -------------------------------------------------------------------------------- /Detection/mmdetection/mmdet/datasets/isaid.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) OpenMMLab. All rights reserved. 2 | from mmdet.registry import DATASETS 3 | from .coco import CocoDataset 4 | 5 | 6 | @DATASETS.register_module() 7 | class iSAIDDataset(CocoDataset): 8 | """Dataset for iSAID instance segmentation. 9 | 10 | iSAID: A Large-scale Dataset for Instance Segmentation 11 | in Aerial Images. 12 | 13 | For more detail, please refer to "projects/iSAID/README.md" 14 | """ 15 | 16 | METAINFO = dict( 17 | classes=('background', 'ship', 'store_tank', 'baseball_diamond', 18 | 'tennis_court', 'basketball_court', 'Ground_Track_Field', 19 | 'Bridge', 'Large_Vehicle', 'Small_Vehicle', 'Helicopter', 20 | 'Swimming_pool', 'Roundabout', 'Soccer_ball_field', 'plane', 21 | 'Harbor'), 22 | palette=[(0, 0, 0), (0, 0, 63), (0, 63, 63), (0, 63, 0), (0, 63, 127), 23 | (0, 63, 191), (0, 63, 255), (0, 127, 63), (0, 127, 127), 24 | (0, 0, 127), (0, 0, 191), (0, 0, 255), (0, 191, 127), 25 | (0, 127, 191), (0, 127, 255), (0, 100, 155)]) 26 | -------------------------------------------------------------------------------- /Detection/mmdetection/mmdet/datasets/samplers/__init__.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) OpenMMLab. All rights reserved. 2 | from .batch_sampler import (AspectRatioBatchSampler, 3 | MultiDataAspectRatioBatchSampler, 4 | TrackAspectRatioBatchSampler) 5 | from .class_aware_sampler import ClassAwareSampler 6 | from .custom_sample_size_sampler import CustomSampleSizeSampler 7 | from .multi_data_sampler import MultiDataSampler 8 | from .multi_source_sampler import GroupMultiSourceSampler, MultiSourceSampler 9 | from .track_img_sampler import TrackImgSampler 10 | 11 | __all__ = [ 12 | 'ClassAwareSampler', 'AspectRatioBatchSampler', 'MultiSourceSampler', 13 | 'GroupMultiSourceSampler', 'TrackImgSampler', 14 | 'TrackAspectRatioBatchSampler', 'MultiDataSampler', 15 | 'MultiDataAspectRatioBatchSampler', 'CustomSampleSizeSampler' 16 | ] 17 | -------------------------------------------------------------------------------- /Detection/mmdetection/mmdet/datasets/v3det.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) OpenMMLab. All rights reserved. 2 | import os.path 3 | from typing import Optional 4 | 5 | import mmengine 6 | 7 | from mmdet.registry import DATASETS 8 | from .coco import CocoDataset 9 | 10 | 11 | @DATASETS.register_module() 12 | class V3DetDataset(CocoDataset): 13 | """Dataset for V3Det.""" 14 | 15 | METAINFO = { 16 | 'classes': None, 17 | 'palette': None, 18 | } 19 | 20 | def __init__( 21 | self, 22 | *args, 23 | metainfo: Optional[dict] = None, 24 | data_root: str = '', 25 | label_file='annotations/category_name_13204_v3det_2023_v1.txt', # noqa 26 | **kwargs) -> None: 27 | class_names = tuple( 28 | mmengine.list_from_file(os.path.join(data_root, label_file))) 29 | if metainfo is None: 30 | metainfo = {'classes': class_names} 31 | super().__init__( 32 | *args, data_root=data_root, metainfo=metainfo, **kwargs) 33 | -------------------------------------------------------------------------------- /Detection/mmdetection/mmdet/engine/__init__.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) OpenMMLab. All rights reserved. 2 | from .hooks import * # noqa: F401, F403 3 | from .optimizers import * # noqa: F401, F403 4 | from .runner import * # noqa: F401, F403 5 | from .schedulers import * # noqa: F401, F403 6 | -------------------------------------------------------------------------------- /Detection/mmdetection/mmdet/engine/hooks/__init__.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) OpenMMLab. All rights reserved. 2 | from .checkloss_hook import CheckInvalidLossHook 3 | from .mean_teacher_hook import MeanTeacherHook 4 | from .memory_profiler_hook import MemoryProfilerHook 5 | from .num_class_check_hook import NumClassCheckHook 6 | from .pipeline_switch_hook import PipelineSwitchHook 7 | from .set_epoch_info_hook import SetEpochInfoHook 8 | from .sync_norm_hook import SyncNormHook 9 | from .utils import trigger_visualization_hook 10 | from .visualization_hook import (DetVisualizationHook, 11 | GroundingVisualizationHook, 12 | TrackVisualizationHook) 13 | from .yolox_mode_switch_hook import YOLOXModeSwitchHook 14 | 15 | __all__ = [ 16 | 'YOLOXModeSwitchHook', 'SyncNormHook', 'CheckInvalidLossHook', 17 | 'SetEpochInfoHook', 'MemoryProfilerHook', 'DetVisualizationHook', 18 | 'NumClassCheckHook', 'MeanTeacherHook', 'trigger_visualization_hook', 19 | 'PipelineSwitchHook', 'TrackVisualizationHook', 20 | 'GroundingVisualizationHook' 21 | ] 22 | -------------------------------------------------------------------------------- /Detection/mmdetection/mmdet/engine/hooks/set_epoch_info_hook.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) OpenMMLab. All rights reserved. 2 | from mmengine.hooks import Hook 3 | from mmengine.model.wrappers import is_model_wrapper 4 | 5 | from mmdet.registry import HOOKS 6 | 7 | 8 | @HOOKS.register_module() 9 | class SetEpochInfoHook(Hook): 10 | """Set runner's epoch information to the model.""" 11 | 12 | def before_train_epoch(self, runner): 13 | epoch = runner.epoch 14 | model = runner.model 15 | if is_model_wrapper(model): 16 | model = model.module 17 | model.set_epoch(epoch) 18 | -------------------------------------------------------------------------------- /Detection/mmdetection/mmdet/engine/hooks/utils.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) OpenMMLab. All rights reserved. 2 | def trigger_visualization_hook(cfg, args): 3 | default_hooks = cfg.default_hooks 4 | if 'visualization' in default_hooks: 5 | visualization_hook = default_hooks['visualization'] 6 | # Turn on visualization 7 | visualization_hook['draw'] = True 8 | if args.show: 9 | visualization_hook['show'] = True 10 | visualization_hook['wait_time'] = args.wait_time 11 | if args.show_dir: 12 | visualization_hook['test_out_dir'] = args.show_dir 13 | else: 14 | raise RuntimeError( 15 | 'VisualizationHook must be included in default_hooks.' 16 | 'refer to usage ' 17 | '"visualization=dict(type=\'VisualizationHook\')"') 18 | 19 | return cfg 20 | -------------------------------------------------------------------------------- /Detection/mmdetection/mmdet/engine/optimizers/__init__.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) OpenMMLab. All rights reserved. 2 | from .layer_decay_optimizer_constructor import \ 3 | LearningRateDecayOptimizerConstructor 4 | 5 | __all__ = ['LearningRateDecayOptimizerConstructor'] 6 | -------------------------------------------------------------------------------- /Detection/mmdetection/mmdet/engine/runner/__init__.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) OpenMMLab. All rights reserved. 2 | from .loops import TeacherStudentValLoop 3 | 4 | __all__ = ['TeacherStudentValLoop'] 5 | -------------------------------------------------------------------------------- /Detection/mmdetection/mmdet/engine/schedulers/__init__.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) OpenMMLab. All rights reserved. 2 | from .quadratic_warmup import (QuadraticWarmupLR, QuadraticWarmupMomentum, 3 | QuadraticWarmupParamScheduler) 4 | 5 | __all__ = [ 6 | 'QuadraticWarmupParamScheduler', 'QuadraticWarmupMomentum', 7 | 'QuadraticWarmupLR' 8 | ] 9 | -------------------------------------------------------------------------------- /Detection/mmdetection/mmdet/evaluation/__init__.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) OpenMMLab. All rights reserved. 2 | from .evaluator import * # noqa: F401,F403 3 | from .functional import * # noqa: F401,F403 4 | from .metrics import * # noqa: F401,F403 5 | -------------------------------------------------------------------------------- /Detection/mmdetection/mmdet/evaluation/evaluator/__init__.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) OpenMMLab. All rights reserved. 2 | from .multi_datasets_evaluator import MultiDatasetsEvaluator 3 | 4 | __all__ = ['MultiDatasetsEvaluator'] 5 | -------------------------------------------------------------------------------- /Detection/mmdetection/mmdet/models/__init__.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) OpenMMLab. All rights reserved. 2 | from .backbones import * # noqa: F401,F403 3 | from .data_preprocessors import * # noqa: F401,F403 4 | from .dense_heads import * # noqa: F401,F403 5 | from .detectors import * # noqa: F401,F403 6 | from .language_models import * # noqa: F401,F403 7 | from .layers import * # noqa: F401,F403 8 | from .losses import * # noqa: F401,F403 9 | from .mot import * # noqa: F401,F403 10 | from .necks import * # noqa: F401,F403 11 | from .reid import * # noqa: F401,F403 12 | from .roi_heads import * # noqa: F401,F403 13 | from .seg_heads import * # noqa: F401,F403 14 | from .task_modules import * # noqa: F401,F403 15 | from .test_time_augs import * # noqa: F401,F403 16 | from .trackers import * # noqa: F401,F403 17 | from .tracking_heads import * # noqa: F401,F403 18 | from .vis import * # noqa: F401,F403 19 | -------------------------------------------------------------------------------- /Detection/mmdetection/mmdet/models/backbones/__init__.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) OpenMMLab. All rights reserved. 2 | from .csp_darknet import CSPDarknet 3 | from .cspnext import CSPNeXt 4 | from .darknet import Darknet 5 | from .detectors_resnet import DetectoRS_ResNet 6 | from .detectors_resnext import DetectoRS_ResNeXt 7 | from .efficientnet import EfficientNet 8 | from .hourglass import HourglassNet 9 | from .hrnet import HRNet 10 | from .mobilenet_v2 import MobileNetV2 11 | from .pvt import PyramidVisionTransformer, PyramidVisionTransformerV2 12 | from .regnet import RegNet 13 | from .res2net import Res2Net 14 | from .resnest import ResNeSt 15 | from .resnet import ResNet, ResNetV1d 16 | from .resnext import ResNeXt 17 | from .ssd_vgg import SSDVGG 18 | from .swin import SwinTransformer 19 | from .trident_resnet import TridentResNet 20 | 21 | __all__ = [ 22 | 'RegNet', 'ResNet', 'ResNetV1d', 'ResNeXt', 'SSDVGG', 'HRNet', 23 | 'MobileNetV2', 'Res2Net', 'HourglassNet', 'DetectoRS_ResNet', 24 | 'DetectoRS_ResNeXt', 'Darknet', 'ResNeSt', 'TridentResNet', 'CSPDarknet', 25 | 'SwinTransformer', 'PyramidVisionTransformer', 26 | 'PyramidVisionTransformerV2', 'EfficientNet', 'CSPNeXt' 27 | ] 28 | -------------------------------------------------------------------------------- /Detection/mmdetection/mmdet/models/data_preprocessors/__init__.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) OpenMMLab. All rights reserved. 2 | from .data_preprocessor import (BatchFixedSizePad, BatchResize, 3 | BatchSyncRandomResize, BoxInstDataPreprocessor, 4 | DetDataPreprocessor, 5 | MultiBranchDataPreprocessor) 6 | from .reid_data_preprocessor import ReIDDataPreprocessor 7 | from .track_data_preprocessor import TrackDataPreprocessor 8 | 9 | __all__ = [ 10 | 'DetDataPreprocessor', 'BatchSyncRandomResize', 'BatchFixedSizePad', 11 | 'MultiBranchDataPreprocessor', 'BatchResize', 'BoxInstDataPreprocessor', 12 | 'TrackDataPreprocessor', 'ReIDDataPreprocessor' 13 | ] 14 | -------------------------------------------------------------------------------- /Detection/mmdetection/mmdet/models/detectors/boxinst.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) OpenMMLab. All rights reserved. 2 | from mmdet.registry import MODELS 3 | from mmdet.utils import ConfigType, OptConfigType, OptMultiConfig 4 | from .single_stage_instance_seg import SingleStageInstanceSegmentor 5 | 6 | 7 | @MODELS.register_module() 8 | class BoxInst(SingleStageInstanceSegmentor): 9 | """Implementation of `BoxInst `_""" 10 | 11 | def __init__(self, 12 | backbone: ConfigType, 13 | neck: ConfigType, 14 | bbox_head: ConfigType, 15 | mask_head: ConfigType, 16 | train_cfg: OptConfigType = None, 17 | test_cfg: OptConfigType = None, 18 | data_preprocessor: OptConfigType = None, 19 | init_cfg: OptMultiConfig = None) -> None: 20 | super().__init__( 21 | backbone=backbone, 22 | neck=neck, 23 | bbox_head=bbox_head, 24 | mask_head=mask_head, 25 | train_cfg=train_cfg, 26 | test_cfg=test_cfg, 27 | data_preprocessor=data_preprocessor, 28 | init_cfg=init_cfg) 29 | -------------------------------------------------------------------------------- /Detection/mmdetection/mmdet/models/detectors/centernet.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) OpenMMLab. All rights reserved. 2 | from mmdet.registry import MODELS 3 | from mmdet.utils import ConfigType, OptConfigType, OptMultiConfig 4 | from .single_stage import SingleStageDetector 5 | 6 | 7 | @MODELS.register_module() 8 | class CenterNet(SingleStageDetector): 9 | """Implementation of CenterNet(Objects as Points) 10 | 11 | . 12 | """ 13 | 14 | def __init__(self, 15 | backbone: ConfigType, 16 | neck: ConfigType, 17 | bbox_head: ConfigType, 18 | train_cfg: OptConfigType = None, 19 | test_cfg: OptConfigType = None, 20 | data_preprocessor: OptConfigType = None, 21 | init_cfg: OptMultiConfig = None) -> None: 22 | super().__init__( 23 | backbone=backbone, 24 | neck=neck, 25 | bbox_head=bbox_head, 26 | train_cfg=train_cfg, 27 | test_cfg=test_cfg, 28 | data_preprocessor=data_preprocessor, 29 | init_cfg=init_cfg) 30 | -------------------------------------------------------------------------------- /Detection/mmdetection/mmdet/models/detectors/condinst.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) OpenMMLab. All rights reserved. 2 | from mmdet.registry import MODELS 3 | from mmdet.utils import ConfigType, OptConfigType, OptMultiConfig 4 | from .single_stage_instance_seg import SingleStageInstanceSegmentor 5 | 6 | 7 | @MODELS.register_module() 8 | class CondInst(SingleStageInstanceSegmentor): 9 | """Implementation of `CondInst `_""" 10 | 11 | def __init__(self, 12 | backbone: ConfigType, 13 | neck: ConfigType, 14 | bbox_head: ConfigType, 15 | mask_head: ConfigType, 16 | train_cfg: OptConfigType = None, 17 | test_cfg: OptConfigType = None, 18 | data_preprocessor: OptConfigType = None, 19 | init_cfg: OptMultiConfig = None) -> None: 20 | super().__init__( 21 | backbone=backbone, 22 | neck=neck, 23 | bbox_head=bbox_head, 24 | mask_head=mask_head, 25 | train_cfg=train_cfg, 26 | test_cfg=test_cfg, 27 | data_preprocessor=data_preprocessor, 28 | init_cfg=init_cfg) 29 | -------------------------------------------------------------------------------- /Detection/mmdetection/mmdet/models/detectors/cornernet.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) OpenMMLab. All rights reserved. 2 | from mmdet.registry import MODELS 3 | from mmdet.utils import ConfigType, OptConfigType, OptMultiConfig 4 | from .single_stage import SingleStageDetector 5 | 6 | 7 | @MODELS.register_module() 8 | class CornerNet(SingleStageDetector): 9 | """CornerNet. 10 | 11 | This detector is the implementation of the paper `CornerNet: Detecting 12 | Objects as Paired Keypoints `_ . 13 | """ 14 | 15 | def __init__(self, 16 | backbone: ConfigType, 17 | neck: ConfigType, 18 | bbox_head: ConfigType, 19 | train_cfg: OptConfigType = None, 20 | test_cfg: OptConfigType = None, 21 | data_preprocessor: OptConfigType = None, 22 | init_cfg: OptMultiConfig = None) -> None: 23 | super().__init__( 24 | backbone=backbone, 25 | neck=neck, 26 | bbox_head=bbox_head, 27 | train_cfg=train_cfg, 28 | test_cfg=test_cfg, 29 | data_preprocessor=data_preprocessor, 30 | init_cfg=init_cfg) 31 | -------------------------------------------------------------------------------- /Detection/mmdetection/mmdet/models/detectors/fast_rcnn.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) OpenMMLab. All rights reserved. 2 | from mmdet.registry import MODELS 3 | from mmdet.utils import ConfigType, OptConfigType, OptMultiConfig 4 | from .two_stage import TwoStageDetector 5 | 6 | 7 | @MODELS.register_module() 8 | class FastRCNN(TwoStageDetector): 9 | """Implementation of `Fast R-CNN `_""" 10 | 11 | def __init__(self, 12 | backbone: ConfigType, 13 | roi_head: ConfigType, 14 | train_cfg: ConfigType, 15 | test_cfg: ConfigType, 16 | neck: OptConfigType = None, 17 | data_preprocessor: OptConfigType = None, 18 | init_cfg: OptMultiConfig = None) -> None: 19 | super().__init__( 20 | backbone=backbone, 21 | neck=neck, 22 | roi_head=roi_head, 23 | train_cfg=train_cfg, 24 | test_cfg=test_cfg, 25 | init_cfg=init_cfg, 26 | data_preprocessor=data_preprocessor) 27 | -------------------------------------------------------------------------------- /Detection/mmdetection/mmdet/models/detectors/faster_rcnn.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) OpenMMLab. All rights reserved. 2 | from mmdet.registry import MODELS 3 | from mmdet.utils import ConfigType, OptConfigType, OptMultiConfig 4 | from .two_stage import TwoStageDetector 5 | 6 | 7 | @MODELS.register_module() 8 | class FasterRCNN(TwoStageDetector): 9 | """Implementation of `Faster R-CNN `_""" 10 | 11 | def __init__(self, 12 | backbone: ConfigType, 13 | rpn_head: ConfigType, 14 | roi_head: ConfigType, 15 | train_cfg: ConfigType, 16 | test_cfg: ConfigType, 17 | neck: OptConfigType = None, 18 | data_preprocessor: OptConfigType = None, 19 | init_cfg: OptMultiConfig = None) -> None: 20 | super().__init__( 21 | backbone=backbone, 22 | neck=neck, 23 | rpn_head=rpn_head, 24 | roi_head=roi_head, 25 | train_cfg=train_cfg, 26 | test_cfg=test_cfg, 27 | init_cfg=init_cfg, 28 | data_preprocessor=data_preprocessor) 29 | -------------------------------------------------------------------------------- /Detection/mmdetection/mmdet/models/detectors/fsaf.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) OpenMMLab. All rights reserved. 2 | from mmdet.registry import MODELS 3 | from mmdet.utils import ConfigType, OptConfigType, OptMultiConfig 4 | from .single_stage import SingleStageDetector 5 | 6 | 7 | @MODELS.register_module() 8 | class FSAF(SingleStageDetector): 9 | """Implementation of `FSAF `_""" 10 | 11 | def __init__(self, 12 | backbone: ConfigType, 13 | neck: ConfigType, 14 | bbox_head: ConfigType, 15 | train_cfg: OptConfigType = None, 16 | test_cfg: OptConfigType = None, 17 | data_preprocessor: OptConfigType = None, 18 | init_cfg: OptMultiConfig = None): 19 | super().__init__( 20 | backbone=backbone, 21 | neck=neck, 22 | bbox_head=bbox_head, 23 | train_cfg=train_cfg, 24 | test_cfg=test_cfg, 25 | data_preprocessor=data_preprocessor, 26 | init_cfg=init_cfg) 27 | -------------------------------------------------------------------------------- /Detection/mmdetection/mmdet/models/detectors/htc.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) OpenMMLab. All rights reserved. 2 | from mmdet.registry import MODELS 3 | from .cascade_rcnn import CascadeRCNN 4 | 5 | 6 | @MODELS.register_module() 7 | class HybridTaskCascade(CascadeRCNN): 8 | """Implementation of `HTC `_""" 9 | 10 | def __init__(self, **kwargs) -> None: 11 | super().__init__(**kwargs) 12 | 13 | @property 14 | def with_semantic(self) -> bool: 15 | """bool: whether the detector has a semantic head""" 16 | return self.roi_head.with_semantic 17 | -------------------------------------------------------------------------------- /Detection/mmdetection/mmdet/models/detectors/mask_rcnn.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) OpenMMLab. All rights reserved. 2 | from mmengine.config import ConfigDict 3 | 4 | from mmdet.registry import MODELS 5 | from mmdet.utils import OptConfigType, OptMultiConfig 6 | from .two_stage import TwoStageDetector 7 | 8 | 9 | @MODELS.register_module() 10 | class MaskRCNN(TwoStageDetector): 11 | """Implementation of `Mask R-CNN `_""" 12 | 13 | def __init__(self, 14 | backbone: ConfigDict, 15 | rpn_head: ConfigDict, 16 | roi_head: ConfigDict, 17 | train_cfg: ConfigDict, 18 | test_cfg: ConfigDict, 19 | neck: OptConfigType = None, 20 | data_preprocessor: OptConfigType = None, 21 | init_cfg: OptMultiConfig = None) -> None: 22 | super().__init__( 23 | backbone=backbone, 24 | neck=neck, 25 | rpn_head=rpn_head, 26 | roi_head=roi_head, 27 | train_cfg=train_cfg, 28 | test_cfg=test_cfg, 29 | init_cfg=init_cfg, 30 | data_preprocessor=data_preprocessor) 31 | -------------------------------------------------------------------------------- /Detection/mmdetection/mmdet/models/detectors/mask_scoring_rcnn.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) OpenMMLab. All rights reserved. 2 | from mmdet.registry import MODELS 3 | from mmdet.utils import ConfigType, OptConfigType, OptMultiConfig 4 | from .two_stage import TwoStageDetector 5 | 6 | 7 | @MODELS.register_module() 8 | class MaskScoringRCNN(TwoStageDetector): 9 | """Mask Scoring RCNN. 10 | 11 | https://arxiv.org/abs/1903.00241 12 | """ 13 | 14 | def __init__(self, 15 | backbone: ConfigType, 16 | rpn_head: ConfigType, 17 | roi_head: ConfigType, 18 | train_cfg: ConfigType, 19 | test_cfg: ConfigType, 20 | neck: OptConfigType = None, 21 | data_preprocessor: OptConfigType = None, 22 | init_cfg: OptMultiConfig = None) -> None: 23 | super().__init__( 24 | backbone=backbone, 25 | neck=neck, 26 | rpn_head=rpn_head, 27 | roi_head=roi_head, 28 | train_cfg=train_cfg, 29 | test_cfg=test_cfg, 30 | data_preprocessor=data_preprocessor, 31 | init_cfg=init_cfg) 32 | -------------------------------------------------------------------------------- /Detection/mmdetection/mmdet/models/detectors/queryinst.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) OpenMMLab. All rights reserved. 2 | from mmdet.registry import MODELS 3 | from mmdet.utils import ConfigType, OptConfigType, OptMultiConfig 4 | from .sparse_rcnn import SparseRCNN 5 | 6 | 7 | @MODELS.register_module() 8 | class QueryInst(SparseRCNN): 9 | r"""Implementation of 10 | `Instances as Queries `_""" 11 | 12 | def __init__(self, 13 | backbone: ConfigType, 14 | rpn_head: ConfigType, 15 | roi_head: ConfigType, 16 | train_cfg: ConfigType, 17 | test_cfg: ConfigType, 18 | neck: OptConfigType = None, 19 | data_preprocessor: OptConfigType = None, 20 | init_cfg: OptMultiConfig = None) -> None: 21 | super().__init__( 22 | backbone=backbone, 23 | neck=neck, 24 | rpn_head=rpn_head, 25 | roi_head=roi_head, 26 | train_cfg=train_cfg, 27 | test_cfg=test_cfg, 28 | data_preprocessor=data_preprocessor, 29 | init_cfg=init_cfg) 30 | -------------------------------------------------------------------------------- /Detection/mmdetection/mmdet/models/detectors/retinanet.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) OpenMMLab. All rights reserved. 2 | from mmdet.registry import MODELS 3 | from mmdet.utils import ConfigType, OptConfigType, OptMultiConfig 4 | from .single_stage import SingleStageDetector 5 | 6 | 7 | @MODELS.register_module() 8 | class RetinaNet(SingleStageDetector): 9 | """Implementation of `RetinaNet `_""" 10 | 11 | def __init__(self, 12 | backbone: ConfigType, 13 | neck: ConfigType, 14 | bbox_head: ConfigType, 15 | train_cfg: OptConfigType = None, 16 | test_cfg: OptConfigType = None, 17 | data_preprocessor: OptConfigType = None, 18 | init_cfg: OptMultiConfig = None) -> None: 19 | super().__init__( 20 | backbone=backbone, 21 | neck=neck, 22 | bbox_head=bbox_head, 23 | train_cfg=train_cfg, 24 | test_cfg=test_cfg, 25 | data_preprocessor=data_preprocessor, 26 | init_cfg=init_cfg) 27 | -------------------------------------------------------------------------------- /Detection/mmdetection/mmdet/models/detectors/scnet.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) OpenMMLab. All rights reserved. 2 | from mmdet.registry import MODELS 3 | from .cascade_rcnn import CascadeRCNN 4 | 5 | 6 | @MODELS.register_module() 7 | class SCNet(CascadeRCNN): 8 | """Implementation of `SCNet `_""" 9 | 10 | def __init__(self, **kwargs) -> None: 11 | super().__init__(**kwargs) 12 | -------------------------------------------------------------------------------- /Detection/mmdetection/mmdet/models/detectors/yolact.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) OpenMMLab. All rights reserved. 2 | from mmdet.registry import MODELS 3 | from mmdet.utils import ConfigType, OptConfigType, OptMultiConfig 4 | from .single_stage_instance_seg import SingleStageInstanceSegmentor 5 | 6 | 7 | @MODELS.register_module() 8 | class YOLACT(SingleStageInstanceSegmentor): 9 | """Implementation of `YOLACT `_""" 10 | 11 | def __init__(self, 12 | backbone: ConfigType, 13 | neck: ConfigType, 14 | bbox_head: ConfigType, 15 | mask_head: ConfigType, 16 | train_cfg: OptConfigType = None, 17 | test_cfg: OptConfigType = None, 18 | data_preprocessor: OptConfigType = None, 19 | init_cfg: OptMultiConfig = None) -> None: 20 | super().__init__( 21 | backbone=backbone, 22 | neck=neck, 23 | bbox_head=bbox_head, 24 | mask_head=mask_head, 25 | train_cfg=train_cfg, 26 | test_cfg=test_cfg, 27 | data_preprocessor=data_preprocessor, 28 | init_cfg=init_cfg) 29 | -------------------------------------------------------------------------------- /Detection/mmdetection/mmdet/models/language_models/__init__.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) OpenMMLab. All rights reserved. 2 | from .bert import BertModel 3 | 4 | __all__ = ['BertModel'] 5 | -------------------------------------------------------------------------------- /Detection/mmdetection/mmdet/models/layers/activations.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) OpenMMLab. All rights reserved. 2 | import torch 3 | import torch.nn as nn 4 | from mmengine.utils import digit_version 5 | 6 | from mmdet.registry import MODELS 7 | 8 | if digit_version(torch.__version__) >= digit_version('1.7.0'): 9 | from torch.nn import SiLU 10 | else: 11 | 12 | class SiLU(nn.Module): 13 | """Sigmoid Weighted Liner Unit.""" 14 | 15 | def __init__(self, inplace=True): 16 | super().__init__() 17 | 18 | def forward(self, inputs) -> torch.Tensor: 19 | return inputs * torch.sigmoid(inputs) 20 | 21 | 22 | MODELS.register_module(module=SiLU, name='SiLU') 23 | -------------------------------------------------------------------------------- /Detection/mmdetection/mmdet/models/mot/__init__.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) OpenMMLab. All rights reserved. 2 | from .base import BaseMOTModel 3 | from .bytetrack import ByteTrack 4 | from .deep_sort import DeepSORT 5 | from .ocsort import OCSORT 6 | from .qdtrack import QDTrack 7 | from .strongsort import StrongSORT 8 | 9 | __all__ = [ 10 | 'BaseMOTModel', 'ByteTrack', 'QDTrack', 'DeepSORT', 'StrongSORT', 'OCSORT' 11 | ] 12 | -------------------------------------------------------------------------------- /Detection/mmdetection/mmdet/models/necks/__init__.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) OpenMMLab. All rights reserved. 2 | from .bfp import BFP 3 | from .channel_mapper import ChannelMapper 4 | from .cspnext_pafpn import CSPNeXtPAFPN 5 | from .ct_resnet_neck import CTResNetNeck 6 | from .dilated_encoder import DilatedEncoder 7 | from .dyhead import DyHead 8 | from .fpg import FPG 9 | from .fpn import FPN 10 | from .fpn_carafe import FPN_CARAFE 11 | from .fpn_dropblock import FPN_DropBlock 12 | from .hrfpn import HRFPN 13 | from .nas_fpn import NASFPN 14 | from .nasfcos_fpn import NASFCOS_FPN 15 | from .pafpn import PAFPN 16 | from .rfp import RFP 17 | from .ssd_neck import SSDNeck 18 | from .ssh import SSH 19 | from .yolo_neck import YOLOV3Neck 20 | from .yolox_pafpn import YOLOXPAFPN 21 | 22 | __all__ = [ 23 | 'FPN', 'BFP', 'ChannelMapper', 'HRFPN', 'NASFPN', 'FPN_CARAFE', 'PAFPN', 24 | 'NASFCOS_FPN', 'RFP', 'YOLOV3Neck', 'FPG', 'DilatedEncoder', 25 | 'CTResNetNeck', 'SSDNeck', 'YOLOXPAFPN', 'DyHead', 'CSPNeXtPAFPN', 'SSH', 26 | 'FPN_DropBlock' 27 | ] 28 | -------------------------------------------------------------------------------- /Detection/mmdetection/mmdet/models/reid/__init__.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) OpenMMLab. All rights reserved. 2 | from .base_reid import BaseReID 3 | from .fc_module import FcModule 4 | from .gap import GlobalAveragePooling 5 | from .linear_reid_head import LinearReIDHead 6 | 7 | __all__ = ['BaseReID', 'GlobalAveragePooling', 'LinearReIDHead', 'FcModule'] 8 | -------------------------------------------------------------------------------- /Detection/mmdetection/mmdet/models/roi_heads/bbox_heads/__init__.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) OpenMMLab. All rights reserved. 2 | from .bbox_head import BBoxHead 3 | from .convfc_bbox_head import (ConvFCBBoxHead, Shared2FCBBoxHead, 4 | Shared4Conv1FCBBoxHead) 5 | from .dii_head import DIIHead 6 | from .double_bbox_head import DoubleConvFCBBoxHead 7 | from .multi_instance_bbox_head import MultiInstanceBBoxHead 8 | from .sabl_head import SABLHead 9 | from .scnet_bbox_head import SCNetBBoxHead 10 | 11 | __all__ = [ 12 | 'BBoxHead', 'ConvFCBBoxHead', 'Shared2FCBBoxHead', 13 | 'Shared4Conv1FCBBoxHead', 'DoubleConvFCBBoxHead', 'SABLHead', 'DIIHead', 14 | 'SCNetBBoxHead', 'MultiInstanceBBoxHead' 15 | ] 16 | -------------------------------------------------------------------------------- /Detection/mmdetection/mmdet/models/roi_heads/mask_heads/__init__.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) OpenMMLab. All rights reserved. 2 | from .coarse_mask_head import CoarseMaskHead 3 | from .dynamic_mask_head import DynamicMaskHead 4 | from .fcn_mask_head import FCNMaskHead 5 | from .feature_relay_head import FeatureRelayHead 6 | from .fused_semantic_head import FusedSemanticHead 7 | from .global_context_head import GlobalContextHead 8 | from .grid_head import GridHead 9 | from .htc_mask_head import HTCMaskHead 10 | from .mask_point_head import MaskPointHead 11 | from .maskiou_head import MaskIoUHead 12 | from .scnet_mask_head import SCNetMaskHead 13 | from .scnet_semantic_head import SCNetSemanticHead 14 | 15 | __all__ = [ 16 | 'FCNMaskHead', 'HTCMaskHead', 'FusedSemanticHead', 'GridHead', 17 | 'MaskIoUHead', 'CoarseMaskHead', 'MaskPointHead', 'SCNetMaskHead', 18 | 'SCNetSemanticHead', 'GlobalContextHead', 'FeatureRelayHead', 19 | 'DynamicMaskHead' 20 | ] 21 | -------------------------------------------------------------------------------- /Detection/mmdetection/mmdet/models/roi_heads/mask_heads/scnet_mask_head.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) OpenMMLab. All rights reserved. 2 | from mmdet.models.layers import ResLayer, SimplifiedBasicBlock 3 | from mmdet.registry import MODELS 4 | from .fcn_mask_head import FCNMaskHead 5 | 6 | 7 | @MODELS.register_module() 8 | class SCNetMaskHead(FCNMaskHead): 9 | """Mask head for `SCNet `_. 10 | 11 | Args: 12 | conv_to_res (bool, optional): if True, change the conv layers to 13 | ``SimplifiedBasicBlock``. 14 | """ 15 | 16 | def __init__(self, conv_to_res: bool = True, **kwargs) -> None: 17 | super().__init__(**kwargs) 18 | self.conv_to_res = conv_to_res 19 | if conv_to_res: 20 | assert self.conv_kernel_size == 3 21 | self.num_res_blocks = self.num_convs // 2 22 | self.convs = ResLayer( 23 | SimplifiedBasicBlock, 24 | self.in_channels, 25 | self.conv_out_channels, 26 | self.num_res_blocks, 27 | conv_cfg=self.conv_cfg, 28 | norm_cfg=self.norm_cfg) 29 | -------------------------------------------------------------------------------- /Detection/mmdetection/mmdet/models/roi_heads/mask_heads/scnet_semantic_head.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) OpenMMLab. All rights reserved. 2 | from mmdet.models.layers import ResLayer, SimplifiedBasicBlock 3 | from mmdet.registry import MODELS 4 | from .fused_semantic_head import FusedSemanticHead 5 | 6 | 7 | @MODELS.register_module() 8 | class SCNetSemanticHead(FusedSemanticHead): 9 | """Mask head for `SCNet `_. 10 | 11 | Args: 12 | conv_to_res (bool, optional): if True, change the conv layers to 13 | ``SimplifiedBasicBlock``. 14 | """ 15 | 16 | def __init__(self, conv_to_res: bool = True, **kwargs) -> None: 17 | super().__init__(**kwargs) 18 | self.conv_to_res = conv_to_res 19 | if self.conv_to_res: 20 | num_res_blocks = self.num_convs // 2 21 | self.convs = ResLayer( 22 | SimplifiedBasicBlock, 23 | self.in_channels, 24 | self.conv_out_channels, 25 | num_res_blocks, 26 | conv_cfg=self.conv_cfg, 27 | norm_cfg=self.norm_cfg) 28 | self.num_convs = num_res_blocks 29 | -------------------------------------------------------------------------------- /Detection/mmdetection/mmdet/models/roi_heads/roi_extractors/__init__.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) OpenMMLab. All rights reserved. 2 | from .base_roi_extractor import BaseRoIExtractor 3 | from .generic_roi_extractor import GenericRoIExtractor 4 | from .single_level_roi_extractor import SingleRoIExtractor 5 | 6 | __all__ = ['BaseRoIExtractor', 'SingleRoIExtractor', 'GenericRoIExtractor'] 7 | -------------------------------------------------------------------------------- /Detection/mmdetection/mmdet/models/roi_heads/shared_heads/__init__.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) OpenMMLab. All rights reserved. 2 | from .res_layer import ResLayer 3 | 4 | __all__ = ['ResLayer'] 5 | -------------------------------------------------------------------------------- /Detection/mmdetection/mmdet/models/seg_heads/__init__.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) OpenMMLab. All rights reserved. 2 | from .panoptic_fpn_head import PanopticFPNHead # noqa: F401,F403 3 | from .panoptic_fusion_heads import * # noqa: F401,F403 4 | -------------------------------------------------------------------------------- /Detection/mmdetection/mmdet/models/seg_heads/panoptic_fusion_heads/__init__.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) OpenMMLab. All rights reserved. 2 | from .base_panoptic_fusion_head import \ 3 | BasePanopticFusionHead # noqa: F401,F403 4 | from .heuristic_fusion_head import HeuristicFusionHead # noqa: F401,F403 5 | from .maskformer_fusion_head import MaskFormerFusionHead # noqa: F401,F403 6 | -------------------------------------------------------------------------------- /Detection/mmdetection/mmdet/models/task_modules/__init__.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) OpenMMLab. All rights reserved. 2 | from .assigners import * # noqa: F401,F403 3 | from .builder import (ANCHOR_GENERATORS, BBOX_ASSIGNERS, BBOX_CODERS, 4 | BBOX_SAMPLERS, IOU_CALCULATORS, MATCH_COSTS, 5 | PRIOR_GENERATORS, build_anchor_generator, build_assigner, 6 | build_bbox_coder, build_iou_calculator, build_match_cost, 7 | build_prior_generator, build_sampler) 8 | from .coders import * # noqa: F401,F403 9 | from .prior_generators import * # noqa: F401,F403 10 | from .samplers import * # noqa: F401,F403 11 | from .tracking import * # noqa: F401,F403 12 | 13 | __all__ = [ 14 | 'ANCHOR_GENERATORS', 'PRIOR_GENERATORS', 'BBOX_ASSIGNERS', 'BBOX_SAMPLERS', 15 | 'MATCH_COSTS', 'BBOX_CODERS', 'IOU_CALCULATORS', 'build_anchor_generator', 16 | 'build_prior_generator', 'build_assigner', 'build_sampler', 17 | 'build_iou_calculator', 'build_match_cost', 'build_bbox_coder' 18 | ] 19 | -------------------------------------------------------------------------------- /Detection/mmdetection/mmdet/models/task_modules/assigners/base_assigner.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) OpenMMLab. All rights reserved. 2 | from abc import ABCMeta, abstractmethod 3 | from typing import Optional 4 | 5 | from mmengine.structures import InstanceData 6 | 7 | 8 | class BaseAssigner(metaclass=ABCMeta): 9 | """Base assigner that assigns boxes to ground truth boxes.""" 10 | 11 | @abstractmethod 12 | def assign(self, 13 | pred_instances: InstanceData, 14 | gt_instances: InstanceData, 15 | gt_instances_ignore: Optional[InstanceData] = None, 16 | **kwargs): 17 | """Assign boxes to either a ground truth boxes or a negative boxes.""" 18 | -------------------------------------------------------------------------------- /Detection/mmdetection/mmdet/models/task_modules/coders/__init__.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) OpenMMLab. All rights reserved. 2 | from .base_bbox_coder import BaseBBoxCoder 3 | from .bucketing_bbox_coder import BucketingBBoxCoder 4 | from .delta_xywh_bbox_coder import (DeltaXYWHBBoxCoder, 5 | DeltaXYWHBBoxCoderForGLIP) 6 | from .distance_point_bbox_coder import DistancePointBBoxCoder 7 | from .legacy_delta_xywh_bbox_coder import LegacyDeltaXYWHBBoxCoder 8 | from .pseudo_bbox_coder import PseudoBBoxCoder 9 | from .tblr_bbox_coder import TBLRBBoxCoder 10 | from .yolo_bbox_coder import YOLOBBoxCoder 11 | 12 | __all__ = [ 13 | 'BaseBBoxCoder', 'PseudoBBoxCoder', 'DeltaXYWHBBoxCoder', 14 | 'LegacyDeltaXYWHBBoxCoder', 'TBLRBBoxCoder', 'YOLOBBoxCoder', 15 | 'BucketingBBoxCoder', 'DistancePointBBoxCoder', 'DeltaXYWHBBoxCoderForGLIP' 16 | ] 17 | -------------------------------------------------------------------------------- /Detection/mmdetection/mmdet/models/task_modules/coders/base_bbox_coder.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) OpenMMLab. All rights reserved. 2 | from abc import ABCMeta, abstractmethod 3 | 4 | 5 | class BaseBBoxCoder(metaclass=ABCMeta): 6 | """Base bounding box coder. 7 | 8 | Args: 9 | use_box_type (bool): Whether to warp decoded boxes with the 10 | box type data structure. Defaults to False. 11 | """ 12 | 13 | # The size of the last of dimension of the encoded tensor. 14 | encode_size = 4 15 | 16 | def __init__(self, use_box_type: bool = False, **kwargs): 17 | self.use_box_type = use_box_type 18 | 19 | @abstractmethod 20 | def encode(self, bboxes, gt_bboxes): 21 | """Encode deltas between bboxes and ground truth boxes.""" 22 | 23 | @abstractmethod 24 | def decode(self, bboxes, bboxes_pred): 25 | """Decode the predicted bboxes according to prediction and base 26 | boxes.""" 27 | -------------------------------------------------------------------------------- /Detection/mmdetection/mmdet/models/task_modules/coders/pseudo_bbox_coder.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) OpenMMLab. All rights reserved. 2 | from typing import Union 3 | 4 | from torch import Tensor 5 | 6 | from mmdet.registry import TASK_UTILS 7 | from mmdet.structures.bbox import BaseBoxes, HorizontalBoxes, get_box_tensor 8 | from .base_bbox_coder import BaseBBoxCoder 9 | 10 | 11 | @TASK_UTILS.register_module() 12 | class PseudoBBoxCoder(BaseBBoxCoder): 13 | """Pseudo bounding box coder.""" 14 | 15 | def __init__(self, **kwargs): 16 | super().__init__(**kwargs) 17 | 18 | def encode(self, bboxes: Tensor, gt_bboxes: Union[Tensor, 19 | BaseBoxes]) -> Tensor: 20 | """torch.Tensor: return the given ``bboxes``""" 21 | gt_bboxes = get_box_tensor(gt_bboxes) 22 | return gt_bboxes 23 | 24 | def decode(self, bboxes: Tensor, pred_bboxes: Union[Tensor, 25 | BaseBoxes]) -> Tensor: 26 | """torch.Tensor: return the given ``pred_bboxes``""" 27 | if self.use_box_type: 28 | pred_bboxes = HorizontalBoxes(pred_bboxes) 29 | return pred_bboxes 30 | -------------------------------------------------------------------------------- /Detection/mmdetection/mmdet/models/task_modules/prior_generators/__init__.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) OpenMMLab. All rights reserved. 2 | from .anchor_generator import (AnchorGenerator, LegacyAnchorGenerator, 3 | SSDAnchorGenerator, YOLOAnchorGenerator) 4 | from .point_generator import MlvlPointGenerator, PointGenerator 5 | from .utils import anchor_inside_flags, calc_region 6 | 7 | __all__ = [ 8 | 'AnchorGenerator', 'LegacyAnchorGenerator', 'anchor_inside_flags', 9 | 'PointGenerator', 'calc_region', 'YOLOAnchorGenerator', 10 | 'MlvlPointGenerator', 'SSDAnchorGenerator' 11 | ] 12 | -------------------------------------------------------------------------------- /Detection/mmdetection/mmdet/models/task_modules/samplers/__init__.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) OpenMMLab. All rights reserved. 2 | from .base_sampler import BaseSampler 3 | from .combined_sampler import CombinedSampler 4 | from .instance_balanced_pos_sampler import InstanceBalancedPosSampler 5 | from .iou_balanced_neg_sampler import IoUBalancedNegSampler 6 | from .mask_pseudo_sampler import MaskPseudoSampler 7 | from .mask_sampling_result import MaskSamplingResult 8 | from .multi_instance_random_sampler import MultiInsRandomSampler 9 | from .multi_instance_sampling_result import MultiInstanceSamplingResult 10 | from .ohem_sampler import OHEMSampler 11 | from .pseudo_sampler import PseudoSampler 12 | from .random_sampler import RandomSampler 13 | from .sampling_result import SamplingResult 14 | from .score_hlr_sampler import ScoreHLRSampler 15 | 16 | __all__ = [ 17 | 'BaseSampler', 'PseudoSampler', 'RandomSampler', 18 | 'InstanceBalancedPosSampler', 'IoUBalancedNegSampler', 'CombinedSampler', 19 | 'OHEMSampler', 'SamplingResult', 'ScoreHLRSampler', 'MaskPseudoSampler', 20 | 'MaskSamplingResult', 'MultiInstanceSamplingResult', 21 | 'MultiInsRandomSampler' 22 | ] 23 | -------------------------------------------------------------------------------- /Detection/mmdetection/mmdet/models/task_modules/samplers/combined_sampler.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) OpenMMLab. All rights reserved. 2 | from mmdet.registry import TASK_UTILS 3 | from .base_sampler import BaseSampler 4 | 5 | 6 | @TASK_UTILS.register_module() 7 | class CombinedSampler(BaseSampler): 8 | """A sampler that combines positive sampler and negative sampler.""" 9 | 10 | def __init__(self, pos_sampler, neg_sampler, **kwargs): 11 | super(CombinedSampler, self).__init__(**kwargs) 12 | self.pos_sampler = TASK_UTILS.build(pos_sampler, default_args=kwargs) 13 | self.neg_sampler = TASK_UTILS.build(neg_sampler, default_args=kwargs) 14 | 15 | def _sample_pos(self, **kwargs): 16 | """Sample positive samples.""" 17 | raise NotImplementedError 18 | 19 | def _sample_neg(self, **kwargs): 20 | """Sample negative samples.""" 21 | raise NotImplementedError 22 | -------------------------------------------------------------------------------- /Detection/mmdetection/mmdet/models/task_modules/tracking/__init__.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) OpenMMLab. All rights reserved. 2 | from .aflink import AppearanceFreeLink 3 | from .camera_motion_compensation import CameraMotionCompensation 4 | from .interpolation import InterpolateTracklets 5 | from .kalman_filter import KalmanFilter 6 | from .similarity import embed_similarity 7 | 8 | __all__ = [ 9 | 'KalmanFilter', 'InterpolateTracklets', 'embed_similarity', 10 | 'AppearanceFreeLink', 'CameraMotionCompensation' 11 | ] 12 | -------------------------------------------------------------------------------- /Detection/mmdetection/mmdet/models/test_time_augs/__init__.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) OpenMMLab. All rights reserved. 2 | from .det_tta import DetTTAModel 3 | from .merge_augs import (merge_aug_bboxes, merge_aug_masks, 4 | merge_aug_proposals, merge_aug_results, 5 | merge_aug_scores) 6 | 7 | __all__ = [ 8 | 'merge_aug_bboxes', 'merge_aug_masks', 'merge_aug_proposals', 9 | 'merge_aug_scores', 'merge_aug_results', 'DetTTAModel' 10 | ] 11 | -------------------------------------------------------------------------------- /Detection/mmdetection/mmdet/models/trackers/__init__.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) OpenMMLab. All rights reserved. 2 | from .base_tracker import BaseTracker 3 | from .byte_tracker import ByteTracker 4 | from .masktrack_rcnn_tracker import MaskTrackRCNNTracker 5 | from .ocsort_tracker import OCSORTTracker 6 | from .quasi_dense_tracker import QuasiDenseTracker 7 | from .sort_tracker import SORTTracker 8 | from .strongsort_tracker import StrongSORTTracker 9 | 10 | __all__ = [ 11 | 'BaseTracker', 'ByteTracker', 'QuasiDenseTracker', 'SORTTracker', 12 | 'StrongSORTTracker', 'OCSORTTracker', 'MaskTrackRCNNTracker' 13 | ] 14 | -------------------------------------------------------------------------------- /Detection/mmdetection/mmdet/models/tracking_heads/__init__.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) OpenMMLab. All rights reserved. 2 | from .mask2former_track_head import Mask2FormerTrackHead 3 | from .quasi_dense_embed_head import QuasiDenseEmbedHead 4 | from .quasi_dense_track_head import QuasiDenseTrackHead 5 | from .roi_embed_head import RoIEmbedHead 6 | from .roi_track_head import RoITrackHead 7 | 8 | __all__ = [ 9 | 'QuasiDenseEmbedHead', 'QuasiDenseTrackHead', 'Mask2FormerTrackHead', 10 | 'RoIEmbedHead', 'RoITrackHead' 11 | ] 12 | -------------------------------------------------------------------------------- /Detection/mmdetection/mmdet/models/vis/__init__.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) OpenMMLab. All rights reserved. 2 | from .mask2former_vis import Mask2FormerVideo 3 | from .masktrack_rcnn import MaskTrackRCNN 4 | 5 | __all__ = ['Mask2FormerVideo', 'MaskTrackRCNN'] 6 | -------------------------------------------------------------------------------- /Detection/mmdetection/mmdet/structures/__init__.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) OpenMMLab. All rights reserved. 2 | from .det_data_sample import DetDataSample, OptSampleList, SampleList 3 | from .reid_data_sample import ReIDDataSample 4 | from .track_data_sample import (OptTrackSampleList, TrackDataSample, 5 | TrackSampleList) 6 | 7 | __all__ = [ 8 | 'DetDataSample', 'SampleList', 'OptSampleList', 'TrackDataSample', 9 | 'TrackSampleList', 'OptTrackSampleList', 'ReIDDataSample' 10 | ] 11 | -------------------------------------------------------------------------------- /Detection/mmdetection/mmdet/structures/mask/__init__.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) OpenMMLab. All rights reserved. 2 | from .mask_target import mask_target 3 | from .structures import (BaseInstanceMasks, BitmapMasks, PolygonMasks, 4 | bitmap_to_polygon, polygon_to_bitmap) 5 | from .utils import encode_mask_results, mask2bbox, split_combined_polys 6 | 7 | __all__ = [ 8 | 'split_combined_polys', 'mask_target', 'BaseInstanceMasks', 'BitmapMasks', 9 | 'PolygonMasks', 'encode_mask_results', 'mask2bbox', 'polygon_to_bitmap', 10 | 'bitmap_to_polygon' 11 | ] 12 | -------------------------------------------------------------------------------- /Detection/mmdetection/mmdet/testing/__init__.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) OpenMMLab. All rights reserved. 2 | from ._fast_stop_training_hook import FastStopTrainingHook # noqa: F401,F403 3 | from ._utils import (demo_mm_inputs, demo_mm_proposals, 4 | demo_mm_sampling_results, demo_track_inputs, 5 | get_detector_cfg, get_roi_head_cfg, random_boxes, 6 | replace_to_ceph) 7 | 8 | __all__ = [ 9 | 'demo_mm_inputs', 'get_detector_cfg', 'get_roi_head_cfg', 10 | 'demo_mm_proposals', 'demo_mm_sampling_results', 'replace_to_ceph', 11 | 'demo_track_inputs', 'VideoDataSampleFeeder', 'random_boxes' 12 | ] 13 | -------------------------------------------------------------------------------- /Detection/mmdetection/mmdet/testing/_fast_stop_training_hook.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) OpenMMLab. All rights reserved. 2 | from mmengine.hooks import Hook 3 | 4 | from mmdet.registry import HOOKS 5 | 6 | 7 | @HOOKS.register_module() 8 | class FastStopTrainingHook(Hook): 9 | """Set runner's epoch information to the model.""" 10 | 11 | def __init__(self, by_epoch, save_ckpt=False, stop_iter_or_epoch=5): 12 | self.by_epoch = by_epoch 13 | self.save_ckpt = save_ckpt 14 | self.stop_iter_or_epoch = stop_iter_or_epoch 15 | 16 | def after_train_iter(self, runner, batch_idx: int, data_batch: None, 17 | outputs: None) -> None: 18 | if self.save_ckpt and self.by_epoch: 19 | # If it is epoch-based and want to save weights, 20 | # we must run at least 1 epoch. 21 | return 22 | if runner.iter >= self.stop_iter_or_epoch: 23 | raise RuntimeError('quick exit') 24 | 25 | def after_train_epoch(self, runner) -> None: 26 | if runner.epoch >= self.stop_iter_or_epoch - 1: 27 | raise RuntimeError('quick exit') 28 | -------------------------------------------------------------------------------- /Detection/mmdetection/mmdet/utils/collect_env.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) OpenMMLab. All rights reserved. 2 | from mmengine.utils import get_git_hash 3 | from mmengine.utils.dl_utils import collect_env as collect_base_env 4 | 5 | import mmdet 6 | 7 | 8 | def collect_env(): 9 | """Collect the information of the running environments.""" 10 | env_info = collect_base_env() 11 | env_info['MMDetection'] = mmdet.__version__ + '+' + get_git_hash()[:7] 12 | return env_info 13 | 14 | 15 | if __name__ == '__main__': 16 | for name, val in collect_env().items(): 17 | print(f'{name}: {val}') 18 | -------------------------------------------------------------------------------- /Detection/mmdetection/mmdet/utils/typing_utils.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) OpenMMLab. All rights reserved. 2 | """Collecting some commonly used type hint in mmdetection.""" 3 | from typing import List, Optional, Sequence, Tuple, Union 4 | 5 | from mmengine.config import ConfigDict 6 | from mmengine.structures import InstanceData, PixelData 7 | 8 | # TODO: Need to avoid circular import with assigner and sampler 9 | # Type hint of config data 10 | ConfigType = Union[ConfigDict, dict] 11 | OptConfigType = Optional[ConfigType] 12 | # Type hint of one or more config data 13 | MultiConfig = Union[ConfigType, List[ConfigType]] 14 | OptMultiConfig = Optional[MultiConfig] 15 | 16 | InstanceList = List[InstanceData] 17 | OptInstanceList = Optional[InstanceList] 18 | 19 | PixelList = List[PixelData] 20 | OptPixelList = Optional[PixelList] 21 | 22 | RangeType = Sequence[Tuple[int, int]] 23 | -------------------------------------------------------------------------------- /Detection/mmdetection/mmdet/utils/util_random.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) OpenMMLab. All rights reserved. 2 | """Helpers for random number generators.""" 3 | import numpy as np 4 | 5 | 6 | def ensure_rng(rng=None): 7 | """Coerces input into a random number generator. 8 | 9 | If the input is None, then a global random state is returned. 10 | 11 | If the input is a numeric value, then that is used as a seed to construct a 12 | random state. Otherwise the input is returned as-is. 13 | 14 | Adapted from [1]_. 15 | 16 | Args: 17 | rng (int | numpy.random.RandomState | None): 18 | if None, then defaults to the global rng. Otherwise this can be an 19 | integer or a RandomState class 20 | Returns: 21 | (numpy.random.RandomState) : rng - 22 | a numpy random number generator 23 | 24 | References: 25 | .. [1] https://gitlab.kitware.com/computer-vision/kwarray/blob/master/kwarray/util_random.py#L270 # noqa: E501 26 | """ 27 | 28 | if rng is None: 29 | rng = np.random.mtrand._rand 30 | elif isinstance(rng, int): 31 | rng = np.random.RandomState(rng) 32 | else: 33 | rng = rng 34 | return rng 35 | -------------------------------------------------------------------------------- /Detection/mmdetection/mmdet/version.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) OpenMMLab. All rights reserved. 2 | 3 | __version__ = '3.3.0' 4 | short_version = __version__ 5 | 6 | 7 | def parse_version_info(version_str): 8 | """Parse a version string into a tuple. 9 | 10 | Args: 11 | version_str (str): The version string. 12 | Returns: 13 | tuple[int | str]: The version info, e.g., "1.3.0" is parsed into 14 | (1, 3, 0), and "2.0.0rc1" is parsed into (2, 0, 0, 'rc1'). 15 | """ 16 | version_info = [] 17 | for x in version_str.split('.'): 18 | if x.isdigit(): 19 | version_info.append(int(x)) 20 | elif x.find('rc') != -1: 21 | patch_version = x.split('rc') 22 | version_info.append(int(patch_version[0])) 23 | version_info.append(f'rc{patch_version[1]}') 24 | return tuple(version_info) 25 | 26 | 27 | version_info = parse_version_info(__version__) 28 | -------------------------------------------------------------------------------- /Detection/mmdetection/mmdet/visualization/__init__.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) OpenMMLab. All rights reserved. 2 | from .local_visualizer import DetLocalVisualizer, TrackLocalVisualizer 3 | from .palette import get_palette, jitter_color, palette_val 4 | 5 | __all__ = [ 6 | 'palette_val', 'get_palette', 'DetLocalVisualizer', 'jitter_color', 7 | 'TrackLocalVisualizer' 8 | ] 9 | -------------------------------------------------------------------------------- /Detection/mmdetection/projects/AlignDETR/align_detr/__init__.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) OpenMMLab. All rights reserved. 2 | from .align_detr_head import AlignDETRHead 3 | from .mixed_hungarian_assigner import MixedHungarianAssigner 4 | 5 | __all__ = ['AlignDETRHead', 'MixedHungarianAssigner'] 6 | -------------------------------------------------------------------------------- /Detection/mmdetection/projects/AlignDETR/align_detr/utils.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) OpenMMLab. All rights reserved. 2 | from typing import Any, List, Optional 3 | 4 | 5 | class KeysRecorder: 6 | """Wrap object to record its `__getitem__` keys in the history. 7 | 8 | Args: 9 | obj (object): Any object that supports `__getitem__`. 10 | keys (List): List of keys already recorded. Default to None. 11 | """ 12 | 13 | def __init__(self, obj: Any, keys: Optional[List[Any]] = None) -> None: 14 | self.obj = obj 15 | 16 | if keys is None: 17 | keys = [] 18 | self.keys = keys 19 | 20 | def __getitem__(self, key: Any) -> 'KeysRecorder': 21 | """Wrap method `__getitem__` to record its keys. 22 | 23 | Args: 24 | key: Key that is passed to the object. 25 | 26 | Returns: 27 | result (KeysRecorder): KeysRecorder instance that wraps sub_obj. 28 | """ 29 | sub_obj = self.obj.__getitem__(key) 30 | keys = self.keys.copy() 31 | keys.append(key) 32 | # Create a KeysRecorder instance from the sub_obj. 33 | result = KeysRecorder(sub_obj, keys) 34 | return result 35 | -------------------------------------------------------------------------------- /Detection/mmdetection/projects/AlignDETR/configs/align_detr-4scale_r50_8xb2-24e_coco.py: -------------------------------------------------------------------------------- 1 | _base_ = './align_detr-4scale_r50_8xb2-12e_coco.py' 2 | max_epochs = 24 3 | train_cfg = dict( 4 | type='EpochBasedTrainLoop', max_epochs=max_epochs, val_interval=1) 5 | param_scheduler = [ 6 | dict( 7 | type='LinearLR', 8 | start_factor=0.0001, 9 | by_epoch=False, 10 | begin=0, 11 | end=2000), 12 | dict( 13 | type='MultiStepLR', 14 | begin=0, 15 | end=max_epochs, 16 | by_epoch=True, 17 | milestones=[20], 18 | gamma=0.1) 19 | ] 20 | -------------------------------------------------------------------------------- /Detection/mmdetection/projects/CO-DETR/codetr/__init__.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) OpenMMLab. All rights reserved. 2 | from .co_atss_head import CoATSSHead 3 | from .co_dino_head import CoDINOHead 4 | from .co_roi_head import CoStandardRoIHead 5 | from .codetr import CoDETR 6 | from .transformer import (CoDinoTransformer, DetrTransformerDecoderLayer, 7 | DetrTransformerEncoder, DinoTransformerDecoder) 8 | 9 | __all__ = [ 10 | 'CoDETR', 'CoDinoTransformer', 'DinoTransformerDecoder', 'CoDINOHead', 11 | 'CoATSSHead', 'CoStandardRoIHead', 'DetrTransformerEncoder', 12 | 'DetrTransformerDecoderLayer' 13 | ] 14 | -------------------------------------------------------------------------------- /Detection/mmdetection/projects/CO-DETR/configs/codino/co_dino_5scale_r50_lsj_8xb2_3x_coco.py: -------------------------------------------------------------------------------- 1 | _base_ = ['co_dino_5scale_r50_lsj_8xb2_1x_coco.py'] 2 | 3 | param_scheduler = [dict(milestones=[30])] 4 | train_cfg = dict(max_epochs=36) 5 | -------------------------------------------------------------------------------- /Detection/mmdetection/projects/CO-DETR/configs/codino/co_dino_5scale_swin_l_16xb1_3x_coco.py: -------------------------------------------------------------------------------- 1 | _base_ = ['co_dino_5scale_swin_l_16xb1_1x_coco.py'] 2 | # model settings 3 | model = dict(backbone=dict(drop_path_rate=0.6)) 4 | 5 | param_scheduler = [dict(milestones=[30])] 6 | train_cfg = dict(max_epochs=36) 7 | -------------------------------------------------------------------------------- /Detection/mmdetection/projects/CO-DETR/configs/codino/co_dino_5scale_swin_l_lsj_16xb1_3x_coco.py: -------------------------------------------------------------------------------- 1 | _base_ = ['co_dino_5scale_swin_l_lsj_16xb1_1x_coco.py'] 2 | 3 | model = dict(backbone=dict(drop_path_rate=0.5)) 4 | 5 | param_scheduler = [dict(type='MultiStepLR', milestones=[30])] 6 | 7 | train_cfg = dict(max_epochs=36) 8 | -------------------------------------------------------------------------------- /Detection/mmdetection/projects/Detic/detic/__init__.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) OpenMMLab. All rights reserved. 2 | from .centernet_rpn_head import CenterNetRPNHead 3 | from .detic_bbox_head import DeticBBoxHead 4 | from .detic_roi_head import DeticRoIHead 5 | from .zero_shot_classifier import ZeroShotClassifier 6 | 7 | __all__ = [ 8 | 'CenterNetRPNHead', 'DeticBBoxHead', 'DeticRoIHead', 'ZeroShotClassifier' 9 | ] 10 | -------------------------------------------------------------------------------- /Detection/mmdetection/projects/Detic_new/configs/detic_centernet2_r50_fpn_4x_lvis-base_boxsup.py: -------------------------------------------------------------------------------- 1 | _base_ = './detic_centernet2_r50_fpn_4x_lvis_boxsup.py' 2 | 3 | # 'lvis_v1_train_norare.json' is the annotations of lvis_v1 4 | # removing the labels of 337 rare-class 5 | train_dataloader = dict( 6 | dataset=dict( 7 | type='ClassBalancedDataset', 8 | oversample_thr=1e-3, 9 | dataset=dict(ann_file='annotations/lvis_v1_train_norare.json'))) 10 | -------------------------------------------------------------------------------- /Detection/mmdetection/projects/Detic_new/configs/detic_centernet2_swin-b_fpn_4x_lvis-base_boxsup.py: -------------------------------------------------------------------------------- 1 | _base_ = './detic_centernet2_swin-b_fpn_4x_lvis_boxsup.py' 2 | 3 | # 'lvis_v1_train_norare.json' is the annotations of lvis_v1 4 | # removing the labels of 337 rare-class 5 | train_dataloader = dict( 6 | dataset=dict( 7 | type='ClassBalancedDataset', 8 | oversample_thr=1e-3, 9 | dataset=dict(ann_file='annotations/lvis_v1_train_norare.json'))) 10 | -------------------------------------------------------------------------------- /Detection/mmdetection/projects/Detic_new/configs/detic_centernet2_swin-b_fpn_4x_lvis_coco_in21k.py: -------------------------------------------------------------------------------- 1 | # not support training, only for testing 2 | _base_ = './detic_centernet2_swin-b_fpn_4x_lvis_in21k-lvis.py' 3 | -------------------------------------------------------------------------------- /Detection/mmdetection/projects/Detic_new/detic/__init__.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) OpenMMLab. All rights reserved. 2 | from .centernet_rpn_head import CenterNetRPNHead 3 | from .detic import Detic 4 | from .detic_bbox_head import DeticBBoxHead 5 | from .detic_roi_head import DeticRoIHead 6 | from .heatmap_focal_loss import HeatmapFocalLoss 7 | from .imagenet_lvis import ImageNetLVISV1Dataset 8 | from .zero_shot_classifier import ZeroShotClassifier 9 | 10 | __all__ = [ 11 | 'CenterNetRPNHead', 'Detic', 'DeticBBoxHead', 'DeticRoIHead', 12 | 'ZeroShotClassifier', 'HeatmapFocalLoss', 'ImageNetLVISV1Dataset' 13 | ] 14 | -------------------------------------------------------------------------------- /Detection/mmdetection/projects/DiffusionDet/diffusiondet/__init__.py: -------------------------------------------------------------------------------- 1 | from .diffusiondet import DiffusionDet 2 | from .head import (DynamicConv, DynamicDiffusionDetHead, 3 | SingleDiffusionDetHead, SinusoidalPositionEmbeddings) 4 | from .loss import DiffusionDetCriterion, DiffusionDetMatcher 5 | 6 | __all__ = [ 7 | 'DiffusionDet', 'DynamicDiffusionDetHead', 'SingleDiffusionDetHead', 8 | 'SinusoidalPositionEmbeddings', 'DynamicConv', 'DiffusionDetCriterion', 9 | 'DiffusionDetMatcher' 10 | ] 11 | -------------------------------------------------------------------------------- /Detection/mmdetection/projects/DiffusionDet/diffusiondet/diffusiondet.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) OpenMMLab. All rights reserved. 2 | from mmdet.models import SingleStageDetector 3 | from mmdet.registry import MODELS 4 | from mmdet.utils import ConfigType, OptConfigType, OptMultiConfig 5 | 6 | 7 | @MODELS.register_module() 8 | class DiffusionDet(SingleStageDetector): 9 | """Implementation of `DiffusionDet <>`_""" 10 | 11 | def __init__(self, 12 | backbone: ConfigType, 13 | neck: ConfigType, 14 | bbox_head: ConfigType, 15 | train_cfg: OptConfigType = None, 16 | test_cfg: OptConfigType = None, 17 | data_preprocessor: OptConfigType = None, 18 | init_cfg: OptMultiConfig = None) -> None: 19 | super().__init__( 20 | backbone=backbone, 21 | neck=neck, 22 | bbox_head=bbox_head, 23 | train_cfg=train_cfg, 24 | test_cfg=test_cfg, 25 | data_preprocessor=data_preprocessor, 26 | init_cfg=init_cfg) 27 | -------------------------------------------------------------------------------- /Detection/mmdetection/projects/EfficientDet/efficientdet/__init__.py: -------------------------------------------------------------------------------- 1 | from .bifpn import BiFPN 2 | from .efficientdet import EfficientDet 3 | from .efficientdet_head import EfficientDetSepBNHead 4 | from .huber_loss import HuberLoss 5 | from .tensorflow.anchor_generator import YXYXAnchorGenerator 6 | from .tensorflow.coco_90class import Coco90Dataset 7 | from .tensorflow.coco_90metric import Coco90Metric 8 | from .tensorflow.trans_max_iou_assigner import TransMaxIoUAssigner 9 | from .tensorflow.yxyx_bbox_coder import YXYXDeltaXYWHBBoxCoder 10 | from .utils import Conv2dSamePadding 11 | 12 | __all__ = [ 13 | 'EfficientDet', 'BiFPN', 'HuberLoss', 'EfficientDetSepBNHead', 14 | 'Conv2dSamePadding', 'Coco90Dataset', 'Coco90Metric', 15 | 'YXYXAnchorGenerator', 'TransMaxIoUAssigner', 'YXYXDeltaXYWHBBoxCoder' 16 | ] 17 | -------------------------------------------------------------------------------- /Detection/mmdetection/projects/EfficientDet/efficientdet/efficientdet.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) OpenMMLab. All rights reserved. 2 | from mmdet.models.detectors.single_stage import SingleStageDetector 3 | from mmdet.registry import MODELS 4 | from mmdet.utils import ConfigType, OptConfigType, OptMultiConfig 5 | 6 | 7 | @MODELS.register_module() 8 | class EfficientDet(SingleStageDetector): 9 | 10 | def __init__(self, 11 | backbone: ConfigType, 12 | neck: ConfigType, 13 | bbox_head: ConfigType, 14 | train_cfg: OptConfigType = None, 15 | test_cfg: OptConfigType = None, 16 | data_preprocessor: OptConfigType = None, 17 | init_cfg: OptMultiConfig = None) -> None: 18 | super().__init__( 19 | backbone=backbone, 20 | neck=neck, 21 | bbox_head=bbox_head, 22 | train_cfg=train_cfg, 23 | test_cfg=test_cfg, 24 | data_preprocessor=data_preprocessor, 25 | init_cfg=init_cfg) 26 | -------------------------------------------------------------------------------- /Detection/mmdetection/projects/EfficientDet/efficientdet/tensorflow/api_wrappers/__init__.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) OpenMMLab. All rights reserved. 2 | from .coco_api import COCO, COCOeval, COCOPanoptic 3 | 4 | __all__ = ['COCO', 'COCOeval', 'COCOPanoptic'] 5 | -------------------------------------------------------------------------------- /Detection/mmdetection/projects/HDINO/__init__.py: -------------------------------------------------------------------------------- 1 | from .h_dino import HDINO 2 | from .h_dino_head import HybridDINOHead 3 | 4 | __all__ = ['HDINO', 'HybridDINOHead'] 5 | -------------------------------------------------------------------------------- /Detection/mmdetection/projects/LabelStudio/readme.md: -------------------------------------------------------------------------------- 1 | # Semi-automatic Object Detection Annotation with MMDetection and Label-Studio 2 | 3 | Please read the [Docs](../../docs/en/user_guides/label_studio.md) for more details. 4 | -------------------------------------------------------------------------------- /Detection/mmdetection/projects/RF100-Benchmark/__init__.py: -------------------------------------------------------------------------------- 1 | from .coco import RF100CocoDataset 2 | from .coco_metric import RF100CocoMetric 3 | 4 | __all__ = ['RF100CocoDataset', 'RF100CocoMetric'] 5 | -------------------------------------------------------------------------------- /Detection/mmdetection/projects/RF100-Benchmark/scripts/download_datasets.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | #set -euo pipefail 3 | input="$(pwd)/scripts/datasets_links_640.txt" 4 | 5 | while getopts f:l: flag 6 | do 7 | case "${flag}" in 8 | f) format=${OPTARG};; 9 | l) location=${OPTARG};; 10 | esac 11 | done 12 | # default values 13 | format=${format:-coco} 14 | location=${location:-$(pwd)/rf100} 15 | 16 | echo "Starting downloading RF100..." 17 | 18 | for link in $(cat $input) 19 | do 20 | attributes=$(python3 $(pwd)/scripts/parse_dataset_link.py -l $link) 21 | 22 | project=$(echo $attributes | cut -d' ' -f 3) 23 | version=$(echo $attributes | cut -d' ' -f 4) 24 | if [ ! -d "$location/$project" ] ; 25 | then 26 | python3 $(pwd)/scripts/download_dataset.py -p $project -v $version -l $location -f $format 27 | fi 28 | done 29 | 30 | echo "Done!" 31 | -------------------------------------------------------------------------------- /Detection/mmdetection/projects/RF100-Benchmark/scripts/parse_dataset_link.py: -------------------------------------------------------------------------------- 1 | import re 2 | from argparse import ArgumentParser 3 | 4 | 5 | def main(): 6 | parser = ArgumentParser( 7 | description='A handy script that will decompose and print from ' 8 | "a roboflow dataset link it's workspace, project and version") 9 | parser.add_argument( 10 | '-l', '--link', required=True, help='A link to a roboflow dataset') 11 | args = vars(parser.parse_args()) 12 | # first one gonna be protocol, e.g. http 13 | _, url, workspace, project, version = re.split('/+', args['link']) 14 | print(url, workspace, project, version) 15 | 16 | 17 | if __name__ == '__main__': 18 | main() 19 | -------------------------------------------------------------------------------- /Detection/mmdetection/projects/SparseInst/sparseinst/__init__.py: -------------------------------------------------------------------------------- 1 | from .decoder import BaseIAMDecoder, GroupIAMDecoder, GroupIAMSoftDecoder 2 | from .encoder import PyramidPoolingModule 3 | from .loss import SparseInstCriterion, SparseInstMatcher 4 | from .sparseinst import SparseInst 5 | 6 | __all__ = [ 7 | 'BaseIAMDecoder', 'GroupIAMDecoder', 'GroupIAMSoftDecoder', 8 | 'PyramidPoolingModule', 'SparseInstCriterion', 'SparseInstMatcher', 9 | 'SparseInst' 10 | ] 11 | -------------------------------------------------------------------------------- /Detection/mmdetection/projects/ViTDet/vitdet/__init__.py: -------------------------------------------------------------------------------- 1 | from .fp16_compression_hook import Fp16CompresssionHook 2 | from .layer_decay_optimizer_constructor import LayerDecayOptimizerConstructor 3 | from .simple_fpn import SimpleFPN 4 | from .vit import LN2d, ViT 5 | 6 | __all__ = [ 7 | 'LayerDecayOptimizerConstructor', 'ViT', 'SimpleFPN', 'LN2d', 8 | 'Fp16CompresssionHook' 9 | ] 10 | -------------------------------------------------------------------------------- /Detection/mmdetection/projects/ViTDet/vitdet/fp16_compression_hook.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) OpenMMLab. All rights reserved. 2 | from mmengine.hooks import Hook 3 | 4 | from mmdet.registry import HOOKS 5 | 6 | 7 | @HOOKS.register_module() 8 | class Fp16CompresssionHook(Hook): 9 | """Support fp16 compression in DDP mode. 10 | 11 | In detectron2, vitdet use Fp16CompresssionHook in training process 12 | Fp16CompresssionHook can reduce training time and improve bbox mAP when you 13 | use Fp16CompresssionHook, training time reduce form 3 days to 2 days and 14 | box mAP from 51.4 to 51.6 15 | """ 16 | 17 | def before_train(self, runner): 18 | 19 | if runner.distributed: 20 | if runner.cfg.get('model_wrapper_cfg') is None: 21 | from torch.distributed.algorithms.ddp_comm_hooks import \ 22 | default as comm_hooks 23 | runner.model.register_comm_hook( 24 | state=None, hook=comm_hooks.fp16_compress_hook) 25 | runner.logger.info('use fp16 compression in DDP mode') 26 | -------------------------------------------------------------------------------- /Detection/mmdetection/projects/XDecoder/configs/_base_/xdecoder-tiny_caption.py: -------------------------------------------------------------------------------- 1 | _base_ = 'xdecoder-tiny_open-vocab-semseg.py' 2 | 3 | model = dict(head=dict(task='caption')) 4 | -------------------------------------------------------------------------------- /Detection/mmdetection/projects/XDecoder/configs/_base_/xdecoder-tiny_open-vocab-instance.py: -------------------------------------------------------------------------------- 1 | _base_ = 'xdecoder-tiny_open-vocab-semseg.py' 2 | 3 | model = dict(head=dict(task='instance'), test_cfg=dict(max_per_img=100)) 4 | -------------------------------------------------------------------------------- /Detection/mmdetection/projects/XDecoder/configs/_base_/xdecoder-tiny_open-vocab-panoptic.py: -------------------------------------------------------------------------------- 1 | _base_ = 'xdecoder-tiny_open-vocab-semseg.py' 2 | 3 | model = dict( 4 | head=dict(task='panoptic'), test_cfg=dict(mask_thr=0.8, overlap_thr=0.8)) 5 | -------------------------------------------------------------------------------- /Detection/mmdetection/projects/XDecoder/configs/_base_/xdecoder-tiny_open-vocab-semseg.py: -------------------------------------------------------------------------------- 1 | _base_ = 'mmdet::_base_/default_runtime.py' 2 | 3 | custom_imports = dict( 4 | imports=['projects.XDecoder.xdecoder'], allow_failed_imports=False) 5 | 6 | model = dict( 7 | type='XDecoder', 8 | data_preprocessor=dict( 9 | type='DetDataPreprocessor', 10 | mean=[123.675, 116.28, 103.53], 11 | std=[58.395, 57.12, 57.375], 12 | bgr_to_rgb=True, 13 | pad_size_divisor=32), 14 | backbone=dict(type='FocalNet'), 15 | head=dict( 16 | type='XDecoderUnifiedhead', 17 | in_channels=(96, 192, 384, 768), 18 | pixel_decoder=dict(type='XTransformerEncoderPixelDecoder'), 19 | transformer_decoder=dict(type='XDecoderTransformerDecoder'), 20 | task='semseg', 21 | ), 22 | # use_thr_for_mc=True means use threshold for multi-class 23 | # This parameter is only used in semantic segmentation task and 24 | # referring semantic segmentation task. 25 | test_cfg=dict(mask_thr=0.5, use_thr_for_mc=True, ignore_index=255), 26 | ) 27 | 28 | val_cfg = dict(type='ValLoop') 29 | test_cfg = dict(type='TestLoop') 30 | -------------------------------------------------------------------------------- /Detection/mmdetection/projects/XDecoder/configs/_base_/xdecoder-tiny_ref-seg.py: -------------------------------------------------------------------------------- 1 | _base_ = 'xdecoder-tiny_open-vocab-semseg.py' 2 | 3 | model = dict(head=dict(task='ref-seg')) 4 | -------------------------------------------------------------------------------- /Detection/mmdetection/projects/XDecoder/configs/xdecoder-tiny_zeroshot_caption_coco2014.py: -------------------------------------------------------------------------------- 1 | _base_ = [ 2 | '_base_/xdecoder-tiny_caption.py', 'mmdet::_base_/datasets/coco_caption.py' 3 | ] 4 | 5 | test_pipeline = [ 6 | dict( 7 | type='LoadImageFromFile', 8 | imdecode_backend='pillow', 9 | backend_args=_base_.backend_args), 10 | dict(type='ResizeShortestEdge', scale=224, backend='pillow'), 11 | dict( 12 | type='PackDetInputs', 13 | meta_keys=('img_id', 'img_path', 'ori_shape', 'img_shape', 14 | 'scale_factor')) 15 | ] 16 | 17 | val_dataloader = dict(dataset=dict(pipeline=test_pipeline)) 18 | test_dataloader = val_dataloader 19 | -------------------------------------------------------------------------------- /Detection/mmdetection/projects/XDecoder/configs/xdecoder-tiny_zeroshot_open-vocab-instance_ade20k.py: -------------------------------------------------------------------------------- 1 | _base_ = [ 2 | '_base_/xdecoder-tiny_open-vocab-instance.py', 3 | 'mmdet::_base_/datasets/ade20k_instance.py' 4 | ] 5 | 6 | test_pipeline = [ 7 | dict(type='LoadImageFromFile', backend_args=_base_.backend_args), 8 | dict(type='Resize', scale=(2560, 640), keep_ratio=True), 9 | dict(type='LoadAnnotations', with_bbox=True, with_mask=True), 10 | dict( 11 | type='PackDetInputs', 12 | meta_keys=('img_id', 'img_path', 'ori_shape', 'img_shape', 13 | 'scale_factor', 'text')) 14 | ] 15 | 16 | val_dataloader = dict( 17 | dataset=dict(return_classes=True, pipeline=test_pipeline)) 18 | test_dataloader = val_dataloader 19 | 20 | test_evaluator = dict(metric=['segm']) 21 | -------------------------------------------------------------------------------- /Detection/mmdetection/projects/XDecoder/configs/xdecoder-tiny_zeroshot_open-vocab-instance_coco.py: -------------------------------------------------------------------------------- 1 | _base_ = [ 2 | '_base_/xdecoder-tiny_open-vocab-instance.py', 3 | 'mmdet::_base_/datasets/coco_instance.py' 4 | ] 5 | 6 | test_pipeline = [ 7 | dict( 8 | type='LoadImageFromFile', 9 | imdecode_backend='pillow', 10 | backend_args=_base_.backend_args), 11 | dict( 12 | type='ResizeShortestEdge', scale=800, max_size=1333, backend='pillow'), 13 | dict(type='LoadAnnotations', with_bbox=True, with_mask=True), 14 | dict( 15 | type='PackDetInputs', 16 | meta_keys=('img_id', 'img_path', 'ori_shape', 'img_shape', 17 | 'scale_factor', 'text')) 18 | ] 19 | 20 | val_dataloader = dict( 21 | dataset=dict(pipeline=test_pipeline, return_classes=True)) 22 | test_dataloader = val_dataloader 23 | 24 | val_evaluator = dict(metric='segm') 25 | test_evaluator = val_evaluator 26 | 27 | train_dataloader = None 28 | -------------------------------------------------------------------------------- /Detection/mmdetection/projects/XDecoder/configs/xdecoder-tiny_zeroshot_open-vocab-panoptic_coco.py: -------------------------------------------------------------------------------- 1 | _base_ = [ 2 | '_base_/xdecoder-tiny_open-vocab-panoptic.py', 3 | 'mmdet::_base_/datasets/coco_panoptic.py' 4 | ] 5 | 6 | model = dict(test_cfg=dict(mask_thr=0.4)) 7 | 8 | test_pipeline = [ 9 | dict( 10 | type='LoadImageFromFile', 11 | imdecode_backend='pillow', 12 | backend_args=_base_.backend_args), 13 | dict( 14 | type='ResizeShortestEdge', scale=800, max_size=1333, backend='pillow'), 15 | dict(type='LoadPanopticAnnotations', backend_args=_base_.backend_args), 16 | dict( 17 | type='PackDetInputs', 18 | meta_keys=('img_id', 'img_path', 'ori_shape', 'img_shape', 19 | 'scale_factor', 'text', 'stuff_text')) 20 | ] 21 | 22 | val_dataloader = dict( 23 | dataset=dict(pipeline=test_pipeline, return_classes=True)) 24 | 25 | test_dataloader = val_dataloader 26 | 27 | train_dataloader = None 28 | -------------------------------------------------------------------------------- /Detection/mmdetection/projects/XDecoder/configs/xdecoder-tiny_zeroshot_open-vocab-ref-seg_refcoco+.py: -------------------------------------------------------------------------------- 1 | _base_ = [ 2 | '_base_/xdecoder-tiny_ref-seg.py', 'mmdet::_base_/datasets/refcoco+.py' 3 | ] 4 | -------------------------------------------------------------------------------- /Detection/mmdetection/projects/XDecoder/configs/xdecoder-tiny_zeroshot_open-vocab-ref-seg_refcoco.py: -------------------------------------------------------------------------------- 1 | _base_ = [ 2 | '_base_/xdecoder-tiny_ref-seg.py', 'mmdet::_base_/datasets/refcoco.py' 3 | ] 4 | -------------------------------------------------------------------------------- /Detection/mmdetection/projects/XDecoder/configs/xdecoder-tiny_zeroshot_open-vocab-ref-seg_refcocog.py: -------------------------------------------------------------------------------- 1 | _base_ = [ 2 | '_base_/xdecoder-tiny_ref-seg.py', 'mmdet::_base_/datasets/refcocog.py' 3 | ] 4 | -------------------------------------------------------------------------------- /Detection/mmdetection/projects/XDecoder/configs/xdecoder-tiny_zeroshot_ref-caption.py: -------------------------------------------------------------------------------- 1 | _base_ = 'xdecoder-tiny_zeroshot_caption_coco2014.py' 2 | 3 | model = dict(head=dict(task='ref-caption')) 4 | 5 | grounding_scale = 512 6 | 7 | test_pipeline = [ 8 | dict(type='LoadImageFromFile', imdecode_backend='pillow'), 9 | dict(type='ResizeShortestEdge', scale=224, backend='pillow'), 10 | dict( 11 | type='PackDetInputs', 12 | meta_keys=('img_id', 'img_path', 'ori_shape', 'img_shape', 13 | 'scale_factor', 'text')) 14 | ] 15 | 16 | val_dataloader = dict(dataset=dict(pipeline=test_pipeline)) 17 | test_dataloader = val_dataloader 18 | -------------------------------------------------------------------------------- /Detection/mmdetection/projects/XDecoder/configs/xdecoder-tiny_zeroshot_text-image-retrieval.py: -------------------------------------------------------------------------------- 1 | _base_ = 'xdecoder-tiny_zeroshot_caption_coco2014.py' 2 | 3 | model = dict(head=dict(task='retrieval')) 4 | 5 | grounding_scale = 512 6 | 7 | test_pipeline = [ 8 | dict( 9 | type='LoadImageFromFile', 10 | imdecode_backend='pillow', 11 | backend_args=_base_.backend_args), 12 | dict( 13 | type='ResizeShortestEdge', 14 | scale=224, 15 | backend='pillow', 16 | interpolation='bicubic'), 17 | dict( 18 | type='PackDetInputs', 19 | meta_keys=('img_id', 'img_path', 'ori_shape', 'img_shape', 20 | 'scale_factor', 'text')) 21 | ] 22 | 23 | val_dataloader = dict(dataset=dict(pipeline=test_pipeline)) 24 | test_dataloader = val_dataloader 25 | -------------------------------------------------------------------------------- /Detection/mmdetection/projects/XDecoder/xdecoder/__init__.py: -------------------------------------------------------------------------------- 1 | from .focalnet import FocalNet 2 | from .pixel_decoder import XTransformerEncoderPixelDecoder 3 | from .transformer_decoder import XDecoderTransformerDecoder 4 | from .unified_head import XDecoderUnifiedhead 5 | from .xdecoder import XDecoder 6 | 7 | __all__ = [ 8 | 'XDecoder', 'FocalNet', 'XDecoderUnifiedhead', 9 | 'XTransformerEncoderPixelDecoder', 'XDecoderTransformerDecoder' 10 | ] 11 | -------------------------------------------------------------------------------- /Detection/mmdetection/projects/XDecoder/xdecoder/inference/__init__.py: -------------------------------------------------------------------------------- 1 | from .image_caption import ImageCaptionInferencer, RefImageCaptionInferencer 2 | from .texttoimage_regionretrieval_inferencer import \ 3 | TextToImageRegionRetrievalInferencer 4 | 5 | __all__ = [ 6 | 'ImageCaptionInferencer', 'RefImageCaptionInferencer', 7 | 'TextToImageRegionRetrievalInferencer' 8 | ] 9 | -------------------------------------------------------------------------------- /Detection/mmdetection/projects/example_largemodel/__init__.py: -------------------------------------------------------------------------------- 1 | from .fsdp_utils import checkpoint_check_fn, layer_auto_wrap_policy 2 | 3 | __all__ = ['checkpoint_check_fn', 'layer_auto_wrap_policy'] 4 | -------------------------------------------------------------------------------- /Detection/mmdetection/projects/example_largemodel/dino-5scale_swin-l_fsdp_8xb2-12e_coco.py: -------------------------------------------------------------------------------- 1 | from mmengine.config import read_base 2 | 3 | with read_base(): 4 | from mmdet.configs.dino.dino_5scale_swin_l_8xb2_12e_coco import * # noqa 5 | 6 | from projects.example_largemodel import (checkpoint_check_fn, 7 | layer_auto_wrap_policy) 8 | 9 | # The checkpoint needs to be controlled by the checkpoint_check_fn. 10 | model.update(dict(backbone=dict(with_cp=False))) # noqa 11 | 12 | # TODO: The new version of configs does not support passing a module list, 13 | # so for now, it can only be hard-coded. We will fix this issue in the future. 14 | runner_type = 'FlexibleRunner' 15 | strategy = dict( 16 | type='FSDPStrategy', 17 | activation_checkpointing=dict(check_fn=checkpoint_check_fn), 18 | model_wrapper=dict(auto_wrap_policy=dict(type=layer_auto_wrap_policy))) 19 | -------------------------------------------------------------------------------- /Detection/mmdetection/projects/example_project/configs/faster-rcnn_dummy-resnet_fpn_1x_coco.py: -------------------------------------------------------------------------------- 1 | _base_ = ['../../../configs/faster_rcnn/faster-rcnn_r50_fpn_1x_coco.py'] 2 | 3 | custom_imports = dict(imports=['projects.example_project.dummy']) 4 | 5 | _base_.model.backbone.type = 'DummyResNet' 6 | -------------------------------------------------------------------------------- /Detection/mmdetection/projects/example_project/dummy/__init__.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) OpenMMLab. All rights reserved. 2 | from .dummy_resnet import DummyResNet 3 | 4 | __all__ = ['DummyResNet'] 5 | -------------------------------------------------------------------------------- /Detection/mmdetection/projects/example_project/dummy/dummy_resnet.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) OpenMMLab. All rights reserved. 2 | from mmdet.models.backbones import ResNet 3 | from mmdet.registry import MODELS 4 | 5 | 6 | @MODELS.register_module() 7 | class DummyResNet(ResNet): 8 | """Implements a dummy ResNet wrapper for demonstration purpose. 9 | Args: 10 | **kwargs: All the arguments are passed to the parent class. 11 | """ 12 | 13 | def __init__(self, **kwargs) -> None: 14 | print('Hello world!') 15 | super().__init__(**kwargs) 16 | -------------------------------------------------------------------------------- /Detection/mmdetection/projects/iSAID/configs/mask_rcnn_r50_fpn_1x_isaid.py: -------------------------------------------------------------------------------- 1 | _base_ = [ 2 | '../../../configs/_base_/models/mask-rcnn_r50_fpn.py', 3 | '../../../configs/_base_/datasets/isaid_instance.py', 4 | '../../../configs/_base_/schedules/schedule_1x.py', 5 | '../../../configs/_base_/default_runtime.py' 6 | ] 7 | -------------------------------------------------------------------------------- /Detection/mmdetection/projects/iSAID/isaid_json.py: -------------------------------------------------------------------------------- 1 | import argparse 2 | import json 3 | import os.path as osp 4 | 5 | 6 | def json_convert(path): 7 | with open(path, 'r+') as f: 8 | coco_data = json.load(f) 9 | coco_data['categories'].append({'id': 0, 'name': 'background'}) 10 | coco_data['categories'] = sorted( 11 | coco_data['categories'], key=lambda x: x['id']) 12 | f.seek(0) 13 | json.dump(coco_data, f) 14 | f.truncate() 15 | 16 | 17 | if __name__ == '__main__': 18 | parser = argparse.ArgumentParser( 19 | description='Convert iSAID dataset to mmdetection format') 20 | parser.add_argument('dataset_path', help='iSAID folder path') 21 | 22 | args = parser.parse_args() 23 | dataset_path = args.dataset_path 24 | json_list = ['train', 'val'] 25 | for dataset_mode in ['train', 'val']: 26 | json_file = 'instancesonly_filtered_' + dataset_mode + '.json' 27 | json_file_path = osp.join(dataset_path, dataset_mode, json_file) 28 | assert osp.exists(json_file_path), f'train is not in {dataset_path}' 29 | json_convert(json_file_path) 30 | -------------------------------------------------------------------------------- /Detection/mmdetection/requirements.txt: -------------------------------------------------------------------------------- 1 | -r requirements/build.txt 2 | -r requirements/optional.txt 3 | -r requirements/runtime.txt 4 | -------------------------------------------------------------------------------- /Detection/mmdetection/requirements/albu.txt: -------------------------------------------------------------------------------- 1 | albumentations>=0.3.2 --no-binary qudida,albumentations 2 | -------------------------------------------------------------------------------- /Detection/mmdetection/requirements/build.txt: -------------------------------------------------------------------------------- 1 | # These must be installed before building mmdetection 2 | cython 3 | numpy 4 | -------------------------------------------------------------------------------- /Detection/mmdetection/requirements/docs.txt: -------------------------------------------------------------------------------- 1 | docutils==0.16.0 2 | myst-parser 3 | -e git+https://github.com/open-mmlab/pytorch_sphinx_theme.git#egg=pytorch_sphinx_theme 4 | sphinx==4.0.2 5 | sphinx-copybutton 6 | sphinx_markdown_tables 7 | sphinx_rtd_theme==0.5.2 8 | urllib3<2.0.0 9 | -------------------------------------------------------------------------------- /Detection/mmdetection/requirements/mminstall.txt: -------------------------------------------------------------------------------- 1 | mmcv>=2.0.0rc4,<2.2.0 2 | mmengine>=0.7.1,<1.0.0 3 | -------------------------------------------------------------------------------- /Detection/mmdetection/requirements/multimodal.txt: -------------------------------------------------------------------------------- 1 | fairscale 2 | jsonlines 3 | nltk 4 | pycocoevalcap 5 | transformers 6 | -------------------------------------------------------------------------------- /Detection/mmdetection/requirements/optional.txt: -------------------------------------------------------------------------------- 1 | cityscapesscripts 2 | emoji 3 | fairscale 4 | imagecorruptions 5 | scikit-learn 6 | -------------------------------------------------------------------------------- /Detection/mmdetection/requirements/readthedocs.txt: -------------------------------------------------------------------------------- 1 | mmcv>=2.0.0rc4,<2.2.0 2 | mmengine>=0.7.1,<1.0.0 3 | scipy 4 | torch 5 | torchvision 6 | urllib3<2.0.0 7 | -------------------------------------------------------------------------------- /Detection/mmdetection/requirements/runtime.txt: -------------------------------------------------------------------------------- 1 | matplotlib 2 | numpy 3 | pycocotools 4 | scipy 5 | shapely 6 | six 7 | terminaltables 8 | tqdm 9 | -------------------------------------------------------------------------------- /Detection/mmdetection/requirements/tests.txt: -------------------------------------------------------------------------------- 1 | asynctest 2 | cityscapesscripts 3 | codecov 4 | flake8 5 | imagecorruptions 6 | instaboostfast 7 | interrogate 8 | isort==4.3.21 9 | # Note: used for kwarray.group_items, this may be ported to mmcv in the future. 10 | kwarray 11 | memory_profiler 12 | -e git+https://github.com/open-mmlab/mmtracking@dev-1.x#egg=mmtrack 13 | nltk 14 | onnx==1.7.0 15 | onnxruntime>=1.8.0 16 | parameterized 17 | prettytable 18 | protobuf<=3.20.1 19 | psutil 20 | pytest 21 | transformers 22 | ubelt 23 | xdoctest>=0.10.0 24 | yapf 25 | -------------------------------------------------------------------------------- /Detection/mmdetection/requirements/tracking.txt: -------------------------------------------------------------------------------- 1 | mmpretrain 2 | motmetrics 3 | numpy<1.24.0 4 | scikit-learn 5 | seaborn 6 | -------------------------------------------------------------------------------- /Detection/mmdetection/resources/coco_test_12510.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wangguanan/DenoiseRep/14cfbf0706510710a9e5eab3bffb694ac58be00f/Detection/mmdetection/resources/coco_test_12510.jpg -------------------------------------------------------------------------------- /Detection/mmdetection/resources/corruptions_sev_3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wangguanan/DenoiseRep/14cfbf0706510710a9e5eab3bffb694ac58be00f/Detection/mmdetection/resources/corruptions_sev_3.png -------------------------------------------------------------------------------- /Detection/mmdetection/resources/data_pipeline.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wangguanan/DenoiseRep/14cfbf0706510710a9e5eab3bffb694ac58be00f/Detection/mmdetection/resources/data_pipeline.png -------------------------------------------------------------------------------- /Detection/mmdetection/resources/loss_curve.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wangguanan/DenoiseRep/14cfbf0706510710a9e5eab3bffb694ac58be00f/Detection/mmdetection/resources/loss_curve.png -------------------------------------------------------------------------------- /Detection/mmdetection/resources/miaomiao_qrcode.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wangguanan/DenoiseRep/14cfbf0706510710a9e5eab3bffb694ac58be00f/Detection/mmdetection/resources/miaomiao_qrcode.jpg -------------------------------------------------------------------------------- /Detection/mmdetection/resources/mmdet-logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wangguanan/DenoiseRep/14cfbf0706510710a9e5eab3bffb694ac58be00f/Detection/mmdetection/resources/mmdet-logo.png -------------------------------------------------------------------------------- /Detection/mmdetection/resources/zhihu_qrcode.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wangguanan/DenoiseRep/14cfbf0706510710a9e5eab3bffb694ac58be00f/Detection/mmdetection/resources/zhihu_qrcode.jpg -------------------------------------------------------------------------------- /Detection/mmdetection/setup.cfg: -------------------------------------------------------------------------------- 1 | [isort] 2 | line_length = 79 3 | multi_line_output = 0 4 | extra_standard_library = setuptools 5 | known_first_party = mmdet 6 | known_third_party = PIL,asynctest,cityscapesscripts,cv2,gather_models,matplotlib,mmcv,mmengine,numpy,onnx,onnxruntime,pycocotools,parameterized,pytest,pytorch_sphinx_theme,requests,scipy,seaborn,six,terminaltables,torch,ts,yaml 7 | no_lines_before = STDLIB,LOCALFOLDER 8 | default_section = THIRDPARTY 9 | 10 | [yapf] 11 | BASED_ON_STYLE = pep8 12 | BLANK_LINE_BEFORE_NESTED_CLASS_OR_DEF = true 13 | SPLIT_BEFORE_EXPRESSION_AFTER_OPENING_PAREN = true 14 | 15 | # ignore-words-list needs to be lowercase format. For example, if we want to 16 | # ignore word "BA", then we need to append "ba" to ignore-words-list rather 17 | # than "BA" 18 | [codespell] 19 | skip = *.ipynb,configs/v3det/category_name_13204_v3det_2023_v1.txt 20 | quiet-level = 3 21 | ignore-words-list = patten,nd,ty,mot,hist,formating,winn,gool,datas,wan,confids,TOOD,tood,ba,warmup,nam,DOTA,dota,conveyer,singed,comittee,extention,moniter,pres, 22 | 23 | [flake8] 24 | per-file-ignores = mmdet/configs/*: F401,F403,F405 25 | -------------------------------------------------------------------------------- /Detection/mmdetection/tests/data/OpenImages/annotations/annotations-human-imagelabels-boxable.csv: -------------------------------------------------------------------------------- 1 | ImageID,Source,LabelName,Confidence 2 | 0001eeaf4aed83f9,verification,/m/0cmf2,1 3 | -------------------------------------------------------------------------------- /Detection/mmdetection/tests/data/OpenImages/annotations/bbox_labels_600_hierarchy.json: -------------------------------------------------------------------------------- 1 | { 2 | "LabelName": "/m/0bl9f", 3 | "Subcategory": [ 4 | { 5 | "LabelName": "/m/0cmf2" 6 | } 7 | ] 8 | } 9 | -------------------------------------------------------------------------------- /Detection/mmdetection/tests/data/OpenImages/annotations/class-descriptions-boxable.csv: -------------------------------------------------------------------------------- 1 | /m/0cmf2,Airplane 2 | -------------------------------------------------------------------------------- /Detection/mmdetection/tests/data/OpenImages/annotations/image-metas.pkl: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wangguanan/DenoiseRep/14cfbf0706510710a9e5eab3bffb694ac58be00f/Detection/mmdetection/tests/data/OpenImages/annotations/image-metas.pkl -------------------------------------------------------------------------------- /Detection/mmdetection/tests/data/OpenImages/annotations/oidv6-train-annotations-bbox.csv: -------------------------------------------------------------------------------- 1 | ImageID,Source,LabelName,Confidence,XMin,XMax,YMin,YMax,IsOccluded,IsTruncated,IsGroupOf,IsDepiction,IsInside 2 | 0001eeaf4aed83f9,xclick,/m/0cmf2,1,0.022673031,0.9642005,0.07103825,0.80054647,0,0,0,0,0 3 | -------------------------------------------------------------------------------- /Detection/mmdetection/tests/data/OpenImages/challenge2019/annotations-human-imagelabels-boxable.csv: -------------------------------------------------------------------------------- 1 | ImageID,Source,LabelName,Confidence 2 | 0001eeaf4aed83f9,verification,/m/0cmf2,1 3 | -------------------------------------------------------------------------------- /Detection/mmdetection/tests/data/OpenImages/challenge2019/challenge-2019-train-detection-bbox.txt: -------------------------------------------------------------------------------- 1 | validation/0001eeaf4aed83f9.jpg 2 | -1 3 | 1 4 | 86 0.022673031 0.07103825 0.9642004999999999 0.80054647 0 5 | -------------------------------------------------------------------------------- /Detection/mmdetection/tests/data/OpenImages/challenge2019/class_label_tree.np: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wangguanan/DenoiseRep/14cfbf0706510710a9e5eab3bffb694ac58be00f/Detection/mmdetection/tests/data/OpenImages/challenge2019/class_label_tree.np -------------------------------------------------------------------------------- /Detection/mmdetection/tests/data/OpenImages/challenge2019/cls-label-description.csv: -------------------------------------------------------------------------------- 1 | /m/0cmf2,Airplane,86 2 | -------------------------------------------------------------------------------- /Detection/mmdetection/tests/data/VOCdevkit/VOC2007/Annotations/000001.xml: -------------------------------------------------------------------------------- 1 | 2 | VOC2007 3 | 000001.jpg 4 | 5 | The VOC2007 Database 6 | PASCAL VOC2007 7 | flickr 8 | 341012865 9 | 10 | 11 | Fried Camels 12 | Jinky the Fruit Bat 13 | 14 | 15 | 353 16 | 500 17 | 3 18 | 19 | 0 20 | 21 | dog 22 | Left 23 | 1 24 | 0 25 | 26 | 48 27 | 240 28 | 195 29 | 371 30 | 31 | 32 | 33 | person 34 | Left 35 | 1 36 | 0 37 | 38 | 8 39 | 12 40 | 352 41 | 498 42 | 43 | 44 | 45 | -------------------------------------------------------------------------------- /Detection/mmdetection/tests/data/VOCdevkit/VOC2007/ImageSets/Main/test.txt: -------------------------------------------------------------------------------- 1 | 000001 2 | -------------------------------------------------------------------------------- /Detection/mmdetection/tests/data/VOCdevkit/VOC2007/ImageSets/Main/trainval.txt: -------------------------------------------------------------------------------- 1 | 000001 2 | -------------------------------------------------------------------------------- /Detection/mmdetection/tests/data/VOCdevkit/VOC2007/JPEGImages/000001.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wangguanan/DenoiseRep/14cfbf0706510710a9e5eab3bffb694ac58be00f/Detection/mmdetection/tests/data/VOCdevkit/VOC2007/JPEGImages/000001.jpg -------------------------------------------------------------------------------- /Detection/mmdetection/tests/data/VOCdevkit/VOC2012/Annotations/000001.xml: -------------------------------------------------------------------------------- 1 | 2 | VOC2007 3 | 000002.jpg 4 | 5 | The VOC2007 Database 6 | PASCAL VOC2007 7 | flickr 8 | 329145082 9 | 10 | 11 | hiromori2 12 | Hiroyuki Mori 13 | 14 | 15 | 335 16 | 500 17 | 3 18 | 19 | 0 20 | 21 | train 22 | Unspecified 23 | 0 24 | 0 25 | 26 | 139 27 | 200 28 | 207 29 | 301 30 | 31 | 32 | 33 | -------------------------------------------------------------------------------- /Detection/mmdetection/tests/data/VOCdevkit/VOC2012/ImageSets/Main/test.txt: -------------------------------------------------------------------------------- 1 | 000001 2 | -------------------------------------------------------------------------------- /Detection/mmdetection/tests/data/VOCdevkit/VOC2012/ImageSets/Main/trainval.txt: -------------------------------------------------------------------------------- 1 | 000001 2 | -------------------------------------------------------------------------------- /Detection/mmdetection/tests/data/VOCdevkit/VOC2012/JPEGImages/000001.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wangguanan/DenoiseRep/14cfbf0706510710a9e5eab3bffb694ac58be00f/Detection/mmdetection/tests/data/VOCdevkit/VOC2012/JPEGImages/000001.jpg -------------------------------------------------------------------------------- /Detection/mmdetection/tests/data/WIDERFace/WIDER_train/0--Parade/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wangguanan/DenoiseRep/14cfbf0706510710a9e5eab3bffb694ac58be00f/Detection/mmdetection/tests/data/WIDERFace/WIDER_train/0--Parade/.gitkeep -------------------------------------------------------------------------------- /Detection/mmdetection/tests/data/WIDERFace/train.txt: -------------------------------------------------------------------------------- 1 | 0_Parade_marchingband_1_5 2 | -------------------------------------------------------------------------------- /Detection/mmdetection/tests/data/coco_wrong_format_sample.json: -------------------------------------------------------------------------------- 1 | { 2 | "images": [ 3 | { 4 | "file_name": "fake1.jpg", 5 | "height": 800, 6 | "width": 800, 7 | "id": 0 8 | } 9 | ], 10 | "annotations": [ 11 | { 12 | "bbox": [ 13 | 0, 14 | 0, 15 | 20, 16 | 20 17 | ], 18 | "area": 400.00, 19 | "score": 1.0, 20 | "category_id": 1, 21 | "id": 1, 22 | "image_id": 0 23 | }, 24 | { 25 | "bbox": [ 26 | 0, 27 | 0, 28 | 20, 29 | 20 30 | ], 31 | "area": 400.00, 32 | "score": 1.0, 33 | "category_id": 1, 34 | "id": 1, 35 | "image_id": 0 36 | } 37 | ], 38 | "categories": [ 39 | { 40 | "id": 1, 41 | "name": "car", 42 | "supercategory": "none" 43 | } 44 | ], 45 | "licenses": [], 46 | "info": null 47 | } 48 | -------------------------------------------------------------------------------- /Detection/mmdetection/tests/data/color.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wangguanan/DenoiseRep/14cfbf0706510710a9e5eab3bffb694ac58be00f/Detection/mmdetection/tests/data/color.jpg -------------------------------------------------------------------------------- /Detection/mmdetection/tests/data/crowdhuman_dataset/id_hw_train.json: -------------------------------------------------------------------------------- 1 | { 2 | "283554,35288000868e92d4": [ 3 | 1356, 4 | 2048 5 | ] 6 | } 7 | -------------------------------------------------------------------------------- /Detection/mmdetection/tests/data/custom_dataset/images/000001.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wangguanan/DenoiseRep/14cfbf0706510710a9e5eab3bffb694ac58be00f/Detection/mmdetection/tests/data/custom_dataset/images/000001.jpg -------------------------------------------------------------------------------- /Detection/mmdetection/tests/data/custom_dataset/images/000001.xml: -------------------------------------------------------------------------------- 1 | 2 | VOC2007 3 | 000001.jpg 4 | 5 | The VOC2007 Database 6 | PASCAL VOC2007 7 | flickr 8 | 341012865 9 | 10 | 11 | Fried Camels 12 | Jinky the Fruit Bat 13 | 14 | 15 | 353 16 | 500 17 | 3 18 | 19 | 0 20 | 21 | dog 22 | Left 23 | 1 24 | 0 25 | 26 | 48 27 | 240 28 | 195 29 | 371 30 | 31 | 32 | 33 | person 34 | Left 35 | 1 36 | 0 37 | 38 | 8 39 | 12 40 | 352 41 | 498 42 | 43 | 44 | 45 | -------------------------------------------------------------------------------- /Detection/mmdetection/tests/data/custom_dataset/test.txt: -------------------------------------------------------------------------------- 1 | 000001 2 | -------------------------------------------------------------------------------- /Detection/mmdetection/tests/data/custom_dataset/trainval.txt: -------------------------------------------------------------------------------- 1 | 000001 2 | -------------------------------------------------------------------------------- /Detection/mmdetection/tests/data/dsdl_det/config.py: -------------------------------------------------------------------------------- 1 | local = dict( 2 | type='LocalFileReader', 3 | working_dir='local path', 4 | ) 5 | -------------------------------------------------------------------------------- /Detection/mmdetection/tests/data/dsdl_det/defs/obejct-detection-def.yaml: -------------------------------------------------------------------------------- 1 | $dsdl-version: "0.5.0" 2 | ObjectDetectionSample: 3 | $def: struct 4 | $params: ["cdom"] 5 | $fields: 6 | media: ImageMedia 7 | annotations: List[LocalObjectEntry[cdom=$cdom]] 8 | ImageMedia: 9 | $def: struct 10 | $fields: 11 | media_path: Image 12 | media_shape: ImageShape 13 | date_captured: Str 14 | id: Int 15 | license: Int 16 | flickr_url: Str 17 | coco_url: Str 18 | $optional: ["flickr_url"] 19 | LocalObjectEntry: 20 | $def: struct 21 | $params: ["cdom"] 22 | $fields: 23 | category_id: Label[dom=$cdom] 24 | bbox: BBox 25 | image_id: Int 26 | id: Int 27 | segmentation: Polygon 28 | area: Num 29 | iscrowd: Bool 30 | -------------------------------------------------------------------------------- /Detection/mmdetection/tests/data/gray.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wangguanan/DenoiseRep/14cfbf0706510710a9e5eab3bffb694ac58be00f/Detection/mmdetection/tests/data/gray.jpg -------------------------------------------------------------------------------- /Detection/mmdetection/tests/test_datasets/test_crowdhuman.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) OpenMMLab. All rights reserved. 2 | import unittest 3 | 4 | from mmdet.datasets import CrowdHumanDataset 5 | 6 | 7 | class TestCrowdHumanDataset(unittest.TestCase): 8 | 9 | def test_crowdhuman_init(self): 10 | dataset = CrowdHumanDataset( 11 | data_root='tests/data/crowdhuman_dataset/', 12 | ann_file='test_annotation_train.odgt', 13 | data_prefix=dict(img='Images/'), 14 | pipeline=[]) 15 | self.assertEqual(len(dataset), 1) 16 | self.assertEqual(dataset.metainfo['classes'], ('person', )) 17 | -------------------------------------------------------------------------------- /Detection/mmdetection/tests/test_datasets/test_dsdldet.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) OpenMMLab. All rights reserved. 2 | import unittest 3 | 4 | from mmdet.datasets import DSDLDetDataset 5 | 6 | try: 7 | from dsdl.dataset import DSDLDataset 8 | except ImportError: 9 | DSDLDataset = None 10 | 11 | 12 | class TestDSDLDetDataset(unittest.TestCase): 13 | 14 | def test_dsdldet_init(self): 15 | if DSDLDataset is not None: 16 | dataset = DSDLDetDataset( 17 | data_root='tests/data/dsdl_det', 18 | ann_file='set-train/train.yaml') 19 | dataset.full_init() 20 | 21 | self.assertEqual(len(dataset), 2) 22 | self.assertEqual(len(dataset[0]['instances']), 4) 23 | self.assertEqual(dataset.get_cat_ids(0), [3, 0, 0, 1]) 24 | else: 25 | ImportWarning('Package `dsdl` is not installed.') 26 | -------------------------------------------------------------------------------- /Detection/mmdetection/tests/test_datasets/test_transforms/__init__.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) OpenMMLab. All rights reserved. 2 | from .utils import construct_toy_data, create_full_masks, create_random_bboxes 3 | 4 | __all__ = ['create_random_bboxes', 'create_full_masks', 'construct_toy_data'] 5 | -------------------------------------------------------------------------------- /Detection/mmdetection/tests/test_datasets/test_wider_face.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) OpenMMLab. All rights reserved. 2 | import unittest 3 | 4 | import cv2 5 | import numpy as np 6 | 7 | from mmdet.datasets import WIDERFaceDataset 8 | 9 | 10 | class TestWIDERFaceDataset(unittest.TestCase): 11 | 12 | def setUp(self) -> None: 13 | img_path = 'tests/data/WIDERFace/WIDER_train/0--Parade/0_Parade_marchingband_1_5.jpg' # noqa: E501 14 | dummy_img = np.zeros((683, 1024, 3), dtype=np.uint8) 15 | cv2.imwrite(img_path, dummy_img) 16 | 17 | def test_wider_face_dataset(self): 18 | dataset = WIDERFaceDataset( 19 | data_root='tests/data/WIDERFace', 20 | ann_file='train.txt', 21 | data_prefix=dict(img='WIDER_train'), 22 | pipeline=[]) 23 | dataset.full_init() 24 | self.assertEqual(len(dataset), 1) 25 | 26 | data_list = dataset.load_data_list() 27 | self.assertEqual(len(data_list), 1) 28 | self.assertEqual(len(data_list[0]['instances']), 10) 29 | -------------------------------------------------------------------------------- /Detection/mmdetection/tests/test_datasets/test_youtube_vis_dataset.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) OpenMMLab. All rights reserved. 2 | from unittest import TestCase 3 | 4 | from mmdet.datasets import YouTubeVISDataset 5 | 6 | 7 | class TestYouTubeVISDataset(TestCase): 8 | 9 | @classmethod 10 | def setUpClass(cls): 11 | 12 | cls.dataset = YouTubeVISDataset( 13 | ann_file='tests/data/vis_sample.json', dataset_version='2019') 14 | 15 | def test_set_dataset_classes(self): 16 | assert isinstance(self.dataset.metainfo, dict) 17 | assert len(self.dataset.metainfo['classes']) == 40 18 | -------------------------------------------------------------------------------- /Detection/mmdetection/tests/test_engine/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wangguanan/DenoiseRep/14cfbf0706510710a9e5eab3bffb694ac58be00f/Detection/mmdetection/tests/test_engine/__init__.py -------------------------------------------------------------------------------- /Detection/mmdetection/tests/test_engine/test_optimizers/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wangguanan/DenoiseRep/14cfbf0706510710a9e5eab3bffb694ac58be00f/Detection/mmdetection/tests/test_engine/test_optimizers/__init__.py -------------------------------------------------------------------------------- /Detection/mmdetection/tests/test_evaluation/test_metrics/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wangguanan/DenoiseRep/14cfbf0706510710a9e5eab3bffb694ac58be00f/Detection/mmdetection/tests/test_evaluation/test_metrics/__init__.py -------------------------------------------------------------------------------- /Detection/mmdetection/tests/test_models/test_backbones/__init__.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) OpenMMLab. All rights reserved. 2 | from .utils import check_norm_state, is_block, is_norm 3 | 4 | __all__ = ['is_block', 'is_norm', 'check_norm_state'] 5 | -------------------------------------------------------------------------------- /Detection/mmdetection/tests/test_models/test_backbones/test_efficientnet.py: -------------------------------------------------------------------------------- 1 | import pytest 2 | import torch 3 | 4 | from mmdet.models.backbones import EfficientNet 5 | 6 | 7 | def test_efficientnet_backbone(): 8 | """Test EfficientNet backbone.""" 9 | with pytest.raises(AssertionError): 10 | # EfficientNet arch should be a key in EfficientNet.arch_settings 11 | EfficientNet(arch='c3') 12 | 13 | model = EfficientNet(arch='b0', out_indices=(0, 1, 2, 3, 4, 5, 6)) 14 | model.train() 15 | 16 | imgs = torch.randn(2, 3, 32, 32) 17 | feat = model(imgs) 18 | assert len(feat) == 7 19 | assert feat[0].shape == torch.Size([2, 32, 16, 16]) 20 | assert feat[1].shape == torch.Size([2, 16, 16, 16]) 21 | assert feat[2].shape == torch.Size([2, 24, 8, 8]) 22 | assert feat[3].shape == torch.Size([2, 40, 4, 4]) 23 | assert feat[4].shape == torch.Size([2, 112, 2, 2]) 24 | assert feat[5].shape == torch.Size([2, 320, 1, 1]) 25 | assert feat[6].shape == torch.Size([2, 1280, 1, 1]) 26 | -------------------------------------------------------------------------------- /Detection/mmdetection/tests/test_models/test_layers/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wangguanan/DenoiseRep/14cfbf0706510710a9e5eab3bffb694ac58be00f/Detection/mmdetection/tests/test_models/test_layers/__init__.py -------------------------------------------------------------------------------- /Detection/mmdetection/tests/test_models/test_layers/test_conv_upsample.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) OpenMMLab. All rights reserved. 2 | import pytest 3 | import torch 4 | 5 | from mmdet.models.layers import ConvUpsample 6 | 7 | 8 | @pytest.mark.parametrize('num_layers', [0, 1, 2]) 9 | def test_conv_upsample(num_layers): 10 | num_upsample = num_layers if num_layers > 0 else 0 11 | num_layers = num_layers if num_layers > 0 else 1 12 | layer = ConvUpsample( 13 | 10, 14 | 5, 15 | num_layers=num_layers, 16 | num_upsample=num_upsample, 17 | conv_cfg=None, 18 | norm_cfg=None) 19 | 20 | size = 5 21 | x = torch.randn((1, 10, size, size)) 22 | size = size * pow(2, num_upsample) 23 | x = layer(x) 24 | assert x.shape[-2:] == (size, size) 25 | -------------------------------------------------------------------------------- /Detection/mmdetection/tests/test_models/test_losses/test_l2_loss.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) OpenMMLab. All rights reserved. 2 | from unittest import TestCase 3 | 4 | import torch 5 | 6 | from mmdet.models import L2Loss 7 | 8 | 9 | class TestL2Loss(TestCase): 10 | 11 | def test_l2_loss(self): 12 | pred = torch.Tensor([[1, 1, 0, 0, 0, 0, 1]]) 13 | target = torch.Tensor([[1, 1, 0, 0, 0, 0, 0]]) 14 | 15 | loss = L2Loss( 16 | neg_pos_ub=2, 17 | pos_margin=0, 18 | neg_margin=0.1, 19 | hard_mining=True, 20 | loss_weight=1.0) 21 | assert torch.allclose(loss(pred, target), torch.tensor(0.1350)) 22 | -------------------------------------------------------------------------------- /Detection/mmdetection/tests/test_models/test_losses/test_multi_pos_cross_entropy_loss.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) OpenMMLab. All rights reserved. 2 | from unittest import TestCase 3 | 4 | import torch 5 | 6 | from mmdet.models.losses import MultiPosCrossEntropyLoss 7 | 8 | 9 | class TestMultiPosCrossEntropyLoss(TestCase): 10 | 11 | def test_mpce_loss(self): 12 | costs = torch.tensor([[1, 0], [0, 1]]) 13 | labels = torch.tensor([[1, 1], [0, 0]]) 14 | 15 | loss = MultiPosCrossEntropyLoss(reduction='mean', loss_weight=1.0) 16 | assert torch.allclose(loss(costs, labels), torch.tensor(0.)) 17 | 18 | labels = torch.Tensor([[1, 0], [0, 1]]) 19 | loss(costs, labels) 20 | assert torch.allclose(loss(costs, labels), torch.tensor(0.31326)) 21 | -------------------------------------------------------------------------------- /Detection/mmdetection/tests/test_models/test_losses/test_triplet_loss.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) OpenMMLab. All rights reserved. 2 | from unittest import TestCase 3 | 4 | import torch 5 | 6 | from mmdet.models import TripletLoss 7 | 8 | 9 | class TestTripletLoss(TestCase): 10 | 11 | def test_triplet_loss(self): 12 | feature = torch.Tensor([[1, 1], [1, 1], [0, 0], [0, 0]]) 13 | label = torch.Tensor([1, 1, 0, 0]) 14 | 15 | loss = TripletLoss(margin=0.3, loss_weight=1.0) 16 | assert torch.allclose(loss(feature, label), torch.tensor(0.)) 17 | 18 | label = torch.Tensor([1, 0, 1, 0]) 19 | assert torch.allclose(loss(feature, label), torch.tensor(1.7142)) 20 | -------------------------------------------------------------------------------- /Detection/mmdetection/tests/test_models/test_reid/test_fc_module.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) OpenMMLab. All rights reserved. 2 | from unittest import TestCase 3 | 4 | import torch 5 | 6 | from mmdet.models import FcModule 7 | 8 | 9 | class TestFcModule(TestCase): 10 | 11 | def test_forward(self): 12 | inputs = torch.rand(32, 128) 13 | 14 | # test 15 | fc = FcModule( 16 | in_channels=128, 17 | out_channels=32, 18 | ) 19 | fc.init_weights() 20 | outputs = fc(inputs) 21 | assert outputs.shape == (32, 32) 22 | 23 | # test with norm 24 | fc = FcModule( 25 | in_channels=128, 26 | out_channels=32, 27 | norm_cfg=dict(type='BN1d'), 28 | ) 29 | outputs = fc(inputs) 30 | assert outputs.shape == (32, 32) 31 | 32 | # test with norm and act 33 | fc = FcModule( 34 | in_channels=128, 35 | out_channels=32, 36 | norm_cfg=dict(type='BN1d'), 37 | act_cfg=dict(type='ReLU'), 38 | ) 39 | outputs = fc(inputs) 40 | assert outputs.shape == (32, 32) 41 | -------------------------------------------------------------------------------- /Detection/mmdetection/tests/test_models/test_reid/test_gap.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) OpenMMLab. All rights reserved. 2 | from unittest import TestCase 3 | 4 | import torch 5 | 6 | from mmdet.models import GlobalAveragePooling 7 | 8 | 9 | class TestGlobalAveragePooling(TestCase): 10 | 11 | def test_forward(self): 12 | inputs = torch.rand(32, 128, 14, 14) 13 | 14 | # test AdaptiveAvgPool2d 15 | neck = GlobalAveragePooling() 16 | outputs = neck(inputs) 17 | assert outputs.shape == (32, 128) 18 | 19 | # test kernel_size 20 | neck = GlobalAveragePooling(kernel_size=7) 21 | outputs = neck(inputs) 22 | assert outputs.shape == (32, 128 * 2 * 2) 23 | 24 | # test kenel_size and stride 25 | neck = GlobalAveragePooling(kernel_size=7, stride=2) 26 | outputs = neck(inputs) 27 | assert outputs.shape == (32, 128 * 4 * 4) 28 | -------------------------------------------------------------------------------- /Detection/mmdetection/tests/test_models/test_roi_heads/test_bbox_heads/test_double_bbox_head.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) OpenMMLab. All rights reserved. 2 | import unittest 3 | from unittest import TestCase 4 | 5 | import torch 6 | from parameterized import parameterized 7 | 8 | from mmdet.models.roi_heads.bbox_heads import DoubleConvFCBBoxHead 9 | 10 | 11 | class TestDoubleBboxHead(TestCase): 12 | 13 | @parameterized.expand(['cpu', 'cuda']) 14 | def test_forward_loss(self, device): 15 | if device == 'cuda': 16 | if not torch.cuda.is_available(): 17 | return unittest.skip('test requires GPU and torch+cuda') 18 | 19 | double_bbox_head = DoubleConvFCBBoxHead( 20 | num_convs=4, 21 | num_fcs=2, 22 | in_channels=1, 23 | conv_out_channels=4, 24 | fc_out_channels=4) 25 | double_bbox_head = double_bbox_head.to(device=device) 26 | 27 | num_samples = 4 28 | feats = torch.rand((num_samples, 1, 7, 7)).to(device) 29 | double_bbox_head(x_cls=feats, x_reg=feats) 30 | -------------------------------------------------------------------------------- /Detection/mmdetection/tests/test_models/test_roi_heads/test_bbox_heads/test_scnet_bbox_head.py: -------------------------------------------------------------------------------- 1 | import unittest 2 | 3 | import torch 4 | 5 | from mmdet.models.roi_heads.bbox_heads import SCNetBBoxHead 6 | 7 | 8 | class TestSCNetBBoxHead(unittest.TestCase): 9 | 10 | def test_forward(self): 11 | x = torch.rand((2, 1, 16, 16)) 12 | bbox_head = SCNetBBoxHead( 13 | num_shared_fcs=2, 14 | in_channels=1, 15 | roi_feat_size=16, 16 | conv_out_channels=1, 17 | fc_out_channels=256, 18 | ) 19 | results = bbox_head(x, return_shared_feat=False) 20 | self.assertEqual(len(results), 2) 21 | results = bbox_head(x, return_shared_feat=True) 22 | self.assertEqual(len(results), 3) 23 | -------------------------------------------------------------------------------- /Detection/mmdetection/tests/test_models/test_roi_heads/test_mask_heads/test_feature_relay_head.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) OpenMMLab. All rights reserved. 2 | import unittest 3 | from unittest import TestCase 4 | 5 | import torch 6 | from parameterized import parameterized 7 | from torch import Tensor 8 | 9 | from mmdet.models.roi_heads.mask_heads import FeatureRelayHead 10 | 11 | 12 | class TestFeatureRelayHead(TestCase): 13 | 14 | @parameterized.expand(['cpu', 'cuda']) 15 | def test_forward(self, device): 16 | if device == 'cuda': 17 | if not torch.cuda.is_available(): 18 | return unittest.skip('test requires GPU and torch+cuda') 19 | mask_head = FeatureRelayHead(in_channels=10, out_conv_channels=10) 20 | 21 | x = torch.rand((1, 10)) 22 | results = mask_head(x) 23 | self.assertIsInstance(results, Tensor) 24 | x = torch.empty((0, 10)) 25 | results = mask_head(x) 26 | self.assertEqual(results, None) 27 | -------------------------------------------------------------------------------- /Detection/mmdetection/tests/test_models/test_roi_heads/test_mask_heads/test_global_context_head.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) OpenMMLab. All rights reserved. 2 | import unittest 3 | from unittest import TestCase 4 | 5 | import torch 6 | from parameterized import parameterized 7 | from torch import Tensor 8 | 9 | from mmdet.models.roi_heads.mask_heads import GlobalContextHead 10 | 11 | 12 | class TestGlobalContextHead(TestCase): 13 | 14 | @parameterized.expand(['cpu', 'cuda']) 15 | def test_forward_loss(self, device): 16 | if device == 'cuda': 17 | if not torch.cuda.is_available(): 18 | return unittest.skip('test requires GPU and torch+cuda') 19 | 20 | head = GlobalContextHead( 21 | num_convs=1, in_channels=4, conv_out_channels=4, num_classes=10) 22 | feats = [ 23 | torch.rand((1, 4, 64 // 2**(i + 1), 64 // 2**(i + 1))) 24 | for i in range(5) 25 | ] 26 | mc_pred, x = head(feats) 27 | 28 | labels = [torch.randint(0, 10, (10, ))] 29 | loss = head.loss(mc_pred, labels) 30 | self.assertIsInstance(loss, Tensor) 31 | -------------------------------------------------------------------------------- /Detection/mmdetection/tests/test_models/test_roi_heads/test_mask_heads/test_scnet_mask_head.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) OpenMMLab. All rights reserved. 2 | import unittest 3 | from unittest import TestCase 4 | 5 | import torch 6 | from parameterized import parameterized 7 | from torch import Tensor 8 | 9 | from mmdet.models.roi_heads.mask_heads import SCNetMaskHead 10 | 11 | 12 | class TestSCNetMaskHead(TestCase): 13 | 14 | @parameterized.expand(['cpu', 'cuda']) 15 | def test_forward(self, device): 16 | if device == 'cuda': 17 | if not torch.cuda.is_available(): 18 | return unittest.skip('test requires GPU and torch+cuda') 19 | num_classes = 6 20 | mask_head = SCNetMaskHead( 21 | conv_to_res=True, 22 | num_convs=1, 23 | in_channels=1, 24 | conv_out_channels=1, 25 | num_classes=num_classes) 26 | 27 | x = torch.rand((1, 1, 10, 10)) 28 | results = mask_head(x) 29 | self.assertIsInstance(results, Tensor) 30 | -------------------------------------------------------------------------------- /Detection/mmdetection/tests/test_models/test_task_modules/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wangguanan/DenoiseRep/14cfbf0706510710a9e5eab3bffb694ac58be00f/Detection/mmdetection/tests/test_models/test_task_modules/__init__.py -------------------------------------------------------------------------------- /Detection/mmdetection/tests/test_models/test_task_modules/test_samplers/test_pesudo_sampler.py: -------------------------------------------------------------------------------- 1 | # TODO: follow up 2 | -------------------------------------------------------------------------------- /Detection/mmdetection/tests/test_models/test_task_modules/test_track/test_similarity.py: -------------------------------------------------------------------------------- 1 | import torch 2 | 3 | from mmdet.models.task_modules import embed_similarity 4 | 5 | 6 | def test_embed_similarity(): 7 | """Test embed similarity.""" 8 | embeds = torch.rand(2, 3) 9 | similarity = embed_similarity(embeds, embeds) 10 | assert similarity.shape == (2, 2) 11 | -------------------------------------------------------------------------------- /Detection/mmdetection/tests/test_structures/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wangguanan/DenoiseRep/14cfbf0706510710a9e5eab3bffb694ac58be00f/Detection/mmdetection/tests/test_structures/__init__.py -------------------------------------------------------------------------------- /Detection/mmdetection/tests/test_structures/test_bbox/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wangguanan/DenoiseRep/14cfbf0706510710a9e5eab3bffb694ac58be00f/Detection/mmdetection/tests/test_structures/test_bbox/__init__.py -------------------------------------------------------------------------------- /Detection/mmdetection/tools/analysis_tools/mot/dist_mot_search.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | CONFIG=$1 4 | GPUS=$2 5 | PORT=${PORT:-29500} 6 | 7 | PYTHONPATH="$(dirname $0)/..":$PYTHONPATH \ 8 | python -m torch.distributed.launch --nproc_per_node=$GPUS --master_port=$PORT \ 9 | $(dirname "$0")/mot_param_search.py $CONFIG --launcher pytorch ${@:3} 10 | -------------------------------------------------------------------------------- /Detection/mmdetection/tools/analysis_tools/mot/slurm_mot_search.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | set -x 4 | 5 | PARTITION=$1 6 | JOB_NAME=$2 7 | CONFIG=$3 8 | GPUS=$4 9 | GPUS_PER_NODE=${GPUS_PER_NODE:-8} 10 | CPUS_PER_TASK=${CPUS_PER_TASK:-2} 11 | PY_ARGS=${@:5} 12 | SRUN_ARGS=${SRUN_ARGS:-""} 13 | 14 | PYTHONPATH="$(dirname $0)/..":$PYTHONPATH \ 15 | srun -p ${PARTITION} \ 16 | --job-name=${JOB_NAME} \ 17 | --gres=gpu:${GPUS_PER_NODE} \ 18 | --ntasks=${GPUS} \ 19 | --ntasks-per-node=${GPUS_PER_NODE} \ 20 | --cpus-per-task=${CPUS_PER_TASK} \ 21 | --kill-on-bad-exit=1 \ 22 | ${SRUN_ARGS} \ 23 | python -u $(dirname "$0")/mot_param_search.py ${CONFIG} --launcher="slurm" ${PY_ARGS} 24 | -------------------------------------------------------------------------------- /Detection/mmdetection/tools/dataset_converters/scripts/preprocess_coco2017.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | DOWNLOAD_DIR=$1 4 | DATA_ROOT=$2 5 | 6 | unzip $DOWNLOAD_DIR/OpenDataLab___COCO_2017/raw/Images/val2017.zip -d $DATA_ROOT 7 | unzip $DOWNLOAD_DIR/OpenDataLab___COCO_2017/raw/Images/train2017.zip -d $DATA_ROOT 8 | unzip $DOWNLOAD_DIR/OpenDataLab___COCO_2017/raw/Images/test2017.zip -d $DATA_ROOT/ 9 | unzip $DOWNLOAD_DIR/OpenDataLab___COCO_2017/raw/Images/unlabeled2017.zip -d $DATA_ROOT 10 | unzip $DOWNLOAD_DIR/OpenDataLab___COCO_2017/raw/Annotations/stuff_annotations_trainval2017.zip -d $DATA_ROOT/ 11 | unzip $DOWNLOAD_DIR/OpenDataLab___COCO_2017/raw/Annotations/panoptic_annotations_trainval2017.zip -d $DATA_ROOT/ 12 | unzip $DOWNLOAD_DIR/OpenDataLab___COCO_2017/raw/Annotations/image_info_unlabeled2017.zip -d $DATA_ROOT/ 13 | unzip $DOWNLOAD_DIR/OpenDataLab___COCO_2017/raw/Annotations/image_info_test2017.zip -d $DATA_ROOT/ 14 | unzip $DOWNLOAD_DIR/OpenDataLab___COCO_2017/raw/Annotations/annotations_trainval2017.zip -d $DATA_ROOT 15 | rm -rf $DOWNLOAD_DIR/OpenDataLab___COCO_2017 16 | -------------------------------------------------------------------------------- /Detection/mmdetection/tools/dataset_converters/scripts/preprocess_voc2007.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | DOWNLOAD_DIR=$1 4 | DATA_ROOT=$2 5 | 6 | tar -xvf $DOWNLOAD_DIR/OpenDataLab___PASCAL_VOC2007/raw/VOCtrainval_06-Nov-2007.tar -C $DATA_ROOT 7 | tar -xvf $DOWNLOAD_DIR/OpenDataLab___PASCAL_VOC2007/raw/VOCtestnoimgs_06-Nov-2007.tar -C $DATA_ROOT 8 | rm -rf $DOWNLOAD_DIR/OpenDataLab___PASCAL_VOC2007 9 | -------------------------------------------------------------------------------- /Detection/mmdetection/tools/dataset_converters/scripts/preprocess_voc2012.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | DOWNLOAD_DIR=$1 4 | DATA_ROOT=$2 5 | 6 | tar -xvf $DOWNLOAD_DIR/OpenDataLab___PASCAL_VOC2012/raw/VOCtrainval_11-May-2012.tar -C $DATA_ROOT 7 | tar -xvf $DOWNLOAD_DIR/OpenDataLab___PASCAL_VOC2012/raw/VOC2012test.tar -C $DATA_ROOT 8 | rm -rf $DOWNLOAD_DIR/OpenDataLab___PASCAL_VOC2012 9 | -------------------------------------------------------------------------------- /Detection/mmdetection/tools/dist_test.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | CONFIG=$1 4 | CHECKPOINT=$2 5 | GPUS=$3 6 | NNODES=${NNODES:-1} 7 | NODE_RANK=${NODE_RANK:-0} 8 | PORT=${PORT:-29500} 9 | MASTER_ADDR=${MASTER_ADDR:-"127.0.0.1"} 10 | 11 | PYTHONPATH="$(dirname $0)/..":$PYTHONPATH \ 12 | python -m torch.distributed.launch \ 13 | --nnodes=$NNODES \ 14 | --node_rank=$NODE_RANK \ 15 | --master_addr=$MASTER_ADDR \ 16 | --nproc_per_node=$GPUS \ 17 | --master_port=$PORT \ 18 | $(dirname "$0")/test.py \ 19 | $CONFIG \ 20 | $CHECKPOINT \ 21 | --launcher pytorch \ 22 | ${@:4} 23 | -------------------------------------------------------------------------------- /Detection/mmdetection/tools/dist_test_tracking.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | CONFIG=$1 4 | GPUS=$2 5 | NNODES=${NNODES:-1} 6 | NODE_RANK=${NODE_RANK:-0} 7 | PORT=${PORT:-29500} 8 | MASTER_ADDR=${MASTER_ADDR:-"127.0.0.1"} 9 | 10 | PYTHONPATH="$(dirname $0)/..":$PYTHONPATH \ 11 | python -m torch.distributed.launch \ 12 | --nnodes=$NNODES \ 13 | --node_rank=$NODE_RANK \ 14 | --master_addr=$MASTER_ADDR \ 15 | --nproc_per_node=$GPUS \ 16 | --master_port=$PORT \ 17 | $(dirname "$0")/test_tracking.py \ 18 | $CONFIG \ 19 | --launcher pytorch \ 20 | ${@:3} 21 | -------------------------------------------------------------------------------- /Detection/mmdetection/tools/dist_train.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | CONFIG=$1 4 | GPUS=$2 5 | NNODES=${NNODES:-1} 6 | NODE_RANK=${NODE_RANK:-0} 7 | PORT=${PORT:-29500} 8 | MASTER_ADDR=${MASTER_ADDR:-"127.0.0.1"} 9 | 10 | PYTHONPATH="$(dirname $0)/..":$PYTHONPATH \ 11 | python -m torch.distributed.launch \ 12 | --nnodes=$NNODES \ 13 | --node_rank=$NODE_RANK \ 14 | --master_addr=$MASTER_ADDR \ 15 | --nproc_per_node=$GPUS \ 16 | --master_port=$PORT \ 17 | $(dirname "$0")/train.py \ 18 | $CONFIG \ 19 | --launcher pytorch ${@:3} 20 | -------------------------------------------------------------------------------- /Detection/mmdetection/tools/misc/gen_coco_panoptic_test_info.py: -------------------------------------------------------------------------------- 1 | import argparse 2 | import os.path as osp 3 | 4 | from mmengine.fileio import dump, load 5 | 6 | 7 | def parse_args(): 8 | parser = argparse.ArgumentParser( 9 | description='Generate COCO test image information ' 10 | 'for COCO panoptic segmentation.') 11 | parser.add_argument('data_root', help='Path to COCO annotation directory.') 12 | args = parser.parse_args() 13 | 14 | return args 15 | 16 | 17 | def main(): 18 | args = parse_args() 19 | data_root = args.data_root 20 | val_info = load(osp.join(data_root, 'panoptic_val2017.json')) 21 | test_old_info = load(osp.join(data_root, 'image_info_test-dev2017.json')) 22 | 23 | # replace categories from image_info_test-dev2017.json 24 | # with categories from panoptic_val2017.json which 25 | # has attribute `isthing`. 26 | test_info = test_old_info 27 | test_info.update({'categories': val_info['categories']}) 28 | dump(test_info, osp.join(data_root, 29 | 'panoptic_image_info_test-dev2017.json')) 30 | 31 | 32 | if __name__ == '__main__': 33 | main() 34 | -------------------------------------------------------------------------------- /Detection/mmdetection/tools/slurm_test.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | set -x 4 | 5 | PARTITION=$1 6 | JOB_NAME=$2 7 | CONFIG=$3 8 | CHECKPOINT=$4 9 | GPUS=${GPUS:-8} 10 | GPUS_PER_NODE=${GPUS_PER_NODE:-8} 11 | CPUS_PER_TASK=${CPUS_PER_TASK:-5} 12 | PY_ARGS=${@:5} 13 | SRUN_ARGS=${SRUN_ARGS:-""} 14 | 15 | PYTHONPATH="$(dirname $0)/..":$PYTHONPATH \ 16 | srun -p ${PARTITION} \ 17 | --job-name=${JOB_NAME} \ 18 | --gres=gpu:${GPUS_PER_NODE} \ 19 | --ntasks=${GPUS} \ 20 | --ntasks-per-node=${GPUS_PER_NODE} \ 21 | --cpus-per-task=${CPUS_PER_TASK} \ 22 | --kill-on-bad-exit=1 \ 23 | ${SRUN_ARGS} \ 24 | python -u tools/test.py ${CONFIG} ${CHECKPOINT} --launcher="slurm" ${PY_ARGS} 25 | -------------------------------------------------------------------------------- /Detection/mmdetection/tools/slurm_test_tracking.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | set -x 4 | 5 | PARTITION=$1 6 | JOB_NAME=$2 7 | CONFIG=$3 8 | GPUS=${GPUS:-8} 9 | GPUS_PER_NODE=${GPUS_PER_NODE:-8} 10 | CPUS_PER_TASK=${CPUS_PER_TASK:-5} 11 | PY_ARGS=${@:4} 12 | SRUN_ARGS=${SRUN_ARGS:-""} 13 | 14 | PYTHONPATH="$(dirname $0)/..":$PYTHONPATH \ 15 | srun -p ${PARTITION} \ 16 | --job-name=${JOB_NAME} \ 17 | --gres=gpu:${GPUS_PER_NODE} \ 18 | --ntasks=${GPUS} \ 19 | --ntasks-per-node=${GPUS_PER_NODE} \ 20 | --cpus-per-task=${CPUS_PER_TASK} \ 21 | --kill-on-bad-exit=1 \ 22 | ${SRUN_ARGS} \ 23 | python -u tools/test_tracking.py ${CONFIG} --launcher="slurm" ${PY_ARGS} 24 | -------------------------------------------------------------------------------- /Detection/mmdetection/tools/slurm_train.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | set -x 4 | 5 | PARTITION=$1 6 | JOB_NAME=$2 7 | CONFIG=$3 8 | WORK_DIR=$4 9 | GPUS=${GPUS:-8} 10 | GPUS_PER_NODE=${GPUS_PER_NODE:-8} 11 | CPUS_PER_TASK=${CPUS_PER_TASK:-5} 12 | SRUN_ARGS=${SRUN_ARGS:-""} 13 | PY_ARGS=${@:5} 14 | 15 | PYTHONPATH="$(dirname $0)/..":$PYTHONPATH \ 16 | srun -p ${PARTITION} \ 17 | --job-name=${JOB_NAME} \ 18 | --gres=gpu:${GPUS_PER_NODE} \ 19 | --ntasks=${GPUS} \ 20 | --ntasks-per-node=${GPUS_PER_NODE} \ 21 | --cpus-per-task=${CPUS_PER_TASK} \ 22 | --kill-on-bad-exit=1 \ 23 | ${SRUN_ARGS} \ 24 | python -u tools/train.py ${CONFIG} --work-dir=${WORK_DIR} --launcher="slurm" ${PY_ARGS} 25 | -------------------------------------------------------------------------------- /Person-ReID/TransReID-SSL/requirements.txt: -------------------------------------------------------------------------------- 1 | faiss-gpu==1.7.1.post2 2 | h5py==2.10.0 3 | lmdb==1.1.1 4 | metric-learn==0.6.2 5 | numpy==1.19.5 6 | opencv-python==4.5.1.48 7 | opencv-python-headless==4.5.1.48 8 | pandas==1.1.5 9 | pytorch-ignite==0.1.2 10 | PyYAML==5.4.1 11 | scikit-image==0.16.2 12 | scikit-learn==0.23.1 13 | scipy==1.2.0 14 | six==1.15.0 15 | sklearn==0.0 16 | timm==0.3.4 17 | torch==1.7.1 18 | torchtoolbox==0.1.5 19 | torchvision==0.8.2 20 | wrapt==1.12.1 21 | yacs==0.1.7 22 | -------------------------------------------------------------------------------- /Person-ReID/TransReID-SSL/transreid_pytorch/config/__init__.py: -------------------------------------------------------------------------------- 1 | # encoding: utf-8 2 | """ 3 | @author: sherlock 4 | @contact: sherlockliao01@gmail.com 5 | """ 6 | 7 | from .defaults import _C as cfg 8 | from .defaults import _C as cfg_test 9 | -------------------------------------------------------------------------------- /Person-ReID/TransReID-SSL/transreid_pytorch/datasets/__init__.py: -------------------------------------------------------------------------------- 1 | from .make_dataloader import make_dataloader -------------------------------------------------------------------------------- /Person-ReID/TransReID-SSL/transreid_pytorch/loss/__init__.py: -------------------------------------------------------------------------------- 1 | from .make_loss import make_loss 2 | from .arcface import ArcFace -------------------------------------------------------------------------------- /Person-ReID/TransReID-SSL/transreid_pytorch/model/__init__.py: -------------------------------------------------------------------------------- 1 | from .make_model import make_model -------------------------------------------------------------------------------- /Person-ReID/TransReID-SSL/transreid_pytorch/model/backbones/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wangguanan/DenoiseRep/14cfbf0706510710a9e5eab3bffb694ac58be00f/Person-ReID/TransReID-SSL/transreid_pytorch/model/backbones/__init__.py -------------------------------------------------------------------------------- /Person-ReID/TransReID-SSL/transreid_pytorch/processor/__init__.py: -------------------------------------------------------------------------------- 1 | from .processor import do_train, do_inference -------------------------------------------------------------------------------- /Person-ReID/TransReID-SSL/transreid_pytorch/run.sh: -------------------------------------------------------------------------------- 1 | #Single GPU 2 | python train.py --config_file configs/market/vit_small.yml 3 | 4 | # Multiple GPUs 5 | CUDA_VISIBLE_DEVICES=0,1,2,3 python -m torch.distributed.launch --nproc_per_node=4 --master_port 66666 train.py --config_file configs/market/vit_small.yml 6 | 7 | -------------------------------------------------------------------------------- /Person-ReID/TransReID-SSL/transreid_pytorch/setup.py: -------------------------------------------------------------------------------- 1 | from setuptools import setup, find_packages 2 | 3 | 4 | setup(name='TranReID', 5 | version='1.0.0', 6 | description='TransReID: Transformer-based Object Re-Identification', 7 | author='xxx', 8 | author_email='xxx', 9 | url='xxx', 10 | install_requires=[ 11 | 'numpy', 'torch==1.6.0', 'torchvision==0.7.0', 12 | 'h5py', 'opencv-python', 'yacs', 'timm==0.3.2' 13 | ], 14 | packages=find_packages(), 15 | keywords=[ 16 | 'Pure Transformer', 17 | 'Object Re-identification' 18 | ]) 19 | -------------------------------------------------------------------------------- /Person-ReID/TransReID-SSL/transreid_pytorch/solver/__init__.py: -------------------------------------------------------------------------------- 1 | from .lr_scheduler import WarmupMultiStepLR 2 | from .make_optimizer import make_optimizer -------------------------------------------------------------------------------- /Person-ReID/TransReID-SSL/transreid_pytorch/utils/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wangguanan/DenoiseRep/14cfbf0706510710a9e5eab3bffb694ac58be00f/Person-ReID/TransReID-SSL/transreid_pytorch/utils/__init__.py -------------------------------------------------------------------------------- /Person-ReID/TransReID-SSL/transreid_pytorch/utils/iotools.py: -------------------------------------------------------------------------------- 1 | # encoding: utf-8 2 | """ 3 | @author: sherlock 4 | @contact: sherlockliao01@gmail.com 5 | """ 6 | 7 | import errno 8 | import json 9 | import os 10 | 11 | import os.path as osp 12 | 13 | 14 | def mkdir_if_missing(directory): 15 | if not osp.exists(directory): 16 | try: 17 | os.makedirs(directory) 18 | except OSError as e: 19 | if e.errno != errno.EEXIST: 20 | raise 21 | 22 | 23 | def check_isfile(path): 24 | isfile = osp.isfile(path) 25 | if not isfile: 26 | print("=> Warning: no file found at '{}' (ignored)".format(path)) 27 | return isfile 28 | 29 | 30 | def read_json(fpath): 31 | with open(fpath, 'r') as f: 32 | obj = json.load(f) 33 | return obj 34 | 35 | 36 | def write_json(obj, fpath): 37 | mkdir_if_missing(osp.dirname(fpath)) 38 | with open(fpath, 'w') as f: 39 | json.dump(obj, f, indent=4, separators=(',', ': ')) 40 | -------------------------------------------------------------------------------- /Person-ReID/TransReID-SSL/transreid_pytorch/utils/logger.py: -------------------------------------------------------------------------------- 1 | import logging 2 | import os 3 | import sys 4 | import os.path as osp 5 | def setup_logger(name, save_dir, if_train): 6 | logger = logging.getLogger(name) 7 | logger.setLevel(logging.DEBUG) 8 | 9 | ch = logging.StreamHandler(stream=sys.stdout) 10 | ch.setLevel(logging.DEBUG) 11 | formatter = logging.Formatter("%(asctime)s %(name)s %(levelname)s: %(message)s",datefmt = '%Y-%m-%d %H:%M:%S') 12 | ch.setFormatter(formatter) 13 | logger.addHandler(ch) 14 | 15 | if save_dir: 16 | if not osp.exists(save_dir): 17 | os.makedirs(save_dir) 18 | if if_train: 19 | fh = logging.FileHandler(os.path.join(save_dir, "train_log.txt"), mode='w') 20 | else: 21 | fh = logging.FileHandler(os.path.join(save_dir, "test_log.txt"), mode='w') 22 | fh.setLevel(logging.DEBUG) 23 | fh.setFormatter(formatter) 24 | logger.addHandler(fh) 25 | 26 | return logger 27 | -------------------------------------------------------------------------------- /Person-ReID/TransReID-SSL/transreid_pytorch/utils/meter.py: -------------------------------------------------------------------------------- 1 | class AverageMeter(object): 2 | """Computes and stores the average and current value""" 3 | 4 | def __init__(self): 5 | self.val = 0 6 | self.avg = 0 7 | self.sum = 0 8 | self.count = 0 9 | 10 | def reset(self): 11 | self.val = 0 12 | self.avg = 0 13 | self.sum = 0 14 | self.count = 0 15 | 16 | def update(self, val, n=1): 17 | self.val = val 18 | self.sum += val * n 19 | self.count += n 20 | self.avg = self.sum / self.count -------------------------------------------------------------------------------- /denoiserep_op/denoiserep/__init__.py: -------------------------------------------------------------------------------- 1 | from .denoise_layer import ( 2 | get_ploss, 3 | fuse_parameters, 4 | DenoiseLayer, 5 | freeze_denoise_layers, 6 | unfreeze_denoise_layers, 7 | ) 8 | from .denoise_linear import ( 9 | DenoiseLinear, 10 | count_linear_layers, 11 | count_vit_linear_layers, 12 | convert_denoise_linear, 13 | convert_vit_denoise_linear, 14 | ) 15 | from .denoise_conv2d import DenoiseConv2d, count_conv2d_layers, convert_denoise_conv2d 16 | -------------------------------------------------------------------------------- /denoiserep_op/make.sh: -------------------------------------------------------------------------------- 1 | python setup.py sdist 2 | pip install dist/denoiserep-0.1.tar.gz -------------------------------------------------------------------------------- /denoiserep_op/setup.py: -------------------------------------------------------------------------------- 1 | from setuptools import setup, find_packages 2 | 3 | setup( 4 | name="denoiserep", 5 | version="0.1", 6 | packages=find_packages(), 7 | ) 8 | -------------------------------------------------------------------------------- /fig/idea.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wangguanan/DenoiseRep/14cfbf0706510710a9e5eab3bffb694ac58be00f/fig/idea.png -------------------------------------------------------------------------------- /fig/method.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wangguanan/DenoiseRep/14cfbf0706510710a9e5eab3bffb694ac58be00f/fig/method.png -------------------------------------------------------------------------------- /fig/tutorial-load-convert.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wangguanan/DenoiseRep/14cfbf0706510710a9e5eab3bffb694ac58be00f/fig/tutorial-load-convert.jpg -------------------------------------------------------------------------------- /fig/tutorial-loss.jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wangguanan/DenoiseRep/14cfbf0706510710a9e5eab3bffb694ac58be00f/fig/tutorial-loss.jpeg -------------------------------------------------------------------------------- /fig/tutorial-trick.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wangguanan/DenoiseRep/14cfbf0706510710a9e5eab3bffb694ac58be00f/fig/tutorial-trick.jpg --------------------------------------------------------------------------------