├── detectron2 ├── tools │ ├── __init__.py │ └── deploy │ │ └── CMakeLists.txt ├── tests │ ├── data │ │ └── __init__.py │ ├── layers │ │ └── __init__.py │ ├── modeling │ │ └── __init__.py │ ├── tracking │ │ └── __init__.py │ ├── structures │ │ ├── __init__.py │ │ └── test_keypoints.py │ ├── config │ │ ├── dir1 │ │ │ ├── bad_import2.py │ │ │ ├── bad_import.py │ │ │ ├── dir1_a.py │ │ │ ├── load_rel.py │ │ │ └── dir1_b.py │ │ └── root_cfg.py │ ├── __init__.py │ ├── README.md │ └── test_packaging.py ├── docs │ ├── .gitignore │ ├── tutorials │ │ ├── install.md │ │ ├── getting_started.md │ │ ├── builtin_datasets.md │ │ ├── README.md │ │ └── index.rst │ ├── notes │ │ ├── contributing.md │ │ └── index.rst │ ├── modules │ │ ├── layers.rst │ │ ├── solver.rst │ │ ├── model_zoo.rst │ │ ├── checkpoint.rst │ │ ├── evaluation.rst │ │ ├── structures.rst │ │ ├── export.rst │ │ ├── data_transforms.rst │ │ ├── index.rst │ │ ├── config.rst │ │ └── engine.rst │ ├── index.rst │ ├── README.md │ ├── _static │ │ └── css │ │ │ └── custom.css │ ├── requirements.txt │ └── Makefile ├── projects │ ├── DensePose │ │ ├── densepose │ │ │ ├── utils │ │ │ │ ├── __init__.py │ │ │ │ ├── logger.py │ │ │ │ └── transform.py │ │ │ ├── vis │ │ │ │ └── __init__.py │ │ │ ├── engine │ │ │ │ └── __init__.py │ │ │ ├── data │ │ │ │ ├── transform │ │ │ │ │ └── __init__.py │ │ │ │ ├── meshes │ │ │ │ │ └── __init__.py │ │ │ │ ├── datasets │ │ │ │ │ ├── __init__.py │ │ │ │ │ ├── dataset_type.py │ │ │ │ │ └── builtin.py │ │ │ │ ├── samplers │ │ │ │ │ ├── densepose_cse_uniform.py │ │ │ │ │ └── __init__.py │ │ │ │ └── video │ │ │ │ │ └── __init__.py │ │ │ ├── evaluation │ │ │ │ └── __init__.py │ │ │ ├── modeling │ │ │ │ ├── losses │ │ │ │ │ ├── registry.py │ │ │ │ │ └── __init__.py │ │ │ │ ├── roi_heads │ │ │ │ │ ├── registry.py │ │ │ │ │ └── __init__.py │ │ │ │ ├── predictors │ │ │ │ │ ├── registry.py │ │ │ │ │ ├── chart_with_confidence.py │ │ │ │ │ ├── __init__.py │ │ │ │ │ └── cse_with_confidence.py │ │ │ │ ├── cse │ │ │ │ │ └── __init__.py │ │ │ │ ├── utils.py │ │ │ │ └── __init__.py │ │ │ └── converters │ │ │ │ └── __init__.py │ │ ├── configs │ │ │ ├── densepose_rcnn_R_101_FPN_s1x.yaml │ │ │ ├── densepose_rcnn_R_50_FPN_s1x.yaml │ │ │ ├── quick_schedules │ │ │ │ ├── densepose_rcnn_HRFPN_HRNet_w32_instant_test.yaml │ │ │ │ ├── densepose_rcnn_R_50_FPN_instant_test.yaml │ │ │ │ ├── densepose_rcnn_R_50_FPN_DL_instant_test.yaml │ │ │ │ ├── cse │ │ │ │ │ └── densepose_rcnn_R_50_FPN_DL_instant_test.yaml │ │ │ │ ├── densepose_rcnn_R_50_FPN_inference_acc_test.yaml │ │ │ │ ├── densepose_rcnn_R_50_FPN_WC1_instant_test.yaml │ │ │ │ ├── densepose_rcnn_R_50_FPN_WC2_instant_test.yaml │ │ │ │ ├── densepose_rcnn_R_50_FPN_TTA_inference_acc_test.yaml │ │ │ │ └── densepose_rcnn_R_50_FPN_training_acc_test.yaml │ │ │ ├── densepose_rcnn_R_50_FPN_DL_s1x.yaml │ │ │ ├── densepose_rcnn_R_101_FPN_DL_s1x.yaml │ │ │ ├── cse │ │ │ │ ├── densepose_rcnn_R_50_FPN_s1x.yaml │ │ │ │ ├── densepose_rcnn_R_101_FPN_DL_s1x.yaml │ │ │ │ ├── densepose_rcnn_R_101_FPN_s1x.yaml │ │ │ │ ├── densepose_rcnn_R_50_FPN_DL_s1x.yaml │ │ │ │ ├── densepose_rcnn_R_50_FPN_soft_s1x.yaml │ │ │ │ ├── densepose_rcnn_R_101_FPN_DL_soft_s1x.yaml │ │ │ │ ├── densepose_rcnn_R_101_FPN_soft_s1x.yaml │ │ │ │ ├── densepose_rcnn_R_50_FPN_DL_soft_s1x.yaml │ │ │ │ └── Base-DensePose-RCNN-FPN-Human.yaml │ │ │ ├── densepose_rcnn_R_50_FPN_WC1_s1x.yaml │ │ │ ├── densepose_rcnn_R_101_FPN_WC1_s1x.yaml │ │ │ ├── densepose_rcnn_R_50_FPN_WC2_s1x.yaml │ │ │ ├── densepose_rcnn_R_101_FPN_WC2_s1x.yaml │ │ │ ├── densepose_rcnn_R_101_FPN_DL_WC1_s1x.yaml │ │ │ ├── densepose_rcnn_R_50_FPN_DL_WC1_s1x.yaml │ │ │ ├── densepose_rcnn_R_101_FPN_DL_WC2_s1x.yaml │ │ │ ├── densepose_rcnn_R_50_FPN_DL_WC2_s1x.yaml │ │ │ ├── HRNet │ │ │ │ ├── densepose_rcnn_HRFPN_HRNet_w32_s1x.yaml │ │ │ │ ├── densepose_rcnn_HRFPN_HRNet_w40_s1x.yaml │ │ │ │ └── densepose_rcnn_HRFPN_HRNet_w48_s1x.yaml │ │ │ ├── densepose_rcnn_R_50_FPN_s1x_legacy.yaml │ │ │ ├── densepose_rcnn_R_101_FPN_WC1M_s1x.yaml │ │ │ ├── densepose_rcnn_R_101_FPN_s1x_legacy.yaml │ │ │ ├── densepose_rcnn_R_50_FPN_WC2M_s1x.yaml │ │ │ ├── densepose_rcnn_R_101_FPN_WC2M_s1x.yaml │ │ │ ├── densepose_rcnn_R_50_FPN_DL_WC1M_s1x.yaml │ │ │ ├── densepose_rcnn_R_101_FPN_DL_WC1M_s1x.yaml │ │ │ ├── densepose_rcnn_R_50_FPN_DL_WC2M_s1x.yaml │ │ │ ├── densepose_rcnn_R_101_FPN_DL_WC2M_s1x.yaml │ │ │ └── densepose_rcnn_R_50_FPN_WC1M_s1x.yaml │ │ ├── dev │ │ │ └── README.md │ │ ├── doc │ │ │ └── RELEASE_2020_04.md │ │ └── tests │ │ │ └── test_image_resize_transform.py │ ├── TensorMask │ │ ├── tests │ │ │ └── __init__.py │ │ ├── tensormask │ │ │ ├── __init__.py │ │ │ └── layers │ │ │ │ ├── __init__.py │ │ │ │ └── csrc │ │ │ │ └── vision.cpp │ │ └── configs │ │ │ ├── tensormask_R_50_FPN_1x.yaml │ │ │ ├── tensormask_R_50_FPN_6x.yaml │ │ │ └── Base-TensorMask.yaml │ ├── PointSup │ │ ├── configs │ │ │ ├── mask_rcnn_R_50_FPN_3x_point_sup_point_aug_coco.yaml │ │ │ ├── implicit_pointrend_R_50_FPN_3x_point_sup_point_aug_coco.yaml │ │ │ └── mask_rcnn_R_50_FPN_3x_point_sup_coco.yaml │ │ └── point_sup │ │ │ ├── __init__.py │ │ │ └── config.py │ ├── TridentNet │ │ ├── configs │ │ │ ├── tridentnet_fast_R_50_C4_1x.yaml │ │ │ ├── tridentnet_fast_R_50_C4_3x.yaml │ │ │ └── tridentnet_fast_R_101_C4_3x.yaml │ │ └── tridentnet │ │ │ └── __init__.py │ ├── Rethinking-BatchNorm │ │ └── configs │ │ │ └── mask_rcnn_SyncBNhead.py │ ├── MViTv2 │ │ └── configs │ │ │ ├── cascade_mask_rcnn_mvitv2_b_in21k_3x.py │ │ │ ├── cascade_mask_rcnn_mvitv2_s_3x.py │ │ │ ├── cascade_mask_rcnn_mvitv2_b_3x.py │ │ │ ├── cascade_mask_rcnn_mvitv2_h_in21k_lsj_3x.py │ │ │ └── common │ │ │ └── coco_loader_lsj.py │ ├── DeepLab │ │ ├── deeplab │ │ │ └── __init__.py │ │ └── configs │ │ │ └── Cityscapes-SemanticSegmentation │ │ │ └── deeplab_v3_R_103_os16_mg124_poly_90k_bs16.yaml │ ├── PointRend │ │ ├── configs │ │ │ ├── InstanceSegmentation │ │ │ │ ├── pointrend_rcnn_R_50_FPN_1x_coco.yaml │ │ │ │ ├── implicit_pointrend_R_50_FPN_1x_coco.yaml │ │ │ │ ├── implicit_pointrend_R_50_FPN_3x_coco.yaml │ │ │ │ ├── pointrend_rcnn_R_50_FPN_3x_coco.yaml │ │ │ │ ├── pointrend_rcnn_R_101_FPN_3x_coco.yaml │ │ │ │ ├── pointrend_rcnn_X_101_32x8d_FPN_3x_coco.yaml │ │ │ │ ├── pointrend_rcnn_R_50_FPN_1x_cityscapes.yaml │ │ │ │ └── Base-PointRend-RCNN-FPN.yaml │ │ │ └── SemanticSegmentation │ │ │ │ └── Base-PointRend-Semantic-FPN.yaml │ │ └── point_rend │ │ │ └── __init__.py │ ├── Panoptic-DeepLab │ │ ├── panoptic_deeplab │ │ │ └── __init__.py │ │ └── configs │ │ │ └── Cityscapes-PanopticSegmentation │ │ │ └── panoptic_deeplab_R_52_os16_mg124_poly_90k_bs32_crop_512_1024.yaml │ └── ViTDet │ │ └── configs │ │ ├── LVIS │ │ └── cascade_mask_rcnn_swin_l_in21k_50ep.py │ │ └── COCO │ │ └── cascade_mask_rcnn_swin_l_in21k_50ep.py ├── detectron2 │ ├── utils │ │ ├── __init__.py │ │ └── README.md │ ├── projects │ │ └── README.md │ ├── layers │ │ ├── csrc │ │ │ ├── README.md │ │ │ └── cuda_version.cu │ │ ├── shape_spec.py │ │ └── rotated_boxes.py │ ├── data │ │ ├── datasets │ │ │ ├── register_coco.py │ │ │ ├── README.md │ │ │ └── __init__.py │ │ ├── samplers │ │ │ └── __init__.py │ │ ├── transforms │ │ │ └── __init__.py │ │ └── __init__.py │ ├── modeling │ │ ├── proposal_generator │ │ │ └── __init__.py │ │ ├── meta_arch │ │ │ └── __init__.py │ │ └── backbone │ │ │ └── __init__.py │ ├── __init__.py │ ├── solver │ │ └── __init__.py │ ├── checkpoint │ │ └── __init__.py │ ├── engine │ │ └── __init__.py │ ├── model_zoo │ │ └── __init__.py │ ├── tracking │ │ └── __init__.py │ ├── export │ │ └── README.md │ ├── config │ │ └── __init__.py │ ├── evaluation │ │ └── __init__.py │ └── structures │ │ └── __init__.py ├── .github │ ├── ISSUE_TEMPLATE.md │ ├── CODE_OF_CONDUCT.md │ ├── pull_request_template.md │ └── ISSUE_TEMPLATE │ │ └── documentation.md ├── configs │ ├── COCO-Detection │ │ ├── retinanet_R_50_FPN_1x.yaml │ │ ├── faster_rcnn_R_50_C4_1x.yaml │ │ ├── faster_rcnn_R_50_FPN_1x.yaml │ │ ├── faster_rcnn_R_50_DC5_1x.yaml │ │ ├── retinanet_R_101_FPN_3x.yaml │ │ ├── retinanet_R_50_FPN_3x.yaml │ │ ├── faster_rcnn_R_101_C4_3x.yaml │ │ ├── faster_rcnn_R_50_C4_3x.yaml │ │ ├── faster_rcnn_R_50_FPN_3x.yaml │ │ ├── faster_rcnn_R_101_FPN_3x.yaml │ │ ├── faster_rcnn_R_50_DC5_3x.yaml │ │ ├── faster_rcnn_R_101_DC5_3x.yaml │ │ ├── rpn_R_50_FPN_1x.yaml │ │ ├── rpn_R_50_C4_1x.yaml │ │ ├── faster_rcnn_X_101_32x8d_FPN_3x.yaml │ │ ├── fcos_R_50_FPN_1x.py │ │ ├── retinanet_R_50_FPN_1x.py │ │ └── fast_rcnn_R_50_FPN_1x.yaml │ ├── COCO-Keypoints │ │ ├── keypoint_rcnn_R_50_FPN_1x.yaml │ │ ├── keypoint_rcnn_R_50_FPN_3x.yaml │ │ ├── keypoint_rcnn_R_101_FPN_3x.yaml │ │ ├── keypoint_rcnn_X_101_32x8d_FPN_3x.yaml │ │ ├── keypoint_rcnn_R_50_FPN_1x.py │ │ └── Base-Keypoint-RCNN-FPN.yaml │ ├── COCO-PanopticSegmentation │ │ ├── panoptic_fpn_R_50_1x.yaml │ │ ├── panoptic_fpn_R_101_3x.yaml │ │ ├── panoptic_fpn_R_50_3x.yaml │ │ ├── Base-Panoptic-FPN.yaml │ │ └── panoptic_fpn_R_50_1x.py │ ├── COCO-InstanceSegmentation │ │ ├── mask_rcnn_R_50_C4_1x.yaml │ │ ├── mask_rcnn_R_50_FPN_1x.yaml │ │ ├── mask_rcnn_R_50_DC5_1x.yaml │ │ ├── mask_rcnn_R_50_C4_3x.yaml │ │ ├── mask_rcnn_R_101_C4_3x.yaml │ │ ├── mask_rcnn_R_101_FPN_3x.yaml │ │ ├── mask_rcnn_R_50_FPN_3x.yaml │ │ ├── mask_rcnn_R_101_DC5_3x.yaml │ │ ├── mask_rcnn_R_50_DC5_3x.yaml │ │ ├── mask_rcnn_R_50_FPN_1x_giou.yaml │ │ ├── mask_rcnn_R_50_C4_1x.py │ │ ├── mask_rcnn_R_50_FPN_1x.py │ │ └── mask_rcnn_X_101_32x8d_FPN_3x.yaml │ ├── new_baselines │ │ ├── mask_rcnn_R_101_FPN_100ep_LSJ.py │ │ ├── mask_rcnn_R_50_FPN_200ep_LSJ.py │ │ ├── mask_rcnn_R_50_FPN_400ep_LSJ.py │ │ ├── mask_rcnn_R_50_FPN_50ep_LSJ.py │ │ ├── mask_rcnn_R_101_FPN_200ep_LSJ.py │ │ ├── mask_rcnn_R_101_FPN_400ep_LSJ.py │ │ ├── mask_rcnn_regnetx_4gf_dds_FPN_200ep_LSJ.py │ │ ├── mask_rcnn_regnetx_4gf_dds_FPN_400ep_LSJ.py │ │ ├── mask_rcnn_regnety_4gf_dds_FPN_200ep_LSJ.py │ │ └── mask_rcnn_regnety_4gf_dds_FPN_400ep_LSJ.py │ ├── quick_schedules │ │ ├── mask_rcnn_R_50_FPN_pred_boxes_training_acc_test.yaml │ │ ├── rpn_R_50_FPN_inference_acc_test.yaml │ │ ├── fast_rcnn_R_50_FPN_inference_acc_test.yaml │ │ ├── retinanet_R_50_FPN_inference_acc_test.yaml │ │ ├── cascade_mask_rcnn_R_50_FPN_instant_test.yaml │ │ ├── cascade_mask_rcnn_R_50_FPN_inference_acc_test.yaml │ │ ├── mask_rcnn_R_50_C4_inference_acc_test.yaml │ │ ├── mask_rcnn_R_50_DC5_inference_acc_test.yaml │ │ ├── keypoint_rcnn_R_50_FPN_inference_acc_test.yaml │ │ ├── rpn_R_50_FPN_instant_test.yaml │ │ ├── mask_rcnn_R_50_C4_instant_test.yaml │ │ ├── mask_rcnn_R_50_FPN_instant_test.yaml │ │ ├── retinanet_R_50_FPN_instant_test.yaml │ │ ├── semantic_R_50_FPN_inference_acc_test.yaml │ │ ├── panoptic_fpn_R_50_inference_acc_test.yaml │ │ ├── keypoint_rcnn_R_50_FPN_instant_test.yaml │ │ ├── mask_rcnn_R_50_C4_GCV_instant_test.yaml │ │ ├── mask_rcnn_R_50_FPN_inference_acc_test.yaml │ │ ├── panoptic_fpn_R_50_instant_test.yaml │ │ ├── semantic_R_50_FPN_instant_test.yaml │ │ ├── README.md │ │ ├── mask_rcnn_R_50_FPN_training_acc_test.yaml │ │ ├── fast_rcnn_R_50_FPN_instant_test.yaml │ │ ├── semantic_R_50_FPN_training_acc_test.yaml │ │ ├── mask_rcnn_R_50_C4_training_acc_test.yaml │ │ └── panoptic_fpn_R_50_training_acc_test.yaml │ ├── Misc │ │ ├── mask_rcnn_R_50_FPN_1x_dconv_c3-c5.yaml │ │ ├── mask_rcnn_R_50_FPN_1x_cls_agnostic.yaml │ │ ├── cascade_mask_rcnn_R_50_FPN_1x.yaml │ │ ├── mask_rcnn_R_50_FPN_3x_dconv_c3-c5.yaml │ │ ├── semantic_R_50_FPN_1x.yaml │ │ ├── cascade_mask_rcnn_R_50_FPN_3x.yaml │ │ ├── mask_rcnn_R_50_FPN_3x_gn.yaml │ │ ├── mask_rcnn_R_50_FPN_3x_syncbn.yaml │ │ ├── scratch_mask_rcnn_R_50_FPN_3x_gn.yaml │ │ ├── scratch_mask_rcnn_R_50_FPN_9x_gn.yaml │ │ └── scratch_mask_rcnn_R_50_FPN_9x_syncbn.yaml │ ├── common │ │ ├── README.md │ │ ├── data │ │ │ ├── constants.py │ │ │ └── coco_keypoint.py │ │ ├── models │ │ │ ├── panoptic_fpn.py │ │ │ └── fcos.py │ │ └── train.py │ ├── Base-RCNN-C4.yaml │ ├── PascalVOC-Detection │ │ ├── faster_rcnn_R_50_C4.yaml │ │ └── faster_rcnn_R_50_FPN.yaml │ ├── Detectron1-Comparisons │ │ ├── faster_rcnn_R_50_FPN_noaug_1x.yaml │ │ └── mask_rcnn_R_50_FPN_noaug_1x.yaml │ ├── LVISv0.5-InstanceSegmentation │ │ ├── mask_rcnn_R_50_FPN_1x.yaml │ │ ├── mask_rcnn_R_101_FPN_1x.yaml │ │ └── mask_rcnn_X_101_32x8d_FPN_1x.yaml │ └── LVISv1-InstanceSegmentation │ │ ├── mask_rcnn_R_50_FPN_1x.yaml │ │ └── mask_rcnn_R_101_FPN_1x.yaml ├── dev │ ├── README.md │ └── packaging │ │ └── README.md ├── demo │ └── README.md ├── .flake8 ├── .circleci │ └── import-tests.sh └── docker │ └── docker-compose.yml ├── AdelaiDet ├── adet │ ├── utils │ │ └── __init__.py │ ├── modeling │ │ ├── roi_heads │ │ │ └── __init__.py │ │ ├── fcos │ │ │ └── __init__.py │ │ ├── batext │ │ │ └── __init__.py │ │ ├── solov2 │ │ │ └── __init__.py │ │ ├── condinst │ │ │ └── __init__.py │ │ ├── fcpose │ │ │ └── __init__.py │ │ ├── blendmask │ │ │ └── __init__.py │ │ ├── MEInst │ │ │ ├── __init__.py │ │ │ └── LME │ │ │ │ └── __init__.py │ │ ├── backbone │ │ │ └── __init__.py │ │ └── __init__.py │ ├── structures │ │ └── __init__.py │ ├── __init__.py │ ├── config │ │ ├── __init__.py │ │ └── config.py │ ├── checkpoint │ │ └── __init__.py │ ├── layers │ │ ├── csrc │ │ │ └── cuda_version.cu │ │ └── __init__.py │ ├── data │ │ └── __init__.py │ └── evaluation │ │ └── __init__.py ├── docs │ ├── .gitignore │ ├── modules │ │ ├── data.rst │ │ ├── layers.rst │ │ ├── index.rst │ │ ├── checkpoint.rst │ │ ├── config.rst │ │ └── utils.rst │ ├── index.rst │ └── Makefile ├── onnx │ └── .gitignore ├── configs │ ├── BAText │ │ ├── ICDAR2015 │ │ │ ├── Base-ic15.yaml │ │ │ └── v1_attn_R_50.yaml │ │ ├── TotalText │ │ │ ├── Base-TotalText.yaml │ │ │ ├── attn_R_50.yaml │ │ │ └── v2_attn_R_50.yaml │ │ ├── ReCTS │ │ │ └── Base-ReCTS.yaml │ │ ├── Pretrain │ │ │ ├── Base-Chn-Pretrain.yaml │ │ │ ├── Base-Pretrain.yaml │ │ │ ├── Base-Pretrain-ic15.yaml │ │ │ ├── attn_R_50.yaml │ │ │ ├── v1_ic15_attn_R_50.yaml │ │ │ └── v2_attn_R_50.yaml │ │ └── CTW1500 │ │ │ ├── Base-CTW1500.yaml │ │ │ ├── attn_R_50.yaml │ │ │ └── v2_attn_R_50.yaml │ ├── PointWSSIS │ │ └── R101_teacher.yaml │ ├── BlendMask │ │ ├── RT_R_50_4x_bn-head_syncbn_shtw.yaml │ │ ├── 550_R_50_1x.yaml │ │ ├── R_50_1x.yaml │ │ ├── Panoptic │ │ │ ├── R_50_1x.yaml │ │ │ ├── R_50_3x.yaml │ │ │ ├── R_101_3x.yaml │ │ │ ├── Base-Panoptic.yaml │ │ │ ├── R_101_dcni3_5x.yaml │ │ │ └── R_50_dcni3_5x.yaml │ │ ├── Person │ │ │ ├── Base-Person.yaml │ │ │ └── R_50_1x.yaml │ │ ├── 550_R_50_3x.yaml │ │ ├── R_101_3x.yaml │ │ ├── R_50_3x.yaml │ │ ├── DLA_34_syncbn_4x.yaml │ │ ├── RT_R_50_4x_syncbn_shtw.yaml │ │ ├── Base-RT.yaml │ │ ├── Base-550.yaml │ │ ├── 550_R_50_dcni3_5x.yaml │ │ └── R_101_dcni3_5x.yaml │ ├── BoxInst │ │ ├── MS_R_101_1x.yaml │ │ ├── MS_R_50_1x.yaml │ │ ├── MS_R_101_3x.yaml │ │ ├── MS_R_50_3x.yaml │ │ ├── MS_R_50_BiFPN_1x.yaml │ │ ├── MS_R_50_BiFPN_3x.yaml │ │ ├── MS_R_101_BiFPN_3x.yaml │ │ └── MS_R_101_BiFPN_dcni3_3x.yaml │ ├── CondInst │ │ ├── MS_R_50_1x.yaml │ │ ├── MS_R_101_1x.yaml │ │ ├── MS_R_50_3x.yaml │ │ ├── MS_R_101_3x.yaml │ │ ├── MS_R_50_3x_sem.yaml │ │ ├── MS_R_101_3x_sem.yaml │ │ ├── MS_R_50_BiFPN_1x.yaml │ │ ├── MS_R_50_BiFPN_3x.yaml │ │ ├── MS_R_101_BiFPN_3x.yaml │ │ ├── MS_R_101_BiFPN_3x_sem.yaml │ │ ├── MS_R_50_BiFPN_3x_sem.yaml │ │ └── Base-CondInst.yaml │ ├── RCNN │ │ ├── LVIS │ │ │ └── R_50_1x.yaml │ │ ├── R_101_3x.yaml │ │ └── 550_R_50_FPN_3x.yaml │ ├── SOLOv2 │ │ ├── R101_3x.yaml │ │ ├── R50_3x.yaml │ │ ├── PointWSSIS_teacher.yaml │ │ └── Base-SOLOv2.yaml │ ├── FCOS-Detection │ │ ├── R_50_1x.yaml │ │ ├── MS_R_50_2x.yaml │ │ ├── MS_R_101_2x.yaml │ │ ├── R_50_1x_iou.yaml │ │ ├── MS_R_101_2x_iou.yaml │ │ ├── MS_R_50_2x_iou.yaml │ │ ├── MS_X_101_64x4d_2x.yaml │ │ ├── MS_X_101_32x8d_2x.yaml │ │ ├── MS_X_101_32x8d_2x_iou.yaml │ │ ├── vovnet │ │ │ ├── MS_V_39_3x.yaml │ │ │ ├── MS_V_57_3x.yaml │ │ │ └── MS_V_99_3x.yaml │ │ ├── MS_X_101_64x4d_2x_dcnv2.yaml │ │ ├── MS_X_101_32x8d_2x_dcnv2.yaml │ │ ├── MS_X_101_32x8d_2x_dcnv2_iou.yaml │ │ ├── FCOS_RT │ │ │ ├── MS_R_50_4x_syncbn.yaml │ │ │ └── MS_R_50_4x_syncbn_bn_head.yaml │ │ └── Base-FCOS.yaml │ ├── DenseCL │ │ ├── FCOS_R50_1x_DenseCL.yaml │ │ ├── SOLOv2_R50_1x_DenseCL.yaml │ │ └── FCOS_R50_1x.yaml │ ├── FCPose │ │ ├── R_50_3X.yaml │ │ └── R_101_3X.yaml │ └── MEInst-InstanceSegmentation │ │ ├── MEInst_R_50_1x_none.yaml │ │ ├── MEInst_R_50_3x.yaml │ │ ├── MEInst_R_50_1x.yaml │ │ ├── MEInst_R_50_3x_512.yaml │ │ └── Base-MEInst.yaml └── tools │ └── remove_optim_from_ckpt.py └── MaskRefineNet └── network └── __init__.py /detectron2/tools/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /AdelaiDet/adet/utils/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /AdelaiDet/docs/.gitignore: -------------------------------------------------------------------------------- 1 | _build -------------------------------------------------------------------------------- /detectron2/tests/data/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /AdelaiDet/onnx/.gitignore: -------------------------------------------------------------------------------- 1 | ncnn 2 | -------------------------------------------------------------------------------- /detectron2/docs/.gitignore: -------------------------------------------------------------------------------- 1 | _build 2 | -------------------------------------------------------------------------------- /detectron2/tests/layers/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /detectron2/tests/modeling/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /detectron2/tests/tracking/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /detectron2/tests/structures/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /AdelaiDet/adet/modeling/roi_heads/__init__.py: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /detectron2/docs/tutorials/install.md: -------------------------------------------------------------------------------- 1 | ../../INSTALL.md -------------------------------------------------------------------------------- /detectron2/projects/DensePose/densepose/utils/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /detectron2/projects/DensePose/densepose/vis/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /AdelaiDet/adet/modeling/fcos/__init__.py: -------------------------------------------------------------------------------- 1 | from .fcos import FCOS 2 | -------------------------------------------------------------------------------- /AdelaiDet/adet/structures/__init__.py: -------------------------------------------------------------------------------- 1 | from .beziers import Beziers -------------------------------------------------------------------------------- /detectron2/docs/notes/contributing.md: -------------------------------------------------------------------------------- 1 | ../../.github/CONTRIBUTING.md -------------------------------------------------------------------------------- /detectron2/docs/tutorials/getting_started.md: -------------------------------------------------------------------------------- 1 | ../../GETTING_STARTED.md -------------------------------------------------------------------------------- /AdelaiDet/adet/modeling/batext/__init__.py: -------------------------------------------------------------------------------- 1 | from .batext import BAText 2 | -------------------------------------------------------------------------------- /AdelaiDet/adet/modeling/solov2/__init__.py: -------------------------------------------------------------------------------- 1 | from .solov2 import SOLOv2 2 | -------------------------------------------------------------------------------- /MaskRefineNet/network/__init__.py: -------------------------------------------------------------------------------- 1 | from .unet import UNet_ResNet101 2 | -------------------------------------------------------------------------------- /detectron2/docs/tutorials/builtin_datasets.md: -------------------------------------------------------------------------------- 1 | ../../datasets/README.md -------------------------------------------------------------------------------- /detectron2/tests/config/dir1/bad_import2.py: -------------------------------------------------------------------------------- 1 | from .does_not_exist import x 2 | -------------------------------------------------------------------------------- /AdelaiDet/adet/modeling/condinst/__init__.py: -------------------------------------------------------------------------------- 1 | from .condinst import CondInst 2 | -------------------------------------------------------------------------------- /AdelaiDet/adet/modeling/fcpose/__init__.py: -------------------------------------------------------------------------------- 1 | from .fcpose_framework import FCPose 2 | -------------------------------------------------------------------------------- /detectron2/tests/__init__.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) Facebook, Inc. and its affiliates. 2 | -------------------------------------------------------------------------------- /AdelaiDet/adet/__init__.py: -------------------------------------------------------------------------------- 1 | from adet import modeling 2 | 3 | __version__ = "0.1.1" 4 | -------------------------------------------------------------------------------- /detectron2/detectron2/utils/__init__.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) Facebook, Inc. and its affiliates. 2 | -------------------------------------------------------------------------------- /detectron2/projects/TensorMask/tests/__init__.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) Facebook, Inc. and its affiliates. 2 | -------------------------------------------------------------------------------- /AdelaiDet/adet/config/__init__.py: -------------------------------------------------------------------------------- 1 | from .config import get_cfg 2 | 3 | __all__ = [ 4 | "get_cfg", 5 | ] 6 | -------------------------------------------------------------------------------- /detectron2/tests/config/dir1/bad_import.py: -------------------------------------------------------------------------------- 1 | # import from directory is not allowed 2 | from . import dir1a 3 | -------------------------------------------------------------------------------- /AdelaiDet/adet/checkpoint/__init__.py: -------------------------------------------------------------------------------- 1 | from .adet_checkpoint import AdetCheckpointer 2 | 3 | __all__ = ["AdetCheckpointer"] 4 | -------------------------------------------------------------------------------- /AdelaiDet/adet/modeling/blendmask/__init__.py: -------------------------------------------------------------------------------- 1 | from .basis_module import build_basis_module 2 | from .blendmask import BlendMask 3 | -------------------------------------------------------------------------------- /detectron2/projects/DensePose/densepose/engine/__init__.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) Facebook, Inc. and its affiliates. 2 | 3 | from .trainer import Trainer 4 | -------------------------------------------------------------------------------- /AdelaiDet/configs/BAText/ICDAR2015/Base-ic15.yaml: -------------------------------------------------------------------------------- 1 | _BASE_: "../Base-BAText.yaml" 2 | DATASETS: 3 | TRAIN: ("icdar2015_train",) 4 | TEST: ("icdar2015_test",) -------------------------------------------------------------------------------- /detectron2/detectron2/projects/README.md: -------------------------------------------------------------------------------- 1 | 2 | Projects live in the [`projects` directory](../../projects) under the root of this repository, but not here. 3 | -------------------------------------------------------------------------------- /detectron2/tests/config/dir1/dir1_a.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) Facebook, Inc. and its affiliates. 2 | dir1a_str = "base_a_1" 3 | dir1a_dict = {"a": 1, "b": 2} 4 | -------------------------------------------------------------------------------- /AdelaiDet/configs/BAText/TotalText/Base-TotalText.yaml: -------------------------------------------------------------------------------- 1 | _BASE_: "../Base-BAText.yaml" 2 | DATASETS: 3 | TRAIN: ("totaltext_train",) 4 | TEST: ("totaltext_val",) -------------------------------------------------------------------------------- /AdelaiDet/configs/BAText/ReCTS/Base-ReCTS.yaml: -------------------------------------------------------------------------------- 1 | _BASE_: "../Base-BAText.yaml" 2 | DATASETS: 3 | TRAIN: ("rects_train", "rects_val") 4 | TEST: ("rects_test",) 5 | -------------------------------------------------------------------------------- /detectron2/projects/DensePose/densepose/data/transform/__init__.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) Facebook, Inc. and its affiliates. 2 | 3 | from .image import ImageResizeTransform 4 | -------------------------------------------------------------------------------- /detectron2/projects/DensePose/densepose/evaluation/__init__.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) Facebook, Inc. and its affiliates. 2 | 3 | from .evaluator import DensePoseCOCOEvaluator 4 | -------------------------------------------------------------------------------- /detectron2/projects/PointSup/configs/mask_rcnn_R_50_FPN_3x_point_sup_point_aug_coco.yaml: -------------------------------------------------------------------------------- 1 | _BASE_: "mask_rcnn_R_50_FPN_3x_point_sup_coco.yaml" 2 | INPUT: 3 | SAMPLE_POINTS: 5 4 | -------------------------------------------------------------------------------- /AdelaiDet/docs/modules/data.rst: -------------------------------------------------------------------------------- 1 | adet.data package 2 | ======================= 3 | 4 | .. automodule:: adet.data 5 | :members: 6 | :undoc-members: 7 | :show-inheritance: -------------------------------------------------------------------------------- /AdelaiDet/docs/modules/layers.rst: -------------------------------------------------------------------------------- 1 | adet.layers package 2 | ========================= 3 | 4 | .. automodule:: adet.layers 5 | :members: 6 | :undoc-members: 7 | :show-inheritance: -------------------------------------------------------------------------------- /detectron2/projects/TensorMask/tensormask/__init__.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) Facebook, Inc. and its affiliates. 2 | from .config import add_tensormask_config 3 | from .arch import TensorMask 4 | -------------------------------------------------------------------------------- /AdelaiDet/adet/layers/csrc/cuda_version.cu: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | namespace adet { 4 | int get_cudart_version() { 5 | return CUDART_VERSION; 6 | } 7 | } // namespace adet 8 | -------------------------------------------------------------------------------- /AdelaiDet/configs/PointWSSIS/R101_teacher.yaml: -------------------------------------------------------------------------------- 1 | _BASE_: "Base-PointWSSIS.yaml" 2 | MODEL: 3 | WEIGHTS: "detectron2://ImageNetPretrained/MSRA/R-101.pkl" 4 | RESNETS: 5 | DEPTH: 101 6 | -------------------------------------------------------------------------------- /detectron2/detectron2/layers/csrc/README.md: -------------------------------------------------------------------------------- 1 | 2 | 3 | To add a new Op: 4 | 5 | 1. Create a new directory 6 | 2. Implement new ops there 7 | 3. Delcare its Python interface in `vision.cpp`. 8 | -------------------------------------------------------------------------------- /AdelaiDet/adet/modeling/MEInst/__init__.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved 2 | from .MEInst import MEInst 3 | from .MaskEncoding import PCAMaskEncoding 4 | -------------------------------------------------------------------------------- /AdelaiDet/docs/modules/index.rst: -------------------------------------------------------------------------------- 1 | API Documentation 2 | ================== 3 | 4 | .. toctree:: 5 | 6 | checkpoint 7 | config 8 | data 9 | layers 10 | modeling 11 | utils -------------------------------------------------------------------------------- /detectron2/.github/ISSUE_TEMPLATE.md: -------------------------------------------------------------------------------- 1 | 2 | Please select an issue template from 3 | https://github.com/facebookresearch/detectron2/issues/new/choose . 4 | 5 | Otherwise your issue will be closed. 6 | -------------------------------------------------------------------------------- /detectron2/docs/modules/layers.rst: -------------------------------------------------------------------------------- 1 | detectron2.layers 2 | ========================= 3 | 4 | .. automodule:: detectron2.layers 5 | :members: 6 | :undoc-members: 7 | :show-inheritance: 8 | -------------------------------------------------------------------------------- /detectron2/docs/modules/solver.rst: -------------------------------------------------------------------------------- 1 | detectron2.solver 2 | ========================= 3 | 4 | .. automodule:: detectron2.solver 5 | :members: 6 | :undoc-members: 7 | :show-inheritance: 8 | -------------------------------------------------------------------------------- /detectron2/tests/config/dir1/load_rel.py: -------------------------------------------------------------------------------- 1 | # test that load_rel can work 2 | from detectron2.config import LazyConfig 3 | 4 | x = LazyConfig.load_rel("dir1_a.py", "dir1a_dict") 5 | assert x["a"] == 1 6 | -------------------------------------------------------------------------------- /AdelaiDet/docs/modules/checkpoint.rst: -------------------------------------------------------------------------------- 1 | adet.checkpoint package 2 | ============================= 3 | 4 | .. automodule:: adet.checkpoint 5 | :members: 6 | :undoc-members: 7 | :show-inheritance: -------------------------------------------------------------------------------- /detectron2/configs/COCO-Detection/retinanet_R_50_FPN_1x.yaml: -------------------------------------------------------------------------------- 1 | _BASE_: "../Base-RetinaNet.yaml" 2 | MODEL: 3 | WEIGHTS: "detectron2://ImageNetPretrained/MSRA/R-50.pkl" 4 | RESNETS: 5 | DEPTH: 50 6 | -------------------------------------------------------------------------------- /detectron2/projects/TensorMask/configs/tensormask_R_50_FPN_1x.yaml: -------------------------------------------------------------------------------- 1 | _BASE_: "Base-TensorMask.yaml" 2 | MODEL: 3 | WEIGHTS: "detectron2://ImageNetPretrained/MSRA/R-50.pkl" 4 | RESNETS: 5 | DEPTH: 50 6 | -------------------------------------------------------------------------------- /detectron2/configs/COCO-Keypoints/keypoint_rcnn_R_50_FPN_1x.yaml: -------------------------------------------------------------------------------- 1 | _BASE_: "Base-Keypoint-RCNN-FPN.yaml" 2 | MODEL: 3 | WEIGHTS: "detectron2://ImageNetPretrained/MSRA/R-50.pkl" 4 | RESNETS: 5 | DEPTH: 50 6 | -------------------------------------------------------------------------------- /detectron2/docs/modules/model_zoo.rst: -------------------------------------------------------------------------------- 1 | detectron2.model_zoo 2 | ============================ 3 | 4 | .. automodule:: detectron2.model_zoo 5 | :members: 6 | :undoc-members: 7 | :show-inheritance: 8 | -------------------------------------------------------------------------------- /AdelaiDet/configs/BlendMask/RT_R_50_4x_bn-head_syncbn_shtw.yaml: -------------------------------------------------------------------------------- 1 | _BASE_: "RT_R_50_4x_syncbn_shtw.yaml" 2 | MODEL: 3 | FCOS: 4 | NORM: "SyncBN" 5 | OUTPUT_DIR: "output/blendmask/RT_R_50_4x_bn-head_syncbn_shtw" 6 | -------------------------------------------------------------------------------- /detectron2/configs/COCO-PanopticSegmentation/panoptic_fpn_R_50_1x.yaml: -------------------------------------------------------------------------------- 1 | _BASE_: "Base-Panoptic-FPN.yaml" 2 | MODEL: 3 | WEIGHTS: "detectron2://ImageNetPretrained/MSRA/R-50.pkl" 4 | RESNETS: 5 | DEPTH: 50 6 | -------------------------------------------------------------------------------- /detectron2/docs/modules/checkpoint.rst: -------------------------------------------------------------------------------- 1 | detectron2.checkpoint 2 | ============================= 3 | 4 | .. automodule:: detectron2.checkpoint 5 | :members: 6 | :undoc-members: 7 | :show-inheritance: 8 | -------------------------------------------------------------------------------- /detectron2/docs/modules/evaluation.rst: -------------------------------------------------------------------------------- 1 | detectron2.evaluation 2 | ============================= 3 | 4 | .. automodule:: detectron2.evaluation 5 | :members: 6 | :undoc-members: 7 | :show-inheritance: 8 | -------------------------------------------------------------------------------- /detectron2/docs/modules/structures.rst: -------------------------------------------------------------------------------- 1 | detectron2.structures 2 | ============================= 3 | 4 | .. automodule:: detectron2.structures 5 | :members: 6 | :undoc-members: 7 | :show-inheritance: 8 | -------------------------------------------------------------------------------- /detectron2/docs/notes/index.rst: -------------------------------------------------------------------------------- 1 | Notes 2 | ====================================== 3 | 4 | .. toctree:: 5 | :maxdepth: 2 6 | 7 | benchmarks 8 | compatibility 9 | contributing 10 | changelog 11 | -------------------------------------------------------------------------------- /AdelaiDet/configs/BAText/Pretrain/Base-Chn-Pretrain.yaml: -------------------------------------------------------------------------------- 1 | _BASE_: "../Base-BAText.yaml" 2 | DATASETS: 3 | TRAIN: ("chnsyn_train", "rects_train", "rects_val", "lsvt_train", "art_train", ) 4 | TEST: ("rects_test", ) 5 | -------------------------------------------------------------------------------- /AdelaiDet/configs/BAText/Pretrain/Base-Pretrain.yaml: -------------------------------------------------------------------------------- 1 | _BASE_: "../Base-BAText.yaml" 2 | DATASETS: 3 | TRAIN: ("mltbezier_word_train", "totaltext_train", "syntext1_train", "syntext2_train",) 4 | TEST: ("totaltext_val",) -------------------------------------------------------------------------------- /AdelaiDet/configs/BlendMask/550_R_50_1x.yaml: -------------------------------------------------------------------------------- 1 | _BASE_: "Base-550.yaml" 2 | MODEL: 3 | WEIGHTS: "detectron2://ImageNetPretrained/MSRA/R-50.pkl" 4 | RESNETS: 5 | DEPTH: 50 6 | OUTPUT_DIR: "output/blendmask/550_R_50_1x" 7 | -------------------------------------------------------------------------------- /AdelaiDet/configs/BlendMask/R_50_1x.yaml: -------------------------------------------------------------------------------- 1 | _BASE_: "Base-BlendMask.yaml" 2 | MODEL: 3 | WEIGHTS: "detectron2://ImageNetPretrained/MSRA/R-50.pkl" 4 | RESNETS: 5 | DEPTH: 50 6 | OUTPUT_DIR: "output/blendmask/R_50_1x" 7 | -------------------------------------------------------------------------------- /AdelaiDet/configs/BoxInst/MS_R_101_1x.yaml: -------------------------------------------------------------------------------- 1 | _BASE_: "Base-BoxInst.yaml" 2 | MODEL: 3 | WEIGHTS: "detectron2://ImageNetPretrained/MSRA/R-101.pkl" 4 | RESNETS: 5 | DEPTH: 101 6 | OUTPUT_DIR: "output/boxinst_MS_R_101_1x" 7 | -------------------------------------------------------------------------------- /AdelaiDet/configs/BoxInst/MS_R_50_1x.yaml: -------------------------------------------------------------------------------- 1 | _BASE_: "Base-BoxInst.yaml" 2 | MODEL: 3 | WEIGHTS: "detectron2://ImageNetPretrained/MSRA/R-50.pkl" 4 | RESNETS: 5 | DEPTH: 50 6 | OUTPUT_DIR: "output/boxinst_MS_R_50_1x" 7 | -------------------------------------------------------------------------------- /AdelaiDet/configs/CondInst/MS_R_50_1x.yaml: -------------------------------------------------------------------------------- 1 | _BASE_: "Base-CondInst.yaml" 2 | MODEL: 3 | WEIGHTS: "detectron2://ImageNetPretrained/MSRA/R-50.pkl" 4 | RESNETS: 5 | DEPTH: 50 6 | OUTPUT_DIR: "output/condinst_MS_R_50_1x" 7 | -------------------------------------------------------------------------------- /AdelaiDet/configs/RCNN/LVIS/R_50_1x.yaml: -------------------------------------------------------------------------------- 1 | _BASE_: "Base-LVIS.yaml" 2 | MODEL: 3 | WEIGHTS: "detectron2://ImageNetPretrained/MSRA/R-50.pkl" 4 | RESNETS: 5 | DEPTH: 50 6 | OUTPUT_DIR: "output/lvis/mask_rcnn/R_50_1x" 7 | -------------------------------------------------------------------------------- /detectron2/configs/COCO-Detection/faster_rcnn_R_50_C4_1x.yaml: -------------------------------------------------------------------------------- 1 | _BASE_: "../Base-RCNN-C4.yaml" 2 | MODEL: 3 | WEIGHTS: "detectron2://ImageNetPretrained/MSRA/R-50.pkl" 4 | MASK_ON: False 5 | RESNETS: 6 | DEPTH: 50 7 | -------------------------------------------------------------------------------- /detectron2/configs/COCO-Detection/faster_rcnn_R_50_FPN_1x.yaml: -------------------------------------------------------------------------------- 1 | _BASE_: "../Base-RCNN-FPN.yaml" 2 | MODEL: 3 | WEIGHTS: "detectron2://ImageNetPretrained/MSRA/R-50.pkl" 4 | MASK_ON: False 5 | RESNETS: 6 | DEPTH: 50 7 | -------------------------------------------------------------------------------- /AdelaiDet/configs/CondInst/MS_R_101_1x.yaml: -------------------------------------------------------------------------------- 1 | _BASE_: "Base-CondInst.yaml" 2 | MODEL: 3 | WEIGHTS: "detectron2://ImageNetPretrained/MSRA/R-101.pkl" 4 | RESNETS: 5 | DEPTH: 101 6 | OUTPUT_DIR: "output/condinst_MS_R_101_1x" 7 | -------------------------------------------------------------------------------- /detectron2/configs/COCO-Detection/faster_rcnn_R_50_DC5_1x.yaml: -------------------------------------------------------------------------------- 1 | _BASE_: "../Base-RCNN-DilatedC5.yaml" 2 | MODEL: 3 | WEIGHTS: "detectron2://ImageNetPretrained/MSRA/R-50.pkl" 4 | MASK_ON: False 5 | RESNETS: 6 | DEPTH: 50 7 | -------------------------------------------------------------------------------- /detectron2/configs/COCO-InstanceSegmentation/mask_rcnn_R_50_C4_1x.yaml: -------------------------------------------------------------------------------- 1 | _BASE_: "../Base-RCNN-C4.yaml" 2 | MODEL: 3 | WEIGHTS: "detectron2://ImageNetPretrained/MSRA/R-50.pkl" 4 | MASK_ON: True 5 | RESNETS: 6 | DEPTH: 50 7 | -------------------------------------------------------------------------------- /detectron2/detectron2/data/datasets/register_coco.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) Facebook, Inc. and its affiliates. 2 | from .coco import register_coco_instances # noqa 3 | from .coco_panoptic import register_coco_panoptic_separated # noqa 4 | -------------------------------------------------------------------------------- /detectron2/detectron2/utils/README.md: -------------------------------------------------------------------------------- 1 | # Utility functions 2 | 3 | This folder contain utility functions that are not used in the 4 | core library, but are useful for building models or training 5 | code using the config system. 6 | -------------------------------------------------------------------------------- /detectron2/configs/COCO-InstanceSegmentation/mask_rcnn_R_50_FPN_1x.yaml: -------------------------------------------------------------------------------- 1 | _BASE_: "../Base-RCNN-FPN.yaml" 2 | MODEL: 3 | WEIGHTS: "detectron2://ImageNetPretrained/MSRA/R-50.pkl" 4 | MASK_ON: True 5 | RESNETS: 6 | DEPTH: 50 7 | -------------------------------------------------------------------------------- /AdelaiDet/configs/BlendMask/Panoptic/R_50_1x.yaml: -------------------------------------------------------------------------------- 1 | _BASE_: "Base-Panoptic.yaml" 2 | MODEL: 3 | WEIGHTS: "detectron2://ImageNetPretrained/MSRA/R-50.pkl" 4 | RESNETS: 5 | DEPTH: 50 6 | OUTPUT_DIR: "output/panoptic/blendmask/R_50_1x" 7 | -------------------------------------------------------------------------------- /AdelaiDet/configs/SOLOv2/R101_3x.yaml: -------------------------------------------------------------------------------- 1 | _BASE_: "Base-SOLOv2.yaml" 2 | MODEL: 3 | WEIGHTS: "detectron2://ImageNetPretrained/MSRA/R-101.pkl" 4 | RESNETS: 5 | DEPTH: 101 6 | SOLVER: 7 | STEPS: (210000, 250000) 8 | MAX_ITER: 270000 9 | -------------------------------------------------------------------------------- /AdelaiDet/configs/SOLOv2/R50_3x.yaml: -------------------------------------------------------------------------------- 1 | _BASE_: "Base-SOLOv2.yaml" 2 | MODEL: 3 | WEIGHTS: "detectron2://ImageNetPretrained/MSRA/R-50.pkl" 4 | RESNETS: 5 | DEPTH: 50 6 | SOLVER: 7 | STEPS: (210000, 250000) 8 | MAX_ITER: 270000 9 | -------------------------------------------------------------------------------- /detectron2/configs/COCO-InstanceSegmentation/mask_rcnn_R_50_DC5_1x.yaml: -------------------------------------------------------------------------------- 1 | _BASE_: "../Base-RCNN-DilatedC5.yaml" 2 | MODEL: 3 | WEIGHTS: "detectron2://ImageNetPretrained/MSRA/R-50.pkl" 4 | MASK_ON: True 5 | RESNETS: 6 | DEPTH: 50 7 | -------------------------------------------------------------------------------- /detectron2/projects/DensePose/densepose/modeling/losses/registry.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) Facebook, Inc. and its affiliates. 2 | 3 | from detectron2.utils.registry import Registry 4 | 5 | DENSEPOSE_LOSS_REGISTRY = Registry("DENSEPOSE_LOSS") 6 | -------------------------------------------------------------------------------- /detectron2/projects/TridentNet/configs/tridentnet_fast_R_50_C4_1x.yaml: -------------------------------------------------------------------------------- 1 | _BASE_: "Base-TridentNet-Fast-C4.yaml" 2 | MODEL: 3 | WEIGHTS: "detectron2://ImageNetPretrained/MSRA/R-50.pkl" 4 | MASK_ON: False 5 | RESNETS: 6 | DEPTH: 50 7 | -------------------------------------------------------------------------------- /detectron2/projects/DensePose/densepose/modeling/roi_heads/registry.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) Facebook, Inc. and its affiliates. 2 | 3 | from detectron2.utils.registry import Registry 4 | 5 | ROI_DENSEPOSE_HEAD_REGISTRY = Registry("ROI_DENSEPOSE_HEAD") 6 | -------------------------------------------------------------------------------- /detectron2/projects/Rethinking-BatchNorm/configs/mask_rcnn_SyncBNhead.py: -------------------------------------------------------------------------------- 1 | from .mask_rcnn_BNhead import model, dataloader, lr_multiplier, optimizer, train 2 | 3 | model.roi_heads.box_head.conv_norm = model.roi_heads.mask_head.conv_norm = "SyncBN" 4 | -------------------------------------------------------------------------------- /detectron2/projects/TensorMask/tensormask/layers/__init__.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) Facebook, Inc. and its affiliates. 2 | from .swap_align2nat import SwapAlign2Nat, swap_align2nat 3 | 4 | __all__ = [k for k in globals().keys() if not k.startswith("_")] 5 | -------------------------------------------------------------------------------- /detectron2/projects/DensePose/densepose/modeling/predictors/registry.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) Facebook, Inc. and its affiliates. 2 | 3 | from detectron2.utils.registry import Registry 4 | 5 | DENSEPOSE_PREDICTOR_REGISTRY = Registry("DENSEPOSE_PREDICTOR") 6 | -------------------------------------------------------------------------------- /AdelaiDet/configs/FCOS-Detection/R_50_1x.yaml: -------------------------------------------------------------------------------- 1 | _BASE_: "Base-FCOS.yaml" 2 | MODEL: 3 | WEIGHTS: "detectron2://ImageNetPretrained/MSRA/R-50.pkl" 4 | RESNETS: 5 | DEPTH: 50 6 | INPUT: 7 | MIN_SIZE_TRAIN: (800,) 8 | OUTPUT_DIR: "output/fcos/R_50_1x" 9 | -------------------------------------------------------------------------------- /AdelaiDet/adet/data/__init__.py: -------------------------------------------------------------------------------- 1 | from . import builtin # ensure the builtin datasets are registered 2 | from .dataset_mapper import DatasetMapperWithBasis 3 | from .fcpose_dataset_mapper import FCPoseDatasetMapper 4 | 5 | 6 | __all__ = ["DatasetMapperWithBasis"] 7 | -------------------------------------------------------------------------------- /AdelaiDet/configs/BAText/Pretrain/Base-Pretrain-ic15.yaml: -------------------------------------------------------------------------------- 1 | _BASE_: "../Base-BAText.yaml" 2 | DATASETS: 3 | TRAIN: ("mltbezier_word_train", "totaltext_train", "syntext1_train", "syntext2_train", "icdar2013_train", "icdar2015_train") 4 | TEST: ("icdar2015_test",) -------------------------------------------------------------------------------- /AdelaiDet/configs/BlendMask/Person/Base-Person.yaml: -------------------------------------------------------------------------------- 1 | _BASE_: "../Base-BlendMask.yaml" 2 | MODEL: 3 | BASIS_MODULE: 4 | NUM_CLASSES: 1 5 | FCOS: 6 | NUM_CLASSES: 1 7 | DATASETS: 8 | TRAIN: ("pic_person_train",) 9 | TEST: ("pic_person_val",) 10 | -------------------------------------------------------------------------------- /AdelaiDet/configs/BlendMask/Person/R_50_1x.yaml: -------------------------------------------------------------------------------- 1 | _BASE_: "Base-Person.yaml" 2 | MODEL: 3 | WEIGHTS: "https://cloudstor.aarnet.edu.au/plus/s/9u1cG2zXvEva5SM/download#R_50_3x.pth" 4 | RESNETS: 5 | DEPTH: 50 6 | OUTPUT_DIR: "output/person/blendmask/R_50_1x" 7 | -------------------------------------------------------------------------------- /detectron2/docs/modules/export.rst: -------------------------------------------------------------------------------- 1 | detectron2.export 2 | ========================= 3 | 4 | Related tutorial: :doc:`../tutorials/deployment`. 5 | 6 | .. automodule:: detectron2.export 7 | :members: 8 | :undoc-members: 9 | :show-inheritance: 10 | -------------------------------------------------------------------------------- /detectron2/docs/tutorials/README.md: -------------------------------------------------------------------------------- 1 | # Read the docs: 2 | 3 | The latest documentation built from this directory is available at [detectron2.readthedocs.io](https://detectron2.readthedocs.io/). 4 | Documents in this directory are not meant to be read on github. 5 | -------------------------------------------------------------------------------- /detectron2/projects/DensePose/densepose/data/meshes/__init__.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved 2 | 3 | from . import builtin 4 | 5 | __all__ = [k for k in globals().keys() if "builtin" not in k and not k.startswith("_")] 6 | -------------------------------------------------------------------------------- /detectron2/projects/MViTv2/configs/cascade_mask_rcnn_mvitv2_b_in21k_3x.py: -------------------------------------------------------------------------------- 1 | from .cascade_mask_rcnn_mvitv2_b_3x import model, dataloader, optimizer, lr_multiplier, train 2 | 3 | train.init_checkpoint = "detectron2://ImageNetPretrained/mvitv2/MViTv2_B_in21k.pyth" 4 | -------------------------------------------------------------------------------- /detectron2/tests/README.md: -------------------------------------------------------------------------------- 1 | ## Unit Tests 2 | 3 | To run the unittests, do: 4 | ``` 5 | cd detectron2 6 | python -m unittest discover -v -s ./tests 7 | ``` 8 | 9 | There are also end-to-end inference & training tests, in [dev/run_*_tests.sh](../dev). 10 | -------------------------------------------------------------------------------- /AdelaiDet/configs/RCNN/R_101_3x.yaml: -------------------------------------------------------------------------------- 1 | _BASE_: "Base-RCNN.yaml" 2 | MODEL: 3 | WEIGHTS: "detectron2://ImageNetPretrained/MSRA/R-101.pkl" 4 | MASK_ON: True 5 | RESNETS: 6 | DEPTH: 101 7 | SOLVER: 8 | STEPS: (210000, 250000) 9 | MAX_ITER: 270000 10 | -------------------------------------------------------------------------------- /detectron2/configs/COCO-Detection/retinanet_R_101_FPN_3x.yaml: -------------------------------------------------------------------------------- 1 | _BASE_: "../Base-RetinaNet.yaml" 2 | MODEL: 3 | WEIGHTS: "detectron2://ImageNetPretrained/MSRA/R-101.pkl" 4 | RESNETS: 5 | DEPTH: 101 6 | SOLVER: 7 | STEPS: (210000, 250000) 8 | MAX_ITER: 270000 9 | -------------------------------------------------------------------------------- /detectron2/configs/COCO-Detection/retinanet_R_50_FPN_3x.yaml: -------------------------------------------------------------------------------- 1 | _BASE_: "../Base-RetinaNet.yaml" 2 | MODEL: 3 | WEIGHTS: "detectron2://ImageNetPretrained/MSRA/R-50.pkl" 4 | RESNETS: 5 | DEPTH: 50 6 | SOLVER: 7 | STEPS: (210000, 250000) 8 | MAX_ITER: 270000 9 | -------------------------------------------------------------------------------- /AdelaiDet/adet/evaluation/__init__.py: -------------------------------------------------------------------------------- 1 | from .text_evaluation_all import TextEvaluator 2 | from .text_eval_script import text_eval_main 3 | from .text_eval_script_ic15 import text_eval_main_ic15 4 | from . import rrc_evaluation_funcs 5 | from . import rrc_evaluation_funcs_ic15 -------------------------------------------------------------------------------- /detectron2/configs/COCO-Keypoints/keypoint_rcnn_R_50_FPN_3x.yaml: -------------------------------------------------------------------------------- 1 | _BASE_: "Base-Keypoint-RCNN-FPN.yaml" 2 | MODEL: 3 | WEIGHTS: "detectron2://ImageNetPretrained/MSRA/R-50.pkl" 4 | RESNETS: 5 | DEPTH: 50 6 | SOLVER: 7 | STEPS: (210000, 250000) 8 | MAX_ITER: 270000 9 | -------------------------------------------------------------------------------- /detectron2/configs/new_baselines/mask_rcnn_R_101_FPN_100ep_LSJ.py: -------------------------------------------------------------------------------- 1 | from .mask_rcnn_R_50_FPN_100ep_LSJ import ( 2 | dataloader, 3 | lr_multiplier, 4 | model, 5 | optimizer, 6 | train, 7 | ) 8 | 9 | model.backbone.bottom_up.stages.depth = 101 10 | -------------------------------------------------------------------------------- /detectron2/configs/COCO-Keypoints/keypoint_rcnn_R_101_FPN_3x.yaml: -------------------------------------------------------------------------------- 1 | _BASE_: "Base-Keypoint-RCNN-FPN.yaml" 2 | MODEL: 3 | WEIGHTS: "detectron2://ImageNetPretrained/MSRA/R-101.pkl" 4 | RESNETS: 5 | DEPTH: 101 6 | SOLVER: 7 | STEPS: (210000, 250000) 8 | MAX_ITER: 270000 9 | -------------------------------------------------------------------------------- /detectron2/configs/COCO-PanopticSegmentation/panoptic_fpn_R_101_3x.yaml: -------------------------------------------------------------------------------- 1 | _BASE_: "Base-Panoptic-FPN.yaml" 2 | MODEL: 3 | WEIGHTS: "detectron2://ImageNetPretrained/MSRA/R-101.pkl" 4 | RESNETS: 5 | DEPTH: 101 6 | SOLVER: 7 | STEPS: (210000, 250000) 8 | MAX_ITER: 270000 9 | -------------------------------------------------------------------------------- /detectron2/configs/COCO-PanopticSegmentation/panoptic_fpn_R_50_3x.yaml: -------------------------------------------------------------------------------- 1 | _BASE_: "Base-Panoptic-FPN.yaml" 2 | MODEL: 3 | WEIGHTS: "detectron2://ImageNetPretrained/MSRA/R-50.pkl" 4 | RESNETS: 5 | DEPTH: 50 6 | SOLVER: 7 | STEPS: (210000, 250000) 8 | MAX_ITER: 270000 9 | -------------------------------------------------------------------------------- /detectron2/projects/DensePose/configs/densepose_rcnn_R_101_FPN_s1x.yaml: -------------------------------------------------------------------------------- 1 | _BASE_: "Base-DensePose-RCNN-FPN.yaml" 2 | MODEL: 3 | WEIGHTS: "detectron2://ImageNetPretrained/MSRA/R-101.pkl" 4 | RESNETS: 5 | DEPTH: 101 6 | SOLVER: 7 | MAX_ITER: 130000 8 | STEPS: (100000, 120000) 9 | -------------------------------------------------------------------------------- /detectron2/projects/DensePose/configs/densepose_rcnn_R_50_FPN_s1x.yaml: -------------------------------------------------------------------------------- 1 | _BASE_: "Base-DensePose-RCNN-FPN.yaml" 2 | MODEL: 3 | WEIGHTS: "detectron2://ImageNetPretrained/MSRA/R-50.pkl" 4 | RESNETS: 5 | DEPTH: 50 6 | SOLVER: 7 | MAX_ITER: 130000 8 | STEPS: (100000, 120000) 9 | -------------------------------------------------------------------------------- /AdelaiDet/configs/FCOS-Detection/MS_R_50_2x.yaml: -------------------------------------------------------------------------------- 1 | _BASE_: "Base-FCOS.yaml" 2 | MODEL: 3 | WEIGHTS: "detectron2://ImageNetPretrained/MSRA/R-50.pkl" 4 | RESNETS: 5 | DEPTH: 50 6 | SOLVER: 7 | STEPS: (120000, 160000) 8 | MAX_ITER: 180000 9 | OUTPUT_DIR: "output/fcos/R_50_2x" 10 | -------------------------------------------------------------------------------- /detectron2/projects/DensePose/densepose/data/datasets/__init__.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) Facebook, Inc. and its affiliates. 2 | 3 | from . import builtin # ensure the builtin datasets are registered 4 | 5 | __all__ = [k for k in globals().keys() if "builtin" not in k and not k.startswith("_")] 6 | -------------------------------------------------------------------------------- /AdelaiDet/configs/BlendMask/550_R_50_3x.yaml: -------------------------------------------------------------------------------- 1 | _BASE_: "Base-550.yaml" 2 | MODEL: 3 | WEIGHTS: "detectron2://ImageNetPretrained/MSRA/R-50.pkl" 4 | RESNETS: 5 | DEPTH: 50 6 | SOLVER: 7 | STEPS: (210000, 250000) 8 | MAX_ITER: 270000 9 | OUTPUT_DIR: "output/blendmask/550_R_50_3x" 10 | -------------------------------------------------------------------------------- /AdelaiDet/configs/BlendMask/R_101_3x.yaml: -------------------------------------------------------------------------------- 1 | _BASE_: "Base-BlendMask.yaml" 2 | MODEL: 3 | WEIGHTS: "detectron2://ImageNetPretrained/MSRA/R-101.pkl" 4 | RESNETS: 5 | DEPTH: 101 6 | SOLVER: 7 | STEPS: (210000, 250000) 8 | MAX_ITER: 270000 9 | OUTPUT_DIR: "output/blendmask/R_101_3x" 10 | -------------------------------------------------------------------------------- /AdelaiDet/configs/BlendMask/R_50_3x.yaml: -------------------------------------------------------------------------------- 1 | _BASE_: "Base-BlendMask.yaml" 2 | MODEL: 3 | WEIGHTS: "detectron2://ImageNetPretrained/MSRA/R-50.pkl" 4 | RESNETS: 5 | DEPTH: 50 6 | SOLVER: 7 | STEPS: (210000, 250000) 8 | MAX_ITER: 270000 9 | OUTPUT_DIR: "output/blendmask/R_50_3x" 10 | -------------------------------------------------------------------------------- /AdelaiDet/configs/BoxInst/MS_R_101_3x.yaml: -------------------------------------------------------------------------------- 1 | _BASE_: "Base-BoxInst.yaml" 2 | MODEL: 3 | WEIGHTS: "detectron2://ImageNetPretrained/MSRA/R-101.pkl" 4 | RESNETS: 5 | DEPTH: 101 6 | SOLVER: 7 | STEPS: (210000, 250000) 8 | MAX_ITER: 270000 9 | OUTPUT_DIR: "output/boxinst_MS_R_101_3x" 10 | -------------------------------------------------------------------------------- /AdelaiDet/configs/BoxInst/MS_R_50_3x.yaml: -------------------------------------------------------------------------------- 1 | _BASE_: "Base-BoxInst.yaml" 2 | MODEL: 3 | WEIGHTS: "detectron2://ImageNetPretrained/MSRA/R-50.pkl" 4 | RESNETS: 5 | DEPTH: 50 6 | SOLVER: 7 | STEPS: (210000, 250000) 8 | MAX_ITER: 270000 9 | OUTPUT_DIR: "output/boxinst_MS_R_50_3x" 10 | -------------------------------------------------------------------------------- /AdelaiDet/configs/CondInst/MS_R_50_3x.yaml: -------------------------------------------------------------------------------- 1 | _BASE_: "Base-CondInst.yaml" 2 | MODEL: 3 | WEIGHTS: "detectron2://ImageNetPretrained/MSRA/R-50.pkl" 4 | RESNETS: 5 | DEPTH: 50 6 | SOLVER: 7 | STEPS: (210000, 250000) 8 | MAX_ITER: 270000 9 | OUTPUT_DIR: "output/condinst_MS_R_50_3x" 10 | -------------------------------------------------------------------------------- /AdelaiDet/configs/DenseCL/FCOS_R50_1x_DenseCL.yaml: -------------------------------------------------------------------------------- 1 | _BASE_: "FCOS_R50_1x.yaml" 2 | MODEL: 3 | PIXEL_MEAN: [123.675, 116.280, 103.530] 4 | PIXEL_STD: [58.395, 57.120, 57.375] 5 | WEIGHTS: "See Instructions" 6 | RESNETS: 7 | STRIDE_IN_1X1: False 8 | INPUT: 9 | FORMAT: "RGB" 10 | -------------------------------------------------------------------------------- /AdelaiDet/configs/DenseCL/SOLOv2_R50_1x_DenseCL.yaml: -------------------------------------------------------------------------------- 1 | _BASE_: "SOLOv2_R50_1x.yaml" 2 | MODEL: 3 | PIXEL_MEAN: [123.675, 116.280, 103.530] 4 | PIXEL_STD: [58.395, 57.120, 57.375] 5 | WEIGHTS: "See Instructions" 6 | RESNETS: 7 | STRIDE_IN_1X1: False 8 | INPUT: 9 | FORMAT: "RGB" 10 | -------------------------------------------------------------------------------- /AdelaiDet/configs/FCOS-Detection/MS_R_101_2x.yaml: -------------------------------------------------------------------------------- 1 | _BASE_: "Base-FCOS.yaml" 2 | MODEL: 3 | WEIGHTS: "detectron2://ImageNetPretrained/MSRA/R-101.pkl" 4 | RESNETS: 5 | DEPTH: 101 6 | SOLVER: 7 | STEPS: (120000, 160000) 8 | MAX_ITER: 180000 9 | OUTPUT_DIR: "output/fcos/R_101_2x" 10 | -------------------------------------------------------------------------------- /detectron2/.github/CODE_OF_CONDUCT.md: -------------------------------------------------------------------------------- 1 | # Code of Conduct 2 | 3 | Facebook has adopted a Code of Conduct that we expect project participants to adhere to. 4 | Please read the [full text](https://code.fb.com/codeofconduct/) 5 | so that you can understand what actions will and will not be tolerated. 6 | -------------------------------------------------------------------------------- /detectron2/configs/COCO-Detection/faster_rcnn_R_101_C4_3x.yaml: -------------------------------------------------------------------------------- 1 | _BASE_: "../Base-RCNN-C4.yaml" 2 | MODEL: 3 | WEIGHTS: "detectron2://ImageNetPretrained/MSRA/R-101.pkl" 4 | MASK_ON: False 5 | RESNETS: 6 | DEPTH: 101 7 | SOLVER: 8 | STEPS: (210000, 250000) 9 | MAX_ITER: 270000 10 | -------------------------------------------------------------------------------- /detectron2/configs/COCO-Detection/faster_rcnn_R_50_C4_3x.yaml: -------------------------------------------------------------------------------- 1 | _BASE_: "../Base-RCNN-C4.yaml" 2 | MODEL: 3 | WEIGHTS: "detectron2://ImageNetPretrained/MSRA/R-50.pkl" 4 | MASK_ON: False 5 | RESNETS: 6 | DEPTH: 50 7 | SOLVER: 8 | STEPS: (210000, 250000) 9 | MAX_ITER: 270000 10 | -------------------------------------------------------------------------------- /detectron2/configs/COCO-Detection/faster_rcnn_R_50_FPN_3x.yaml: -------------------------------------------------------------------------------- 1 | _BASE_: "../Base-RCNN-FPN.yaml" 2 | MODEL: 3 | WEIGHTS: "detectron2://ImageNetPretrained/MSRA/R-50.pkl" 4 | MASK_ON: False 5 | RESNETS: 6 | DEPTH: 50 7 | SOLVER: 8 | STEPS: (210000, 250000) 9 | MAX_ITER: 270000 10 | -------------------------------------------------------------------------------- /detectron2/configs/quick_schedules/mask_rcnn_R_50_FPN_pred_boxes_training_acc_test.yaml: -------------------------------------------------------------------------------- 1 | _BASE_: "./mask_rcnn_R_50_FPN_training_acc_test.yaml" 2 | MODEL: 3 | ROI_BOX_HEAD: 4 | TRAIN_ON_PRED_BOXES: True 5 | TEST: 6 | EXPECTED_RESULTS: [["bbox", "AP", 42.6, 1.0], ["segm", "AP", 35.8, 0.8]] 7 | -------------------------------------------------------------------------------- /detectron2/projects/DensePose/densepose/modeling/cse/__init__.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved 2 | 3 | from .vertex_direct_embedder import VertexDirectEmbedder 4 | from .vertex_feature_embedder import VertexFeatureEmbedder 5 | from .embedder import Embedder 6 | -------------------------------------------------------------------------------- /AdelaiDet/configs/CondInst/MS_R_101_3x.yaml: -------------------------------------------------------------------------------- 1 | _BASE_: "Base-CondInst.yaml" 2 | MODEL: 3 | WEIGHTS: "detectron2://ImageNetPretrained/MSRA/R-101.pkl" 4 | RESNETS: 5 | DEPTH: 101 6 | SOLVER: 7 | STEPS: (210000, 250000) 8 | MAX_ITER: 270000 9 | OUTPUT_DIR: "output/condinst_MS_R_101_3x" 10 | -------------------------------------------------------------------------------- /detectron2/configs/COCO-Detection/faster_rcnn_R_101_FPN_3x.yaml: -------------------------------------------------------------------------------- 1 | _BASE_: "../Base-RCNN-FPN.yaml" 2 | MODEL: 3 | WEIGHTS: "detectron2://ImageNetPretrained/MSRA/R-101.pkl" 4 | MASK_ON: False 5 | RESNETS: 6 | DEPTH: 101 7 | SOLVER: 8 | STEPS: (210000, 250000) 9 | MAX_ITER: 270000 10 | -------------------------------------------------------------------------------- /detectron2/configs/COCO-Detection/faster_rcnn_R_50_DC5_3x.yaml: -------------------------------------------------------------------------------- 1 | _BASE_: "../Base-RCNN-DilatedC5.yaml" 2 | MODEL: 3 | WEIGHTS: "detectron2://ImageNetPretrained/MSRA/R-50.pkl" 4 | MASK_ON: False 5 | RESNETS: 6 | DEPTH: 50 7 | SOLVER: 8 | STEPS: (210000, 250000) 9 | MAX_ITER: 270000 10 | -------------------------------------------------------------------------------- /detectron2/configs/COCO-InstanceSegmentation/mask_rcnn_R_50_C4_3x.yaml: -------------------------------------------------------------------------------- 1 | _BASE_: "../Base-RCNN-C4.yaml" 2 | MODEL: 3 | WEIGHTS: "detectron2://ImageNetPretrained/MSRA/R-50.pkl" 4 | MASK_ON: True 5 | RESNETS: 6 | DEPTH: 50 7 | SOLVER: 8 | STEPS: (210000, 250000) 9 | MAX_ITER: 270000 10 | -------------------------------------------------------------------------------- /detectron2/configs/COCO-Detection/faster_rcnn_R_101_DC5_3x.yaml: -------------------------------------------------------------------------------- 1 | _BASE_: "../Base-RCNN-DilatedC5.yaml" 2 | MODEL: 3 | WEIGHTS: "detectron2://ImageNetPretrained/MSRA/R-101.pkl" 4 | MASK_ON: False 5 | RESNETS: 6 | DEPTH: 101 7 | SOLVER: 8 | STEPS: (210000, 250000) 9 | MAX_ITER: 270000 10 | -------------------------------------------------------------------------------- /detectron2/configs/COCO-InstanceSegmentation/mask_rcnn_R_101_C4_3x.yaml: -------------------------------------------------------------------------------- 1 | _BASE_: "../Base-RCNN-C4.yaml" 2 | MODEL: 3 | WEIGHTS: "detectron2://ImageNetPretrained/MSRA/R-101.pkl" 4 | MASK_ON: True 5 | RESNETS: 6 | DEPTH: 101 7 | SOLVER: 8 | STEPS: (210000, 250000) 9 | MAX_ITER: 270000 10 | -------------------------------------------------------------------------------- /detectron2/configs/COCO-InstanceSegmentation/mask_rcnn_R_101_FPN_3x.yaml: -------------------------------------------------------------------------------- 1 | _BASE_: "../Base-RCNN-FPN.yaml" 2 | MODEL: 3 | WEIGHTS: "detectron2://ImageNetPretrained/MSRA/R-101.pkl" 4 | MASK_ON: True 5 | RESNETS: 6 | DEPTH: 101 7 | SOLVER: 8 | STEPS: (210000, 250000) 9 | MAX_ITER: 270000 10 | -------------------------------------------------------------------------------- /detectron2/configs/COCO-InstanceSegmentation/mask_rcnn_R_50_FPN_3x.yaml: -------------------------------------------------------------------------------- 1 | _BASE_: "../Base-RCNN-FPN.yaml" 2 | MODEL: 3 | WEIGHTS: "detectron2://ImageNetPretrained/MSRA/R-50.pkl" 4 | MASK_ON: True 5 | RESNETS: 6 | DEPTH: 50 7 | SOLVER: 8 | STEPS: (210000, 250000) 9 | MAX_ITER: 270000 10 | -------------------------------------------------------------------------------- /detectron2/detectron2/modeling/proposal_generator/__init__.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) Facebook, Inc. and its affiliates. 2 | from .build import PROPOSAL_GENERATOR_REGISTRY, build_proposal_generator 3 | from .rpn import RPN_HEAD_REGISTRY, build_rpn_head, RPN, StandardRPNHead 4 | 5 | __all__ = list(globals().keys()) 6 | -------------------------------------------------------------------------------- /detectron2/projects/DeepLab/deeplab/__init__.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) Facebook, Inc. and its affiliates. 2 | from .build_solver import build_lr_scheduler 3 | from .config import add_deeplab_config 4 | from .resnet import build_resnet_deeplab_backbone 5 | from .semantic_seg import DeepLabV3Head, DeepLabV3PlusHead 6 | -------------------------------------------------------------------------------- /AdelaiDet/configs/BlendMask/Panoptic/R_50_3x.yaml: -------------------------------------------------------------------------------- 1 | _BASE_: "Base-Panoptic.yaml" 2 | MODEL: 3 | WEIGHTS: "detectron2://ImageNetPretrained/MSRA/R-50.pkl" 4 | RESNETS: 5 | DEPTH: 50 6 | SOLVER: 7 | STEPS: (210000, 250000) 8 | MAX_ITER: 270000 9 | OUTPUT_DIR: "output/panoptic/blendmask/R_50_3x" 10 | -------------------------------------------------------------------------------- /AdelaiDet/configs/FCOS-Detection/R_50_1x_iou.yaml: -------------------------------------------------------------------------------- 1 | _BASE_: "Base-FCOS.yaml" 2 | MODEL: 3 | WEIGHTS: "detectron2://ImageNetPretrained/MSRA/R-50.pkl" 4 | RESNETS: 5 | DEPTH: 50 6 | FCOS: 7 | BOX_QUALITY: "iou" 8 | INPUT: 9 | MIN_SIZE_TRAIN: (800,) 10 | OUTPUT_DIR: "output/fcos/R_50_1x_iou" 11 | -------------------------------------------------------------------------------- /detectron2/configs/COCO-Detection/rpn_R_50_FPN_1x.yaml: -------------------------------------------------------------------------------- 1 | _BASE_: "../Base-RCNN-FPN.yaml" 2 | MODEL: 3 | META_ARCHITECTURE: "ProposalNetwork" 4 | WEIGHTS: "detectron2://ImageNetPretrained/MSRA/R-50.pkl" 5 | MASK_ON: False 6 | RESNETS: 7 | DEPTH: 50 8 | RPN: 9 | POST_NMS_TOPK_TEST: 2000 10 | -------------------------------------------------------------------------------- /detectron2/configs/COCO-InstanceSegmentation/mask_rcnn_R_101_DC5_3x.yaml: -------------------------------------------------------------------------------- 1 | _BASE_: "../Base-RCNN-DilatedC5.yaml" 2 | MODEL: 3 | WEIGHTS: "detectron2://ImageNetPretrained/MSRA/R-101.pkl" 4 | MASK_ON: True 5 | RESNETS: 6 | DEPTH: 101 7 | SOLVER: 8 | STEPS: (210000, 250000) 9 | MAX_ITER: 270000 10 | -------------------------------------------------------------------------------- /detectron2/configs/COCO-InstanceSegmentation/mask_rcnn_R_50_DC5_3x.yaml: -------------------------------------------------------------------------------- 1 | _BASE_: "../Base-RCNN-DilatedC5.yaml" 2 | MODEL: 3 | WEIGHTS: "detectron2://ImageNetPretrained/MSRA/R-50.pkl" 4 | MASK_ON: True 5 | RESNETS: 6 | DEPTH: 50 7 | SOLVER: 8 | STEPS: (210000, 250000) 9 | MAX_ITER: 270000 10 | -------------------------------------------------------------------------------- /detectron2/projects/TridentNet/configs/tridentnet_fast_R_50_C4_3x.yaml: -------------------------------------------------------------------------------- 1 | _BASE_: "Base-TridentNet-Fast-C4.yaml" 2 | MODEL: 3 | WEIGHTS: "detectron2://ImageNetPretrained/MSRA/R-50.pkl" 4 | MASK_ON: False 5 | RESNETS: 6 | DEPTH: 50 7 | SOLVER: 8 | STEPS: (210000, 250000) 9 | MAX_ITER: 270000 10 | -------------------------------------------------------------------------------- /AdelaiDet/adet/config/config.py: -------------------------------------------------------------------------------- 1 | from detectron2.config import CfgNode 2 | 3 | 4 | def get_cfg() -> CfgNode: 5 | """ 6 | Get a copy of the default config. 7 | 8 | Returns: 9 | a detectron2 CfgNode instance. 10 | """ 11 | from .defaults import _C 12 | 13 | return _C.clone() 14 | -------------------------------------------------------------------------------- /AdelaiDet/configs/BlendMask/Panoptic/R_101_3x.yaml: -------------------------------------------------------------------------------- 1 | _BASE_: "Base-Panoptic.yaml" 2 | MODEL: 3 | WEIGHTS: "detectron2://ImageNetPretrained/MSRA/R-101.pkl" 4 | RESNETS: 5 | DEPTH: 101 6 | SOLVER: 7 | STEPS: (210000, 250000) 8 | MAX_ITER: 270000 9 | OUTPUT_DIR: "output/panoptic/blendmask/R_101_3x" 10 | -------------------------------------------------------------------------------- /detectron2/projects/TridentNet/configs/tridentnet_fast_R_101_C4_3x.yaml: -------------------------------------------------------------------------------- 1 | _BASE_: "Base-TridentNet-Fast-C4.yaml" 2 | MODEL: 3 | WEIGHTS: "detectron2://ImageNetPretrained/MSRA/R-101.pkl" 4 | MASK_ON: False 5 | RESNETS: 6 | DEPTH: 101 7 | SOLVER: 8 | STEPS: (210000, 250000) 9 | MAX_ITER: 270000 10 | -------------------------------------------------------------------------------- /AdelaiDet/adet/modeling/backbone/__init__.py: -------------------------------------------------------------------------------- 1 | from .fpn import build_fcos_resnet_fpn_backbone 2 | from .vovnet import build_vovnet_fpn_backbone, build_vovnet_backbone 3 | from .dla import build_fcos_dla_fpn_backbone 4 | from .resnet_lpf import build_resnet_lpf_backbone 5 | from .bifpn import build_fcos_resnet_bifpn_backbone 6 | -------------------------------------------------------------------------------- /AdelaiDet/configs/FCPose/R_50_3X.yaml: -------------------------------------------------------------------------------- 1 | _BASE_: "Base-FCPose.yaml" 2 | SOLVER: 3 | STEPS: (180000, 240000) 4 | MAX_ITER: 270000 5 | MODEL: 6 | FCOS: 7 | NUM_CLASSES: 1 8 | # FCPOSE: 9 | # LOSS_WEIGHT_DIRECTION: 0.0 10 | # LOSS_WEIGHT_KEYPOINT: 0.0 11 | # BASIS_MODULE: 12 | # LOSS_WEIGHT: 0.0 -------------------------------------------------------------------------------- /detectron2/dev/README.md: -------------------------------------------------------------------------------- 1 | 2 | ## Some scripts for developers to use, include: 3 | 4 | - `linter.sh`: lint the codebase before commit. 5 | - `run_{inference,instant}_tests.sh`: run inference/training for a few iterations. 6 | Note that these tests require 2 GPUs. 7 | - `parse_results.sh`: parse results from a log file. 8 | -------------------------------------------------------------------------------- /detectron2/configs/Misc/mask_rcnn_R_50_FPN_1x_dconv_c3-c5.yaml: -------------------------------------------------------------------------------- 1 | _BASE_: "../Base-RCNN-FPN.yaml" 2 | MODEL: 3 | WEIGHTS: "detectron2://ImageNetPretrained/MSRA/R-50.pkl" 4 | MASK_ON: True 5 | RESNETS: 6 | DEPTH: 50 7 | DEFORM_ON_PER_STAGE: [False, True, True, True] # on Res3,Res4,Res5 8 | DEFORM_MODULATED: False 9 | -------------------------------------------------------------------------------- /detectron2/projects/DensePose/densepose/modeling/roi_heads/__init__.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) Facebook, Inc. and its affiliates. 2 | 3 | from .v1convx import DensePoseV1ConvXHead 4 | from .deeplab import DensePoseDeepLabHead 5 | from .registry import ROI_DENSEPOSE_HEAD_REGISTRY 6 | from .roi_head import Decoder, DensePoseROIHeads 7 | -------------------------------------------------------------------------------- /detectron2/docs/modules/data_transforms.rst: -------------------------------------------------------------------------------- 1 | detectron2.data.transforms 2 | ==================================== 3 | 4 | Related tutorial: :doc:`../tutorials/augmentation`. 5 | 6 | .. automodule:: detectron2.data.transforms 7 | :members: 8 | :undoc-members: 9 | :show-inheritance: 10 | :imported-members: 11 | -------------------------------------------------------------------------------- /detectron2/detectron2/__init__.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) Facebook, Inc. and its affiliates. 2 | 3 | from .utils.env import setup_environment 4 | 5 | setup_environment() 6 | 7 | 8 | # This line will be programatically read/write by setup.py. 9 | # Leave them at the bottom of this file and don't touch them. 10 | __version__ = "0.6" 11 | -------------------------------------------------------------------------------- /AdelaiDet/configs/FCPose/R_101_3X.yaml: -------------------------------------------------------------------------------- 1 | _BASE_: "Base-FCPose.yaml" 2 | MODEL: 3 | WEIGHTS: "detectron2://ImageNetPretrained/MSRA/R-101.pkl" 4 | RESNETS: 5 | DEPTH: 101 6 | FCOS: 7 | NUM_CLASSES: 1 8 | SOLVER: 9 | STEPS: (180000, 240000) 10 | MAX_ITER: 270000 11 | # WARMUP_FACTOR: 1.0 / 3000 12 | # WARMUP_ITERS: 3000 -------------------------------------------------------------------------------- /detectron2/configs/COCO-Detection/rpn_R_50_C4_1x.yaml: -------------------------------------------------------------------------------- 1 | _BASE_: "../Base-RCNN-C4.yaml" 2 | MODEL: 3 | META_ARCHITECTURE: "ProposalNetwork" 4 | WEIGHTS: "detectron2://ImageNetPretrained/MSRA/R-50.pkl" 5 | MASK_ON: False 6 | RESNETS: 7 | DEPTH: 50 8 | RPN: 9 | PRE_NMS_TOPK_TEST: 12000 10 | POST_NMS_TOPK_TEST: 2000 11 | -------------------------------------------------------------------------------- /detectron2/configs/Misc/mask_rcnn_R_50_FPN_1x_cls_agnostic.yaml: -------------------------------------------------------------------------------- 1 | _BASE_: "../Base-RCNN-FPN.yaml" 2 | MODEL: 3 | WEIGHTS: "detectron2://ImageNetPretrained/MSRA/R-50.pkl" 4 | MASK_ON: True 5 | RESNETS: 6 | DEPTH: 50 7 | ROI_BOX_HEAD: 8 | CLS_AGNOSTIC_BBOX_REG: True 9 | ROI_MASK_HEAD: 10 | CLS_AGNOSTIC_MASK: True 11 | -------------------------------------------------------------------------------- /AdelaiDet/configs/FCOS-Detection/MS_R_101_2x_iou.yaml: -------------------------------------------------------------------------------- 1 | _BASE_: "Base-FCOS.yaml" 2 | MODEL: 3 | WEIGHTS: "detectron2://ImageNetPretrained/MSRA/R-101.pkl" 4 | RESNETS: 5 | DEPTH: 101 6 | FCOS: 7 | BOX_QUALITY: "iou" 8 | SOLVER: 9 | STEPS: (120000, 160000) 10 | MAX_ITER: 180000 11 | OUTPUT_DIR: "output/fcos/MS_R_101_2x_iou" 12 | -------------------------------------------------------------------------------- /AdelaiDet/configs/FCOS-Detection/MS_R_50_2x_iou.yaml: -------------------------------------------------------------------------------- 1 | _BASE_: "Base-FCOS.yaml" 2 | MODEL: 3 | WEIGHTS: "detectron2://ImageNetPretrained/MSRA/R-50.pkl" 4 | RESNETS: 5 | DEPTH: 50 6 | FCOS: 7 | BOX_QUALITY: "iou" 8 | SOLVER: 9 | STEPS: (120000, 160000) 10 | MAX_ITER: 180000 11 | OUTPUT_DIR: "output/fcos/MS_R_50_2x_iou" 12 | -------------------------------------------------------------------------------- /detectron2/projects/DensePose/configs/quick_schedules/densepose_rcnn_HRFPN_HRNet_w32_instant_test.yaml: -------------------------------------------------------------------------------- 1 | _BASE_: "../HRNet/densepose_rcnn_HRFPN_HRNet_w32_s1x.yaml" 2 | DATASETS: 3 | TRAIN: ("densepose_coco_2014_minival_100",) 4 | TEST: ("densepose_coco_2014_minival_100",) 5 | SOLVER: 6 | MAX_ITER: 40 7 | STEPS: (30,) 8 | IMS_PER_BATCH: 2 9 | -------------------------------------------------------------------------------- /AdelaiDet/configs/DenseCL/FCOS_R50_1x.yaml: -------------------------------------------------------------------------------- 1 | _BASE_: "../FCOS-Detection/Base-FCOS.yaml" 2 | MODEL: 3 | WEIGHTS: "detectron2://ImageNetPretrained/MSRA/R-50.pkl" 4 | BACKBONE: 5 | FREEZE_AT: 0 6 | RESNETS: 7 | DEPTH: 50 8 | NORM: "SyncBN" 9 | FPN: 10 | NORM: "SyncBN" 11 | TEST: 12 | PRECISE_BN: 13 | ENABLED: True 14 | -------------------------------------------------------------------------------- /detectron2/configs/quick_schedules/rpn_R_50_FPN_inference_acc_test.yaml: -------------------------------------------------------------------------------- 1 | _BASE_: "../COCO-Detection/rpn_R_50_FPN_1x.yaml" 2 | MODEL: 3 | WEIGHTS: "detectron2://COCO-Detection/rpn_R_50_FPN_1x/137258492/model_final_02ce48.pkl" 4 | DATASETS: 5 | TEST: ("coco_2017_val_100",) 6 | TEST: 7 | EXPECTED_RESULTS: [["box_proposals", "AR@1000", 58.16, 0.02]] 8 | -------------------------------------------------------------------------------- /detectron2/docs/modules/index.rst: -------------------------------------------------------------------------------- 1 | API Documentation 2 | ================== 3 | 4 | .. toctree:: 5 | 6 | checkpoint 7 | config 8 | data 9 | data_transforms 10 | engine 11 | evaluation 12 | layers 13 | model_zoo 14 | modeling 15 | solver 16 | structures 17 | utils 18 | export 19 | fvcore 20 | -------------------------------------------------------------------------------- /detectron2/projects/DensePose/densepose/data/datasets/dataset_type.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) Facebook, Inc. and its affiliates. 2 | 3 | from enum import Enum 4 | 5 | 6 | class DatasetType(Enum): 7 | """ 8 | Dataset type, mostly used for datasets that contain data to bootstrap models on 9 | """ 10 | 11 | VIDEO_LIST = "video_list" 12 | -------------------------------------------------------------------------------- /detectron2/configs/quick_schedules/fast_rcnn_R_50_FPN_inference_acc_test.yaml: -------------------------------------------------------------------------------- 1 | _BASE_: "../COCO-Detection/fast_rcnn_R_50_FPN_1x.yaml" 2 | MODEL: 3 | WEIGHTS: "detectron2://COCO-Detection/fast_rcnn_R_50_FPN_1x/137635226/model_final_e5f7ce.pkl" 4 | DATASETS: 5 | TEST: ("coco_2017_val_100",) 6 | TEST: 7 | EXPECTED_RESULTS: [["bbox", "AP", 45.70, 0.02]] 8 | -------------------------------------------------------------------------------- /detectron2/configs/quick_schedules/retinanet_R_50_FPN_inference_acc_test.yaml: -------------------------------------------------------------------------------- 1 | _BASE_: "../COCO-Detection/retinanet_R_50_FPN_3x.yaml" 2 | MODEL: 3 | WEIGHTS: "detectron2://COCO-Detection/retinanet_R_50_FPN_3x/190397829/model_final_5bd44e.pkl" 4 | DATASETS: 5 | TEST: ("coco_2017_val_100",) 6 | TEST: 7 | EXPECTED_RESULTS: [["bbox", "AP", 44.45, 0.02]] 8 | -------------------------------------------------------------------------------- /detectron2/projects/DensePose/configs/densepose_rcnn_R_50_FPN_DL_s1x.yaml: -------------------------------------------------------------------------------- 1 | _BASE_: "Base-DensePose-RCNN-FPN.yaml" 2 | MODEL: 3 | WEIGHTS: "detectron2://ImageNetPretrained/MSRA/R-50.pkl" 4 | RESNETS: 5 | DEPTH: 50 6 | ROI_DENSEPOSE_HEAD: 7 | NAME: "DensePoseDeepLabHead" 8 | SOLVER: 9 | MAX_ITER: 130000 10 | STEPS: (100000, 120000) 11 | -------------------------------------------------------------------------------- /detectron2/projects/DensePose/dev/README.md: -------------------------------------------------------------------------------- 1 | 2 | ## Some scripts for developers to use, include: 3 | 4 | - `run_instant_tests.sh`: run training for a few iterations. 5 | - `run_inference_tests.sh`: run inference on a small dataset. 6 | - `../../dev/linter.sh`: lint the codebase before commit 7 | - `../../dev/parse_results.sh`: parse results from log file. 8 | -------------------------------------------------------------------------------- /detectron2/configs/quick_schedules/cascade_mask_rcnn_R_50_FPN_instant_test.yaml: -------------------------------------------------------------------------------- 1 | _BASE_: "../Misc/cascade_mask_rcnn_R_50_FPN_3x.yaml" 2 | DATASETS: 3 | TRAIN: ("coco_2017_val_100",) 4 | TEST: ("coco_2017_val_100",) 5 | SOLVER: 6 | BASE_LR: 0.005 7 | STEPS: (30,) 8 | MAX_ITER: 40 9 | IMS_PER_BATCH: 4 10 | DATALOADER: 11 | NUM_WORKERS: 2 12 | -------------------------------------------------------------------------------- /detectron2/projects/DensePose/configs/densepose_rcnn_R_101_FPN_DL_s1x.yaml: -------------------------------------------------------------------------------- 1 | _BASE_: "Base-DensePose-RCNN-FPN.yaml" 2 | MODEL: 3 | WEIGHTS: "detectron2://ImageNetPretrained/MSRA/R-101.pkl" 4 | RESNETS: 5 | DEPTH: 101 6 | ROI_DENSEPOSE_HEAD: 7 | NAME: "DensePoseDeepLabHead" 8 | SOLVER: 9 | MAX_ITER: 130000 10 | STEPS: (100000, 120000) 11 | -------------------------------------------------------------------------------- /detectron2/projects/TensorMask/configs/tensormask_R_50_FPN_6x.yaml: -------------------------------------------------------------------------------- 1 | _BASE_: "Base-TensorMask.yaml" 2 | MODEL: 3 | WEIGHTS: "detectron2://ImageNetPretrained/MSRA/R-50.pkl" 4 | RESNETS: 5 | DEPTH: 50 6 | SOLVER: 7 | STEPS: (480000, 520000) 8 | MAX_ITER: 540000 9 | INPUT: 10 | MIN_SIZE_TRAIN_SAMPLING: "range" 11 | MIN_SIZE_TRAIN: (640, 800) 12 | -------------------------------------------------------------------------------- /AdelaiDet/configs/BAText/CTW1500/Base-CTW1500.yaml: -------------------------------------------------------------------------------- 1 | _BASE_: "../Base-BAText.yaml" 2 | MODEL: 3 | BATEXT: 4 | POOLER_RESOLUTION: (8,128) 5 | NUM_CHARS: 100 6 | FCOS: 7 | INFERENCE_TH_TEST: 0.6 8 | DATASETS: 9 | TRAIN: ("ctw1500_word_train",) 10 | TEST: ("ctw1500_word_test",) 11 | INPUT: 12 | MIN_SIZE_TEST: 800 13 | MAX_SIZE_TEST: 1024 14 | -------------------------------------------------------------------------------- /detectron2/projects/MViTv2/configs/cascade_mask_rcnn_mvitv2_s_3x.py: -------------------------------------------------------------------------------- 1 | from .cascade_mask_rcnn_mvitv2_t_3x import model, dataloader, optimizer, lr_multiplier, train 2 | 3 | 4 | model.backbone.bottom_up.depth = 16 5 | model.backbone.bottom_up.last_block_indexes = (0, 2, 13, 15) 6 | 7 | train.init_checkpoint = "detectron2://ImageNetPretrained/mvitv2/MViTv2_S_in1k.pyth" 8 | -------------------------------------------------------------------------------- /AdelaiDet/configs/CondInst/MS_R_50_3x_sem.yaml: -------------------------------------------------------------------------------- 1 | _BASE_: "Base-CondInst.yaml" 2 | MODEL: 3 | WEIGHTS: "detectron2://ImageNetPretrained/MSRA/R-50.pkl" 4 | RESNETS: 5 | DEPTH: 50 6 | CONDINST: 7 | MASK_BRANCH: 8 | SEMANTIC_LOSS_ON: True 9 | SOLVER: 10 | STEPS: (210000, 250000) 11 | MAX_ITER: 270000 12 | OUTPUT_DIR: "output/condinst_MS_R_50_3x_sem" 13 | -------------------------------------------------------------------------------- /detectron2/configs/Misc/cascade_mask_rcnn_R_50_FPN_1x.yaml: -------------------------------------------------------------------------------- 1 | _BASE_: "../Base-RCNN-FPN.yaml" 2 | MODEL: 3 | WEIGHTS: "detectron2://ImageNetPretrained/MSRA/R-50.pkl" 4 | MASK_ON: True 5 | RESNETS: 6 | DEPTH: 50 7 | ROI_HEADS: 8 | NAME: CascadeROIHeads 9 | ROI_BOX_HEAD: 10 | CLS_AGNOSTIC_BBOX_REG: True 11 | RPN: 12 | POST_NMS_TOPK_TRAIN: 2000 13 | -------------------------------------------------------------------------------- /AdelaiDet/configs/CondInst/MS_R_101_3x_sem.yaml: -------------------------------------------------------------------------------- 1 | _BASE_: "Base-CondInst.yaml" 2 | MODEL: 3 | WEIGHTS: "detectron2://ImageNetPretrained/MSRA/R-101.pkl" 4 | RESNETS: 5 | DEPTH: 101 6 | CONDINST: 7 | MASK_BRANCH: 8 | SEMANTIC_LOSS_ON: True 9 | SOLVER: 10 | STEPS: (210000, 250000) 11 | MAX_ITER: 270000 12 | OUTPUT_DIR: "output/condinst_MS_R_101_3x_sem" 13 | -------------------------------------------------------------------------------- /detectron2/demo/README.md: -------------------------------------------------------------------------------- 1 | 2 | ## Detectron2 Demo 3 | 4 | We provide a command line tool to run a simple demo of builtin configs. 5 | The usage is explained in [GETTING_STARTED.md](../GETTING_STARTED.md). 6 | 7 | See our [blog post](https://ai.facebook.com/blog/-detectron2-a-pytorch-based-modular-object-detection-library-) 8 | for a high-quality demo generated with this tool. 9 | -------------------------------------------------------------------------------- /detectron2/projects/DensePose/configs/quick_schedules/densepose_rcnn_R_50_FPN_instant_test.yaml: -------------------------------------------------------------------------------- 1 | _BASE_: "../Base-DensePose-RCNN-FPN.yaml" 2 | MODEL: 3 | WEIGHTS: "detectron2://ImageNetPretrained/MSRA/R-50.pkl" 4 | DATASETS: 5 | TRAIN: ("densepose_coco_2014_minival_100",) 6 | TEST: ("densepose_coco_2014_minival_100",) 7 | SOLVER: 8 | MAX_ITER: 40 9 | STEPS: (30,) 10 | -------------------------------------------------------------------------------- /detectron2/projects/PointRend/configs/InstanceSegmentation/pointrend_rcnn_R_50_FPN_1x_coco.yaml: -------------------------------------------------------------------------------- 1 | _BASE_: Base-PointRend-RCNN-FPN.yaml 2 | MODEL: 3 | WEIGHTS: detectron2://ImageNetPretrained/MSRA/R-50.pkl 4 | RESNETS: 5 | DEPTH: 50 6 | # To add COCO AP evaluation against the higher-quality LVIS annotations. 7 | # DATASETS: 8 | # TEST: ("coco_2017_val", "lvis_v0.5_val_cocofied") 9 | -------------------------------------------------------------------------------- /detectron2/projects/PointRend/point_rend/__init__.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) Facebook, Inc. and its affiliates. 2 | from .config import add_pointrend_config 3 | from .mask_head import PointRendMaskHead, ImplicitPointRendMaskHead 4 | from .semantic_seg import PointRendSemSegHead 5 | from .color_augmentation import ColorAugSSDTransform 6 | 7 | from . import roi_heads as _ # only registration 8 | -------------------------------------------------------------------------------- /detectron2/configs/quick_schedules/cascade_mask_rcnn_R_50_FPN_inference_acc_test.yaml: -------------------------------------------------------------------------------- 1 | _BASE_: "../Misc/cascade_mask_rcnn_R_50_FPN_3x.yaml" 2 | MODEL: 3 | WEIGHTS: "detectron2://Misc/cascade_mask_rcnn_R_50_FPN_3x/144998488/model_final_480dd8.pkl" 4 | DATASETS: 5 | TEST: ("coco_2017_val_100",) 6 | TEST: 7 | EXPECTED_RESULTS: [["bbox", "AP", 50.18, 0.02], ["segm", "AP", 43.87, 0.02]] 8 | -------------------------------------------------------------------------------- /detectron2/projects/PointRend/configs/InstanceSegmentation/implicit_pointrend_R_50_FPN_1x_coco.yaml: -------------------------------------------------------------------------------- 1 | _BASE_: "Base-Implicit-PointRend.yaml" 2 | MODEL: 3 | WEIGHTS: detectron2://ImageNetPretrained/MSRA/R-50.pkl 4 | RESNETS: 5 | DEPTH: 50 6 | # To add COCO AP evaluation against the higher-quality LVIS annotations. 7 | # DATASETS: 8 | # TEST: ("coco_2017_val", "lvis_v0.5_val_cocofied") 9 | -------------------------------------------------------------------------------- /detectron2/projects/PointSup/point_sup/__init__.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved 2 | from . import register_point_annotations 3 | from .config import add_point_sup_config 4 | from .dataset_mapper import PointSupDatasetMapper 5 | from .mask_head import MaskRCNNConvUpsamplePointSupHead 6 | from .point_utils import get_point_coords_from_point_annotation 7 | -------------------------------------------------------------------------------- /AdelaiDet/docs/modules/config.rst: -------------------------------------------------------------------------------- 1 | adet.config package 2 | ========================= 3 | 4 | .. automodule:: adet.config 5 | :members: 6 | :undoc-members: 7 | :show-inheritance: 8 | :inherited-members: 9 | 10 | 11 | Config References 12 | ----------------- 13 | 14 | .. literalinclude:: ../../adet/config/defaults.py 15 | :language: python 16 | :linenos: 17 | :lines: 4- -------------------------------------------------------------------------------- /detectron2/configs/COCO-PanopticSegmentation/Base-Panoptic-FPN.yaml: -------------------------------------------------------------------------------- 1 | _BASE_: "../Base-RCNN-FPN.yaml" 2 | MODEL: 3 | META_ARCHITECTURE: "PanopticFPN" 4 | MASK_ON: True 5 | SEM_SEG_HEAD: 6 | LOSS_WEIGHT: 0.5 7 | DATASETS: 8 | TRAIN: ("coco_2017_train_panoptic_separated",) 9 | TEST: ("coco_2017_val_panoptic_separated",) 10 | DATALOADER: 11 | FILTER_EMPTY_ANNOTATIONS: False 12 | -------------------------------------------------------------------------------- /AdelaiDet/adet/modeling/MEInst/LME/__init__.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved 2 | from .MaskLoader import MaskLoader 3 | from .utils import inverse_sigmoid, direct_sigmoid, IOUMetric, transform, inverse_transform 4 | 5 | __all__ = ["MaskLoader", "IOUMetric", 6 | "inverse_sigmoid", "direct_sigmoid", 7 | "transform", "inverse_transform"] 8 | -------------------------------------------------------------------------------- /detectron2/configs/quick_schedules/mask_rcnn_R_50_C4_inference_acc_test.yaml: -------------------------------------------------------------------------------- 1 | _BASE_: "../COCO-InstanceSegmentation/mask_rcnn_R_50_C4_3x.yaml" 2 | MODEL: 3 | WEIGHTS: "detectron2://COCO-InstanceSegmentation/mask_rcnn_R_50_C4_3x/137849525/model_final_4ce675.pkl" 4 | DATASETS: 5 | TEST: ("coco_2017_val_100",) 6 | TEST: 7 | EXPECTED_RESULTS: [["bbox", "AP", 47.37, 0.02], ["segm", "AP", 40.99, 0.02]] 8 | -------------------------------------------------------------------------------- /detectron2/configs/Misc/mask_rcnn_R_50_FPN_3x_dconv_c3-c5.yaml: -------------------------------------------------------------------------------- 1 | _BASE_: "../Base-RCNN-FPN.yaml" 2 | MODEL: 3 | WEIGHTS: "detectron2://ImageNetPretrained/MSRA/R-50.pkl" 4 | MASK_ON: True 5 | RESNETS: 6 | DEPTH: 50 7 | DEFORM_ON_PER_STAGE: [False, True, True, True] # on Res3,Res4,Res5 8 | DEFORM_MODULATED: False 9 | SOLVER: 10 | STEPS: (210000, 250000) 11 | MAX_ITER: 270000 12 | -------------------------------------------------------------------------------- /detectron2/configs/quick_schedules/mask_rcnn_R_50_DC5_inference_acc_test.yaml: -------------------------------------------------------------------------------- 1 | _BASE_: "../COCO-InstanceSegmentation/mask_rcnn_R_50_DC5_3x.yaml" 2 | MODEL: 3 | WEIGHTS: "detectron2://COCO-InstanceSegmentation/mask_rcnn_R_50_DC5_3x/137849551/model_final_84107b.pkl" 4 | DATASETS: 5 | TEST: ("coco_2017_val_100",) 6 | TEST: 7 | EXPECTED_RESULTS: [["bbox", "AP", 47.44, 0.02], ["segm", "AP", 42.94, 0.02]] 8 | -------------------------------------------------------------------------------- /detectron2/docs/tutorials/index.rst: -------------------------------------------------------------------------------- 1 | Tutorials 2 | ====================================== 3 | 4 | .. toctree:: 5 | :maxdepth: 2 6 | 7 | install 8 | getting_started 9 | builtin_datasets 10 | extend 11 | datasets 12 | data_loading 13 | augmentation 14 | models 15 | write-models 16 | training 17 | evaluation 18 | configs 19 | lazyconfigs 20 | deployment 21 | -------------------------------------------------------------------------------- /detectron2/configs/quick_schedules/keypoint_rcnn_R_50_FPN_inference_acc_test.yaml: -------------------------------------------------------------------------------- 1 | _BASE_: "../COCO-Keypoints/keypoint_rcnn_R_50_FPN_3x.yaml" 2 | MODEL: 3 | WEIGHTS: "detectron2://COCO-Keypoints/keypoint_rcnn_R_50_FPN_3x/137849621/model_final_a6e10b.pkl" 4 | DATASETS: 5 | TEST: ("keypoints_coco_2017_val_100",) 6 | TEST: 7 | EXPECTED_RESULTS: [["bbox", "AP", 52.47, 0.02], ["keypoints", "AP", 67.36, 0.02]] 8 | -------------------------------------------------------------------------------- /detectron2/projects/PointSup/configs/implicit_pointrend_R_50_FPN_3x_point_sup_point_aug_coco.yaml: -------------------------------------------------------------------------------- 1 | _BASE_: "../../PointRend/configs/InstanceSegmentation/implicit_pointrend_R_50_FPN_3x_coco.yaml" 2 | MODEL: 3 | ROI_MASK_HEAD: 4 | NAME: "ImplicitPointRendPointSupHead" 5 | INPUT: 6 | POINT_SUP: True 7 | SAMPLE_POINTS: 5 8 | DATASETS: 9 | TRAIN: ("coco_2017_train_points_n10_v1_without_masks",) 10 | -------------------------------------------------------------------------------- /AdelaiDet/configs/BoxInst/MS_R_50_BiFPN_1x.yaml: -------------------------------------------------------------------------------- 1 | _BASE_: "Base-BoxInst.yaml" 2 | MODEL: 3 | WEIGHTS: "detectron2://ImageNetPretrained/MSRA/R-50.pkl" 4 | BACKBONE: 5 | NAME: "build_fcos_resnet_bifpn_backbone" 6 | RESNETS: 7 | DEPTH: 50 8 | BiFPN: 9 | IN_FEATURES: ["res3", "res4", "res5"] 10 | OUT_CHANNELS: 160 11 | NORM: "SyncBN" 12 | OUTPUT_DIR: "output/boxinst_MS_R_50_1x_bifpn" 13 | -------------------------------------------------------------------------------- /detectron2/configs/COCO-InstanceSegmentation/mask_rcnn_R_50_FPN_1x_giou.yaml: -------------------------------------------------------------------------------- 1 | _BASE_: "../Base-RCNN-FPN.yaml" 2 | MODEL: 3 | WEIGHTS: "detectron2://ImageNetPretrained/MSRA/R-50.pkl" 4 | MASK_ON: True 5 | RESNETS: 6 | DEPTH: 50 7 | RPN: 8 | BBOX_REG_LOSS_TYPE: "giou" 9 | BBOX_REG_LOSS_WEIGHT: 2.0 10 | ROI_BOX_HEAD: 11 | BBOX_REG_LOSS_TYPE: "giou" 12 | BBOX_REG_LOSS_WEIGHT: 10.0 13 | -------------------------------------------------------------------------------- /detectron2/configs/quick_schedules/rpn_R_50_FPN_instant_test.yaml: -------------------------------------------------------------------------------- 1 | _BASE_: "../COCO-Detection/rpn_R_50_FPN_1x.yaml" 2 | MODEL: 3 | WEIGHTS: "detectron2://ImageNetPretrained/MSRA/R-50.pkl" 4 | DATASETS: 5 | TRAIN: ("coco_2017_val_100",) 6 | TEST: ("coco_2017_val_100",) 7 | SOLVER: 8 | STEPS: (30,) 9 | MAX_ITER: 40 10 | BASE_LR: 0.005 11 | IMS_PER_BATCH: 4 12 | DATALOADER: 13 | NUM_WORKERS: 2 14 | -------------------------------------------------------------------------------- /detectron2/projects/DensePose/doc/RELEASE_2020_04.md: -------------------------------------------------------------------------------- 1 | # DensePose Confidence Estimation and Model Zoo Improvements 2 | 3 | * [DensePose models with confidence estimation](doc/DENSEPOSE_IUV.md#ModelZooConfidence) 4 | * [Panoptic FPN and DeepLabV3 head implementation](doc/DENSEPOSE_IUV.md#ModelZooDeepLabV3) 5 | * Test time augmentations for DensePose 6 | * New evaluation metric (GPSm) that yields more reliable scores 7 | -------------------------------------------------------------------------------- /detectron2/projects/MViTv2/configs/cascade_mask_rcnn_mvitv2_b_3x.py: -------------------------------------------------------------------------------- 1 | from .cascade_mask_rcnn_mvitv2_t_3x import model, dataloader, optimizer, lr_multiplier, train 2 | 3 | 4 | model.backbone.bottom_up.depth = 24 5 | model.backbone.bottom_up.last_block_indexes = (1, 4, 20, 23) 6 | model.backbone.bottom_up.drop_path_rate = 0.4 7 | 8 | train.init_checkpoint = "detectron2://ImageNetPretrained/mvitv2/MViTv2_B_in1k.pyth" 9 | -------------------------------------------------------------------------------- /detectron2/projects/TridentNet/tridentnet/__init__.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) Facebook, Inc. and its affiliates. 2 | from .config import add_tridentnet_config 3 | from .trident_backbone import ( 4 | TridentBottleneckBlock, 5 | build_trident_resnet_backbone, 6 | make_trident_stage, 7 | ) 8 | from .trident_rpn import TridentRPN 9 | from .trident_rcnn import TridentRes5ROIHeads, TridentStandardROIHeads 10 | -------------------------------------------------------------------------------- /AdelaiDet/configs/CondInst/MS_R_50_BiFPN_1x.yaml: -------------------------------------------------------------------------------- 1 | _BASE_: "Base-CondInst.yaml" 2 | MODEL: 3 | WEIGHTS: "detectron2://ImageNetPretrained/MSRA/R-50.pkl" 4 | BACKBONE: 5 | NAME: "build_fcos_resnet_bifpn_backbone" 6 | RESNETS: 7 | DEPTH: 50 8 | BiFPN: 9 | IN_FEATURES: ["res3", "res4", "res5"] 10 | OUT_CHANNELS: 160 11 | NORM: "SyncBN" 12 | OUTPUT_DIR: "output/condinst_MS_R_50_1x_bifpn" 13 | -------------------------------------------------------------------------------- /detectron2/projects/DensePose/configs/cse/densepose_rcnn_R_50_FPN_s1x.yaml: -------------------------------------------------------------------------------- 1 | _BASE_: "Base-DensePose-RCNN-FPN-Human.yaml" 2 | MODEL: 3 | WEIGHTS: "detectron2://ImageNetPretrained/MSRA/R-50.pkl" 4 | RESNETS: 5 | DEPTH: 50 6 | ROI_DENSEPOSE_HEAD: 7 | NAME: "DensePoseV1ConvXHead" 8 | CSE: 9 | EMBED_LOSS_NAME: "EmbeddingLoss" 10 | SOLVER: 11 | MAX_ITER: 130000 12 | STEPS: (100000, 120000) 13 | -------------------------------------------------------------------------------- /AdelaiDet/configs/BlendMask/DLA_34_syncbn_4x.yaml: -------------------------------------------------------------------------------- 1 | _BASE_: "Base-RT.yaml" 2 | MODEL: 3 | BACKBONE: 4 | NAME: "build_fcos_dla_fpn_backbone" 5 | FREEZE_AT: -1 6 | WEIGHTS: "http://dl.yf.io/dla/models/imagenet/dla34-ba72cf86.pth" 7 | DLA: 8 | CONV_BODY: "DLA34" 9 | NORM: "SyncBN" 10 | FPN: 11 | IN_FEATURES: ["level3", "level4", "level5"] 12 | OUTPUT_DIR: "output/blendmask/DLA_34_syncbn_4x" 13 | -------------------------------------------------------------------------------- /AdelaiDet/docs/index.rst: -------------------------------------------------------------------------------- 1 | .. AdelaiDet documentation master file, created by 2 | sphinx-quickstart on Wed Feb 26 15:24:04 2020. 3 | You can adapt this file completely to your liking, but it should at least 4 | contain the root `toctree` directive. 5 | 6 | Welcome to AdelaiDet's documentation! 7 | ===================================== 8 | 9 | .. toctree:: 10 | :maxdepth: 2 11 | 12 | 13 | modules/index -------------------------------------------------------------------------------- /detectron2/configs/Misc/semantic_R_50_FPN_1x.yaml: -------------------------------------------------------------------------------- 1 | _BASE_: "../Base-RCNN-FPN.yaml" 2 | MODEL: 3 | META_ARCHITECTURE: "SemanticSegmentor" 4 | WEIGHTS: "detectron2://ImageNetPretrained/MSRA/R-50.pkl" 5 | RESNETS: 6 | DEPTH: 50 7 | DATASETS: 8 | TRAIN: ("coco_2017_train_panoptic_stuffonly",) 9 | TEST: ("coco_2017_val_panoptic_stuffonly",) 10 | INPUT: 11 | MIN_SIZE_TRAIN: (640, 672, 704, 736, 768, 800) 12 | -------------------------------------------------------------------------------- /detectron2/configs/common/README.md: -------------------------------------------------------------------------------- 1 | This directory provides definitions for a few common models, dataloaders, scheduler, 2 | and optimizers that are often used in training. 3 | The definition of these objects are provided in the form of lazy instantiation: 4 | their arguments can be edited by users before constructing the objects. 5 | 6 | They can be imported, or loaded by `model_zoo.get_config` API in users' own configs. 7 | -------------------------------------------------------------------------------- /detectron2/configs/quick_schedules/mask_rcnn_R_50_C4_instant_test.yaml: -------------------------------------------------------------------------------- 1 | _BASE_: "../Base-RCNN-C4.yaml" 2 | MODEL: 3 | WEIGHTS: "detectron2://ImageNetPretrained/MSRA/R-50.pkl" 4 | MASK_ON: True 5 | DATASETS: 6 | TRAIN: ("coco_2017_val_100",) 7 | TEST: ("coco_2017_val_100",) 8 | SOLVER: 9 | BASE_LR: 0.001 10 | STEPS: (30,) 11 | MAX_ITER: 40 12 | IMS_PER_BATCH: 4 13 | DATALOADER: 14 | NUM_WORKERS: 2 15 | -------------------------------------------------------------------------------- /detectron2/configs/quick_schedules/mask_rcnn_R_50_FPN_instant_test.yaml: -------------------------------------------------------------------------------- 1 | _BASE_: "../Base-RCNN-FPN.yaml" 2 | MODEL: 3 | WEIGHTS: "detectron2://ImageNetPretrained/MSRA/R-50.pkl" 4 | MASK_ON: True 5 | DATASETS: 6 | TRAIN: ("coco_2017_val_100",) 7 | TEST: ("coco_2017_val_100",) 8 | SOLVER: 9 | BASE_LR: 0.005 10 | STEPS: (30,) 11 | MAX_ITER: 40 12 | IMS_PER_BATCH: 4 13 | DATALOADER: 14 | NUM_WORKERS: 2 15 | -------------------------------------------------------------------------------- /detectron2/detectron2/solver/__init__.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) Facebook, Inc. and its affiliates. 2 | from .build import build_lr_scheduler, build_optimizer, get_default_optimizer_params 3 | from .lr_scheduler import ( 4 | LRMultiplier, 5 | LRScheduler, 6 | WarmupCosineLR, 7 | WarmupMultiStepLR, 8 | WarmupParamScheduler, 9 | ) 10 | 11 | __all__ = [k for k in globals().keys() if not k.startswith("_")] 12 | -------------------------------------------------------------------------------- /detectron2/projects/DensePose/configs/cse/densepose_rcnn_R_101_FPN_DL_s1x.yaml: -------------------------------------------------------------------------------- 1 | _BASE_: "Base-DensePose-RCNN-FPN-Human.yaml" 2 | MODEL: 3 | WEIGHTS: "detectron2://ImageNetPretrained/MSRA/R-101.pkl" 4 | RESNETS: 5 | DEPTH: 101 6 | ROI_DENSEPOSE_HEAD: 7 | NAME: "DensePoseDeepLabHead" 8 | CSE: 9 | EMBED_LOSS_NAME: "EmbeddingLoss" 10 | SOLVER: 11 | MAX_ITER: 130000 12 | STEPS: (100000, 120000) 13 | -------------------------------------------------------------------------------- /detectron2/projects/DensePose/configs/cse/densepose_rcnn_R_101_FPN_s1x.yaml: -------------------------------------------------------------------------------- 1 | _BASE_: "Base-DensePose-RCNN-FPN-Human.yaml" 2 | MODEL: 3 | WEIGHTS: "detectron2://ImageNetPretrained/MSRA/R-101.pkl" 4 | RESNETS: 5 | DEPTH: 101 6 | ROI_DENSEPOSE_HEAD: 7 | NAME: "DensePoseV1ConvXHead" 8 | CSE: 9 | EMBED_LOSS_NAME: "EmbeddingLoss" 10 | SOLVER: 11 | MAX_ITER: 130000 12 | STEPS: (100000, 120000) 13 | -------------------------------------------------------------------------------- /detectron2/projects/DensePose/configs/cse/densepose_rcnn_R_50_FPN_DL_s1x.yaml: -------------------------------------------------------------------------------- 1 | _BASE_: "Base-DensePose-RCNN-FPN-Human.yaml" 2 | MODEL: 3 | WEIGHTS: "detectron2://ImageNetPretrained/MSRA/R-50.pkl" 4 | RESNETS: 5 | DEPTH: 50 6 | ROI_DENSEPOSE_HEAD: 7 | NAME: "DensePoseDeepLabHead" 8 | CSE: 9 | EMBED_LOSS_NAME: "EmbeddingLoss" 10 | SOLVER: 11 | MAX_ITER: 130000 12 | STEPS: (100000, 120000) 13 | -------------------------------------------------------------------------------- /detectron2/configs/COCO-InstanceSegmentation/mask_rcnn_R_50_C4_1x.py: -------------------------------------------------------------------------------- 1 | from ..common.train import train 2 | from ..common.optim import SGD as optimizer 3 | from ..common.coco_schedule import lr_multiplier_1x as lr_multiplier 4 | from ..common.data.coco import dataloader 5 | from ..common.models.mask_rcnn_c4 import model 6 | 7 | model.backbone.freeze_at = 2 8 | train.init_checkpoint = "detectron2://ImageNetPretrained/MSRA/R-50.pkl" 9 | -------------------------------------------------------------------------------- /detectron2/configs/quick_schedules/retinanet_R_50_FPN_instant_test.yaml: -------------------------------------------------------------------------------- 1 | _BASE_: "../COCO-Detection/retinanet_R_50_FPN_1x.yaml" 2 | MODEL: 3 | WEIGHTS: "detectron2://ImageNetPretrained/MSRA/R-50.pkl" 4 | DATASETS: 5 | TRAIN: ("coco_2017_val_100",) 6 | TEST: ("coco_2017_val_100",) 7 | SOLVER: 8 | BASE_LR: 0.005 9 | STEPS: (30,) 10 | MAX_ITER: 40 11 | IMS_PER_BATCH: 4 12 | DATALOADER: 13 | NUM_WORKERS: 2 14 | -------------------------------------------------------------------------------- /detectron2/detectron2/data/datasets/README.md: -------------------------------------------------------------------------------- 1 | 2 | 3 | ### Common Datasets 4 | 5 | The dataset implemented here do not need to load the data into the final format. 6 | It should provide the minimal data structure needed to use the dataset, so it can be very efficient. 7 | 8 | For example, for an image dataset, just provide the file names and labels, but don't read the images. 9 | Let the downstream decide how to read. 10 | -------------------------------------------------------------------------------- /detectron2/projects/DensePose/configs/cse/densepose_rcnn_R_50_FPN_soft_s1x.yaml: -------------------------------------------------------------------------------- 1 | _BASE_: "Base-DensePose-RCNN-FPN-Human.yaml" 2 | MODEL: 3 | WEIGHTS: "detectron2://ImageNetPretrained/MSRA/R-50.pkl" 4 | RESNETS: 5 | DEPTH: 50 6 | ROI_DENSEPOSE_HEAD: 7 | NAME: "DensePoseV1ConvXHead" 8 | CSE: 9 | EMBED_LOSS_NAME: "SoftEmbeddingLoss" 10 | SOLVER: 11 | MAX_ITER: 130000 12 | STEPS: (100000, 120000) 13 | -------------------------------------------------------------------------------- /AdelaiDet/adet/layers/__init__.py: -------------------------------------------------------------------------------- 1 | from .deform_conv import DFConv2d 2 | from .ml_nms import ml_nms 3 | from .iou_loss import IOULoss 4 | from .conv_with_kaiming_uniform import conv_with_kaiming_uniform 5 | from .bezier_align import BezierAlign 6 | from .def_roi_align import DefROIAlign 7 | from .naive_group_norm import NaiveGroupNorm 8 | from .gcn import GCN 9 | 10 | __all__ = [k for k in globals().keys() if not k.startswith("_")] -------------------------------------------------------------------------------- /detectron2/detectron2/checkpoint/__init__.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | # Copyright (c) Facebook, Inc. and its affiliates. 3 | # File: 4 | 5 | 6 | from . import catalog as _UNUSED # register the handler 7 | from .detection_checkpoint import DetectionCheckpointer 8 | from fvcore.common.checkpoint import Checkpointer, PeriodicCheckpointer 9 | 10 | __all__ = ["Checkpointer", "PeriodicCheckpointer", "DetectionCheckpointer"] 11 | -------------------------------------------------------------------------------- /detectron2/detectron2/engine/__init__.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) Facebook, Inc. and its affiliates. 2 | 3 | from .launch import * 4 | from .train_loop import * 5 | 6 | __all__ = [k for k in globals().keys() if not k.startswith("_")] 7 | 8 | 9 | # prefer to let hooks and defaults live in separate namespaces (therefore not in __all__) 10 | # but still make them available here 11 | from .hooks import * 12 | from .defaults import * 13 | -------------------------------------------------------------------------------- /detectron2/projects/DensePose/configs/cse/densepose_rcnn_R_101_FPN_DL_soft_s1x.yaml: -------------------------------------------------------------------------------- 1 | _BASE_: "Base-DensePose-RCNN-FPN-Human.yaml" 2 | MODEL: 3 | WEIGHTS: "detectron2://ImageNetPretrained/MSRA/R-101.pkl" 4 | RESNETS: 5 | DEPTH: 101 6 | ROI_DENSEPOSE_HEAD: 7 | NAME: "DensePoseDeepLabHead" 8 | CSE: 9 | EMBED_LOSS_NAME: "SoftEmbeddingLoss" 10 | SOLVER: 11 | MAX_ITER: 130000 12 | STEPS: (100000, 120000) 13 | -------------------------------------------------------------------------------- /detectron2/projects/DensePose/configs/cse/densepose_rcnn_R_101_FPN_soft_s1x.yaml: -------------------------------------------------------------------------------- 1 | _BASE_: "Base-DensePose-RCNN-FPN-Human.yaml" 2 | MODEL: 3 | WEIGHTS: "detectron2://ImageNetPretrained/MSRA/R-101.pkl" 4 | RESNETS: 5 | DEPTH: 101 6 | ROI_DENSEPOSE_HEAD: 7 | NAME: "DensePoseV1ConvXHead" 8 | CSE: 9 | EMBED_LOSS_NAME: "SoftEmbeddingLoss" 10 | SOLVER: 11 | MAX_ITER: 130000 12 | STEPS: (100000, 120000) 13 | -------------------------------------------------------------------------------- /detectron2/projects/DensePose/configs/cse/densepose_rcnn_R_50_FPN_DL_soft_s1x.yaml: -------------------------------------------------------------------------------- 1 | _BASE_: "Base-DensePose-RCNN-FPN-Human.yaml" 2 | MODEL: 3 | WEIGHTS: "detectron2://ImageNetPretrained/MSRA/R-50.pkl" 4 | RESNETS: 5 | DEPTH: 50 6 | ROI_DENSEPOSE_HEAD: 7 | NAME: "DensePoseDeepLabHead" 8 | CSE: 9 | EMBED_LOSS_NAME: "SoftEmbeddingLoss" 10 | SOLVER: 11 | MAX_ITER: 130000 12 | STEPS: (100000, 120000) 13 | -------------------------------------------------------------------------------- /detectron2/projects/DensePose/densepose/data/samplers/densepose_cse_uniform.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) Facebook, Inc. and its affiliates. 2 | 3 | from .densepose_cse_base import DensePoseCSEBaseSampler 4 | from .densepose_uniform import DensePoseUniformSampler 5 | 6 | 7 | class DensePoseCSEUniformSampler(DensePoseCSEBaseSampler, DensePoseUniformSampler): 8 | """ 9 | Uniform Sampler for CSE 10 | """ 11 | 12 | pass 13 | -------------------------------------------------------------------------------- /AdelaiDet/configs/BAText/TotalText/attn_R_50.yaml: -------------------------------------------------------------------------------- 1 | _BASE_: "Base-TotalText.yaml" 2 | MODEL: 3 | WEIGHTS: "weights/batext/pretrain_attn_R_50.pth" 4 | RESNETS: 5 | DEPTH: 50 6 | BATEXT: 7 | RECOGNIZER: "attn" # "attn" "rnn" 8 | SOLVER: 9 | IMS_PER_BATCH: 8 10 | BASE_LR: 0.001 11 | MAX_ITER: 5000 12 | CHECKPOINT_PERIOD: 1000 13 | TEST: 14 | EVAL_PERIOD: 1000 15 | OUTPUT_DIR: "output/batext/totaltext/attn_R_50" 16 | -------------------------------------------------------------------------------- /detectron2/projects/Panoptic-DeepLab/panoptic_deeplab/__init__.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) Facebook, Inc. and its affiliates. 2 | from .config import add_panoptic_deeplab_config 3 | from .dataset_mapper import PanopticDeeplabDatasetMapper 4 | from .panoptic_seg import ( 5 | PanopticDeepLab, 6 | INS_EMBED_BRANCHES_REGISTRY, 7 | build_ins_embed_branch, 8 | PanopticDeepLabSemSegHead, 9 | PanopticDeepLabInsEmbedHead, 10 | ) 11 | -------------------------------------------------------------------------------- /AdelaiDet/configs/FCOS-Detection/MS_X_101_64x4d_2x.yaml: -------------------------------------------------------------------------------- 1 | _BASE_: "Base-FCOS.yaml" 2 | MODEL: 3 | WEIGHTS: "catalog://ImageNetPretrained/FAIR/X-101-64x4d" 4 | PIXEL_STD: [1.0, 1.0, 1.0] 5 | RESNETS: 6 | STRIDE_IN_1X1: False # this is a C2 model 7 | NUM_GROUPS: 64 8 | WIDTH_PER_GROUP: 4 9 | DEPTH: 101 10 | SOLVER: 11 | STEPS: (120000, 160000) 12 | MAX_ITER: 180000 13 | OUTPUT_DIR: "output/fcos/MS_X_101_64x4d_2x" 14 | -------------------------------------------------------------------------------- /detectron2/configs/COCO-InstanceSegmentation/mask_rcnn_R_50_FPN_1x.py: -------------------------------------------------------------------------------- 1 | from ..common.optim import SGD as optimizer 2 | from ..common.coco_schedule import lr_multiplier_1x as lr_multiplier 3 | from ..common.data.coco import dataloader 4 | from ..common.models.mask_rcnn_fpn import model 5 | from ..common.train import train 6 | 7 | model.backbone.bottom_up.freeze_at = 2 8 | train.init_checkpoint = "detectron2://ImageNetPretrained/MSRA/R-50.pkl" 9 | -------------------------------------------------------------------------------- /detectron2/configs/COCO-Keypoints/keypoint_rcnn_X_101_32x8d_FPN_3x.yaml: -------------------------------------------------------------------------------- 1 | _BASE_: "Base-Keypoint-RCNN-FPN.yaml" 2 | MODEL: 3 | WEIGHTS: "detectron2://ImageNetPretrained/FAIR/X-101-32x8d.pkl" 4 | PIXEL_STD: [57.375, 57.120, 58.395] 5 | RESNETS: 6 | STRIDE_IN_1X1: False # this is a C2 model 7 | NUM_GROUPS: 32 8 | WIDTH_PER_GROUP: 8 9 | DEPTH: 101 10 | SOLVER: 11 | STEPS: (210000, 250000) 12 | MAX_ITER: 270000 13 | -------------------------------------------------------------------------------- /detectron2/configs/Misc/cascade_mask_rcnn_R_50_FPN_3x.yaml: -------------------------------------------------------------------------------- 1 | _BASE_: "../Base-RCNN-FPN.yaml" 2 | MODEL: 3 | WEIGHTS: "detectron2://ImageNetPretrained/MSRA/R-50.pkl" 4 | MASK_ON: True 5 | RESNETS: 6 | DEPTH: 50 7 | ROI_HEADS: 8 | NAME: CascadeROIHeads 9 | ROI_BOX_HEAD: 10 | CLS_AGNOSTIC_BBOX_REG: True 11 | RPN: 12 | POST_NMS_TOPK_TRAIN: 2000 13 | SOLVER: 14 | STEPS: (210000, 250000) 15 | MAX_ITER: 270000 16 | -------------------------------------------------------------------------------- /detectron2/tests/config/dir1/dir1_b.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) Facebook, Inc. and its affiliates. 2 | from detectron2.config import LazyConfig 3 | 4 | # equivalent to relative import 5 | dir1a_str, dir1a_dict = LazyConfig.load_rel("dir1_a.py", ("dir1a_str", "dir1a_dict")) 6 | 7 | dir1b_str = dir1a_str + "_from_b" 8 | dir1b_dict = dir1a_dict 9 | 10 | # Every import is a reload: not modified by other config files 11 | assert dir1a_dict.a == 1 12 | -------------------------------------------------------------------------------- /detectron2/tests/config/root_cfg.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) Facebook, Inc. and its affiliates. 2 | from itertools import count 3 | 4 | from detectron2.config import LazyCall as L 5 | 6 | from .dir1.dir1_a import dir1a_dict, dir1a_str 7 | 8 | dir1a_dict.a = "modified" 9 | 10 | # modification above won't affect future imports 11 | from .dir1.dir1_b import dir1b_dict, dir1b_str 12 | 13 | 14 | lazyobj = L(count)(x=dir1a_str, y=dir1b_str) 15 | -------------------------------------------------------------------------------- /AdelaiDet/configs/BlendMask/RT_R_50_4x_syncbn_shtw.yaml: -------------------------------------------------------------------------------- 1 | _BASE_: "Base-RT.yaml" 2 | MODEL: 3 | WEIGHTS: "detectron2://ImageNetPretrained/MSRA/R-50.pkl" 4 | RESNETS: 5 | DEPTH: 50 6 | NORM: "SyncBN" 7 | BACKBONE: 8 | FREEZE_AT: -1 9 | FCOS: 10 | NUM_SHARE_CONVS: 3 11 | NUM_CLS_CONVS: 0 12 | NUM_BOX_CONVS: 0 13 | BASIS_MODULE: 14 | NUM_CONVS: 2 15 | OUTPUT_DIR: "output/blendmask/RT_R_50_4x_syncbn_shtw" 16 | -------------------------------------------------------------------------------- /detectron2/configs/COCO-Keypoints/keypoint_rcnn_R_50_FPN_1x.py: -------------------------------------------------------------------------------- 1 | from ..common.optim import SGD as optimizer 2 | from ..common.coco_schedule import lr_multiplier_1x as lr_multiplier 3 | from ..common.data.coco_keypoint import dataloader 4 | from ..common.models.keypoint_rcnn_fpn import model 5 | from ..common.train import train 6 | 7 | model.backbone.bottom_up.freeze_at = 2 8 | train.init_checkpoint = "detectron2://ImageNetPretrained/MSRA/R-50.pkl" 9 | -------------------------------------------------------------------------------- /detectron2/configs/new_baselines/mask_rcnn_R_50_FPN_200ep_LSJ.py: -------------------------------------------------------------------------------- 1 | from .mask_rcnn_R_50_FPN_100ep_LSJ import ( 2 | dataloader, 3 | lr_multiplier, 4 | model, 5 | optimizer, 6 | train, 7 | ) 8 | 9 | train.max_iter *= 2 # 100ep -> 200ep 10 | 11 | lr_multiplier.scheduler.milestones = [ 12 | milestone * 2 for milestone in lr_multiplier.scheduler.milestones 13 | ] 14 | lr_multiplier.scheduler.num_updates = train.max_iter 15 | -------------------------------------------------------------------------------- /detectron2/configs/new_baselines/mask_rcnn_R_50_FPN_400ep_LSJ.py: -------------------------------------------------------------------------------- 1 | from .mask_rcnn_R_50_FPN_100ep_LSJ import ( 2 | dataloader, 3 | lr_multiplier, 4 | model, 5 | optimizer, 6 | train, 7 | ) 8 | 9 | train.max_iter *= 4 # 100ep -> 400ep 10 | 11 | lr_multiplier.scheduler.milestones = [ 12 | milestone * 4 for milestone in lr_multiplier.scheduler.milestones 13 | ] 14 | lr_multiplier.scheduler.num_updates = train.max_iter 15 | -------------------------------------------------------------------------------- /detectron2/configs/new_baselines/mask_rcnn_R_50_FPN_50ep_LSJ.py: -------------------------------------------------------------------------------- 1 | from .mask_rcnn_R_50_FPN_100ep_LSJ import ( 2 | dataloader, 3 | lr_multiplier, 4 | model, 5 | optimizer, 6 | train, 7 | ) 8 | 9 | train.max_iter //= 2 # 100ep -> 50ep 10 | 11 | lr_multiplier.scheduler.milestones = [ 12 | milestone // 2 for milestone in lr_multiplier.scheduler.milestones 13 | ] 14 | lr_multiplier.scheduler.num_updates = train.max_iter 15 | -------------------------------------------------------------------------------- /detectron2/projects/DensePose/configs/quick_schedules/densepose_rcnn_R_50_FPN_DL_instant_test.yaml: -------------------------------------------------------------------------------- 1 | _BASE_: "../Base-DensePose-RCNN-FPN.yaml" 2 | MODEL: 3 | WEIGHTS: "detectron2://ImageNetPretrained/MSRA/R-50.pkl" 4 | ROI_DENSEPOSE_HEAD: 5 | NAME: "DensePoseDeepLabHead" 6 | DATASETS: 7 | TRAIN: ("densepose_coco_2014_minival_100",) 8 | TEST: ("densepose_coco_2014_minival_100",) 9 | SOLVER: 10 | MAX_ITER: 40 11 | STEPS: (30,) 12 | -------------------------------------------------------------------------------- /AdelaiDet/configs/FCOS-Detection/MS_X_101_32x8d_2x.yaml: -------------------------------------------------------------------------------- 1 | _BASE_: "Base-FCOS.yaml" 2 | MODEL: 3 | WEIGHTS: "detectron2://ImageNetPretrained/FAIR/X-101-32x8d.pkl" 4 | PIXEL_STD: [57.375, 57.120, 58.395] 5 | RESNETS: 6 | STRIDE_IN_1X1: False # this is a C2 model 7 | NUM_GROUPS: 32 8 | WIDTH_PER_GROUP: 8 9 | DEPTH: 101 10 | SOLVER: 11 | STEPS: (120000, 160000) 12 | MAX_ITER: 180000 13 | OUTPUT_DIR: "output/fcos/X_101_2x" 14 | -------------------------------------------------------------------------------- /AdelaiDet/configs/MEInst-InstanceSegmentation/MEInst_R_50_1x_none.yaml: -------------------------------------------------------------------------------- 1 | _BASE_: "Base-MEInst.yaml" 2 | MODEL: 3 | WEIGHTS: "detectron2://ImageNetPretrained/MSRA/R-50.pkl" 4 | RESNETS: 5 | DEPTH: 50 6 | MEInst: 7 | DIM_MASK: 60 8 | MASK_SIZE: 28 9 | INPUT: 10 | MIN_SIZE_TRAIN: (800,) 11 | SOLVER: 12 | WARMUP_METHOD: "constant" 13 | WARMUP_FACTOR: 0.3333 14 | WARMUP_ITERS: 500 15 | OUTPUT_DIR: "output/MEInst/R_50_1x_none" 16 | -------------------------------------------------------------------------------- /detectron2/configs/COCO-Detection/faster_rcnn_X_101_32x8d_FPN_3x.yaml: -------------------------------------------------------------------------------- 1 | _BASE_: "../Base-RCNN-FPN.yaml" 2 | MODEL: 3 | MASK_ON: False 4 | WEIGHTS: "detectron2://ImageNetPretrained/FAIR/X-101-32x8d.pkl" 5 | PIXEL_STD: [57.375, 57.120, 58.395] 6 | RESNETS: 7 | STRIDE_IN_1X1: False # this is a C2 model 8 | NUM_GROUPS: 32 9 | WIDTH_PER_GROUP: 8 10 | DEPTH: 101 11 | SOLVER: 12 | STEPS: (210000, 250000) 13 | MAX_ITER: 270000 14 | -------------------------------------------------------------------------------- /detectron2/configs/new_baselines/mask_rcnn_R_101_FPN_200ep_LSJ.py: -------------------------------------------------------------------------------- 1 | from .mask_rcnn_R_101_FPN_100ep_LSJ import ( 2 | dataloader, 3 | lr_multiplier, 4 | model, 5 | optimizer, 6 | train, 7 | ) 8 | 9 | train.max_iter *= 2 # 100ep -> 200ep 10 | 11 | lr_multiplier.scheduler.milestones = [ 12 | milestone * 2 for milestone in lr_multiplier.scheduler.milestones 13 | ] 14 | lr_multiplier.scheduler.num_updates = train.max_iter 15 | -------------------------------------------------------------------------------- /detectron2/configs/new_baselines/mask_rcnn_R_101_FPN_400ep_LSJ.py: -------------------------------------------------------------------------------- 1 | from .mask_rcnn_R_101_FPN_100ep_LSJ import ( 2 | dataloader, 3 | lr_multiplier, 4 | model, 5 | optimizer, 6 | train, 7 | ) 8 | 9 | train.max_iter *= 4 # 100ep -> 400ep 10 | 11 | lr_multiplier.scheduler.milestones = [ 12 | milestone * 4 for milestone in lr_multiplier.scheduler.milestones 13 | ] 14 | lr_multiplier.scheduler.num_updates = train.max_iter 15 | -------------------------------------------------------------------------------- /detectron2/projects/ViTDet/configs/LVIS/cascade_mask_rcnn_swin_l_in21k_50ep.py: -------------------------------------------------------------------------------- 1 | from .cascade_mask_rcnn_swin_b_in21k_50ep import ( 2 | dataloader, 3 | lr_multiplier, 4 | model, 5 | train, 6 | optimizer, 7 | ) 8 | 9 | model.backbone.bottom_up.embed_dim = 192 10 | model.backbone.bottom_up.num_heads = [6, 12, 24, 48] 11 | 12 | train.init_checkpoint = "detectron2://ImageNetPretrained/swin/swin_large_patch4_window7_224_22k.pth" 13 | -------------------------------------------------------------------------------- /AdelaiDet/configs/BAText/CTW1500/attn_R_50.yaml: -------------------------------------------------------------------------------- 1 | _BASE_: "Base-CTW1500.yaml" 2 | MODEL: 3 | WEIGHTS: "weights/batext/pretrain_attn_R_50.pth" 4 | RESNETS: 5 | DEPTH: 50 6 | BATEXT: 7 | RECOGNIZER: "attn" # "attn" "rnn" 8 | SOLVER: 9 | IMS_PER_BATCH: 8 10 | BASE_LR: 0.001 11 | STEPS: (80000,) 12 | MAX_ITER: 120000 13 | CHECKPOINT_PERIOD: 10000 14 | TEST: 15 | EVAL_PERIOD: 10000 16 | OUTPUT_DIR: "output/batext/ctw1500/attn_R_50" 17 | -------------------------------------------------------------------------------- /AdelaiDet/configs/RCNN/550_R_50_FPN_3x.yaml: -------------------------------------------------------------------------------- 1 | _BASE_: "Base-RCNN.yaml" 2 | MODEL: 3 | WEIGHTS: "output/mask_rcnn/550_R_50_3x/model_final.pth" 4 | MASK_ON: True 5 | RESNETS: 6 | DEPTH: 50 7 | SOLVER: 8 | STEPS: (210000, 250000) 9 | MAX_ITER: 270000 10 | INPUT: 11 | MIN_SIZE_TRAIN: (440, 462, 484, 506, 528, 550) 12 | MAX_SIZE_TRAIN: 916 13 | MIN_SIZE_TEST: 550 14 | MAX_SIZE_TEST: 916 15 | OUTPUT_DIR: "output/mask_rcnn/550_R_50_3x" 16 | -------------------------------------------------------------------------------- /AdelaiDet/docs/modules/utils.rst: -------------------------------------------------------------------------------- 1 | adet.utils package 2 | ======================== 3 | 4 | adet.utils.comm module 5 | -------------------------------- 6 | 7 | .. automodule:: adet.utils.comm 8 | :members: 9 | :undoc-members: 10 | :show-inheritance: 11 | 12 | adet.utils.measures module 13 | ---------------------------- 14 | 15 | .. automodule:: adet.utils.measures 16 | :members: 17 | :undoc-members: 18 | :show-inheritance: 19 | -------------------------------------------------------------------------------- /detectron2/configs/COCO-PanopticSegmentation/panoptic_fpn_R_50_1x.py: -------------------------------------------------------------------------------- 1 | from ..common.optim import SGD as optimizer 2 | from ..common.coco_schedule import lr_multiplier_1x as lr_multiplier 3 | from ..common.data.coco_panoptic_separated import dataloader 4 | from ..common.models.panoptic_fpn import model 5 | from ..common.train import train 6 | 7 | model.backbone.bottom_up.freeze_at = 2 8 | train.init_checkpoint = "detectron2://ImageNetPretrained/MSRA/R-50.pkl" 9 | -------------------------------------------------------------------------------- /AdelaiDet/configs/BAText/Pretrain/attn_R_50.yaml: -------------------------------------------------------------------------------- 1 | _BASE_: "Base-Pretrain.yaml" 2 | MODEL: 3 | WEIGHTS: "detectron2://ImageNetPretrained/MSRA/R-50.pkl" 4 | RESNETS: 5 | DEPTH: 50 6 | BATEXT: 7 | RECOGNIZER: "attn" 8 | SOLVER: 9 | IMS_PER_BATCH: 8 10 | BASE_LR: 0.01 11 | STEPS: (160000, 220000) 12 | MAX_ITER: 260000 13 | CHECKPOINT_PERIOD: 20000 14 | TEST: 15 | EVAL_PERIOD: 20000 16 | OUTPUT_DIR: "output/batext/pretrain/attn_R_50" 17 | -------------------------------------------------------------------------------- /AdelaiDet/configs/MEInst-InstanceSegmentation/MEInst_R_50_3x.yaml: -------------------------------------------------------------------------------- 1 | _BASE_: "Base-MEInst.yaml" 2 | MODEL: 3 | WEIGHTS: "detectron2://ImageNetPretrained/MSRA/R-50.pkl" 4 | RESNETS: 5 | DEPTH: 50 6 | MEInst: 7 | DIM_MASK: 60 8 | MASK_SIZE: 28 9 | USE_DEFORMABLE: True 10 | LAST_DEFORMABLE: True 11 | TYPE_DEFORMABLE: "DCNv1" 12 | SOLVER: 13 | STEPS: (180000, 240000) 14 | MAX_ITER: 270000 15 | OUTPUT_DIR: "output/MEInst/R_50_3x" 16 | -------------------------------------------------------------------------------- /detectron2/configs/COCO-InstanceSegmentation/mask_rcnn_X_101_32x8d_FPN_3x.yaml: -------------------------------------------------------------------------------- 1 | _BASE_: "../Base-RCNN-FPN.yaml" 2 | MODEL: 3 | MASK_ON: True 4 | WEIGHTS: "detectron2://ImageNetPretrained/FAIR/X-101-32x8d.pkl" 5 | PIXEL_STD: [57.375, 57.120, 58.395] 6 | RESNETS: 7 | STRIDE_IN_1X1: False # this is a C2 model 8 | NUM_GROUPS: 32 9 | WIDTH_PER_GROUP: 8 10 | DEPTH: 101 11 | SOLVER: 12 | STEPS: (210000, 250000) 13 | MAX_ITER: 270000 14 | -------------------------------------------------------------------------------- /detectron2/projects/DensePose/densepose/modeling/utils.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) Facebook, Inc. and its affiliates. 2 | 3 | from torch import nn 4 | 5 | 6 | def initialize_module_params(module: nn.Module) -> None: 7 | for name, param in module.named_parameters(): 8 | if "bias" in name: 9 | nn.init.constant_(param, 0) 10 | elif "weight" in name: 11 | nn.init.kaiming_normal_(param, mode="fan_out", nonlinearity="relu") 12 | -------------------------------------------------------------------------------- /detectron2/projects/DensePose/densepose/utils/logger.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) Facebook, Inc. and its affiliates. 2 | import logging 3 | 4 | 5 | def verbosity_to_level(verbosity) -> int: 6 | if verbosity is not None: 7 | if verbosity == 0: 8 | return logging.WARNING 9 | elif verbosity == 1: 10 | return logging.INFO 11 | elif verbosity >= 2: 12 | return logging.DEBUG 13 | return logging.WARNING 14 | -------------------------------------------------------------------------------- /AdelaiDet/configs/BlendMask/Base-RT.yaml: -------------------------------------------------------------------------------- 1 | _BASE_: "Base-BlendMask.yaml" 2 | INPUT: 3 | MIN_SIZE_TRAIN: (256, 288, 320, 352, 384, 416, 448, 480, 512, 544, 576, 608) 4 | MAX_SIZE_TRAIN: 900 5 | MAX_SIZE_TEST: 736 6 | MIN_SIZE_TEST: 512 7 | MODEL: 8 | FCOS: 9 | TOP_LEVELS: 0 10 | SIZES_OF_INTEREST: [64, 128] 11 | FPN_STRIDES: [8, 16, 32] 12 | IN_FEATURES: ['p3', 'p4', 'p5'] 13 | SOLVER: 14 | STEPS: (300000, 340000) 15 | MAX_ITER: 360000 -------------------------------------------------------------------------------- /detectron2/.github/pull_request_template.md: -------------------------------------------------------------------------------- 1 | Thanks for your contribution! 2 | 3 | If you're sending a large PR (e.g., >100 lines), 4 | please open an issue first about the feature / bug, and indicate how you want to contribute. 5 | 6 | We do not always accept features. 7 | See https://detectron2.readthedocs.io/notes/contributing.html#pull-requests about how we handle PRs. 8 | 9 | Before submitting a PR, please run `dev/linter.sh` to lint the code. 10 | 11 | -------------------------------------------------------------------------------- /detectron2/docs/index.rst: -------------------------------------------------------------------------------- 1 | .. detectron2 documentation master file, created by 2 | sphinx-quickstart on Sat Sep 21 13:46:45 2019. 3 | You can adapt this file completely to your liking, but it should at least 4 | contain the root `toctree` directive. 5 | 6 | Welcome to detectron2's documentation! 7 | ====================================== 8 | 9 | .. toctree:: 10 | :maxdepth: 2 11 | 12 | tutorials/index 13 | notes/index 14 | modules/index 15 | -------------------------------------------------------------------------------- /detectron2/projects/DensePose/configs/quick_schedules/cse/densepose_rcnn_R_50_FPN_DL_instant_test.yaml: -------------------------------------------------------------------------------- 1 | _BASE_: "../../cse/Base-DensePose-RCNN-FPN.yaml" 2 | MODEL: 3 | WEIGHTS: "detectron2://ImageNetPretrained/MSRA/R-50.pkl" 4 | ROI_DENSEPOSE_HEAD: 5 | NAME: "DensePoseDeepLabHead" 6 | DATASETS: 7 | TRAIN: ("densepose_coco_2014_minival_100_cse",) 8 | TEST: ("densepose_coco_2014_minival_100_cse",) 9 | SOLVER: 10 | MAX_ITER: 40 11 | STEPS: (30,) 12 | -------------------------------------------------------------------------------- /detectron2/projects/PointRend/configs/InstanceSegmentation/implicit_pointrend_R_50_FPN_3x_coco.yaml: -------------------------------------------------------------------------------- 1 | _BASE_: "Base-Implicit-PointRend.yaml" 2 | MODEL: 3 | WEIGHTS: detectron2://ImageNetPretrained/MSRA/R-50.pkl 4 | RESNETS: 5 | DEPTH: 50 6 | SOLVER: 7 | STEPS: (210000, 250000) 8 | MAX_ITER: 270000 9 | # To add COCO AP evaluation against the higher-quality LVIS annotations. 10 | # DATASETS: 11 | # TEST: ("coco_2017_val", "lvis_v0.5_val_cocofied") 12 | -------------------------------------------------------------------------------- /detectron2/projects/PointRend/configs/InstanceSegmentation/pointrend_rcnn_R_50_FPN_3x_coco.yaml: -------------------------------------------------------------------------------- 1 | _BASE_: Base-PointRend-RCNN-FPN.yaml 2 | MODEL: 3 | WEIGHTS: detectron2://ImageNetPretrained/MSRA/R-50.pkl 4 | RESNETS: 5 | DEPTH: 50 6 | SOLVER: 7 | STEPS: (210000, 250000) 8 | MAX_ITER: 270000 9 | # To add COCO AP evaluation against the higher-quality LVIS annotations. 10 | # DATASETS: 11 | # TEST: ("coco_2017_val", "lvis_v0.5_val_cocofied") 12 | 13 | -------------------------------------------------------------------------------- /detectron2/configs/new_baselines/mask_rcnn_regnetx_4gf_dds_FPN_200ep_LSJ.py: -------------------------------------------------------------------------------- 1 | from .mask_rcnn_regnetx_4gf_dds_FPN_100ep_LSJ import ( 2 | dataloader, 3 | lr_multiplier, 4 | model, 5 | optimizer, 6 | train, 7 | ) 8 | 9 | train.max_iter *= 2 # 100ep -> 200ep 10 | 11 | lr_multiplier.scheduler.milestones = [ 12 | milestone * 2 for milestone in lr_multiplier.scheduler.milestones 13 | ] 14 | lr_multiplier.scheduler.num_updates = train.max_iter 15 | -------------------------------------------------------------------------------- /detectron2/configs/new_baselines/mask_rcnn_regnetx_4gf_dds_FPN_400ep_LSJ.py: -------------------------------------------------------------------------------- 1 | from .mask_rcnn_regnetx_4gf_dds_FPN_100ep_LSJ import ( 2 | dataloader, 3 | lr_multiplier, 4 | model, 5 | optimizer, 6 | train, 7 | ) 8 | 9 | train.max_iter *= 4 # 100ep -> 400ep 10 | 11 | lr_multiplier.scheduler.milestones = [ 12 | milestone * 4 for milestone in lr_multiplier.scheduler.milestones 13 | ] 14 | lr_multiplier.scheduler.num_updates = train.max_iter 15 | -------------------------------------------------------------------------------- /detectron2/configs/new_baselines/mask_rcnn_regnety_4gf_dds_FPN_200ep_LSJ.py: -------------------------------------------------------------------------------- 1 | from .mask_rcnn_regnety_4gf_dds_FPN_100ep_LSJ import ( 2 | dataloader, 3 | lr_multiplier, 4 | model, 5 | optimizer, 6 | train, 7 | ) 8 | 9 | train.max_iter *= 2 # 100ep -> 200ep 10 | 11 | lr_multiplier.scheduler.milestones = [ 12 | milestone * 2 for milestone in lr_multiplier.scheduler.milestones 13 | ] 14 | lr_multiplier.scheduler.num_updates = train.max_iter 15 | -------------------------------------------------------------------------------- /detectron2/configs/new_baselines/mask_rcnn_regnety_4gf_dds_FPN_400ep_LSJ.py: -------------------------------------------------------------------------------- 1 | from .mask_rcnn_regnety_4gf_dds_FPN_100ep_LSJ import ( 2 | dataloader, 3 | lr_multiplier, 4 | model, 5 | optimizer, 6 | train, 7 | ) 8 | 9 | train.max_iter *= 4 # 100ep -> 400ep 10 | 11 | lr_multiplier.scheduler.milestones = [ 12 | milestone * 4 for milestone in lr_multiplier.scheduler.milestones 13 | ] 14 | lr_multiplier.scheduler.num_updates = train.max_iter 15 | -------------------------------------------------------------------------------- /detectron2/docs/modules/config.rst: -------------------------------------------------------------------------------- 1 | detectron2.config 2 | ========================= 3 | 4 | Related tutorials: :doc:`../tutorials/configs`, :doc:`../tutorials/extend`. 5 | 6 | .. automodule:: detectron2.config 7 | :members: 8 | :undoc-members: 9 | :show-inheritance: 10 | 11 | 12 | Yaml Config References 13 | ----------------- 14 | 15 | .. literalinclude:: ../../detectron2/config/defaults.py 16 | :language: python 17 | :linenos: 18 | :lines: 7- 19 | -------------------------------------------------------------------------------- /detectron2/projects/PointSup/point_sup/config.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | # Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved 3 | 4 | 5 | def add_point_sup_config(cfg): 6 | """ 7 | Add config for point supervision. 8 | """ 9 | # Use point annotation 10 | cfg.INPUT.POINT_SUP = False 11 | # Sample only part of points in each iteration. 12 | # Default: 0, use all available points. 13 | cfg.INPUT.SAMPLE_POINTS = 0 14 | -------------------------------------------------------------------------------- /AdelaiDet/configs/BoxInst/MS_R_50_BiFPN_3x.yaml: -------------------------------------------------------------------------------- 1 | _BASE_: "Base-BoxInst.yaml" 2 | MODEL: 3 | WEIGHTS: "detectron2://ImageNetPretrained/MSRA/R-50.pkl" 4 | BACKBONE: 5 | NAME: "build_fcos_resnet_bifpn_backbone" 6 | RESNETS: 7 | DEPTH: 50 8 | BiFPN: 9 | IN_FEATURES: ["res3", "res4", "res5"] 10 | OUT_CHANNELS: 160 11 | NORM: "SyncBN" 12 | SOLVER: 13 | STEPS: (210000, 250000) 14 | MAX_ITER: 270000 15 | OUTPUT_DIR: "output/boxinst_MS_R_50_3x_bifpn" 16 | -------------------------------------------------------------------------------- /AdelaiDet/configs/CondInst/MS_R_50_BiFPN_3x.yaml: -------------------------------------------------------------------------------- 1 | _BASE_: "Base-CondInst.yaml" 2 | MODEL: 3 | WEIGHTS: "detectron2://ImageNetPretrained/MSRA/R-50.pkl" 4 | BACKBONE: 5 | NAME: "build_fcos_resnet_bifpn_backbone" 6 | RESNETS: 7 | DEPTH: 50 8 | BiFPN: 9 | IN_FEATURES: ["res3", "res4", "res5"] 10 | OUT_CHANNELS: 160 11 | NORM: "SyncBN" 12 | SOLVER: 13 | STEPS: (210000, 250000) 14 | MAX_ITER: 270000 15 | OUTPUT_DIR: "output/condinst_MS_R_50_3x_bifpn" 16 | -------------------------------------------------------------------------------- /detectron2/configs/quick_schedules/semantic_R_50_FPN_inference_acc_test.yaml: -------------------------------------------------------------------------------- 1 | _BASE_: "../Base-RCNN-FPN.yaml" 2 | MODEL: 3 | META_ARCHITECTURE: "SemanticSegmentor" 4 | WEIGHTS: "detectron2://semantic_R_50_FPN_1x/111802073/model_final_c18079783c55a94968edc28b7101c5f0.pkl" 5 | RESNETS: 6 | DEPTH: 50 7 | DATASETS: 8 | TEST: ("coco_2017_val_100_panoptic_stuffonly",) 9 | TEST: 10 | EXPECTED_RESULTS: [["sem_seg", "mIoU", 39.53, 0.02], ["sem_seg", "mACC", 51.50, 0.02]] 11 | -------------------------------------------------------------------------------- /detectron2/projects/PointRend/configs/InstanceSegmentation/pointrend_rcnn_R_101_FPN_3x_coco.yaml: -------------------------------------------------------------------------------- 1 | _BASE_: Base-PointRend-RCNN-FPN.yaml 2 | MODEL: 3 | WEIGHTS: detectron2://ImageNetPretrained/MSRA/R-101.pkl 4 | MASK_ON: true 5 | RESNETS: 6 | DEPTH: 101 7 | SOLVER: 8 | STEPS: (210000, 250000) 9 | MAX_ITER: 270000 10 | # To add COCO AP evaluation against the higher-quality LVIS annotations. 11 | # DATASETS: 12 | # TEST: ("coco_2017_val", "lvis_v0.5_val_cocofied") 13 | -------------------------------------------------------------------------------- /AdelaiDet/configs/BoxInst/MS_R_101_BiFPN_3x.yaml: -------------------------------------------------------------------------------- 1 | _BASE_: "Base-BoxInst.yaml" 2 | MODEL: 3 | WEIGHTS: "detectron2://ImageNetPretrained/MSRA/R-101.pkl" 4 | BACKBONE: 5 | NAME: "build_fcos_resnet_bifpn_backbone" 6 | RESNETS: 7 | DEPTH: 101 8 | BiFPN: 9 | IN_FEATURES: ["res3", "res4", "res5"] 10 | OUT_CHANNELS: 160 11 | NORM: "SyncBN" 12 | SOLVER: 13 | STEPS: (210000, 250000) 14 | MAX_ITER: 270000 15 | OUTPUT_DIR: "output/boxinst_MS_R_101_3x_bifpn" 16 | -------------------------------------------------------------------------------- /AdelaiDet/configs/CondInst/MS_R_101_BiFPN_3x.yaml: -------------------------------------------------------------------------------- 1 | _BASE_: "Base-CondInst.yaml" 2 | MODEL: 3 | WEIGHTS: "detectron2://ImageNetPretrained/MSRA/R-101.pkl" 4 | BACKBONE: 5 | NAME: "build_fcos_resnet_bifpn_backbone" 6 | RESNETS: 7 | DEPTH: 101 8 | BiFPN: 9 | IN_FEATURES: ["res3", "res4", "res5"] 10 | OUT_CHANNELS: 160 11 | NORM: "SyncBN" 12 | SOLVER: 13 | STEPS: (210000, 250000) 14 | MAX_ITER: 270000 15 | OUTPUT_DIR: "output/condinst_MS_R_101_3x_bifpn" 16 | -------------------------------------------------------------------------------- /detectron2/configs/Base-RCNN-C4.yaml: -------------------------------------------------------------------------------- 1 | MODEL: 2 | META_ARCHITECTURE: "GeneralizedRCNN" 3 | RPN: 4 | PRE_NMS_TOPK_TEST: 6000 5 | POST_NMS_TOPK_TEST: 1000 6 | ROI_HEADS: 7 | NAME: "Res5ROIHeads" 8 | DATASETS: 9 | TRAIN: ("coco_2017_train",) 10 | TEST: ("coco_2017_val",) 11 | SOLVER: 12 | IMS_PER_BATCH: 16 13 | BASE_LR: 0.02 14 | STEPS: (60000, 80000) 15 | MAX_ITER: 90000 16 | INPUT: 17 | MIN_SIZE_TRAIN: (640, 672, 704, 736, 768, 800) 18 | VERSION: 2 19 | -------------------------------------------------------------------------------- /detectron2/configs/quick_schedules/panoptic_fpn_R_50_inference_acc_test.yaml: -------------------------------------------------------------------------------- 1 | _BASE_: "../COCO-PanopticSegmentation/panoptic_fpn_R_50_3x.yaml" 2 | MODEL: 3 | WEIGHTS: "detectron2://COCO-PanopticSegmentation/panoptic_fpn_R_50_3x/139514569/model_final_c10459.pkl" 4 | DATASETS: 5 | TEST: ("coco_2017_val_100_panoptic_separated",) 6 | TEST: 7 | EXPECTED_RESULTS: [["bbox", "AP", 46.47, 0.02], ["segm", "AP", 43.39, 0.02], ["sem_seg", "mIoU", 42.55, 0.02], ["panoptic_seg", "PQ", 38.99, 0.02]] 8 | -------------------------------------------------------------------------------- /detectron2/configs/quick_schedules/keypoint_rcnn_R_50_FPN_instant_test.yaml: -------------------------------------------------------------------------------- 1 | _BASE_: "../Base-RCNN-FPN.yaml" 2 | MODEL: 3 | WEIGHTS: "detectron2://ImageNetPretrained/MSRA/R-50.pkl" 4 | KEYPOINT_ON: True 5 | ROI_HEADS: 6 | NUM_CLASSES: 1 7 | DATASETS: 8 | TRAIN: ("keypoints_coco_2017_val_100",) 9 | TEST: ("keypoints_coco_2017_val_100",) 10 | SOLVER: 11 | BASE_LR: 0.005 12 | STEPS: (30,) 13 | MAX_ITER: 40 14 | IMS_PER_BATCH: 4 15 | DATALOADER: 16 | NUM_WORKERS: 2 17 | -------------------------------------------------------------------------------- /detectron2/projects/DensePose/configs/quick_schedules/densepose_rcnn_R_50_FPN_inference_acc_test.yaml: -------------------------------------------------------------------------------- 1 | _BASE_: "../densepose_rcnn_R_50_FPN_s1x.yaml" 2 | MODEL: 3 | WEIGHTS: "https://dl.fbaipublicfiles.com/densepose/densepose_rcnn_R_50_FPN_s1x/165712039/model_final_162be9.pkl" 4 | DATASETS: 5 | TRAIN: () 6 | TEST: ("densepose_coco_2014_minival_100",) 7 | TEST: 8 | EXPECTED_RESULTS: [["bbox", "AP", 59.27, 0.025], ["densepose_gps", "AP", 60.11, 0.02], ["densepose_gpsm", "AP", 64.09, 0.02]] 9 | -------------------------------------------------------------------------------- /detectron2/projects/DensePose/densepose/data/video/__init__.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) Facebook, Inc. and its affiliates. 2 | 3 | from .frame_selector import ( 4 | FrameSelectionStrategy, 5 | RandomKFramesSelector, 6 | FirstKFramesSelector, 7 | LastKFramesSelector, 8 | FrameTsList, 9 | FrameSelector, 10 | ) 11 | 12 | from .video_keyframe_dataset import ( 13 | VideoKeyframeDataset, 14 | video_list_from_file, 15 | list_keyframes, 16 | read_keyframes, 17 | ) 18 | -------------------------------------------------------------------------------- /AdelaiDet/configs/FCOS-Detection/MS_X_101_32x8d_2x_iou.yaml: -------------------------------------------------------------------------------- 1 | _BASE_: "Base-FCOS.yaml" 2 | MODEL: 3 | WEIGHTS: "detectron2://ImageNetPretrained/FAIR/X-101-32x8d.pkl" 4 | PIXEL_STD: [57.375, 57.120, 58.395] 5 | RESNETS: 6 | STRIDE_IN_1X1: False # this is a C2 model 7 | NUM_GROUPS: 32 8 | WIDTH_PER_GROUP: 8 9 | DEPTH: 101 10 | FCOS: 11 | BOX_QUALITY: "iou" 12 | SOLVER: 13 | STEPS: (120000, 160000) 14 | MAX_ITER: 180000 15 | OUTPUT_DIR: "output/fcos/X_101_2x_iou" 16 | -------------------------------------------------------------------------------- /detectron2/projects/DensePose/configs/densepose_rcnn_R_50_FPN_WC1_s1x.yaml: -------------------------------------------------------------------------------- 1 | _BASE_: "Base-DensePose-RCNN-FPN.yaml" 2 | MODEL: 3 | WEIGHTS: "detectron2://ImageNetPretrained/MSRA/R-50.pkl" 4 | RESNETS: 5 | DEPTH: 50 6 | ROI_DENSEPOSE_HEAD: 7 | UV_CONFIDENCE: 8 | ENABLED: True 9 | TYPE: "iid_iso" 10 | POINT_REGRESSION_WEIGHTS: 0.0005 11 | SOLVER: 12 | CLIP_GRADIENTS: 13 | ENABLED: True 14 | MAX_ITER: 130000 15 | STEPS: (100000, 120000) 16 | WARMUP_FACTOR: 0.025 17 | -------------------------------------------------------------------------------- /detectron2/projects/DensePose/densepose/modeling/losses/__init__.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) Facebook, Inc. and its affiliates. 2 | 3 | from .chart import DensePoseChartLoss 4 | from .chart_with_confidences import DensePoseChartWithConfidenceLoss 5 | from .cse import DensePoseCseLoss 6 | from .registry import DENSEPOSE_LOSS_REGISTRY 7 | 8 | 9 | __all__ = [ 10 | "DensePoseChartLoss", 11 | "DensePoseChartWithConfidenceLoss", 12 | "DensePoseCseLoss", 13 | "DENSEPOSE_LOSS_REGISTRY", 14 | ] 15 | -------------------------------------------------------------------------------- /detectron2/projects/PointSup/configs/mask_rcnn_R_50_FPN_3x_point_sup_coco.yaml: -------------------------------------------------------------------------------- 1 | _BASE_: "../../../configs/Base-RCNN-FPN.yaml" 2 | MODEL: 3 | WEIGHTS: "detectron2://ImageNetPretrained/MSRA/R-50.pkl" 4 | MASK_ON: True 5 | RESNETS: 6 | DEPTH: 50 7 | ROI_MASK_HEAD: 8 | NAME: "MaskRCNNConvUpsamplePointSupHead" 9 | INPUT: 10 | POINT_SUP: True 11 | DATASETS: 12 | TRAIN: ("coco_2017_train_points_n10_v1_without_masks",) 13 | SOLVER: 14 | STEPS: (210000, 250000) 15 | MAX_ITER: 270000 16 | -------------------------------------------------------------------------------- /AdelaiDet/configs/BlendMask/Base-550.yaml: -------------------------------------------------------------------------------- 1 | _BASE_: "Base-BlendMask.yaml" 2 | MODEL: 3 | FCOS: 4 | TOP_LEVELS: 1 5 | IN_FEATURES: ["p3", "p4", "p5", "p6"] 6 | FPN_STRIDES: [8, 16, 32, 64] 7 | SIZES_OF_INTEREST: [64, 128, 256] 8 | NUM_SHARE_CONVS: 3 9 | NUM_CLS_CONVS: 0 10 | NUM_BOX_CONVS: 0 11 | BASIS_MODULE: 12 | NUM_CONVS: 2 13 | INPUT: 14 | MIN_SIZE_TRAIN: (440, 462, 484, 506, 528, 550) 15 | MAX_SIZE_TRAIN: 916 16 | MIN_SIZE_TEST: 550 17 | MAX_SIZE_TEST: 916 18 | -------------------------------------------------------------------------------- /detectron2/configs/COCO-Detection/fcos_R_50_FPN_1x.py: -------------------------------------------------------------------------------- 1 | from ..common.optim import SGD as optimizer 2 | from ..common.coco_schedule import lr_multiplier_1x as lr_multiplier 3 | from ..common.data.coco import dataloader 4 | from ..common.models.fcos import model 5 | from ..common.train import train 6 | 7 | dataloader.train.mapper.use_instance_mask = False 8 | optimizer.lr = 0.01 9 | 10 | model.backbone.bottom_up.freeze_at = 2 11 | train.init_checkpoint = "detectron2://ImageNetPretrained/MSRA/R-50.pkl" 12 | -------------------------------------------------------------------------------- /detectron2/projects/DensePose/configs/densepose_rcnn_R_101_FPN_WC1_s1x.yaml: -------------------------------------------------------------------------------- 1 | _BASE_: "Base-DensePose-RCNN-FPN.yaml" 2 | MODEL: 3 | WEIGHTS: "detectron2://ImageNetPretrained/MSRA/R-101.pkl" 4 | RESNETS: 5 | DEPTH: 101 6 | ROI_DENSEPOSE_HEAD: 7 | UV_CONFIDENCE: 8 | ENABLED: True 9 | TYPE: "iid_iso" 10 | POINT_REGRESSION_WEIGHTS: 0.0005 11 | SOLVER: 12 | CLIP_GRADIENTS: 13 | ENABLED: True 14 | MAX_ITER: 130000 15 | STEPS: (100000, 120000) 16 | WARMUP_FACTOR: 0.025 17 | -------------------------------------------------------------------------------- /detectron2/projects/DensePose/configs/densepose_rcnn_R_50_FPN_WC2_s1x.yaml: -------------------------------------------------------------------------------- 1 | _BASE_: "Base-DensePose-RCNN-FPN.yaml" 2 | MODEL: 3 | WEIGHTS: "detectron2://ImageNetPretrained/MSRA/R-50.pkl" 4 | RESNETS: 5 | DEPTH: 50 6 | ROI_DENSEPOSE_HEAD: 7 | UV_CONFIDENCE: 8 | ENABLED: True 9 | TYPE: "indep_aniso" 10 | POINT_REGRESSION_WEIGHTS: 0.0005 11 | SOLVER: 12 | CLIP_GRADIENTS: 13 | ENABLED: True 14 | MAX_ITER: 130000 15 | STEPS: (100000, 120000) 16 | WARMUP_FACTOR: 0.025 17 | -------------------------------------------------------------------------------- /detectron2/configs/common/data/constants.py: -------------------------------------------------------------------------------- 1 | constants = dict( 2 | imagenet_rgb256_mean=[123.675, 116.28, 103.53], 3 | imagenet_rgb256_std=[58.395, 57.12, 57.375], 4 | imagenet_bgr256_mean=[103.530, 116.280, 123.675], 5 | # When using pre-trained models in Detectron1 or any MSRA models, 6 | # std has been absorbed into its conv1 weights, so the std needs to be set 1. 7 | # Otherwise, you can use [57.375, 57.120, 58.395] (ImageNet std) 8 | imagenet_bgr256_std=[1.0, 1.0, 1.0], 9 | ) 10 | -------------------------------------------------------------------------------- /detectron2/projects/DensePose/configs/densepose_rcnn_R_101_FPN_WC2_s1x.yaml: -------------------------------------------------------------------------------- 1 | _BASE_: "Base-DensePose-RCNN-FPN.yaml" 2 | MODEL: 3 | WEIGHTS: "detectron2://ImageNetPretrained/MSRA/R-101.pkl" 4 | RESNETS: 5 | DEPTH: 101 6 | ROI_DENSEPOSE_HEAD: 7 | UV_CONFIDENCE: 8 | ENABLED: True 9 | TYPE: "indep_aniso" 10 | POINT_REGRESSION_WEIGHTS: 0.0005 11 | SOLVER: 12 | CLIP_GRADIENTS: 13 | ENABLED: True 14 | MAX_ITER: 130000 15 | STEPS: (100000, 120000) 16 | WARMUP_FACTOR: 0.025 17 | -------------------------------------------------------------------------------- /detectron2/.github/ISSUE_TEMPLATE/documentation.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: "\U0001F4DA Documentation Issue" 3 | about: Report a problem about existing documentation, comments, website or tutorials. 4 | labels: documentation 5 | 6 | --- 7 | 8 | ## 📚 Documentation Issue 9 | 10 | This issue category is for problems about existing documentation, not for asking how-to questions. 11 | 12 | * Provide a link to an existing documentation/comment/tutorial: 13 | 14 | * How should the above documentation/comment/tutorial improve: 15 | -------------------------------------------------------------------------------- /detectron2/configs/COCO-Detection/retinanet_R_50_FPN_1x.py: -------------------------------------------------------------------------------- 1 | from ..common.optim import SGD as optimizer 2 | from ..common.coco_schedule import lr_multiplier_1x as lr_multiplier 3 | from ..common.data.coco import dataloader 4 | from ..common.models.retinanet import model 5 | from ..common.train import train 6 | 7 | dataloader.train.mapper.use_instance_mask = False 8 | model.backbone.bottom_up.freeze_at = 2 9 | optimizer.lr = 0.01 10 | 11 | train.init_checkpoint = "detectron2://ImageNetPretrained/MSRA/R-50.pkl" 12 | -------------------------------------------------------------------------------- /detectron2/configs/quick_schedules/mask_rcnn_R_50_C4_GCV_instant_test.yaml: -------------------------------------------------------------------------------- 1 | _BASE_: "../Base-RCNN-C4.yaml" 2 | MODEL: 3 | WEIGHTS: "detectron2://ImageNetPretrained/MSRA/R-50.pkl" 4 | MASK_ON: True 5 | DATASETS: 6 | TRAIN: ("coco_2017_val_100",) 7 | TEST: ("coco_2017_val_100",) 8 | SOLVER: 9 | BASE_LR: 0.001 10 | STEPS: (30,) 11 | MAX_ITER: 40 12 | IMS_PER_BATCH: 4 13 | CLIP_GRADIENTS: 14 | ENABLED: True 15 | CLIP_TYPE: "value" 16 | CLIP_VALUE: 1.0 17 | DATALOADER: 18 | NUM_WORKERS: 2 19 | -------------------------------------------------------------------------------- /detectron2/projects/DensePose/configs/densepose_rcnn_R_101_FPN_DL_WC1_s1x.yaml: -------------------------------------------------------------------------------- 1 | _BASE_: "Base-DensePose-RCNN-FPN.yaml" 2 | MODEL: 3 | WEIGHTS: "detectron2://ImageNetPretrained/MSRA/R-101.pkl" 4 | RESNETS: 5 | DEPTH: 101 6 | ROI_DENSEPOSE_HEAD: 7 | NAME: "DensePoseDeepLabHead" 8 | UV_CONFIDENCE: 9 | ENABLED: True 10 | TYPE: "iid_iso" 11 | POINT_REGRESSION_WEIGHTS: 0.0005 12 | SOLVER: 13 | CLIP_GRADIENTS: 14 | ENABLED: True 15 | MAX_ITER: 130000 16 | STEPS: (100000, 120000) 17 | -------------------------------------------------------------------------------- /detectron2/projects/DensePose/configs/densepose_rcnn_R_50_FPN_DL_WC1_s1x.yaml: -------------------------------------------------------------------------------- 1 | _BASE_: "Base-DensePose-RCNN-FPN.yaml" 2 | MODEL: 3 | WEIGHTS: "detectron2://ImageNetPretrained/MSRA/R-50.pkl" 4 | RESNETS: 5 | DEPTH: 50 6 | ROI_DENSEPOSE_HEAD: 7 | NAME: "DensePoseDeepLabHead" 8 | UV_CONFIDENCE: 9 | ENABLED: True 10 | TYPE: "iid_iso" 11 | POINT_REGRESSION_WEIGHTS: 0.0005 12 | SOLVER: 13 | CLIP_GRADIENTS: 14 | ENABLED: True 15 | MAX_ITER: 130000 16 | STEPS: (100000, 120000) 17 | -------------------------------------------------------------------------------- /detectron2/projects/DensePose/configs/densepose_rcnn_R_101_FPN_DL_WC2_s1x.yaml: -------------------------------------------------------------------------------- 1 | _BASE_: "Base-DensePose-RCNN-FPN.yaml" 2 | MODEL: 3 | WEIGHTS: "detectron2://ImageNetPretrained/MSRA/R-101.pkl" 4 | RESNETS: 5 | DEPTH: 101 6 | ROI_DENSEPOSE_HEAD: 7 | NAME: "DensePoseDeepLabHead" 8 | UV_CONFIDENCE: 9 | ENABLED: True 10 | TYPE: "indep_aniso" 11 | POINT_REGRESSION_WEIGHTS: 0.0005 12 | SOLVER: 13 | CLIP_GRADIENTS: 14 | ENABLED: True 15 | MAX_ITER: 130000 16 | STEPS: (100000, 120000) 17 | -------------------------------------------------------------------------------- /detectron2/projects/DensePose/configs/densepose_rcnn_R_50_FPN_DL_WC2_s1x.yaml: -------------------------------------------------------------------------------- 1 | _BASE_: "Base-DensePose-RCNN-FPN.yaml" 2 | MODEL: 3 | WEIGHTS: "detectron2://ImageNetPretrained/MSRA/R-50.pkl" 4 | RESNETS: 5 | DEPTH: 50 6 | ROI_DENSEPOSE_HEAD: 7 | NAME: "DensePoseDeepLabHead" 8 | UV_CONFIDENCE: 9 | ENABLED: True 10 | TYPE: "indep_aniso" 11 | POINT_REGRESSION_WEIGHTS: 0.0005 12 | SOLVER: 13 | CLIP_GRADIENTS: 14 | ENABLED: True 15 | MAX_ITER: 130000 16 | STEPS: (100000, 120000) 17 | -------------------------------------------------------------------------------- /detectron2/projects/DensePose/densepose/data/samplers/__init__.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) Facebook, Inc. and its affiliates. 2 | 3 | from .densepose_uniform import DensePoseUniformSampler 4 | from .densepose_confidence_based import DensePoseConfidenceBasedSampler 5 | from .densepose_cse_uniform import DensePoseCSEUniformSampler 6 | from .densepose_cse_confidence_based import DensePoseCSEConfidenceBasedSampler 7 | from .mask_from_densepose import MaskFromDensePoseSampler 8 | from .prediction_to_gt import PredictionToGroundTruthSampler 9 | -------------------------------------------------------------------------------- /detectron2/detectron2/model_zoo/__init__.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) Facebook, Inc. and its affiliates. 2 | """ 3 | Model Zoo API for Detectron2: a collection of functions to create common model architectures 4 | listed in `MODEL_ZOO.md `_, 5 | and optionally load their pre-trained weights. 6 | """ 7 | 8 | from .model_zoo import get, get_config_file, get_checkpoint_url, get_config 9 | 10 | __all__ = ["get_checkpoint_url", "get", "get_config_file", "get_config"] 11 | -------------------------------------------------------------------------------- /AdelaiDet/configs/MEInst-InstanceSegmentation/MEInst_R_50_1x.yaml: -------------------------------------------------------------------------------- 1 | _BASE_: "Base-MEInst.yaml" 2 | MODEL: 3 | WEIGHTS: "detectron2://ImageNetPretrained/MSRA/R-50.pkl" 4 | RESNETS: 5 | DEPTH: 50 6 | MEInst: 7 | DIM_MASK: 60 8 | MASK_SIZE: 28 9 | USE_DEFORMABLE: True 10 | LAST_DEFORMABLE: True 11 | TYPE_DEFORMABLE: "DCNv1" 12 | INPUT: 13 | MIN_SIZE_TRAIN: (800,) 14 | SOLVER: 15 | WARMUP_METHOD: "constant" 16 | WARMUP_FACTOR: 0.3333 17 | WARMUP_ITERS: 500 18 | OUTPUT_DIR: "output/MEInst/R_50_1x" 19 | -------------------------------------------------------------------------------- /detectron2/detectron2/data/samplers/__init__.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) Facebook, Inc. and its affiliates. 2 | from .distributed_sampler import ( 3 | InferenceSampler, 4 | RandomSubsetTrainingSampler, 5 | RepeatFactorTrainingSampler, 6 | TrainingSampler, 7 | ) 8 | 9 | from .grouped_batch_sampler import GroupedBatchSampler 10 | 11 | __all__ = [ 12 | "GroupedBatchSampler", 13 | "TrainingSampler", 14 | "RandomSubsetTrainingSampler", 15 | "InferenceSampler", 16 | "RepeatFactorTrainingSampler", 17 | ] 18 | -------------------------------------------------------------------------------- /AdelaiDet/configs/BlendMask/Panoptic/Base-Panoptic.yaml: -------------------------------------------------------------------------------- 1 | _BASE_: "../Base-BlendMask.yaml" 2 | MODEL: 3 | RESNETS: 4 | OUT_FEATURES: ["res2", "res3", "res4", "res5"] 5 | FPN: 6 | IN_FEATURES: ["res2", "res3", "res4", "res5"] 7 | SEM_SEG_HEAD: 8 | LOSS_WEIGHT: 0.5 9 | PANOPTIC_FPN: 10 | COMBINE: 11 | ENABLED: True 12 | INSTANCES_CONFIDENCE_THRESH: 0.45 13 | OVERLAP_THRESH: 0.4 14 | DATASETS: 15 | TRAIN: ("coco_2017_train_panoptic_separated",) 16 | TEST: ("coco_2017_val_panoptic_separated",) 17 | -------------------------------------------------------------------------------- /detectron2/configs/Misc/mask_rcnn_R_50_FPN_3x_gn.yaml: -------------------------------------------------------------------------------- 1 | _BASE_: "../Base-RCNN-FPN.yaml" 2 | MODEL: 3 | WEIGHTS: "catalog://ImageNetPretrained/FAIR/R-50-GN" 4 | MASK_ON: True 5 | RESNETS: 6 | DEPTH: 50 7 | NORM: "GN" 8 | STRIDE_IN_1X1: False 9 | FPN: 10 | NORM: "GN" 11 | ROI_BOX_HEAD: 12 | NAME: "FastRCNNConvFCHead" 13 | NUM_CONV: 4 14 | NUM_FC: 1 15 | NORM: "GN" 16 | ROI_MASK_HEAD: 17 | NORM: "GN" 18 | SOLVER: 19 | # 3x schedule 20 | STEPS: (210000, 250000) 21 | MAX_ITER: 270000 22 | -------------------------------------------------------------------------------- /AdelaiDet/configs/FCOS-Detection/vovnet/MS_V_39_3x.yaml: -------------------------------------------------------------------------------- 1 | _BASE_: "../Base-FCOS.yaml" 2 | MODEL: 3 | WEIGHTS: "https://www.dropbox.com/s/q98pypf96rhtd8y/vovnet39_ese_detectron2.pth?dl=1" 4 | BACKBONE: 5 | NAME: "build_fcos_vovnet_fpn_backbone" 6 | FREEZE_AT: 0 7 | VOVNET: 8 | CONV_BODY : "V-39-eSE" 9 | OUT_FEATURES: ["stage3", "stage4", "stage5"] 10 | FPN: 11 | IN_FEATURES: ["stage3", "stage4", "stage5"] 12 | SOLVER: 13 | STEPS: (210000, 250000) 14 | MAX_ITER: 270000 15 | OUTPUT_DIR: "output/fcos/V_39_ms_3x" 16 | -------------------------------------------------------------------------------- /AdelaiDet/configs/FCOS-Detection/vovnet/MS_V_57_3x.yaml: -------------------------------------------------------------------------------- 1 | _BASE_: "../Base-FCOS.yaml" 2 | MODEL: 3 | WEIGHTS: "https://www.dropbox.com/s/8xl0cb3jj51f45a/vovnet57_ese_detectron2.pth?dl=1" 4 | BACKBONE: 5 | NAME: "build_fcos_vovnet_fpn_backbone" 6 | FREEZE_AT: 0 7 | VOVNET: 8 | CONV_BODY : "V-57-eSE" 9 | OUT_FEATURES: ["stage3", "stage4", "stage5"] 10 | FPN: 11 | IN_FEATURES: ["stage3", "stage4", "stage5"] 12 | SOLVER: 13 | STEPS: (210000, 250000) 14 | MAX_ITER: 270000 15 | OUTPUT_DIR: "output/fcos/V_57_ms_3x" 16 | -------------------------------------------------------------------------------- /AdelaiDet/configs/FCOS-Detection/vovnet/MS_V_99_3x.yaml: -------------------------------------------------------------------------------- 1 | _BASE_: "../Base-FCOS.yaml" 2 | MODEL: 3 | WEIGHTS: "https://www.dropbox.com/s/1mlv31coewx8trd/vovnet99_ese_detectron2.pth?dl=1" 4 | BACKBONE: 5 | NAME: "build_fcos_vovnet_fpn_backbone" 6 | FREEZE_AT: 0 7 | VOVNET: 8 | CONV_BODY : "V-99-eSE" 9 | OUT_FEATURES: ["stage3", "stage4", "stage5"] 10 | FPN: 11 | IN_FEATURES: ["stage3", "stage4", "stage5"] 12 | SOLVER: 13 | STEPS: (210000, 250000) 14 | MAX_ITER: 270000 15 | OUTPUT_DIR: "output/fcos/V_99_ms_3x" 16 | -------------------------------------------------------------------------------- /detectron2/configs/common/data/coco_keypoint.py: -------------------------------------------------------------------------------- 1 | from detectron2.data.detection_utils import create_keypoint_hflip_indices 2 | 3 | from .coco import dataloader 4 | 5 | dataloader.train.dataset.min_keypoints = 1 6 | dataloader.train.dataset.names = "keypoints_coco_2017_train" 7 | dataloader.test.dataset.names = "keypoints_coco_2017_val" 8 | 9 | dataloader.train.mapper.update( 10 | use_instance_mask=False, 11 | use_keypoint=True, 12 | keypoint_hflip_indices=create_keypoint_hflip_indices(dataloader.train.dataset.names), 13 | ) 14 | -------------------------------------------------------------------------------- /detectron2/projects/DensePose/densepose/modeling/__init__.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) Facebook, Inc. and its affiliates. 2 | 3 | from .confidence import DensePoseConfidenceModelConfig, DensePoseUVConfidenceType 4 | from .filter import DensePoseDataFilter 5 | from .inference import densepose_inference 6 | from .utils import initialize_module_params 7 | from .build import ( 8 | build_densepose_data_filter, 9 | build_densepose_embedder, 10 | build_densepose_head, 11 | build_densepose_losses, 12 | build_densepose_predictor, 13 | ) 14 | -------------------------------------------------------------------------------- /detectron2/projects/DensePose/configs/HRNet/densepose_rcnn_HRFPN_HRNet_w32_s1x.yaml: -------------------------------------------------------------------------------- 1 | _BASE_: "../Base-DensePose-RCNN-FPN.yaml" 2 | MODEL: 3 | WEIGHTS: "https://1drv.ms/u/s!Aus8VCZ_C_33dYBMemi9xOUFR0w" 4 | BACKBONE: 5 | NAME: "build_hrfpn_backbone" 6 | RPN: 7 | IN_FEATURES: ['p1', 'p2', 'p3', 'p4', 'p5'] 8 | ROI_HEADS: 9 | IN_FEATURES: ['p1', 'p2', 'p3', 'p4', 'p5'] 10 | SOLVER: 11 | MAX_ITER: 130000 12 | STEPS: (100000, 120000) 13 | CLIP_GRADIENTS: 14 | ENABLED: True 15 | CLIP_TYPE: "norm" 16 | BASE_LR: 0.03 17 | -------------------------------------------------------------------------------- /AdelaiDet/configs/BAText/ICDAR2015/v1_attn_R_50.yaml: -------------------------------------------------------------------------------- 1 | _BASE_: "Base-ic15.yaml" 2 | MODEL: 3 | RESNETS: 4 | DEPTH: 50 5 | BATEXT: 6 | RECOGNIZER: "attn" 7 | SOLVER: 8 | IMS_PER_BATCH: 4 9 | BASE_LR: 0.001 10 | MAX_ITER: 5500 11 | CHECKPOINT_PERIOD: 500 12 | INPUT: 13 | MIN_SIZE_TRAIN: (980, 1044, 1108, 1172, 1236, 1300, 1364, 1428, 1492) 14 | MAX_SIZE_TRAIN: 2900 15 | MIN_SIZE_TEST: 2000 16 | MAX_SIZE_TEST: 4000 17 | IS_ROTATE: True 18 | TEST: 19 | EVAL_PERIOD: 500 20 | OUTPUT_DIR: "output/batext/ic15/v1_attn_R_50" 21 | -------------------------------------------------------------------------------- /detectron2/projects/DensePose/configs/densepose_rcnn_R_50_FPN_s1x_legacy.yaml: -------------------------------------------------------------------------------- 1 | _BASE_: "Base-DensePose-RCNN-FPN.yaml" 2 | MODEL: 3 | WEIGHTS: "detectron2://ImageNetPretrained/MSRA/R-50.pkl" 4 | RESNETS: 5 | DEPTH: 50 6 | ROI_DENSEPOSE_HEAD: 7 | NUM_COARSE_SEGM_CHANNELS: 15 8 | POOLER_RESOLUTION: 14 9 | HEATMAP_SIZE: 56 10 | INDEX_WEIGHTS: 2.0 11 | PART_WEIGHTS: 0.3 12 | POINT_REGRESSION_WEIGHTS: 0.1 13 | DECODER_ON: False 14 | SOLVER: 15 | BASE_LR: 0.002 16 | MAX_ITER: 130000 17 | STEPS: (100000, 120000) 18 | -------------------------------------------------------------------------------- /AdelaiDet/configs/MEInst-InstanceSegmentation/MEInst_R_50_3x_512.yaml: -------------------------------------------------------------------------------- 1 | _BASE_: "Base-MEInst.yaml" 2 | MODEL: 3 | WEIGHTS: "detectron2://ImageNetPretrained/MSRA/R-50.pkl" 4 | RESNETS: 5 | DEPTH: 50 6 | MEInst: 7 | DIM_MASK: 60 8 | MASK_SIZE: 28 9 | USE_DEFORMABLE: True 10 | LAST_DEFORMABLE: True 11 | TYPE_DEFORMABLE: "DCNv1" 12 | INPUT: 13 | MIN_SIZE_TRAIN: (384, 416, 448, 480, 512, 544) 14 | MIN_SIZE_TEST: 512 15 | SOLVER: 16 | STEPS: (180000, 240000) 17 | MAX_ITER: 270000 18 | OUTPUT_DIR: "output/MEInst/R_50_3x_512" 19 | -------------------------------------------------------------------------------- /detectron2/configs/quick_schedules/mask_rcnn_R_50_FPN_inference_acc_test.yaml: -------------------------------------------------------------------------------- 1 | _BASE_: "../COCO-InstanceSegmentation/mask_rcnn_R_50_FPN_3x.yaml" 2 | MODEL: 3 | WEIGHTS: "detectron2://COCO-InstanceSegmentation/mask_rcnn_R_50_FPN_3x/137849600/model_final_f10217.pkl" 4 | DATASETS: 5 | TEST: ("coco_2017_val_100",) 6 | TEST: 7 | EXPECTED_RESULTS: [["bbox", "AP", 47.34, 0.02], ["segm", "AP", 42.67, 0.02], ["bbox_TTA", "AP", 49.11, 0.02], ["segm_TTA", "AP", 45.04, 0.02]] 8 | AUG: 9 | ENABLED: True 10 | MIN_SIZES: (700, 800) # to save some time 11 | -------------------------------------------------------------------------------- /detectron2/projects/DensePose/configs/densepose_rcnn_R_101_FPN_WC1M_s1x.yaml: -------------------------------------------------------------------------------- 1 | _BASE_: "Base-DensePose-RCNN-FPN.yaml" 2 | MODEL: 3 | WEIGHTS: "detectron2://ImageNetPretrained/MSRA/R-101.pkl" 4 | RESNETS: 5 | DEPTH: 101 6 | ROI_DENSEPOSE_HEAD: 7 | UV_CONFIDENCE: 8 | ENABLED: True 9 | TYPE: "iid_iso" 10 | SEGM_CONFIDENCE: 11 | ENABLED: True 12 | POINT_REGRESSION_WEIGHTS: 0.0005 13 | SOLVER: 14 | CLIP_GRADIENTS: 15 | ENABLED: True 16 | MAX_ITER: 130000 17 | STEPS: (100000, 120000) 18 | WARMUP_FACTOR: 0.025 19 | -------------------------------------------------------------------------------- /detectron2/projects/DensePose/configs/densepose_rcnn_R_101_FPN_s1x_legacy.yaml: -------------------------------------------------------------------------------- 1 | _BASE_: "Base-DensePose-RCNN-FPN.yaml" 2 | MODEL: 3 | WEIGHTS: "detectron2://ImageNetPretrained/MSRA/R-101.pkl" 4 | RESNETS: 5 | DEPTH: 101 6 | ROI_DENSEPOSE_HEAD: 7 | NUM_COARSE_SEGM_CHANNELS: 15 8 | POOLER_RESOLUTION: 14 9 | HEATMAP_SIZE: 56 10 | INDEX_WEIGHTS: 2.0 11 | PART_WEIGHTS: 0.3 12 | POINT_REGRESSION_WEIGHTS: 0.1 13 | DECODER_ON: False 14 | SOLVER: 15 | BASE_LR: 0.002 16 | MAX_ITER: 130000 17 | STEPS: (100000, 120000) 18 | -------------------------------------------------------------------------------- /detectron2/projects/DensePose/configs/densepose_rcnn_R_50_FPN_WC2M_s1x.yaml: -------------------------------------------------------------------------------- 1 | _BASE_: "Base-DensePose-RCNN-FPN.yaml" 2 | MODEL: 3 | WEIGHTS: "detectron2://ImageNetPretrained/MSRA/R-50.pkl" 4 | RESNETS: 5 | DEPTH: 50 6 | ROI_DENSEPOSE_HEAD: 7 | UV_CONFIDENCE: 8 | ENABLED: True 9 | TYPE: "indep_aniso" 10 | SEGM_CONFIDENCE: 11 | ENABLED: True 12 | POINT_REGRESSION_WEIGHTS: 0.0005 13 | SOLVER: 14 | CLIP_GRADIENTS: 15 | ENABLED: True 16 | MAX_ITER: 130000 17 | STEPS: (100000, 120000) 18 | WARMUP_FACTOR: 0.025 19 | -------------------------------------------------------------------------------- /detectron2/projects/ViTDet/configs/COCO/cascade_mask_rcnn_swin_l_in21k_50ep.py: -------------------------------------------------------------------------------- 1 | from .cascade_mask_rcnn_swin_b_in21k_50ep import ( 2 | dataloader, 3 | lr_multiplier, 4 | model, 5 | train, 6 | optimizer, 7 | ) 8 | 9 | model.backbone.bottom_up.depths = [2, 2, 18, 2] 10 | model.backbone.bottom_up.drop_path_rate = 0.4 11 | model.backbone.bottom_up.embed_dim = 192 12 | model.backbone.bottom_up.num_heads = [6, 12, 24, 48] 13 | 14 | 15 | train.init_checkpoint = "detectron2://ImageNetPretrained/swin/swin_large_patch4_window7_224_22k.pth" 16 | -------------------------------------------------------------------------------- /AdelaiDet/configs/BlendMask/550_R_50_dcni3_5x.yaml: -------------------------------------------------------------------------------- 1 | _BASE_: "Base-550.yaml" 2 | MODEL: 3 | WEIGHTS: "detectron2://ImageNetPretrained/MSRA/R-50.pkl" 4 | RESNETS: 5 | DEPTH: 50 6 | DEFORM_ON_PER_STAGE: [False, True, True, True] 7 | DEFORM_MODULATED: True 8 | DEFORM_INTERVAL: 3 9 | INPUT: 10 | MIN_SIZE_TRAIN: (440, 594) 11 | MIN_SIZE_TRAIN_SAMPLING: "range" 12 | MAX_SIZE_TRAIN: 990 13 | CROP: 14 | ENABLED: True 15 | SOLVER: 16 | STEPS: (210000, 250000) 17 | MAX_ITER: 270000 18 | OUTPUT_DIR: "output/blendmask/550_R_50_dcni3_5x" 19 | -------------------------------------------------------------------------------- /AdelaiDet/configs/CondInst/MS_R_101_BiFPN_3x_sem.yaml: -------------------------------------------------------------------------------- 1 | _BASE_: "Base-CondInst.yaml" 2 | MODEL: 3 | WEIGHTS: "detectron2://ImageNetPretrained/MSRA/R-101.pkl" 4 | BACKBONE: 5 | NAME: "build_fcos_resnet_bifpn_backbone" 6 | RESNETS: 7 | DEPTH: 101 8 | BiFPN: 9 | IN_FEATURES: ["res3", "res4", "res5"] 10 | OUT_CHANNELS: 160 11 | NORM: "SyncBN" 12 | CONDINST: 13 | MASK_BRANCH: 14 | SEMANTIC_LOSS_ON: True 15 | SOLVER: 16 | STEPS: (210000, 250000) 17 | MAX_ITER: 270000 18 | OUTPUT_DIR: "output/condinst_MS_R_101_3x_bifpn_sem" 19 | -------------------------------------------------------------------------------- /AdelaiDet/configs/CondInst/MS_R_50_BiFPN_3x_sem.yaml: -------------------------------------------------------------------------------- 1 | _BASE_: "Base-CondInst.yaml" 2 | MODEL: 3 | WEIGHTS: "detectron2://ImageNetPretrained/MSRA/R-50.pkl" 4 | BACKBONE: 5 | NAME: "build_fcos_resnet_bifpn_backbone" 6 | RESNETS: 7 | DEPTH: 50 8 | BiFPN: 9 | IN_FEATURES: ["res3", "res4", "res5"] 10 | OUT_CHANNELS: 160 11 | NORM: "SyncBN" 12 | CONDINST: 13 | MASK_BRANCH: 14 | SEMANTIC_LOSS_ON: True 15 | SOLVER: 16 | STEPS: (210000, 250000) 17 | MAX_ITER: 270000 18 | OUTPUT_DIR: "output/condinst_MS_R_50_3x_bifpn_sem" 19 | -------------------------------------------------------------------------------- /detectron2/docs/README.md: -------------------------------------------------------------------------------- 1 | # Read the docs: 2 | 3 | The latest documentation built from this directory is available at [detectron2.readthedocs.io](https://detectron2.readthedocs.io/). 4 | Documents in this directory are not meant to be read on github. 5 | 6 | # Build the docs: 7 | 8 | 1. Install detectron2 according to [INSTALL.md](../INSTALL.md). 9 | 2. Install additional libraries required to build docs: 10 | - docutils==0.16 11 | - Sphinx==3.2.0 12 | - recommonmark==0.6.0 13 | - sphinx_rtd_theme 14 | 15 | 3. Run `make html` from this directory. 16 | -------------------------------------------------------------------------------- /detectron2/projects/DensePose/configs/densepose_rcnn_R_101_FPN_WC2M_s1x.yaml: -------------------------------------------------------------------------------- 1 | _BASE_: "Base-DensePose-RCNN-FPN.yaml" 2 | MODEL: 3 | WEIGHTS: "detectron2://ImageNetPretrained/MSRA/R-101.pkl" 4 | RESNETS: 5 | DEPTH: 101 6 | ROI_DENSEPOSE_HEAD: 7 | UV_CONFIDENCE: 8 | ENABLED: True 9 | TYPE: "indep_aniso" 10 | SEGM_CONFIDENCE: 11 | ENABLED: True 12 | POINT_REGRESSION_WEIGHTS: 0.0005 13 | SOLVER: 14 | CLIP_GRADIENTS: 15 | ENABLED: True 16 | MAX_ITER: 130000 17 | STEPS: (100000, 120000) 18 | WARMUP_FACTOR: 0.025 19 | -------------------------------------------------------------------------------- /detectron2/.flake8: -------------------------------------------------------------------------------- 1 | # This is an example .flake8 config, used when developing *Black* itself. 2 | # Keep in sync with setup.cfg which is used for source packages. 3 | 4 | [flake8] 5 | ignore = W503, E203, E221, C901, C408, E741, C407, B017, F811, C101, EXE001, EXE002 6 | max-line-length = 100 7 | max-complexity = 18 8 | select = B,C,E,F,W,T4,B9 9 | exclude = build 10 | per-file-ignores = 11 | **/__init__.py:F401,F403,E402 12 | **/configs/**.py:F401,E402 13 | configs/**.py:F401,E402 14 | **/tests/config/**.py:F401,E402 15 | tests/config/**.py:F401,E402 16 | -------------------------------------------------------------------------------- /detectron2/projects/DensePose/configs/densepose_rcnn_R_50_FPN_DL_WC1M_s1x.yaml: -------------------------------------------------------------------------------- 1 | _BASE_: "Base-DensePose-RCNN-FPN.yaml" 2 | MODEL: 3 | WEIGHTS: "detectron2://ImageNetPretrained/MSRA/R-50.pkl" 4 | RESNETS: 5 | DEPTH: 50 6 | ROI_DENSEPOSE_HEAD: 7 | NAME: "DensePoseDeepLabHead" 8 | UV_CONFIDENCE: 9 | ENABLED: True 10 | TYPE: "iid_iso" 11 | SEGM_CONFIDENCE: 12 | ENABLED: True 13 | POINT_REGRESSION_WEIGHTS: 0.0005 14 | SOLVER: 15 | CLIP_GRADIENTS: 16 | ENABLED: True 17 | MAX_ITER: 130000 18 | STEPS: (100000, 120000) 19 | -------------------------------------------------------------------------------- /detectron2/detectron2/data/transforms/__init__.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) Facebook, Inc. and its affiliates. 2 | from fvcore.transforms.transform import Transform, TransformList # order them first 3 | from fvcore.transforms.transform import * 4 | from .transform import * 5 | from .augmentation import * 6 | from .augmentation_impl import * 7 | 8 | __all__ = [k for k in globals().keys() if not k.startswith("_")] 9 | 10 | 11 | from detectron2.utils.env import fixup_module_metadata 12 | 13 | fixup_module_metadata(__name__, globals(), __all__) 14 | del fixup_module_metadata 15 | -------------------------------------------------------------------------------- /detectron2/projects/DensePose/configs/densepose_rcnn_R_101_FPN_DL_WC1M_s1x.yaml: -------------------------------------------------------------------------------- 1 | _BASE_: "Base-DensePose-RCNN-FPN.yaml" 2 | MODEL: 3 | WEIGHTS: "detectron2://ImageNetPretrained/MSRA/R-101.pkl" 4 | RESNETS: 5 | DEPTH: 101 6 | ROI_DENSEPOSE_HEAD: 7 | NAME: "DensePoseDeepLabHead" 8 | UV_CONFIDENCE: 9 | ENABLED: True 10 | TYPE: "iid_iso" 11 | SEGM_CONFIDENCE: 12 | ENABLED: True 13 | POINT_REGRESSION_WEIGHTS: 0.0005 14 | SOLVER: 15 | CLIP_GRADIENTS: 16 | ENABLED: True 17 | MAX_ITER: 130000 18 | STEPS: (100000, 120000) 19 | -------------------------------------------------------------------------------- /detectron2/projects/DensePose/configs/densepose_rcnn_R_50_FPN_DL_WC2M_s1x.yaml: -------------------------------------------------------------------------------- 1 | _BASE_: "Base-DensePose-RCNN-FPN.yaml" 2 | MODEL: 3 | WEIGHTS: "detectron2://ImageNetPretrained/MSRA/R-50.pkl" 4 | RESNETS: 5 | DEPTH: 50 6 | ROI_DENSEPOSE_HEAD: 7 | NAME: "DensePoseDeepLabHead" 8 | UV_CONFIDENCE: 9 | ENABLED: True 10 | TYPE: "indep_aniso" 11 | SEGM_CONFIDENCE: 12 | ENABLED: True 13 | POINT_REGRESSION_WEIGHTS: 0.0005 14 | SOLVER: 15 | CLIP_GRADIENTS: 16 | ENABLED: True 17 | MAX_ITER: 130000 18 | STEPS: (100000, 120000) 19 | -------------------------------------------------------------------------------- /AdelaiDet/configs/BAText/Pretrain/v1_ic15_attn_R_50.yaml: -------------------------------------------------------------------------------- 1 | _BASE_: "Base-Pretrain-ic15.yaml" 2 | MODEL: 3 | WEIGHTS: "https://dl.fbaipublicfiles.com/detectron/ImageNetPretrained/MSRA/R-50.pkl" 4 | RESNETS: 5 | DEPTH: 50 6 | BATEXT: 7 | RECOGNIZER: "attn" 8 | POOLER_RESOLUTION: (16, 64) 9 | SOLVER: 10 | IMS_PER_BATCH: 8 11 | BASE_LR: 0.01 12 | STEPS: (160000, 220000) 13 | MAX_ITER: 260000 14 | CHECKPOINT_PERIOD: 5000 15 | TEST: 16 | EVAL_PERIOD: 20000 17 | INPUT: 18 | IS_ROTATE: True 19 | OUTPUT_DIR: "output/batext/pretrain/v1_ic15_attn_R_50" 20 | -------------------------------------------------------------------------------- /detectron2/configs/quick_schedules/panoptic_fpn_R_50_instant_test.yaml: -------------------------------------------------------------------------------- 1 | _BASE_: "../Base-RCNN-FPN.yaml" 2 | MODEL: 3 | META_ARCHITECTURE: "PanopticFPN" 4 | WEIGHTS: "detectron2://ImageNetPretrained/MSRA/R-50.pkl" 5 | MASK_ON: True 6 | RESNETS: 7 | DEPTH: 50 8 | SEM_SEG_HEAD: 9 | LOSS_WEIGHT: 0.5 10 | DATASETS: 11 | TRAIN: ("coco_2017_val_100_panoptic_separated",) 12 | TEST: ("coco_2017_val_100_panoptic_separated",) 13 | SOLVER: 14 | BASE_LR: 0.005 15 | STEPS: (30,) 16 | MAX_ITER: 40 17 | IMS_PER_BATCH: 4 18 | DATALOADER: 19 | NUM_WORKERS: 1 20 | -------------------------------------------------------------------------------- /detectron2/projects/DensePose/configs/densepose_rcnn_R_101_FPN_DL_WC2M_s1x.yaml: -------------------------------------------------------------------------------- 1 | _BASE_: "Base-DensePose-RCNN-FPN.yaml" 2 | MODEL: 3 | WEIGHTS: "detectron2://ImageNetPretrained/MSRA/R-101.pkl" 4 | RESNETS: 5 | DEPTH: 101 6 | ROI_DENSEPOSE_HEAD: 7 | NAME: "DensePoseDeepLabHead" 8 | UV_CONFIDENCE: 9 | ENABLED: True 10 | TYPE: "indep_aniso" 11 | SEGM_CONFIDENCE: 12 | ENABLED: True 13 | POINT_REGRESSION_WEIGHTS: 0.0005 14 | SOLVER: 15 | CLIP_GRADIENTS: 16 | ENABLED: True 17 | MAX_ITER: 130000 18 | STEPS: (100000, 120000) 19 | -------------------------------------------------------------------------------- /detectron2/projects/DensePose/densepose/modeling/predictors/chart_with_confidence.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) Facebook, Inc. and its affiliates. 2 | 3 | from . import DensePoseChartConfidencePredictorMixin, DensePoseChartPredictor 4 | from .registry import DENSEPOSE_PREDICTOR_REGISTRY 5 | 6 | 7 | @DENSEPOSE_PREDICTOR_REGISTRY.register() 8 | class DensePoseChartWithConfidencePredictor( 9 | DensePoseChartConfidencePredictorMixin, DensePoseChartPredictor 10 | ): 11 | """ 12 | Predictor that combines chart and chart confidence estimation 13 | """ 14 | 15 | pass 16 | -------------------------------------------------------------------------------- /detectron2/projects/TensorMask/tensormask/layers/csrc/vision.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (c) Facebook, Inc. and its affiliates. 2 | 3 | #include 4 | #include "SwapAlign2Nat/SwapAlign2Nat.h" 5 | 6 | namespace tensormask { 7 | 8 | PYBIND11_MODULE(TORCH_EXTENSION_NAME, m) { 9 | m.def( 10 | "swap_align2nat_forward", 11 | &SwapAlign2Nat_forward, 12 | "SwapAlign2Nat_forward"); 13 | m.def( 14 | "swap_align2nat_backward", 15 | &SwapAlign2Nat_backward, 16 | "SwapAlign2Nat_backward"); 17 | } 18 | 19 | } // namespace tensormask 20 | -------------------------------------------------------------------------------- /AdelaiDet/configs/BlendMask/Panoptic/R_101_dcni3_5x.yaml: -------------------------------------------------------------------------------- 1 | _BASE_: "Base-Panoptic.yaml" 2 | MODEL: 3 | WEIGHTS: "detectron2://ImageNetPretrained/MSRA/R-101.pkl" 4 | RESNETS: 5 | DEPTH: 101 6 | DEFORM_ON_PER_STAGE: [False, True, True, True] 7 | DEFORM_MODULATED: True 8 | DEFORM_INTERVAL: 3 9 | SOLVER: 10 | STEPS: (280000, 360000) 11 | MAX_ITER: 400000 12 | INPUT: 13 | MIN_SIZE_TRAIN: (640, 864) 14 | MIN_SIZE_TRAIN_SAMPLING: "range" 15 | MAX_SIZE_TRAIN: 1333 16 | CROP: 17 | ENABLED: True 18 | OUTPUT_DIR: "output/panoptic/blendmask/R_101_dcni3_5x" 19 | -------------------------------------------------------------------------------- /AdelaiDet/configs/BlendMask/Panoptic/R_50_dcni3_5x.yaml: -------------------------------------------------------------------------------- 1 | _BASE_: "Base-Panoptic.yaml" 2 | MODEL: 3 | WEIGHTS: "detectron2://ImageNetPretrained/MSRA/R-50.pkl" 4 | RESNETS: 5 | DEPTH: 50 6 | DEFORM_ON_PER_STAGE: [False, True, True, True] 7 | DEFORM_MODULATED: True 8 | DEFORM_INTERVAL: 3 9 | SOLVER: 10 | STEPS: (280000, 360000) 11 | MAX_ITER: 400000 12 | INPUT: 13 | MIN_SIZE_TRAIN: (640, 864) 14 | MIN_SIZE_TRAIN_SAMPLING: "range" 15 | MAX_SIZE_TRAIN: 1440 16 | CROP: 17 | ENABLED: True 18 | OUTPUT_DIR: "output/panoptic/blendmask/R_50_dcni3_5x" 19 | -------------------------------------------------------------------------------- /AdelaiDet/configs/SOLOv2/PointWSSIS_teacher.yaml: -------------------------------------------------------------------------------- 1 | _BASE_: "Base-SOLOv2.yaml" 2 | MODEL: 3 | WEIGHTS: "detectron2://ImageNetPretrained/MSRA/R-101.pkl" 4 | RESNETS: 5 | DEPTH: 101 6 | SOLOV2: 7 | FPN_SCALE_RANGES: "((1,72),(72,144),(144,288),(288,584),(584,2048))" 8 | NUM_GRIDS: "80,64,32,24,12" 9 | PROMPT: "point" 10 | NMS_TYPE: "mask" 11 | LOSS: 12 | DICE_WEIGHT: 3.0 13 | SOLVER: 14 | STEPS: (60000, 80000) 15 | MAX_ITER: 90000 16 | BASE_LR: 0.05 17 | CHECKPOINT_PERIOD: 5000 18 | WARMUP_ITERS: 3000 19 | TEST: 20 | EVAL_PERIOD: 5000 21 | -------------------------------------------------------------------------------- /detectron2/configs/quick_schedules/semantic_R_50_FPN_instant_test.yaml: -------------------------------------------------------------------------------- 1 | _BASE_: "../Base-RCNN-FPN.yaml" 2 | MODEL: 3 | META_ARCHITECTURE: "SemanticSegmentor" 4 | WEIGHTS: "detectron2://ImageNetPretrained/MSRA/R-50.pkl" 5 | RESNETS: 6 | DEPTH: 50 7 | DATASETS: 8 | TRAIN: ("coco_2017_val_100_panoptic_stuffonly",) 9 | TEST: ("coco_2017_val_100_panoptic_stuffonly",) 10 | INPUT: 11 | MIN_SIZE_TRAIN: (640, 672, 704, 736, 768, 800) 12 | SOLVER: 13 | BASE_LR: 0.005 14 | STEPS: (30,) 15 | MAX_ITER: 40 16 | IMS_PER_BATCH: 4 17 | DATALOADER: 18 | NUM_WORKERS: 2 19 | -------------------------------------------------------------------------------- /detectron2/projects/DensePose/densepose/modeling/predictors/__init__.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) Facebook, Inc. and its affiliates. 2 | 3 | from .chart import DensePoseChartPredictor 4 | from .chart_confidence import DensePoseChartConfidencePredictorMixin 5 | from .chart_with_confidence import DensePoseChartWithConfidencePredictor 6 | from .cse import DensePoseEmbeddingPredictor 7 | from .cse_confidence import DensePoseEmbeddingConfidencePredictorMixin 8 | from .cse_with_confidence import DensePoseEmbeddingWithConfidencePredictor 9 | from .registry import DENSEPOSE_PREDICTOR_REGISTRY 10 | -------------------------------------------------------------------------------- /detectron2/configs/PascalVOC-Detection/faster_rcnn_R_50_C4.yaml: -------------------------------------------------------------------------------- 1 | _BASE_: "../Base-RCNN-C4.yaml" 2 | MODEL: 3 | WEIGHTS: "detectron2://ImageNetPretrained/MSRA/R-50.pkl" 4 | MASK_ON: False 5 | RESNETS: 6 | DEPTH: 50 7 | ROI_HEADS: 8 | NUM_CLASSES: 20 9 | INPUT: 10 | MIN_SIZE_TRAIN: (480, 512, 544, 576, 608, 640, 672, 704, 736, 768, 800) 11 | MIN_SIZE_TEST: 800 12 | DATASETS: 13 | TRAIN: ('voc_2007_trainval', 'voc_2012_trainval') 14 | TEST: ('voc_2007_test',) 15 | SOLVER: 16 | STEPS: (12000, 16000) 17 | MAX_ITER: 18000 # 17.4 epochs 18 | WARMUP_ITERS: 100 19 | -------------------------------------------------------------------------------- /detectron2/configs/PascalVOC-Detection/faster_rcnn_R_50_FPN.yaml: -------------------------------------------------------------------------------- 1 | _BASE_: "../Base-RCNN-FPN.yaml" 2 | MODEL: 3 | WEIGHTS: "detectron2://ImageNetPretrained/MSRA/R-50.pkl" 4 | MASK_ON: False 5 | RESNETS: 6 | DEPTH: 50 7 | ROI_HEADS: 8 | NUM_CLASSES: 20 9 | INPUT: 10 | MIN_SIZE_TRAIN: (480, 512, 544, 576, 608, 640, 672, 704, 736, 768, 800) 11 | MIN_SIZE_TEST: 800 12 | DATASETS: 13 | TRAIN: ('voc_2007_trainval', 'voc_2012_trainval') 14 | TEST: ('voc_2007_test',) 15 | SOLVER: 16 | STEPS: (12000, 16000) 17 | MAX_ITER: 18000 # 17.4 epochs 18 | WARMUP_ITERS: 100 19 | -------------------------------------------------------------------------------- /detectron2/projects/DensePose/densepose/modeling/predictors/cse_with_confidence.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) Facebook, Inc. and its affiliates. 2 | 3 | from . import DensePoseEmbeddingConfidencePredictorMixin, DensePoseEmbeddingPredictor 4 | from .registry import DENSEPOSE_PREDICTOR_REGISTRY 5 | 6 | 7 | @DENSEPOSE_PREDICTOR_REGISTRY.register() 8 | class DensePoseEmbeddingWithConfidencePredictor( 9 | DensePoseEmbeddingConfidencePredictorMixin, DensePoseEmbeddingPredictor 10 | ): 11 | """ 12 | Predictor that combines CSE and CSE confidence estimation 13 | """ 14 | 15 | pass 16 | -------------------------------------------------------------------------------- /AdelaiDet/configs/FCOS-Detection/MS_X_101_64x4d_2x_dcnv2.yaml: -------------------------------------------------------------------------------- 1 | _BASE_: "Base-FCOS.yaml" 2 | MODEL: 3 | WEIGHTS: "catalog://ImageNetPretrained/FAIR/X-101-64x4d" 4 | PIXEL_STD: [1.0, 1.0, 1.0] 5 | RESNETS: 6 | STRIDE_IN_1X1: False # this is a C2 model 7 | NUM_GROUPS: 64 8 | WIDTH_PER_GROUP: 4 9 | DEPTH: 101 10 | DEFORM_ON_PER_STAGE: [False, False, True, True] # on Res4, Res5 11 | DEFORM_MODULATED: True 12 | FCOS: 13 | USE_DEFORMABLE: True 14 | SOLVER: 15 | STEPS: (120000, 160000) 16 | MAX_ITER: 180000 17 | OUTPUT_DIR: "output/fcos/MS_X_101_64x4d_2x_dcnv2" 18 | -------------------------------------------------------------------------------- /detectron2/configs/Detectron1-Comparisons/faster_rcnn_R_50_FPN_noaug_1x.yaml: -------------------------------------------------------------------------------- 1 | _BASE_: "../Base-RCNN-FPN.yaml" 2 | MODEL: 3 | WEIGHTS: "detectron2://ImageNetPretrained/MSRA/R-50.pkl" 4 | MASK_ON: False 5 | RESNETS: 6 | DEPTH: 50 7 | # Detectron1 uses smooth L1 loss with some magic beta values. 8 | # The defaults are changed to L1 loss in Detectron2. 9 | RPN: 10 | SMOOTH_L1_BETA: 0.1111 11 | ROI_BOX_HEAD: 12 | SMOOTH_L1_BETA: 1.0 13 | POOLER_SAMPLING_RATIO: 2 14 | POOLER_TYPE: "ROIAlign" 15 | INPUT: 16 | # no scale augmentation 17 | MIN_SIZE_TRAIN: (800, ) 18 | -------------------------------------------------------------------------------- /AdelaiDet/configs/BlendMask/R_101_dcni3_5x.yaml: -------------------------------------------------------------------------------- 1 | _BASE_: "Base-BlendMask.yaml" 2 | MODEL: 3 | WEIGHTS: "detectron2://ImageNetPretrained/MSRA/R-101.pkl" 4 | RESNETS: 5 | DEPTH: 101 6 | DEFORM_ON_PER_STAGE: [False, True, True, True] 7 | DEFORM_MODULATED: True 8 | DEFORM_INTERVAL: 3 9 | SOLVER: 10 | STEPS: (280000, 360000) 11 | MAX_ITER: 400000 12 | INPUT: 13 | MIN_SIZE_TRAIN: (640, 864) 14 | MIN_SIZE_TRAIN_SAMPLING: "range" 15 | MAX_SIZE_TRAIN: 1440 16 | CROP: 17 | ENABLED: True 18 | TEST: 19 | EVAL_PERIOD: 20000 20 | OUTPUT_DIR: "output/blendmask/R_101_dcni3_5x" 21 | -------------------------------------------------------------------------------- /detectron2/detectron2/data/datasets/__init__.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) Facebook, Inc. and its affiliates. 2 | from .coco import load_coco_json, load_sem_seg, register_coco_instances, convert_to_coco_json 3 | from .coco_panoptic import register_coco_panoptic, register_coco_panoptic_separated 4 | from .lvis import load_lvis_json, register_lvis_instances, get_lvis_instances_meta 5 | from .pascal_voc import load_voc_instances, register_pascal_voc 6 | from . import builtin as _builtin # ensure the builtin datasets are registered 7 | 8 | 9 | __all__ = [k for k in globals().keys() if not k.startswith("_")] 10 | -------------------------------------------------------------------------------- /AdelaiDet/configs/BoxInst/MS_R_101_BiFPN_dcni3_3x.yaml: -------------------------------------------------------------------------------- 1 | _BASE_: "Base-BoxInst.yaml" 2 | MODEL: 3 | WEIGHTS: "detectron2://ImageNetPretrained/MSRA/R-101.pkl" 4 | BACKBONE: 5 | NAME: "build_fcos_resnet_bifpn_backbone" 6 | RESNETS: 7 | DEPTH: 101 8 | DEFORM_ON_PER_STAGE: [False, True, True, True] 9 | DEFORM_MODULATED: True 10 | DEFORM_INTERVAL: 3 11 | BiFPN: 12 | IN_FEATURES: ["res3", "res4", "res5"] 13 | OUT_CHANNELS: 160 14 | NORM: "SyncBN" 15 | SOLVER: 16 | STEPS: (210000, 250000) 17 | MAX_ITER: 270000 18 | OUTPUT_DIR: "output/boxinst_MS_R_101_BiFPN_dcni3_3x" 19 | -------------------------------------------------------------------------------- /AdelaiDet/configs/FCOS-Detection/MS_X_101_32x8d_2x_dcnv2.yaml: -------------------------------------------------------------------------------- 1 | _BASE_: "Base-FCOS.yaml" 2 | MODEL: 3 | WEIGHTS: "detectron2://ImageNetPretrained/FAIR/X-101-32x8d.pkl" 4 | PIXEL_STD: [57.375, 57.120, 58.395] 5 | RESNETS: 6 | STRIDE_IN_1X1: False # this is a C2 model 7 | NUM_GROUPS: 32 8 | WIDTH_PER_GROUP: 8 9 | DEPTH: 101 10 | DEFORM_ON_PER_STAGE: [False, False, True, True] # on Res4, Res5 11 | DEFORM_MODULATED: True 12 | FCOS: 13 | USE_DEFORMABLE: True 14 | SOLVER: 15 | STEPS: (120000, 160000) 16 | MAX_ITER: 180000 17 | OUTPUT_DIR: "output/fcos/MS_X_101_2x_dcnv2" 18 | -------------------------------------------------------------------------------- /detectron2/projects/DensePose/configs/densepose_rcnn_R_50_FPN_WC1M_s1x.yaml: -------------------------------------------------------------------------------- 1 | _BASE_: "Base-DensePose-RCNN-FPN.yaml" 2 | MODEL: 3 | WEIGHTS: "detectron2://ImageNetPretrained/MSRA/R-50.pkl" 4 | RESNETS: 5 | DEPTH: 50 6 | ROI_DENSEPOSE_HEAD: 7 | UV_CONFIDENCE: 8 | ENABLED: True 9 | TYPE: "iid_iso" 10 | SEGM_CONFIDENCE: 11 | ENABLED: True 12 | POINT_REGRESSION_WEIGHTS: 0.0005 13 | SOLVER: 14 | CLIP_GRADIENTS: 15 | ENABLED: True 16 | CLIP_TYPE: norm 17 | CLIP_VALUE: 100.0 18 | MAX_ITER: 130000 19 | STEPS: (100000, 120000) 20 | WARMUP_FACTOR: 0.025 21 | -------------------------------------------------------------------------------- /detectron2/configs/Misc/mask_rcnn_R_50_FPN_3x_syncbn.yaml: -------------------------------------------------------------------------------- 1 | _BASE_: "../Base-RCNN-FPN.yaml" 2 | MODEL: 3 | WEIGHTS: "detectron2://ImageNetPretrained/MSRA/R-50.pkl" 4 | MASK_ON: True 5 | RESNETS: 6 | DEPTH: 50 7 | NORM: "SyncBN" 8 | STRIDE_IN_1X1: True 9 | FPN: 10 | NORM: "SyncBN" 11 | ROI_BOX_HEAD: 12 | NAME: "FastRCNNConvFCHead" 13 | NUM_CONV: 4 14 | NUM_FC: 1 15 | NORM: "SyncBN" 16 | ROI_MASK_HEAD: 17 | NORM: "SyncBN" 18 | SOLVER: 19 | # 3x schedule 20 | STEPS: (210000, 250000) 21 | MAX_ITER: 270000 22 | TEST: 23 | PRECISE_BN: 24 | ENABLED: True 25 | -------------------------------------------------------------------------------- /detectron2/dev/packaging/README.md: -------------------------------------------------------------------------------- 1 | 2 | ## To build a cu101 wheel for release: 3 | 4 | ``` 5 | $ nvidia-docker run -it --storage-opt "size=20GB" --name pt pytorch/manylinux-cuda101 6 | # inside the container: 7 | # git clone https://github.com/facebookresearch/detectron2/ 8 | # cd detectron2 9 | # export CU_VERSION=cu101 D2_VERSION_SUFFIX= PYTHON_VERSION=3.7 PYTORCH_VERSION=1.8 10 | # ./dev/packaging/build_wheel.sh 11 | ``` 12 | 13 | ## To build all wheels for combinations of CUDA and Python 14 | ``` 15 | ./dev/packaging/build_all_wheels.sh 16 | ./dev/packaging/gen_wheel_index.sh /path/to/wheels 17 | ``` 18 | -------------------------------------------------------------------------------- /detectron2/projects/MViTv2/configs/cascade_mask_rcnn_mvitv2_h_in21k_lsj_3x.py: -------------------------------------------------------------------------------- 1 | from .cascade_mask_rcnn_mvitv2_b_3x import model, optimizer, train, lr_multiplier 2 | from .common.coco_loader_lsj import dataloader 3 | 4 | 5 | model.backbone.bottom_up.embed_dim = 192 6 | model.backbone.bottom_up.depth = 80 7 | model.backbone.bottom_up.num_heads = 3 8 | model.backbone.bottom_up.last_block_indexes = (3, 11, 71, 79) 9 | model.backbone.bottom_up.drop_path_rate = 0.6 10 | model.backbone.bottom_up.use_act_checkpoint = True 11 | 12 | train.init_checkpoint = "detectron2://ImageNetPretrained/mvitv2/MViTv2_H_in21k.pyth" 13 | -------------------------------------------------------------------------------- /detectron2/configs/LVISv0.5-InstanceSegmentation/mask_rcnn_R_50_FPN_1x.yaml: -------------------------------------------------------------------------------- 1 | _BASE_: "../Base-RCNN-FPN.yaml" 2 | MODEL: 3 | WEIGHTS: "detectron2://ImageNetPretrained/MSRA/R-50.pkl" 4 | MASK_ON: True 5 | RESNETS: 6 | DEPTH: 50 7 | ROI_HEADS: 8 | NUM_CLASSES: 1230 9 | SCORE_THRESH_TEST: 0.0001 10 | INPUT: 11 | MIN_SIZE_TRAIN: (640, 672, 704, 736, 768, 800) 12 | DATASETS: 13 | TRAIN: ("lvis_v0.5_train",) 14 | TEST: ("lvis_v0.5_val",) 15 | TEST: 16 | DETECTIONS_PER_IMAGE: 300 # LVIS allows up to 300 17 | DATALOADER: 18 | SAMPLER_TRAIN: "RepeatFactorTrainingSampler" 19 | REPEAT_THRESHOLD: 0.001 20 | -------------------------------------------------------------------------------- /detectron2/configs/Misc/scratch_mask_rcnn_R_50_FPN_3x_gn.yaml: -------------------------------------------------------------------------------- 1 | _BASE_: "mask_rcnn_R_50_FPN_3x_gn.yaml" 2 | MODEL: 3 | # Train from random initialization. 4 | WEIGHTS: "" 5 | # It makes sense to divide by STD when training from scratch 6 | # But it seems to make no difference on the results and C2's models didn't do this. 7 | # So we keep things consistent with C2. 8 | # PIXEL_STD: [57.375, 57.12, 58.395] 9 | MASK_ON: True 10 | BACKBONE: 11 | FREEZE_AT: 0 12 | # NOTE: Please refer to Rethinking ImageNet Pre-training https://arxiv.org/abs/1811.08883 13 | # to learn what you need for training from scratch. 14 | -------------------------------------------------------------------------------- /detectron2/detectron2/modeling/meta_arch/__init__.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | # Copyright (c) Facebook, Inc. and its affiliates. 3 | 4 | from .build import META_ARCH_REGISTRY, build_model # isort:skip 5 | 6 | from .panoptic_fpn import PanopticFPN 7 | 8 | # import all the meta_arch, so they will be registered 9 | from .rcnn import GeneralizedRCNN, ProposalNetwork 10 | from .dense_detector import DenseDetector 11 | from .retinanet import RetinaNet 12 | from .fcos import FCOS 13 | from .semantic_seg import SEM_SEG_HEADS_REGISTRY, SemanticSegmentor, build_sem_seg_head 14 | 15 | 16 | __all__ = list(globals().keys()) 17 | -------------------------------------------------------------------------------- /detectron2/configs/LVISv0.5-InstanceSegmentation/mask_rcnn_R_101_FPN_1x.yaml: -------------------------------------------------------------------------------- 1 | _BASE_: "../Base-RCNN-FPN.yaml" 2 | MODEL: 3 | WEIGHTS: "detectron2://ImageNetPretrained/MSRA/R-101.pkl" 4 | MASK_ON: True 5 | RESNETS: 6 | DEPTH: 101 7 | ROI_HEADS: 8 | NUM_CLASSES: 1230 9 | SCORE_THRESH_TEST: 0.0001 10 | INPUT: 11 | MIN_SIZE_TRAIN: (640, 672, 704, 736, 768, 800) 12 | DATASETS: 13 | TRAIN: ("lvis_v0.5_train",) 14 | TEST: ("lvis_v0.5_val",) 15 | TEST: 16 | DETECTIONS_PER_IMAGE: 300 # LVIS allows up to 300 17 | DATALOADER: 18 | SAMPLER_TRAIN: "RepeatFactorTrainingSampler" 19 | REPEAT_THRESHOLD: 0.001 20 | -------------------------------------------------------------------------------- /detectron2/configs/quick_schedules/README.md: -------------------------------------------------------------------------------- 1 | These are quick configs for performance or accuracy regression tracking purposes. 2 | 3 | * `*instance_test.yaml`: can train on 2 GPUs. They are used to test whether the training can 4 | successfully finish. They are not expected to produce reasonable training results. 5 | * `*inference_acc_test.yaml`: They should be run using `--eval-only`. They run inference using pre-trained models and verify 6 | the results are as expected. 7 | * `*training_acc_test.yaml`: They should be trained on 8 GPUs. They finish in about an hour and verify the training accuracy 8 | is within the normal range. 9 | -------------------------------------------------------------------------------- /detectron2/projects/DensePose/configs/quick_schedules/densepose_rcnn_R_50_FPN_WC1_instant_test.yaml: -------------------------------------------------------------------------------- 1 | _BASE_: "../Base-DensePose-RCNN-FPN.yaml" 2 | MODEL: 3 | WEIGHTS: "detectron2://ImageNetPretrained/MSRA/R-50.pkl" 4 | RESNETS: 5 | DEPTH: 50 6 | ROI_DENSEPOSE_HEAD: 7 | UV_CONFIDENCE: 8 | ENABLED: True 9 | TYPE: "iid_iso" 10 | POINT_REGRESSION_WEIGHTS: 0.0005 11 | DATASETS: 12 | TRAIN: ("densepose_coco_2014_minival_100",) 13 | TEST: ("densepose_coco_2014_minival_100",) 14 | SOLVER: 15 | CLIP_GRADIENTS: 16 | ENABLED: True 17 | MAX_ITER: 40 18 | STEPS: (30,) 19 | WARMUP_FACTOR: 0.025 20 | -------------------------------------------------------------------------------- /detectron2/projects/DensePose/densepose/utils/transform.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) Facebook, Inc. and its affiliates. 2 | from detectron2.data import MetadataCatalog 3 | from detectron2.utils.file_io import PathManager 4 | 5 | from densepose import DensePoseTransformData 6 | 7 | 8 | def load_for_dataset(dataset_name): 9 | path = MetadataCatalog.get(dataset_name).densepose_transform_src 10 | densepose_transform_data_fpath = PathManager.get_local_path(path) 11 | return DensePoseTransformData.load(densepose_transform_data_fpath) 12 | 13 | 14 | def load_from_cfg(cfg): 15 | return load_for_dataset(cfg.DATASETS.TEST[0]) 16 | -------------------------------------------------------------------------------- /AdelaiDet/adet/modeling/__init__.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved 2 | from .fcos import FCOS 3 | from .blendmask import BlendMask 4 | from .backbone import build_fcos_resnet_fpn_backbone 5 | from .one_stage_detector import OneStageDetector, OneStageRCNN 6 | from .roi_heads.text_head import TextHead 7 | from .batext import BAText 8 | from .MEInst import MEInst 9 | from .condinst import condinst 10 | from .solov2 import SOLOv2 11 | from .fcpose import FCPose 12 | 13 | _EXCLUDE = {"torch", "ShapeSpec"} 14 | __all__ = [k for k in globals().keys() if k not in _EXCLUDE and not k.startswith("_")] 15 | -------------------------------------------------------------------------------- /detectron2/projects/DensePose/configs/quick_schedules/densepose_rcnn_R_50_FPN_WC2_instant_test.yaml: -------------------------------------------------------------------------------- 1 | _BASE_: "../Base-DensePose-RCNN-FPN.yaml" 2 | MODEL: 3 | WEIGHTS: "detectron2://ImageNetPretrained/MSRA/R-50.pkl" 4 | RESNETS: 5 | DEPTH: 50 6 | ROI_DENSEPOSE_HEAD: 7 | UV_CONFIDENCE: 8 | ENABLED: True 9 | TYPE: "indep_aniso" 10 | POINT_REGRESSION_WEIGHTS: 0.0005 11 | DATASETS: 12 | TRAIN: ("densepose_coco_2014_minival_100",) 13 | TEST: ("densepose_coco_2014_minival_100",) 14 | SOLVER: 15 | CLIP_GRADIENTS: 16 | ENABLED: True 17 | MAX_ITER: 40 18 | STEPS: (30,) 19 | WARMUP_FACTOR: 0.025 20 | -------------------------------------------------------------------------------- /detectron2/projects/PointRend/configs/InstanceSegmentation/pointrend_rcnn_X_101_32x8d_FPN_3x_coco.yaml: -------------------------------------------------------------------------------- 1 | _BASE_: Base-PointRend-RCNN-FPN.yaml 2 | MODEL: 3 | MASK_ON: True 4 | WEIGHTS: "detectron2://ImageNetPretrained/FAIR/X-101-32x8d.pkl" 5 | PIXEL_STD: [57.375, 57.120, 58.395] 6 | RESNETS: 7 | STRIDE_IN_1X1: False # this is a C2 model 8 | NUM_GROUPS: 32 9 | WIDTH_PER_GROUP: 8 10 | DEPTH: 101 11 | SOLVER: 12 | STEPS: (210000, 250000) 13 | MAX_ITER: 270000 14 | # To add COCO AP evaluation against the higher-quality LVIS annotations. 15 | # DATASETS: 16 | # TEST: ("coco_2017_val", "lvis_v0.5_val_cocofied") 17 | -------------------------------------------------------------------------------- /AdelaiDet/configs/FCOS-Detection/MS_X_101_32x8d_2x_dcnv2_iou.yaml: -------------------------------------------------------------------------------- 1 | _BASE_: "Base-FCOS.yaml" 2 | MODEL: 3 | WEIGHTS: "detectron2://ImageNetPretrained/FAIR/X-101-32x8d.pkl" 4 | PIXEL_STD: [57.375, 57.120, 58.395] 5 | RESNETS: 6 | STRIDE_IN_1X1: False # this is a C2 model 7 | NUM_GROUPS: 32 8 | WIDTH_PER_GROUP: 8 9 | DEPTH: 101 10 | DEFORM_ON_PER_STAGE: [False, False, True, True] # on Res4, Res5 11 | DEFORM_MODULATED: True 12 | FCOS: 13 | USE_DEFORMABLE: True 14 | BOX_QUALITY: "iou" 15 | SOLVER: 16 | STEPS: (120000, 160000) 17 | MAX_ITER: 180000 18 | OUTPUT_DIR: "output/fcos/MS_X_101_2x_dcnv2_iou" 19 | -------------------------------------------------------------------------------- /detectron2/configs/COCO-Keypoints/Base-Keypoint-RCNN-FPN.yaml: -------------------------------------------------------------------------------- 1 | _BASE_: "../Base-RCNN-FPN.yaml" 2 | MODEL: 3 | KEYPOINT_ON: True 4 | ROI_HEADS: 5 | NUM_CLASSES: 1 6 | ROI_BOX_HEAD: 7 | SMOOTH_L1_BETA: 0.5 # Keypoint AP degrades (though box AP improves) when using plain L1 loss 8 | RPN: 9 | # Detectron1 uses 2000 proposals per-batch, but this option is per-image in detectron2. 10 | # 1000 proposals per-image is found to hurt box AP. 11 | # Therefore we increase it to 1500 per-image. 12 | POST_NMS_TOPK_TRAIN: 1500 13 | DATASETS: 14 | TRAIN: ("keypoints_coco_2017_train",) 15 | TEST: ("keypoints_coco_2017_val",) 16 | -------------------------------------------------------------------------------- /detectron2/detectron2/layers/shape_spec.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | # Copyright (c) Facebook, Inc. and its affiliates. 3 | from dataclasses import dataclass 4 | from typing import Optional 5 | 6 | 7 | @dataclass 8 | class ShapeSpec: 9 | """ 10 | A simple structure that contains basic shape specification about a tensor. 11 | It is often used as the auxiliary inputs/outputs of models, 12 | to complement the lack of shape inference ability among pytorch modules. 13 | """ 14 | 15 | channels: Optional[int] = None 16 | height: Optional[int] = None 17 | width: Optional[int] = None 18 | stride: Optional[int] = None 19 | -------------------------------------------------------------------------------- /detectron2/configs/quick_schedules/mask_rcnn_R_50_FPN_training_acc_test.yaml: -------------------------------------------------------------------------------- 1 | _BASE_: "../Base-RCNN-FPN.yaml" 2 | MODEL: 3 | WEIGHTS: "detectron2://ImageNetPretrained/MSRA/R-50.pkl" 4 | ROI_HEADS: 5 | BATCH_SIZE_PER_IMAGE: 256 6 | MASK_ON: True 7 | DATASETS: 8 | TRAIN: ("coco_2017_val",) 9 | TEST: ("coco_2017_val",) 10 | INPUT: 11 | MIN_SIZE_TRAIN: (600,) 12 | MAX_SIZE_TRAIN: 1000 13 | MIN_SIZE_TEST: 800 14 | MAX_SIZE_TEST: 1000 15 | SOLVER: 16 | WARMUP_FACTOR: 0.3333333 17 | WARMUP_ITERS: 100 18 | STEPS: (5500, 5800) 19 | MAX_ITER: 6000 20 | TEST: 21 | EXPECTED_RESULTS: [["bbox", "AP", 42.5, 1.0], ["segm", "AP", 35.8, 0.8]] 22 | -------------------------------------------------------------------------------- /detectron2/projects/DeepLab/configs/Cityscapes-SemanticSegmentation/deeplab_v3_R_103_os16_mg124_poly_90k_bs16.yaml: -------------------------------------------------------------------------------- 1 | _BASE_: Base-DeepLabV3-OS16-Semantic.yaml 2 | MODEL: 3 | WEIGHTS: "detectron2://DeepLab/R-103.pkl" 4 | PIXEL_MEAN: [123.675, 116.280, 103.530] 5 | PIXEL_STD: [58.395, 57.120, 57.375] 6 | BACKBONE: 7 | NAME: "build_resnet_deeplab_backbone" 8 | RESNETS: 9 | DEPTH: 101 10 | NORM: "SyncBN" 11 | RES5_MULTI_GRID: [1, 2, 4] 12 | STEM_TYPE: "deeplab" 13 | STEM_OUT_CHANNELS: 128 14 | STRIDE_IN_1X1: False 15 | SEM_SEG_HEAD: 16 | NAME: "DeepLabV3Head" 17 | NORM: "SyncBN" 18 | INPUT: 19 | FORMAT: "RGB" 20 | -------------------------------------------------------------------------------- /detectron2/projects/DensePose/configs/quick_schedules/densepose_rcnn_R_50_FPN_TTA_inference_acc_test.yaml: -------------------------------------------------------------------------------- 1 | _BASE_: "../densepose_rcnn_R_50_FPN_s1x.yaml" 2 | MODEL: 3 | WEIGHTS: "https://dl.fbaipublicfiles.com/densepose/densepose_rcnn_R_50_FPN_s1x/165712039/model_final_162be9.pkl" 4 | DATASETS: 5 | TRAIN: () 6 | TEST: ("densepose_coco_2014_minival_100",) 7 | TEST: 8 | AUG: 9 | ENABLED: True 10 | MIN_SIZES: (400, 500, 600, 700, 800, 900, 1000, 1100, 1200) 11 | MAX_SIZE: 4000 12 | FLIP: True 13 | EXPECTED_RESULTS: [["bbox_TTA", "AP", 61.74, 0.03], ["densepose_gps_TTA", "AP", 60.22, 0.03], ["densepose_gpsm_TTA", "AP", 63.59, 0.03]] 14 | -------------------------------------------------------------------------------- /AdelaiDet/configs/FCOS-Detection/FCOS_RT/MS_R_50_4x_syncbn.yaml: -------------------------------------------------------------------------------- 1 | _BASE_: "../Base-FCOS.yaml" 2 | INPUT: 3 | MIN_SIZE_TRAIN: (256, 288, 320, 352, 384, 416, 448, 480, 512, 544, 576, 608) 4 | MAX_SIZE_TRAIN: 900 5 | MAX_SIZE_TEST: 736 6 | MIN_SIZE_TEST: 512 7 | MODEL: 8 | WEIGHTS: "detectron2://ImageNetPretrained/MSRA/R-50.pkl" 9 | RESNETS: 10 | DEPTH: 50 11 | NORM: "SyncBN" 12 | FCOS: 13 | TOP_LEVELS: 0 14 | SIZES_OF_INTEREST: [64, 128] 15 | FPN_STRIDES: [8, 16, 32] 16 | IN_FEATURES: ['p3', 'p4', 'p5'] 17 | SOLVER: 18 | STEPS: (300000, 340000) 19 | MAX_ITER: 360000 20 | OUTPUT_DIR: "output/fcos/FCOS_RT_MS_R_50_4x_syncbn" 21 | -------------------------------------------------------------------------------- /AdelaiDet/configs/SOLOv2/Base-SOLOv2.yaml: -------------------------------------------------------------------------------- 1 | MODEL: 2 | META_ARCHITECTURE: "SOLOv2" 3 | MASK_ON: True 4 | BACKBONE: 5 | NAME: "build_resnet_fpn_backbone" 6 | RESNETS: 7 | OUT_FEATURES: ["res2", "res3", "res4", "res5"] 8 | FPN: 9 | IN_FEATURES: ["res2", "res3", "res4", "res5"] 10 | DATASETS: 11 | TRAIN: ("coco_2017_train",) 12 | TEST: ("coco_2017_val",) 13 | SOLVER: 14 | IMS_PER_BATCH: 16 15 | BASE_LR: 0.01 16 | WARMUP_FACTOR: 0.01 17 | WARMUP_ITERS: 1000 18 | STEPS: (60000, 80000) 19 | MAX_ITER: 90000 20 | INPUT: 21 | MIN_SIZE_TRAIN: (640, 672, 704, 736, 768, 800) 22 | MASK_FORMAT: "bitmask" 23 | VERSION: 2 24 | 25 | 26 | -------------------------------------------------------------------------------- /detectron2/configs/Misc/scratch_mask_rcnn_R_50_FPN_9x_gn.yaml: -------------------------------------------------------------------------------- 1 | _BASE_: "mask_rcnn_R_50_FPN_3x_gn.yaml" 2 | MODEL: 3 | PIXEL_STD: [57.375, 57.12, 58.395] 4 | WEIGHTS: "" 5 | MASK_ON: True 6 | RESNETS: 7 | STRIDE_IN_1X1: False 8 | BACKBONE: 9 | FREEZE_AT: 0 10 | SOLVER: 11 | # 9x schedule 12 | IMS_PER_BATCH: 64 # 4x the standard 13 | STEPS: (187500, 197500) # last 60/4==15k and last 20/4==5k 14 | MAX_ITER: 202500 # 90k * 9 / 4 15 | BASE_LR: 0.08 16 | TEST: 17 | EVAL_PERIOD: 2500 18 | # NOTE: Please refer to Rethinking ImageNet Pre-training https://arxiv.org/abs/1811.08883 19 | # to learn what you need for training from scratch. 20 | -------------------------------------------------------------------------------- /detectron2/configs/Misc/scratch_mask_rcnn_R_50_FPN_9x_syncbn.yaml: -------------------------------------------------------------------------------- 1 | _BASE_: "mask_rcnn_R_50_FPN_3x_syncbn.yaml" 2 | MODEL: 3 | PIXEL_STD: [57.375, 57.12, 58.395] 4 | WEIGHTS: "" 5 | MASK_ON: True 6 | RESNETS: 7 | STRIDE_IN_1X1: False 8 | BACKBONE: 9 | FREEZE_AT: 0 10 | SOLVER: 11 | # 9x schedule 12 | IMS_PER_BATCH: 64 # 4x the standard 13 | STEPS: (187500, 197500) # last 60/4==15k and last 20/4==5k 14 | MAX_ITER: 202500 # 90k * 9 / 4 15 | BASE_LR: 0.08 16 | TEST: 17 | EVAL_PERIOD: 2500 18 | # NOTE: Please refer to Rethinking ImageNet Pre-training https://arxiv.org/abs/1811.08883 19 | # to learn what you need for training from scratch. 20 | -------------------------------------------------------------------------------- /detectron2/docs/modules/engine.rst: -------------------------------------------------------------------------------- 1 | detectron2.engine 2 | ========================= 3 | 4 | Related tutorial: :doc:`../tutorials/training`. 5 | 6 | .. automodule:: detectron2.engine 7 | :members: 8 | :undoc-members: 9 | :show-inheritance: 10 | 11 | 12 | detectron2.engine.defaults module 13 | --------------------------------- 14 | 15 | .. automodule:: detectron2.engine.defaults 16 | :members: 17 | :undoc-members: 18 | :show-inheritance: 19 | 20 | detectron2.engine.hooks module 21 | --------------------------------- 22 | 23 | .. automodule:: detectron2.engine.hooks 24 | :members: 25 | :undoc-members: 26 | :show-inheritance: 27 | -------------------------------------------------------------------------------- /detectron2/projects/DensePose/configs/quick_schedules/densepose_rcnn_R_50_FPN_training_acc_test.yaml: -------------------------------------------------------------------------------- 1 | _BASE_: "../Base-DensePose-RCNN-FPN.yaml" 2 | MODEL: 3 | WEIGHTS: "detectron2://ImageNetPretrained/MSRA/R-50.pkl" 4 | ROI_HEADS: 5 | NUM_CLASSES: 1 6 | DATASETS: 7 | TRAIN: ("densepose_coco_2014_minival",) 8 | TEST: ("densepose_coco_2014_minival",) 9 | SOLVER: 10 | CLIP_GRADIENTS: 11 | ENABLED: True 12 | CLIP_TYPE: norm 13 | CLIP_VALUE: 1.0 14 | MAX_ITER: 6000 15 | STEPS: (5500, 5800) 16 | TEST: 17 | EXPECTED_RESULTS: [["bbox", "AP", 76.2477, 1.0], ["densepose_gps", "AP", 79.6090, 1.5], ["densepose_gpsm", "AP", 80.0061, 1.5]] 18 | 19 | -------------------------------------------------------------------------------- /detectron2/configs/quick_schedules/fast_rcnn_R_50_FPN_instant_test.yaml: -------------------------------------------------------------------------------- 1 | _BASE_: "../COCO-Detection/fast_rcnn_R_50_FPN_1x.yaml" 2 | MODEL: 3 | WEIGHTS: "detectron2://ImageNetPretrained/MSRA/R-50.pkl" 4 | DATASETS: 5 | TRAIN: ("coco_2017_val_100",) 6 | PROPOSAL_FILES_TRAIN: ("detectron2://COCO-Detection/rpn_R_50_FPN_1x/137258492/coco_2017_val_box_proposals_ee0dad.pkl", ) 7 | TEST: ("coco_2017_val_100",) 8 | PROPOSAL_FILES_TEST: ("detectron2://COCO-Detection/rpn_R_50_FPN_1x/137258492/coco_2017_val_box_proposals_ee0dad.pkl", ) 9 | SOLVER: 10 | BASE_LR: 0.005 11 | STEPS: (30,) 12 | MAX_ITER: 40 13 | IMS_PER_BATCH: 4 14 | DATALOADER: 15 | NUM_WORKERS: 2 16 | -------------------------------------------------------------------------------- /detectron2/.circleci/import-tests.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash -e 2 | # Copyright (c) Facebook, Inc. and its affiliates. 3 | 4 | # Test that import works without building detectron2. 5 | 6 | # Check that _C is not importable 7 | python -c "from detectron2 import _C" > /dev/null 2>&1 && { 8 | echo "This test should be run without building detectron2." 9 | exit 1 10 | } 11 | 12 | # Check that other modules are still importable, even when _C is not importable 13 | python -c "from detectron2 import modeling" 14 | python -c "from detectron2 import modeling, data" 15 | python -c "from detectron2 import evaluation, export, checkpoint" 16 | python -c "from detectron2 import utils, engine" 17 | -------------------------------------------------------------------------------- /detectron2/configs/Detectron1-Comparisons/mask_rcnn_R_50_FPN_noaug_1x.yaml: -------------------------------------------------------------------------------- 1 | _BASE_: "../Base-RCNN-FPN.yaml" 2 | MODEL: 3 | WEIGHTS: "detectron2://ImageNetPretrained/MSRA/R-50.pkl" 4 | MASK_ON: True 5 | RESNETS: 6 | DEPTH: 50 7 | # Detectron1 uses smooth L1 loss with some magic beta values. 8 | # The defaults are changed to L1 loss in Detectron2. 9 | RPN: 10 | SMOOTH_L1_BETA: 0.1111 11 | ROI_BOX_HEAD: 12 | SMOOTH_L1_BETA: 1.0 13 | POOLER_SAMPLING_RATIO: 2 14 | POOLER_TYPE: "ROIAlign" 15 | ROI_MASK_HEAD: 16 | POOLER_SAMPLING_RATIO: 2 17 | POOLER_TYPE: "ROIAlign" 18 | INPUT: 19 | # no scale augmentation 20 | MIN_SIZE_TRAIN: (800, ) 21 | -------------------------------------------------------------------------------- /detectron2/configs/quick_schedules/semantic_R_50_FPN_training_acc_test.yaml: -------------------------------------------------------------------------------- 1 | _BASE_: "../Base-RCNN-FPN.yaml" 2 | MODEL: 3 | META_ARCHITECTURE: "SemanticSegmentor" 4 | WEIGHTS: "detectron2://ImageNetPretrained/MSRA/R-50.pkl" 5 | RESNETS: 6 | DEPTH: 50 7 | DATASETS: 8 | TRAIN: ("coco_2017_val_panoptic_stuffonly",) 9 | TEST: ("coco_2017_val_panoptic_stuffonly",) 10 | SOLVER: 11 | BASE_LR: 0.01 12 | WARMUP_FACTOR: 0.001 13 | WARMUP_ITERS: 300 14 | STEPS: (5500,) 15 | MAX_ITER: 7000 16 | TEST: 17 | EXPECTED_RESULTS: [["sem_seg", "mIoU", 76.51, 1.0], ["sem_seg", "mACC", 83.25, 1.0]] 18 | INPUT: 19 | # no scale augmentation 20 | MIN_SIZE_TRAIN: (800, ) 21 | -------------------------------------------------------------------------------- /detectron2/detectron2/tracking/__init__.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) Facebook, Inc. and its affiliates. 2 | from .base_tracker import ( # noqa 3 | BaseTracker, 4 | build_tracker_head, 5 | TRACKER_HEADS_REGISTRY, 6 | ) 7 | from .bbox_iou_tracker import BBoxIOUTracker # noqa 8 | from .hungarian_tracker import BaseHungarianTracker # noqa 9 | from .iou_weighted_hungarian_bbox_iou_tracker import ( # noqa 10 | IOUWeightedHungarianBBoxIOUTracker, 11 | ) 12 | from .utils import create_prediction_pairs # noqa 13 | from .vanilla_hungarian_bbox_iou_tracker import VanillaHungarianBBoxIOUTracker # noqa 14 | 15 | __all__ = [k for k in globals().keys() if not k.startswith("_")] 16 | -------------------------------------------------------------------------------- /detectron2/projects/Panoptic-DeepLab/configs/Cityscapes-PanopticSegmentation/panoptic_deeplab_R_52_os16_mg124_poly_90k_bs32_crop_512_1024.yaml: -------------------------------------------------------------------------------- 1 | _BASE_: Base-PanopticDeepLab-OS16.yaml 2 | MODEL: 3 | WEIGHTS: "detectron2://DeepLab/R-52.pkl" 4 | PIXEL_MEAN: [123.675, 116.280, 103.530] 5 | PIXEL_STD: [58.395, 57.120, 57.375] 6 | BACKBONE: 7 | NAME: "build_resnet_deeplab_backbone" 8 | RESNETS: 9 | DEPTH: 50 10 | NORM: "SyncBN" 11 | RES5_MULTI_GRID: [1, 2, 4] 12 | STEM_TYPE: "deeplab" 13 | STEM_OUT_CHANNELS: 128 14 | STRIDE_IN_1X1: False 15 | SOLVER: 16 | MAX_ITER: 90000 17 | INPUT: 18 | FORMAT: "RGB" 19 | CROP: 20 | SIZE: (512, 1024) 21 | -------------------------------------------------------------------------------- /detectron2/docs/_static/css/custom.css: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Facebook, Inc. and its affiliates. 3 | * some extra css to make markdown look similar between github/sphinx 4 | */ 5 | 6 | /* 7 | * Below is for install.md: 8 | */ 9 | .rst-content code { 10 | white-space: pre; 11 | border: 0px; 12 | } 13 | 14 | .rst-content th { 15 | border: 1px solid #e1e4e5; 16 | } 17 | 18 | .rst-content th p { 19 | /* otherwise will be default 24px for regular paragraph */ 20 | margin-bottom: 0px; 21 | } 22 | 23 | .rst-content .line-block { 24 | /* otherwise will be 24px */ 25 | margin-bottom: 0px; 26 | } 27 | 28 | div.section > details { 29 | padding-bottom: 1em; 30 | } 31 | -------------------------------------------------------------------------------- /AdelaiDet/configs/FCOS-Detection/Base-FCOS.yaml: -------------------------------------------------------------------------------- 1 | MODEL: 2 | META_ARCHITECTURE: "OneStageDetector" 3 | BACKBONE: 4 | NAME: "build_fcos_resnet_fpn_backbone" 5 | RESNETS: 6 | OUT_FEATURES: ["res3", "res4", "res5"] 7 | FPN: 8 | IN_FEATURES: ["res3", "res4", "res5"] 9 | PROPOSAL_GENERATOR: 10 | NAME: "FCOS" 11 | # PIXEL_MEAN: [102.9801, 115.9465, 122.7717] 12 | DATASETS: 13 | TRAIN: ("coco_2017_train",) 14 | TEST: ("coco_2017_val",) 15 | SOLVER: 16 | IMS_PER_BATCH: 16 17 | BASE_LR: 0.01 # Note that RetinaNet uses a different default learning rate 18 | STEPS: (60000, 80000) 19 | MAX_ITER: 90000 20 | INPUT: 21 | MIN_SIZE_TRAIN: (640, 672, 704, 736, 768, 800) 22 | -------------------------------------------------------------------------------- /detectron2/configs/quick_schedules/mask_rcnn_R_50_C4_training_acc_test.yaml: -------------------------------------------------------------------------------- 1 | _BASE_: "../Base-RCNN-C4.yaml" 2 | MODEL: 3 | WEIGHTS: "detectron2://ImageNetPretrained/MSRA/R-50.pkl" 4 | ROI_HEADS: 5 | BATCH_SIZE_PER_IMAGE: 256 6 | MASK_ON: True 7 | DATASETS: 8 | TRAIN: ("coco_2017_val",) 9 | TEST: ("coco_2017_val",) 10 | INPUT: 11 | MIN_SIZE_TRAIN: (600,) 12 | MAX_SIZE_TRAIN: 1000 13 | MIN_SIZE_TEST: 800 14 | MAX_SIZE_TEST: 1000 15 | SOLVER: 16 | IMS_PER_BATCH: 8 # base uses 16 17 | WARMUP_FACTOR: 0.33333 18 | WARMUP_ITERS: 100 19 | STEPS: (11000, 11600) 20 | MAX_ITER: 12000 21 | TEST: 22 | EXPECTED_RESULTS: [["bbox", "AP", 41.88, 0.7], ["segm", "AP", 33.79, 0.5]] 23 | -------------------------------------------------------------------------------- /detectron2/docs/requirements.txt: -------------------------------------------------------------------------------- 1 | docutils==0.16 2 | # https://github.com/sphinx-doc/sphinx/commit/7acd3ada3f38076af7b2b5c9f3b60bb9c2587a3d 3 | sphinx==3.2.0 4 | recommonmark==0.6.0 5 | sphinx_rtd_theme 6 | # Dependencies here are only those required by import 7 | termcolor 8 | numpy 9 | tqdm 10 | matplotlib 11 | termcolor 12 | yacs 13 | tabulate 14 | cloudpickle 15 | Pillow 16 | future 17 | git+https://github.com/facebookresearch/fvcore.git 18 | https://download.pytorch.org/whl/cpu/torch-1.8.1%2Bcpu-cp37-cp37m-linux_x86_64.whl 19 | https://download.pytorch.org/whl/cpu/torchvision-0.9.1%2Bcpu-cp37-cp37m-linux_x86_64.whl 20 | omegaconf>=2.1.0.dev24 21 | hydra-core>=1.1.0.dev5 22 | scipy 23 | timm 24 | -------------------------------------------------------------------------------- /AdelaiDet/configs/FCOS-Detection/FCOS_RT/MS_R_50_4x_syncbn_bn_head.yaml: -------------------------------------------------------------------------------- 1 | _BASE_: "../Base-FCOS.yaml" 2 | INPUT: 3 | MIN_SIZE_TRAIN: (256, 288, 320, 352, 384, 416, 448, 480, 512, 544, 576, 608) 4 | MAX_SIZE_TRAIN: 900 5 | MAX_SIZE_TEST: 736 6 | MIN_SIZE_TEST: 512 7 | MODEL: 8 | WEIGHTS: "detectron2://ImageNetPretrained/MSRA/R-50.pkl" 9 | RESNETS: 10 | DEPTH: 50 11 | NORM: "SyncBN" 12 | FCOS: 13 | TOP_LEVELS: 0 14 | SIZES_OF_INTEREST: [64, 128] 15 | FPN_STRIDES: [8, 16, 32] 16 | IN_FEATURES: ['p3', 'p4', 'p5'] 17 | NORM: "SyncBN" 18 | SOLVER: 19 | STEPS: (300000, 340000) 20 | MAX_ITER: 360000 21 | OUTPUT_DIR: "output/fcos/FCOS_RT_MS_R_50_4x_syncbn_bn_head" 22 | -------------------------------------------------------------------------------- /detectron2/projects/PointRend/configs/InstanceSegmentation/pointrend_rcnn_R_50_FPN_1x_cityscapes.yaml: -------------------------------------------------------------------------------- 1 | _BASE_: Base-PointRend-RCNN-FPN.yaml 2 | MODEL: 3 | WEIGHTS: detectron2://ImageNetPretrained/MSRA/R-50.pkl 4 | RESNETS: 5 | DEPTH: 50 6 | ROI_HEADS: 7 | NUM_CLASSES: 8 8 | POINT_HEAD: 9 | NUM_CLASSES: 8 10 | DATASETS: 11 | TEST: ("cityscapes_fine_instance_seg_val",) 12 | TRAIN: ("cityscapes_fine_instance_seg_train",) 13 | SOLVER: 14 | BASE_LR: 0.01 15 | IMS_PER_BATCH: 8 16 | MAX_ITER: 24000 17 | STEPS: (18000,) 18 | INPUT: 19 | MAX_SIZE_TEST: 2048 20 | MAX_SIZE_TRAIN: 2048 21 | MIN_SIZE_TEST: 1024 22 | MIN_SIZE_TRAIN: (800, 832, 864, 896, 928, 960, 992, 1024) 23 | -------------------------------------------------------------------------------- /AdelaiDet/configs/CondInst/Base-CondInst.yaml: -------------------------------------------------------------------------------- 1 | MODEL: 2 | META_ARCHITECTURE: "CondInst" 3 | MASK_ON: True 4 | BACKBONE: 5 | NAME: "build_fcos_resnet_fpn_backbone" 6 | RESNETS: 7 | OUT_FEATURES: ["res3", "res4", "res5"] 8 | FPN: 9 | IN_FEATURES: ["res3", "res4", "res5"] 10 | PROPOSAL_GENERATOR: 11 | NAME: "FCOS" 12 | FCOS: 13 | THRESH_WITH_CTR: True 14 | USE_SCALE: True 15 | CONDINST: 16 | MAX_PROPOSALS: 500 17 | DATASETS: 18 | TRAIN: ("coco_2017_train",) 19 | TEST: ("coco_2017_val",) 20 | SOLVER: 21 | IMS_PER_BATCH: 16 22 | BASE_LR: 0.01 23 | STEPS: (60000, 80000) 24 | MAX_ITER: 90000 25 | INPUT: 26 | MIN_SIZE_TRAIN: (640, 672, 704, 736, 768, 800) 27 | -------------------------------------------------------------------------------- /detectron2/projects/PointRend/configs/SemanticSegmentation/Base-PointRend-Semantic-FPN.yaml: -------------------------------------------------------------------------------- 1 | _BASE_: "../../../../configs/Base-RCNN-FPN.yaml" 2 | MODEL: 3 | META_ARCHITECTURE: "SemanticSegmentor" 4 | BACKBONE: 5 | FREEZE_AT: 0 6 | SEM_SEG_HEAD: 7 | NAME: "PointRendSemSegHead" 8 | POINT_HEAD: 9 | NUM_CLASSES: 54 10 | FC_DIM: 256 11 | NUM_FC: 3 12 | IN_FEATURES: ["p2"] 13 | TRAIN_NUM_POINTS: 1024 14 | SUBDIVISION_STEPS: 2 15 | SUBDIVISION_NUM_POINTS: 8192 16 | COARSE_SEM_SEG_HEAD_NAME: "SemSegFPNHead" 17 | COARSE_PRED_EACH_LAYER: False 18 | DATASETS: 19 | TRAIN: ("coco_2017_train_panoptic_stuffonly",) 20 | TEST: ("coco_2017_val_panoptic_stuffonly",) 21 | -------------------------------------------------------------------------------- /detectron2/tools/deploy/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Copyright (c) Facebook, Inc. and its affiliates. 2 | # See https://pytorch.org/tutorials/advanced/cpp_frontend.html 3 | cmake_minimum_required(VERSION 3.12 FATAL_ERROR) 4 | project(torchscript_mask_rcnn) 5 | 6 | find_package(Torch REQUIRED) 7 | find_package(OpenCV REQUIRED) 8 | find_package(TorchVision REQUIRED) # needed by export-method=tracing/scripting 9 | 10 | add_executable(torchscript_mask_rcnn torchscript_mask_rcnn.cpp) 11 | target_link_libraries( 12 | torchscript_mask_rcnn 13 | -Wl,--no-as-needed TorchVision::TorchVision -Wl,--as-needed 14 | "${TORCH_LIBRARIES}" ${OpenCV_LIBS}) 15 | set_property(TARGET torchscript_mask_rcnn PROPERTY CXX_STANDARD 14) 16 | -------------------------------------------------------------------------------- /detectron2/detectron2/export/README.md: -------------------------------------------------------------------------------- 1 | 2 | This directory contains code to prepare a detectron2 model for deployment. 3 | Currently it supports exporting a detectron2 model to TorchScript, ONNX, or (deprecated) Caffe2 format. 4 | 5 | Please see [documentation](https://detectron2.readthedocs.io/tutorials/deployment.html) for its usage. 6 | 7 | 8 | ### Acknowledgements 9 | 10 | Thanks to Mobile Vision team at Facebook for developing the Caffe2 conversion tools. 11 | 12 | Thanks to Computing Platform Department - PAI team at Alibaba Group (@bddpqq, @chenbohua3) who 13 | help export Detectron2 models to TorchScript. 14 | 15 | Thanks to ONNX Converter team at Microsoft who help export Detectron2 models to ONNX. 16 | -------------------------------------------------------------------------------- /detectron2/configs/LVISv1-InstanceSegmentation/mask_rcnn_R_50_FPN_1x.yaml: -------------------------------------------------------------------------------- 1 | _BASE_: "../Base-RCNN-FPN.yaml" 2 | MODEL: 3 | WEIGHTS: "detectron2://ImageNetPretrained/MSRA/R-50.pkl" 4 | MASK_ON: True 5 | RESNETS: 6 | DEPTH: 50 7 | ROI_HEADS: 8 | NUM_CLASSES: 1203 9 | SCORE_THRESH_TEST: 0.0001 10 | INPUT: 11 | MIN_SIZE_TRAIN: (640, 672, 704, 736, 768, 800) 12 | DATASETS: 13 | TRAIN: ("lvis_v1_train",) 14 | TEST: ("lvis_v1_val",) 15 | TEST: 16 | DETECTIONS_PER_IMAGE: 300 # LVIS allows up to 300 17 | SOLVER: 18 | STEPS: (120000, 160000) 19 | MAX_ITER: 180000 # 180000 * 16 / 100000 ~ 28.8 epochs 20 | DATALOADER: 21 | SAMPLER_TRAIN: "RepeatFactorTrainingSampler" 22 | REPEAT_THRESHOLD: 0.001 23 | -------------------------------------------------------------------------------- /detectron2/configs/quick_schedules/panoptic_fpn_R_50_training_acc_test.yaml: -------------------------------------------------------------------------------- 1 | _BASE_: "../Base-RCNN-FPN.yaml" 2 | MODEL: 3 | META_ARCHITECTURE: "PanopticFPN" 4 | WEIGHTS: "detectron2://ImageNetPretrained/MSRA/R-50.pkl" 5 | MASK_ON: True 6 | RESNETS: 7 | DEPTH: 50 8 | SEM_SEG_HEAD: 9 | LOSS_WEIGHT: 0.5 10 | DATASETS: 11 | TRAIN: ("coco_2017_val_panoptic_separated",) 12 | TEST: ("coco_2017_val_panoptic_separated",) 13 | SOLVER: 14 | BASE_LR: 0.01 15 | WARMUP_FACTOR: 0.001 16 | WARMUP_ITERS: 500 17 | STEPS: (5500,) 18 | MAX_ITER: 7000 19 | TEST: 20 | EXPECTED_RESULTS: [["bbox", "AP", 46.70, 1.1], ["segm", "AP", 39.0, 0.7], ["sem_seg", "mIoU", 64.73, 1.3], ["panoptic_seg", "PQ", 48.13, 0.8]] 21 | -------------------------------------------------------------------------------- /detectron2/configs/LVISv1-InstanceSegmentation/mask_rcnn_R_101_FPN_1x.yaml: -------------------------------------------------------------------------------- 1 | _BASE_: "../Base-RCNN-FPN.yaml" 2 | MODEL: 3 | WEIGHTS: "detectron2://ImageNetPretrained/MSRA/R-101.pkl" 4 | MASK_ON: True 5 | RESNETS: 6 | DEPTH: 101 7 | ROI_HEADS: 8 | NUM_CLASSES: 1203 9 | SCORE_THRESH_TEST: 0.0001 10 | INPUT: 11 | MIN_SIZE_TRAIN: (640, 672, 704, 736, 768, 800) 12 | DATASETS: 13 | TRAIN: ("lvis_v1_train",) 14 | TEST: ("lvis_v1_val",) 15 | TEST: 16 | DETECTIONS_PER_IMAGE: 300 # LVIS allows up to 300 17 | SOLVER: 18 | STEPS: (120000, 160000) 19 | MAX_ITER: 180000 # 180000 * 16 / 100000 ~ 28.8 epochs 20 | DATALOADER: 21 | SAMPLER_TRAIN: "RepeatFactorTrainingSampler" 22 | REPEAT_THRESHOLD: 0.001 23 | -------------------------------------------------------------------------------- /detectron2/docker/docker-compose.yml: -------------------------------------------------------------------------------- 1 | version: "2.3" 2 | services: 3 | detectron2: 4 | build: 5 | context: . 6 | dockerfile: Dockerfile 7 | args: 8 | USER_ID: ${USER_ID:-1000} 9 | deploy: 10 | resources: 11 | reservations: 12 | devices: 13 | - capabilities: 14 | - gpu 15 | shm_size: "8gb" 16 | ulimits: 17 | memlock: -1 18 | stack: 67108864 19 | volumes: 20 | - /tmp/.X11-unix:/tmp/.X11-unix:ro 21 | environment: 22 | - DISPLAY=$DISPLAY 23 | - NVIDIA_VISIBLE_DEVICES=all 24 | # Uncomment with proper source to access webcam from docker 25 | # devices: 26 | # - /dev/video0:/dev/video0 27 | -------------------------------------------------------------------------------- /detectron2/projects/DensePose/configs/HRNet/densepose_rcnn_HRFPN_HRNet_w40_s1x.yaml: -------------------------------------------------------------------------------- 1 | _BASE_: "../Base-DensePose-RCNN-FPN.yaml" 2 | MODEL: 3 | WEIGHTS: "https://1drv.ms/u/s!Aus8VCZ_C_33ck0gvo5jfoWBOPo" 4 | BACKBONE: 5 | NAME: "build_hrfpn_backbone" 6 | RPN: 7 | IN_FEATURES: ['p1', 'p2', 'p3', 'p4', 'p5'] 8 | ROI_HEADS: 9 | IN_FEATURES: ['p1', 'p2', 'p3', 'p4', 'p5'] 10 | HRNET: 11 | STAGE2: 12 | NUM_CHANNELS: [40, 80] 13 | STAGE3: 14 | NUM_CHANNELS: [40, 80, 160] 15 | STAGE4: 16 | NUM_CHANNELS: [40, 80, 160, 320] 17 | SOLVER: 18 | MAX_ITER: 130000 19 | STEPS: (100000, 120000) 20 | CLIP_GRADIENTS: 21 | ENABLED: True 22 | CLIP_TYPE: "norm" 23 | BASE_LR: 0.03 24 | -------------------------------------------------------------------------------- /detectron2/projects/DensePose/configs/HRNet/densepose_rcnn_HRFPN_HRNet_w48_s1x.yaml: -------------------------------------------------------------------------------- 1 | _BASE_: "../Base-DensePose-RCNN-FPN.yaml" 2 | MODEL: 3 | WEIGHTS: "https://1drv.ms/u/s!Aus8VCZ_C_33dKvqI6pBZlifgJk" 4 | BACKBONE: 5 | NAME: "build_hrfpn_backbone" 6 | RPN: 7 | IN_FEATURES: ['p1', 'p2', 'p3', 'p4', 'p5'] 8 | ROI_HEADS: 9 | IN_FEATURES: ['p1', 'p2', 'p3', 'p4', 'p5'] 10 | HRNET: 11 | STAGE2: 12 | NUM_CHANNELS: [48, 96] 13 | STAGE3: 14 | NUM_CHANNELS: [48, 96, 192] 15 | STAGE4: 16 | NUM_CHANNELS: [48, 96, 192, 384] 17 | SOLVER: 18 | MAX_ITER: 130000 19 | STEPS: (100000, 120000) 20 | CLIP_GRADIENTS: 21 | ENABLED: True 22 | CLIP_TYPE: "norm" 23 | BASE_LR: 0.03 24 | -------------------------------------------------------------------------------- /detectron2/configs/common/models/panoptic_fpn.py: -------------------------------------------------------------------------------- 1 | from detectron2.config import LazyCall as L 2 | from detectron2.layers import ShapeSpec 3 | from detectron2.modeling import PanopticFPN 4 | from detectron2.modeling.meta_arch.semantic_seg import SemSegFPNHead 5 | 6 | from .mask_rcnn_fpn import model 7 | 8 | model._target_ = PanopticFPN 9 | model.sem_seg_head = L(SemSegFPNHead)( 10 | input_shape={ 11 | f: L(ShapeSpec)(stride=s, channels="${....backbone.out_channels}") 12 | for f, s in zip(["p2", "p3", "p4", "p5"], [4, 8, 16, 32]) 13 | }, 14 | ignore_value=255, 15 | num_classes=54, # COCO stuff + 1 16 | conv_dims=128, 17 | common_stride=4, 18 | loss_weight=0.5, 19 | norm="GN", 20 | ) 21 | -------------------------------------------------------------------------------- /detectron2/detectron2/modeling/backbone/__init__.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) Facebook, Inc. and its affiliates. 2 | from .build import build_backbone, BACKBONE_REGISTRY # noqa F401 isort:skip 3 | 4 | from .backbone import Backbone 5 | from .fpn import FPN 6 | from .regnet import RegNet 7 | from .resnet import ( 8 | BasicStem, 9 | ResNet, 10 | ResNetBlockBase, 11 | build_resnet_backbone, 12 | make_stage, 13 | BottleneckBlock, 14 | ) 15 | from .vit import ViT, SimpleFeaturePyramid, get_vit_lr_decay_rate 16 | from .mvit import MViT 17 | from .swin import SwinTransformer 18 | 19 | __all__ = [k for k in globals().keys() if not k.startswith("_")] 20 | # TODO can expose more resnet blocks after careful consideration 21 | -------------------------------------------------------------------------------- /detectron2/docs/Makefile: -------------------------------------------------------------------------------- 1 | # Minimal makefile for Sphinx documentation 2 | # Copyright (c) Facebook, Inc. and its affiliates. 3 | 4 | # You can set these variables from the command line. 5 | SPHINXOPTS = 6 | SPHINXBUILD = sphinx-build 7 | SOURCEDIR = . 8 | BUILDDIR = _build 9 | 10 | # Put it first so that "make" without argument is like "make help". 11 | help: 12 | @$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O) 13 | 14 | .PHONY: help Makefile 15 | 16 | # Catch-all target: route all unknown targets to Sphinx using the new 17 | # "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS). 18 | %: Makefile 19 | @$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O) 20 | -------------------------------------------------------------------------------- /detectron2/projects/DensePose/configs/cse/Base-DensePose-RCNN-FPN-Human.yaml: -------------------------------------------------------------------------------- 1 | _BASE_: "Base-DensePose-RCNN-FPN.yaml" 2 | MODEL: 3 | ROI_DENSEPOSE_HEAD: 4 | CSE: 5 | EMBEDDERS: 6 | "smpl_27554": 7 | TYPE: vertex_feature 8 | NUM_VERTICES: 27554 9 | FEATURE_DIM: 256 10 | FEATURES_TRAINABLE: False 11 | IS_TRAINABLE: True 12 | INIT_FILE: "https://dl.fbaipublicfiles.com/densepose/data/cse/lbo/phi_smpl_27554_256.pkl" 13 | DATASETS: 14 | TRAIN: 15 | - "densepose_coco_2014_train_cse" 16 | - "densepose_coco_2014_valminusminival_cse" 17 | TEST: 18 | - "densepose_coco_2014_minival_cse" 19 | CLASS_TO_MESH_NAME_MAPPING: 20 | "0": "smpl_27554" 21 | -------------------------------------------------------------------------------- /detectron2/tests/structures/test_keypoints.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) Facebook, Inc. and its affiliates. 2 | import unittest 3 | import torch 4 | 5 | from detectron2.structures.keypoints import Keypoints 6 | 7 | 8 | class TestKeypoints(unittest.TestCase): 9 | def test_cat_keypoints(self): 10 | keypoints1 = Keypoints(torch.rand(2, 21, 3)) 11 | keypoints2 = Keypoints(torch.rand(4, 21, 3)) 12 | 13 | cat_keypoints = keypoints1.cat([keypoints1, keypoints2]) 14 | self.assertTrue(torch.all(cat_keypoints.tensor[:2] == keypoints1.tensor).item()) 15 | self.assertTrue(torch.all(cat_keypoints.tensor[2:] == keypoints2.tensor).item()) 16 | 17 | 18 | if __name__ == "__main__": 19 | unittest.main() 20 | -------------------------------------------------------------------------------- /AdelaiDet/docs/Makefile: -------------------------------------------------------------------------------- 1 | # Minimal makefile for Sphinx documentation 2 | # 3 | 4 | # You can set these variables from the command line, and also 5 | # from the environment for the first two. 6 | SPHINXOPTS ?= 7 | SPHINXBUILD ?= sphinx-build 8 | SOURCEDIR = . 9 | BUILDDIR = _build 10 | 11 | # Put it first so that "make" without argument is like "make help". 12 | help: 13 | @$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O) 14 | 15 | .PHONY: help Makefile 16 | 17 | # Catch-all target: route all unknown targets to Sphinx using the new 18 | # "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS). 19 | %: Makefile 20 | @$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O) 21 | -------------------------------------------------------------------------------- /AdelaiDet/tools/remove_optim_from_ckpt.py: -------------------------------------------------------------------------------- 1 | import argparse 2 | 3 | import torch 4 | 5 | 6 | def get_parser(): 7 | parser = argparse.ArgumentParser(description="Keep only model in ckpt") 8 | parser.add_argument( 9 | "--path", 10 | default="output/person/blendmask/R_50_1x/", 11 | help="path to model weights", 12 | ) 13 | parser.add_argument( 14 | "--name", 15 | default="R_50_1x.pth", 16 | help="name of output file", 17 | ) 18 | return parser 19 | 20 | 21 | if __name__ == "__main__": 22 | args = get_parser().parse_args() 23 | ckpt = torch.load(args.path + 'model_final.pth') 24 | model = ckpt["model"] 25 | torch.save(model, args.path + args.name) 26 | -------------------------------------------------------------------------------- /detectron2/projects/DensePose/densepose/converters/__init__.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) Facebook, Inc. and its affiliates. 2 | 3 | from .hflip import HFlipConverter 4 | from .to_mask import ToMaskConverter 5 | from .to_chart_result import ToChartResultConverter, ToChartResultConverterWithConfidences 6 | from .segm_to_mask import ( 7 | predictor_output_with_fine_and_coarse_segm_to_mask, 8 | predictor_output_with_coarse_segm_to_mask, 9 | resample_fine_and_coarse_segm_to_bbox, 10 | ) 11 | from .chart_output_to_chart_result import ( 12 | densepose_chart_predictor_output_to_result, 13 | densepose_chart_predictor_output_to_result_with_confidences, 14 | ) 15 | from .chart_output_hflip import densepose_chart_predictor_output_hflip 16 | -------------------------------------------------------------------------------- /detectron2/projects/PointRend/configs/InstanceSegmentation/Base-PointRend-RCNN-FPN.yaml: -------------------------------------------------------------------------------- 1 | _BASE_: "../../../../configs/Base-RCNN-FPN.yaml" 2 | MODEL: 3 | MASK_ON: true 4 | ROI_BOX_HEAD: 5 | TRAIN_ON_PRED_BOXES: True 6 | ROI_MASK_HEAD: 7 | POOLER_TYPE: "" # No RoI pooling, let the head process image features directly 8 | NAME: "PointRendMaskHead" 9 | FC_DIM: 1024 10 | NUM_FC: 2 11 | OUTPUT_SIDE_RESOLUTION: 7 12 | IN_FEATURES: ["p2"] # for the coarse mask head 13 | POINT_HEAD_ON: True 14 | POINT_HEAD: 15 | FC_DIM: 256 16 | NUM_FC: 3 17 | IN_FEATURES: ["p2"] 18 | INPUT: 19 | # PointRend for instance segmentation does not work with "polygon" mask_format. 20 | MASK_FORMAT: "bitmask" 21 | -------------------------------------------------------------------------------- /detectron2/configs/common/models/fcos.py: -------------------------------------------------------------------------------- 1 | from detectron2.modeling.meta_arch.fcos import FCOS, FCOSHead 2 | 3 | from .retinanet import model 4 | 5 | model._target_ = FCOS 6 | 7 | del model.anchor_generator 8 | del model.box2box_transform 9 | del model.anchor_matcher 10 | del model.input_format 11 | 12 | # Use P5 instead of C5 to compute P6/P7 13 | # (Sec 2.2 of https://arxiv.org/abs/2006.09214) 14 | model.backbone.top_block.in_feature = "p5" 15 | model.backbone.top_block.in_channels = 256 16 | 17 | # New score threshold determined based on sqrt(cls_score * centerness) 18 | model.test_score_thresh = 0.2 19 | model.test_nms_thresh = 0.6 20 | 21 | model.head._target_ = FCOSHead 22 | del model.head.num_anchors 23 | model.head.norm = "GN" 24 | -------------------------------------------------------------------------------- /detectron2/configs/common/train.py: -------------------------------------------------------------------------------- 1 | # Common training-related configs that are designed for "tools/lazyconfig_train_net.py" 2 | # You can use your own instead, together with your own train_net.py 3 | train = dict( 4 | output_dir="./output", 5 | init_checkpoint="", 6 | max_iter=90000, 7 | amp=dict(enabled=False), # options for Automatic Mixed Precision 8 | ddp=dict( # options for DistributedDataParallel 9 | broadcast_buffers=False, 10 | find_unused_parameters=False, 11 | fp16_compression=False, 12 | ), 13 | checkpointer=dict(period=5000, max_to_keep=100), # options for PeriodicCheckpointer 14 | eval_period=5000, 15 | log_period=20, 16 | device="cuda" 17 | # ... 18 | ) 19 | -------------------------------------------------------------------------------- /detectron2/detectron2/config/__init__.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) Facebook, Inc. and its affiliates. 2 | from .compat import downgrade_config, upgrade_config 3 | from .config import CfgNode, get_cfg, global_cfg, set_global_cfg, configurable 4 | from .instantiate import instantiate 5 | from .lazy import LazyCall, LazyConfig 6 | 7 | __all__ = [ 8 | "CfgNode", 9 | "get_cfg", 10 | "global_cfg", 11 | "set_global_cfg", 12 | "downgrade_config", 13 | "upgrade_config", 14 | "configurable", 15 | "instantiate", 16 | "LazyCall", 17 | "LazyConfig", 18 | ] 19 | 20 | 21 | from detectron2.utils.env import fixup_module_metadata 22 | 23 | fixup_module_metadata(__name__, globals(), __all__) 24 | del fixup_module_metadata 25 | -------------------------------------------------------------------------------- /AdelaiDet/configs/MEInst-InstanceSegmentation/Base-MEInst.yaml: -------------------------------------------------------------------------------- 1 | MODEL: 2 | MASK_ON: True 3 | META_ARCHITECTURE: "OneStageDetector" 4 | BACKBONE: 5 | NAME: "build_fcos_resnet_fpn_backbone" 6 | RESNETS: 7 | OUT_FEATURES: ["res3", "res4", "res5"] 8 | FPN: 9 | IN_FEATURES: ["res3", "res4", "res5"] 10 | PROPOSAL_GENERATOR: 11 | NAME: "MEInst" 12 | # PIXEL_MEAN: [102.9801, 115.9465, 122.7717] 13 | DATASETS: 14 | TRAIN: ("coco_2017_train",) 15 | TEST: ("coco_2017_val",) 16 | SOLVER: 17 | IMS_PER_BATCH: 16 18 | BASE_LR: 0.01 # Note that RetinaNet uses a different default learning rate 19 | STEPS: (60000, 80000) 20 | MAX_ITER: 90000 21 | INPUT: 22 | MIN_SIZE_TRAIN: (640, 672, 704, 736, 768, 800) 23 | VERSION: 2 24 | -------------------------------------------------------------------------------- /detectron2/tests/test_packaging.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) Facebook, Inc. and its affiliates. 2 | import unittest 3 | 4 | from detectron2.utils.collect_env import collect_env_info 5 | 6 | 7 | class TestProjects(unittest.TestCase): 8 | def test_import(self): 9 | from detectron2.projects import point_rend 10 | 11 | _ = point_rend.add_pointrend_config 12 | 13 | import detectron2.projects.deeplab as deeplab 14 | 15 | _ = deeplab.add_deeplab_config 16 | 17 | # import detectron2.projects.panoptic_deeplab as panoptic_deeplab 18 | 19 | # _ = panoptic_deeplab.add_panoptic_deeplab_config 20 | 21 | 22 | class TestCollectEnv(unittest.TestCase): 23 | def test(self): 24 | _ = collect_env_info() 25 | -------------------------------------------------------------------------------- /AdelaiDet/configs/BAText/Pretrain/v2_attn_R_50.yaml: -------------------------------------------------------------------------------- 1 | _BASE_: "Base-Pretrain.yaml" 2 | MODEL: 3 | WEIGHTS: "https://dl.fbaipublicfiles.com/detectron/ImageNetPretrained/MSRA/R-50.pkl" 4 | BACKBONE: 5 | NAME: "build_fcos_resnet_bifpn_backbone" 6 | BiFPN: 7 | IN_FEATURES: ["res2", "res3", "res4", "res5"] 8 | OUT_CHANNELS: 256 9 | NUM_REPEATS: 2 10 | NORM: "SyncBN" 11 | RESNETS: 12 | DEPTH: 50 13 | BATEXT: 14 | RECOGNIZER: "attn" 15 | USE_COORDCONV: True 16 | USE_AET: True 17 | SOLVER: 18 | IMS_PER_BATCH: 8 19 | BASE_LR: 0.01 20 | STEPS: (160000, 220000) 21 | MAX_ITER: 260000 22 | CHECKPOINT_PERIOD: 20000 23 | TEST: 24 | EVAL_PERIOD: 20000 25 | OUTPUT_DIR: "output/batext/pretrain/v2_attn_R_50" 26 | 27 | -------------------------------------------------------------------------------- /detectron2/configs/COCO-Detection/fast_rcnn_R_50_FPN_1x.yaml: -------------------------------------------------------------------------------- 1 | _BASE_: "../Base-RCNN-FPN.yaml" 2 | MODEL: 3 | WEIGHTS: "detectron2://ImageNetPretrained/MSRA/R-50.pkl" 4 | MASK_ON: False 5 | LOAD_PROPOSALS: True 6 | RESNETS: 7 | DEPTH: 50 8 | PROPOSAL_GENERATOR: 9 | NAME: "PrecomputedProposals" 10 | DATASETS: 11 | TRAIN: ("coco_2017_train",) 12 | PROPOSAL_FILES_TRAIN: ("detectron2://COCO-Detection/rpn_R_50_FPN_1x/137258492/coco_2017_train_box_proposals_21bc3a.pkl", ) 13 | TEST: ("coco_2017_val",) 14 | PROPOSAL_FILES_TEST: ("detectron2://COCO-Detection/rpn_R_50_FPN_1x/137258492/coco_2017_val_box_proposals_ee0dad.pkl", ) 15 | DATALOADER: 16 | # proposals are part of the dataset_dicts, and take a lot of RAM 17 | NUM_WORKERS: 2 18 | -------------------------------------------------------------------------------- /detectron2/detectron2/data/__init__.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) Facebook, Inc. and its affiliates. 2 | from . import transforms # isort:skip 3 | 4 | from .build import ( 5 | build_batch_data_loader, 6 | build_detection_test_loader, 7 | build_detection_train_loader, 8 | get_detection_dataset_dicts, 9 | load_proposals_into_dataset, 10 | print_instances_class_histogram, 11 | ) 12 | from .catalog import DatasetCatalog, MetadataCatalog, Metadata 13 | from .common import DatasetFromList, MapDataset, ToIterableDataset 14 | from .dataset_mapper import DatasetMapper 15 | 16 | # ensure the builtin datasets are registered 17 | from . import datasets, samplers # isort:skip 18 | 19 | __all__ = [k for k in globals().keys() if not k.startswith("_")] 20 | -------------------------------------------------------------------------------- /detectron2/detectron2/evaluation/__init__.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) Facebook, Inc. and its affiliates. 2 | from .cityscapes_evaluation import CityscapesInstanceEvaluator, CityscapesSemSegEvaluator 3 | from .coco_evaluation import COCOEvaluator 4 | from .rotated_coco_evaluation import RotatedCOCOEvaluator 5 | from .evaluator import DatasetEvaluator, DatasetEvaluators, inference_context, inference_on_dataset 6 | from .lvis_evaluation import LVISEvaluator 7 | from .panoptic_evaluation import COCOPanopticEvaluator 8 | from .pascal_voc_evaluation import PascalVOCDetectionEvaluator 9 | from .sem_seg_evaluation import SemSegEvaluator 10 | from .testing import print_csv_format, verify_results 11 | 12 | __all__ = [k for k in globals().keys() if not k.startswith("_")] 13 | -------------------------------------------------------------------------------- /detectron2/detectron2/structures/__init__.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) Facebook, Inc. and its affiliates. 2 | from .boxes import Boxes, BoxMode, pairwise_iou, pairwise_ioa, pairwise_point_box_distance 3 | from .image_list import ImageList 4 | 5 | from .instances import Instances 6 | from .keypoints import Keypoints, heatmaps_to_keypoints 7 | from .masks import BitMasks, PolygonMasks, polygons_to_bitmask, ROIMasks 8 | from .rotated_boxes import RotatedBoxes 9 | from .rotated_boxes import pairwise_iou as pairwise_iou_rotated 10 | 11 | __all__ = [k for k in globals().keys() if not k.startswith("_")] 12 | 13 | 14 | from detectron2.utils.env import fixup_module_metadata 15 | 16 | fixup_module_metadata(__name__, globals(), __all__) 17 | del fixup_module_metadata 18 | -------------------------------------------------------------------------------- /detectron2/projects/MViTv2/configs/common/coco_loader_lsj.py: -------------------------------------------------------------------------------- 1 | import detectron2.data.transforms as T 2 | from detectron2 import model_zoo 3 | from detectron2.config import LazyCall as L 4 | 5 | from .coco_loader import dataloader 6 | 7 | # Data using LSJ 8 | image_size = 1024 9 | dataloader.train.mapper.augmentations = [ 10 | L(T.RandomFlip)(horizontal=True), # flip first 11 | L(T.ResizeScale)( 12 | min_scale=0.1, max_scale=2.0, target_height=image_size, target_width=image_size 13 | ), 14 | L(T.FixedSizeCrop)(crop_size=(image_size, image_size)), 15 | ] 16 | dataloader.train.mapper.image_format = "RGB" 17 | dataloader.train.total_batch_size = 64 18 | # recompute boxes due to cropping 19 | dataloader.train.mapper.recompute_boxes = True 20 | -------------------------------------------------------------------------------- /detectron2/projects/DensePose/tests/test_image_resize_transform.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) Facebook, Inc. and its affiliates. 2 | 3 | import unittest 4 | import torch 5 | 6 | from densepose.data.transform import ImageResizeTransform 7 | 8 | 9 | class TestImageResizeTransform(unittest.TestCase): 10 | def test_image_resize_1(self): 11 | images_batch = torch.ones((3, 3, 100, 100), dtype=torch.uint8) * 100 12 | transform = ImageResizeTransform() 13 | images_transformed = transform(images_batch) 14 | IMAGES_GT = torch.ones((3, 3, 800, 800), dtype=torch.float) * 100 15 | self.assertEqual(images_transformed.size(), IMAGES_GT.size()) 16 | self.assertAlmostEqual(torch.abs(IMAGES_GT - images_transformed).max().item(), 0.0) 17 | -------------------------------------------------------------------------------- /AdelaiDet/configs/BAText/CTW1500/v2_attn_R_50.yaml: -------------------------------------------------------------------------------- 1 | _BASE_: "Base-CTW1500.yaml" 2 | MODEL: 3 | WEIGHTS: "model_v2_pretrain.pth" 4 | BACKBONE: 5 | NAME: "build_fcos_resnet_bifpn_backbone" 6 | BiFPN: 7 | IN_FEATURES: ["res2", "res3", "res4", "res5"] 8 | OUT_CHANNELS: 256 9 | NUM_REPEATS: 2 10 | NORM: "SyncBN" 11 | RESNETS: 12 | DEPTH: 50 13 | BATEXT: 14 | RECOGNIZER: "attn" 15 | USE_COORDCONV: True 16 | USE_AET: True 17 | FCOS: 18 | # Best e2e: 0.5; Best det: 0.3 19 | INFERENCE_TH_TEST: 0.5 20 | SOLVER: 21 | IMS_PER_BATCH: 8 22 | BASE_LR: 0.001 23 | STEPS: (80000, ) 24 | MAX_ITER: 100000 25 | CHECKPOINT_PERIOD: 10000 26 | TEST: 27 | EVAL_PERIOD: 10000 28 | OUTPUT_DIR: "output/batext/ctw1500/v2_attn_R_50" 29 | -------------------------------------------------------------------------------- /detectron2/projects/TensorMask/configs/Base-TensorMask.yaml: -------------------------------------------------------------------------------- 1 | MODEL: 2 | META_ARCHITECTURE: "TensorMask" 3 | MASK_ON: True 4 | BACKBONE: 5 | NAME: "build_retinanet_resnet_fpn_backbone" 6 | RESNETS: 7 | OUT_FEATURES: ["res2", "res3", "res4", "res5"] 8 | ANCHOR_GENERATOR: 9 | SIZES: [[44, 60], [88, 120], [176, 240], [352, 480], [704, 960], [1408, 1920]] 10 | ASPECT_RATIOS: [[1.0]] 11 | FPN: 12 | IN_FEATURES: ["res2", "res3", "res4", "res5"] 13 | FUSE_TYPE: "avg" 14 | TENSOR_MASK: 15 | ALIGNED_ON: True 16 | BIPYRAMID_ON: True 17 | DATASETS: 18 | TRAIN: ("coco_2017_train",) 19 | TEST: ("coco_2017_val",) 20 | SOLVER: 21 | IMS_PER_BATCH: 16 22 | BASE_LR: 0.02 23 | STEPS: (60000, 80000) 24 | MAX_ITER: 90000 25 | VERSION: 2 26 | -------------------------------------------------------------------------------- /detectron2/detectron2/layers/csrc/cuda_version.cu: -------------------------------------------------------------------------------- 1 | // Copyright (c) Facebook, Inc. and its affiliates. 2 | 3 | #include 4 | 5 | namespace detectron2 { 6 | int get_cudart_version() { 7 | // Not a ROCM platform: Either HIP is not used, or 8 | // it is used, but platform is not ROCM (i.e. it is CUDA) 9 | #if !defined(__HIP_PLATFORM_HCC__) 10 | return CUDART_VERSION; 11 | #else 12 | int version = 0; 13 | 14 | #if HIP_VERSION_MAJOR != 0 15 | // Create a convention similar to that of CUDA, as assumed by other 16 | // parts of the code. 17 | 18 | version = HIP_VERSION_MINOR; 19 | version += (HIP_VERSION_MAJOR * 100); 20 | #else 21 | hipRuntimeGetVersion(&version); 22 | #endif 23 | return version; 24 | #endif 25 | } 26 | } // namespace detectron2 27 | -------------------------------------------------------------------------------- /detectron2/detectron2/layers/rotated_boxes.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) Facebook, Inc. and its affiliates. 2 | from __future__ import absolute_import, division, print_function, unicode_literals 3 | import torch 4 | 5 | 6 | def pairwise_iou_rotated(boxes1, boxes2): 7 | """ 8 | Return intersection-over-union (Jaccard index) of boxes. 9 | 10 | Both sets of boxes are expected to be in 11 | (x_center, y_center, width, height, angle) format. 12 | 13 | Arguments: 14 | boxes1 (Tensor[N, 5]) 15 | boxes2 (Tensor[M, 5]) 16 | 17 | Returns: 18 | iou (Tensor[N, M]): the NxM matrix containing the pairwise 19 | IoU values for every element in boxes1 and boxes2 20 | """ 21 | return torch.ops.detectron2.box_iou_rotated(boxes1, boxes2) 22 | -------------------------------------------------------------------------------- /detectron2/configs/LVISv0.5-InstanceSegmentation/mask_rcnn_X_101_32x8d_FPN_1x.yaml: -------------------------------------------------------------------------------- 1 | _BASE_: "../Base-RCNN-FPN.yaml" 2 | MODEL: 3 | WEIGHTS: "detectron2://ImageNetPretrained/FAIR/X-101-32x8d.pkl" 4 | PIXEL_STD: [57.375, 57.120, 58.395] 5 | MASK_ON: True 6 | RESNETS: 7 | STRIDE_IN_1X1: False # this is a C2 model 8 | NUM_GROUPS: 32 9 | WIDTH_PER_GROUP: 8 10 | DEPTH: 101 11 | ROI_HEADS: 12 | NUM_CLASSES: 1230 13 | SCORE_THRESH_TEST: 0.0001 14 | INPUT: 15 | MIN_SIZE_TRAIN: (640, 672, 704, 736, 768, 800) 16 | DATASETS: 17 | TRAIN: ("lvis_v0.5_train",) 18 | TEST: ("lvis_v0.5_val",) 19 | TEST: 20 | DETECTIONS_PER_IMAGE: 300 # LVIS allows up to 300 21 | DATALOADER: 22 | SAMPLER_TRAIN: "RepeatFactorTrainingSampler" 23 | REPEAT_THRESHOLD: 0.001 24 | -------------------------------------------------------------------------------- /AdelaiDet/configs/BAText/TotalText/v2_attn_R_50.yaml: -------------------------------------------------------------------------------- 1 | _BASE_: "Base-TotalText.yaml" 2 | MODEL: 3 | WEIGHTS: "https://dl.fbaipublicfiles.com/detectron/ImageNetPretrained/MSRA/R-50.pkl" 4 | BACKBONE: 5 | NAME: "build_fcos_resnet_bifpn_backbone" 6 | BiFPN: 7 | IN_FEATURES: ["res2", "res3", "res4", "res5"] 8 | OUT_CHANNELS: 256 9 | NUM_REPEATS: 2 10 | NORM: "SyncBN" 11 | RESNETS: 12 | DEPTH: 50 13 | BATEXT: 14 | RECOGNIZER: "attn" 15 | USE_COORDCONV: True 16 | USE_AET: True 17 | FCOS: 18 | # Best e2e: 0.5; Best det: 0.4 19 | INFERENCE_TH_TEST: 0.5 20 | SOLVER: 21 | IMS_PER_BATCH: 8 22 | BASE_LR: 0.001 23 | MAX_ITER: 5000 24 | CHECKPOINT_PERIOD: 1000 25 | TEST: 26 | EVAL_PERIOD: 1000 27 | OUTPUT_DIR: "output/batext/pretrain/v2_attn_R_50" 28 | -------------------------------------------------------------------------------- /detectron2/projects/DensePose/densepose/data/datasets/builtin.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) Facebook, Inc. and its affiliates. 2 | from .chimpnsee import register_dataset as register_chimpnsee_dataset 3 | from .coco import BASE_DATASETS as BASE_COCO_DATASETS 4 | from .coco import DATASETS as COCO_DATASETS 5 | from .coco import register_datasets as register_coco_datasets 6 | from .lvis import DATASETS as LVIS_DATASETS 7 | from .lvis import register_datasets as register_lvis_datasets 8 | 9 | DEFAULT_DATASETS_ROOT = "datasets" 10 | 11 | 12 | register_coco_datasets(COCO_DATASETS, DEFAULT_DATASETS_ROOT) 13 | register_coco_datasets(BASE_COCO_DATASETS, DEFAULT_DATASETS_ROOT) 14 | register_lvis_datasets(LVIS_DATASETS, DEFAULT_DATASETS_ROOT) 15 | 16 | register_chimpnsee_dataset(DEFAULT_DATASETS_ROOT) # pyre-ignore[19] 17 | --------------------------------------------------------------------------------