├── .gitignore ├── README.md ├── prune_coco ├── GETTING_STARTED.md ├── INSTALL.md ├── LICENSE ├── MODEL_ZOO.md ├── README.md ├── check_models.py ├── check_transfer.py ├── configs │ ├── Base-RCNN-C4.yaml │ ├── Base-RCNN-DilatedC5.yaml │ ├── Base-RCNN-FPN.yaml │ ├── Base-RetinaNet.yaml │ ├── COCO-Detection │ │ ├── fast_rcnn_R_50_FPN_1x.yaml │ │ ├── faster_rcnn_R_101_C4_3x.yaml │ │ ├── faster_rcnn_R_101_DC5_3x.yaml │ │ ├── faster_rcnn_R_101_FPN_3x.yaml │ │ ├── faster_rcnn_R_50_C4_1x.yaml │ │ ├── faster_rcnn_R_50_C4_3x.yaml │ │ ├── faster_rcnn_R_50_DC5_1x.yaml │ │ ├── faster_rcnn_R_50_DC5_3x.yaml │ │ ├── faster_rcnn_R_50_FPN_1x.yaml │ │ ├── faster_rcnn_R_50_FPN_3x.yaml │ │ ├── faster_rcnn_X_101_32x8d_FPN_3x.yaml │ │ ├── retinanet_R_101_FPN_3x.yaml │ │ ├── retinanet_R_50_FPN_1x.yaml │ │ ├── retinanet_R_50_FPN_3x.yaml │ │ ├── rpn_R_50_C4_1x.yaml │ │ └── rpn_R_50_FPN_1x.yaml │ ├── COCO-InstanceSegmentation │ │ ├── mask_rcnn_R_101_C4_3x.yaml │ │ ├── mask_rcnn_R_101_DC5_3x.yaml │ │ ├── mask_rcnn_R_101_FPN_3x.yaml │ │ ├── mask_rcnn_R_50_C4_1x.yaml │ │ ├── mask_rcnn_R_50_C4_3x.yaml │ │ ├── mask_rcnn_R_50_DC5_1x.yaml │ │ ├── mask_rcnn_R_50_DC5_3x.yaml │ │ ├── mask_rcnn_R_50_FPN_1x.yaml │ │ ├── mask_rcnn_R_50_FPN_1x_giou.yaml │ │ ├── mask_rcnn_R_50_FPN_3x.yaml │ │ ├── mask_rcnn_X_101_32x8d_FPN_3x.yaml │ │ └── mask_rcnn_r18_FPN_1x.yaml │ ├── COCO-Keypoints │ │ ├── Base-Keypoint-RCNN-FPN.yaml │ │ ├── keypoint_rcnn_R_101_FPN_3x.yaml │ │ ├── keypoint_rcnn_R_50_FPN_1x.yaml │ │ ├── keypoint_rcnn_R_50_FPN_3x.yaml │ │ ├── keypoint_rcnn_X_101_32x8d_FPN_3x.yaml │ │ └── keypoint_rcnn_r18_FPN_1x.yaml │ ├── COCO-PanopticSegmentation │ │ ├── Base-Panoptic-FPN.yaml │ │ ├── panoptic_fpn_R_101_3x.yaml │ │ ├── panoptic_fpn_R_50_1x.yaml │ │ └── panoptic_fpn_R_50_3x.yaml │ ├── Cityscapes │ │ └── mask_rcnn_R_50_FPN.yaml │ ├── Detectron1-Comparisons │ │ ├── README.md │ │ ├── faster_rcnn_R_50_FPN_noaug_1x.yaml │ │ ├── keypoint_rcnn_R_50_FPN_1x.yaml │ │ └── mask_rcnn_R_50_FPN_noaug_1x.yaml │ ├── LVISv0.5-InstanceSegmentation │ │ ├── mask_rcnn_R_101_FPN_1x.yaml │ │ ├── mask_rcnn_R_50_FPN_1x.yaml │ │ └── mask_rcnn_X_101_32x8d_FPN_1x.yaml │ ├── LVISv1-InstanceSegmentation │ │ ├── mask_rcnn_R_101_FPN_1x.yaml │ │ ├── mask_rcnn_R_50_FPN_1x.yaml │ │ └── mask_rcnn_X_101_32x8d_FPN_1x.yaml │ ├── Misc │ │ ├── cascade_mask_rcnn_R_50_FPN_1x.yaml │ │ ├── cascade_mask_rcnn_R_50_FPN_3x.yaml │ │ ├── cascade_mask_rcnn_X_152_32x8d_FPN_IN5k_gn_dconv.yaml │ │ ├── mask_rcnn_R_50_FPN_1x_cls_agnostic.yaml │ │ ├── mask_rcnn_R_50_FPN_1x_dconv_c3-c5.yaml │ │ ├── mask_rcnn_R_50_FPN_3x_dconv_c3-c5.yaml │ │ ├── mask_rcnn_R_50_FPN_3x_gn.yaml │ │ ├── mask_rcnn_R_50_FPN_3x_syncbn.yaml │ │ ├── panoptic_fpn_R_101_dconv_cascade_gn_3x.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 │ │ └── semantic_R_50_FPN_1x.yaml │ ├── PascalVOC-Detection │ │ ├── faster_rcnn_R_50_C4.yaml │ │ └── faster_rcnn_R_50_FPN.yaml │ └── quick_schedules │ │ ├── README.md │ │ ├── cascade_mask_rcnn_R_50_FPN_inference_acc_test.yaml │ │ ├── cascade_mask_rcnn_R_50_FPN_instant_test.yaml │ │ ├── fast_rcnn_R_50_FPN_inference_acc_test.yaml │ │ ├── fast_rcnn_R_50_FPN_instant_test.yaml │ │ ├── keypoint_rcnn_R_50_FPN_inference_acc_test.yaml │ │ ├── keypoint_rcnn_R_50_FPN_instant_test.yaml │ │ ├── keypoint_rcnn_R_50_FPN_normalized_training_acc_test.yaml │ │ ├── keypoint_rcnn_R_50_FPN_training_acc_test.yaml │ │ ├── mask_rcnn_R_50_C4_GCV_instant_test.yaml │ │ ├── mask_rcnn_R_50_C4_inference_acc_test.yaml │ │ ├── mask_rcnn_R_50_C4_instant_test.yaml │ │ ├── mask_rcnn_R_50_C4_training_acc_test.yaml │ │ ├── mask_rcnn_R_50_DC5_inference_acc_test.yaml │ │ ├── mask_rcnn_R_50_FPN_inference_acc_test.yaml │ │ ├── mask_rcnn_R_50_FPN_instant_test.yaml │ │ ├── mask_rcnn_R_50_FPN_pred_boxes_training_acc_test.yaml │ │ ├── mask_rcnn_R_50_FPN_training_acc_test.yaml │ │ ├── panoptic_fpn_R_50_inference_acc_test.yaml │ │ ├── panoptic_fpn_R_50_instant_test.yaml │ │ ├── panoptic_fpn_R_50_training_acc_test.yaml │ │ ├── retinanet_R_50_FPN_inference_acc_test.yaml │ │ ├── retinanet_R_50_FPN_instant_test.yaml │ │ ├── rpn_R_50_FPN_inference_acc_test.yaml │ │ ├── rpn_R_50_FPN_instant_test.yaml │ │ ├── semantic_R_50_FPN_inference_acc_test.yaml │ │ ├── semantic_R_50_FPN_instant_test.yaml │ │ └── semantic_R_50_FPN_training_acc_test.yaml ├── datasets │ ├── README.md │ ├── prepare_ade20k_sem_seg.py │ ├── prepare_cocofied_lvis.py │ └── prepare_panoptic_fpn.py ├── demo │ ├── README.md │ ├── demo.py │ └── predictor.py ├── detectron2 │ ├── __init__.py │ ├── checkpoint │ │ ├── __init__.py │ │ ├── c2_model_loading.py │ │ ├── catalog.py │ │ └── detection_checkpoint.py │ ├── config │ │ ├── __init__.py │ │ ├── compat.py │ │ ├── config.py │ │ └── defaults.py │ ├── data │ │ ├── __init__.py │ │ ├── build.py │ │ ├── catalog.py │ │ ├── common.py │ │ ├── dataset_mapper.py │ │ ├── datasets │ │ │ ├── README.md │ │ │ ├── __init__.py │ │ │ ├── builtin.py │ │ │ ├── builtin_meta.py │ │ │ ├── cityscapes.py │ │ │ ├── cityscapes_panoptic.py │ │ │ ├── coco.py │ │ │ ├── coco_panoptic.py │ │ │ ├── lvis.py │ │ │ ├── lvis_v0_5_categories.py │ │ │ ├── lvis_v1_categories.py │ │ │ ├── pascal_voc.py │ │ │ └── register_coco.py │ │ ├── detection_utils.py │ │ ├── samplers │ │ │ ├── __init__.py │ │ │ ├── distributed_sampler.py │ │ │ └── grouped_batch_sampler.py │ │ └── transforms │ │ │ ├── __init__.py │ │ │ ├── augmentation.py │ │ │ ├── augmentation_impl.py │ │ │ └── transform.py │ ├── engine │ │ ├── __init__.py │ │ ├── defaults.py │ │ ├── hooks.py │ │ ├── launch.py │ │ └── train_loop.py │ ├── evaluation │ │ ├── __init__.py │ │ ├── cityscapes_evaluation.py │ │ ├── coco_evaluation.py │ │ ├── evaluator.py │ │ ├── fast_eval_api.py │ │ ├── lvis_evaluation.py │ │ ├── panoptic_evaluation.py │ │ ├── pascal_voc_evaluation.py │ │ ├── rotated_coco_evaluation.py │ │ ├── sem_seg_evaluation.py │ │ └── testing.py │ ├── export │ │ ├── README.md │ │ ├── __init__.py │ │ ├── api.py │ │ ├── c10.py │ │ ├── caffe2_export.py │ │ ├── caffe2_inference.py │ │ ├── caffe2_modeling.py │ │ ├── caffe2_patch.py │ │ ├── shared.py │ │ ├── torchscript.py │ │ └── torchscript_patch.py │ ├── layers │ │ ├── __init__.py │ │ ├── aspp.py │ │ ├── batch_norm.py │ │ ├── blocks.py │ │ ├── csrc │ │ │ ├── README.md │ │ │ ├── ROIAlign │ │ │ │ ├── ROIAlign.h │ │ │ │ ├── ROIAlign_cpu.cpp │ │ │ │ └── ROIAlign_cuda.cu │ │ │ ├── ROIAlignRotated │ │ │ │ ├── ROIAlignRotated.h │ │ │ │ ├── ROIAlignRotated_cpu.cpp │ │ │ │ └── ROIAlignRotated_cuda.cu │ │ │ ├── box_iou_rotated │ │ │ │ ├── box_iou_rotated.h │ │ │ │ ├── box_iou_rotated_cpu.cpp │ │ │ │ ├── box_iou_rotated_cuda.cu │ │ │ │ └── box_iou_rotated_utils.h │ │ │ ├── cocoeval │ │ │ │ ├── cocoeval.cpp │ │ │ │ └── cocoeval.h │ │ │ ├── cuda_version.cu │ │ │ ├── deformable │ │ │ │ ├── deform_conv.h │ │ │ │ ├── deform_conv_cuda.cu │ │ │ │ └── deform_conv_cuda_kernel.cu │ │ │ ├── nms_rotated │ │ │ │ ├── nms_rotated.h │ │ │ │ ├── nms_rotated_cpu.cpp │ │ │ │ └── nms_rotated_cuda.cu │ │ │ └── vision.cpp │ │ ├── deform_conv.py │ │ ├── mask_ops.py │ │ ├── nms.py │ │ ├── roi_align.py │ │ ├── roi_align_rotated.py │ │ ├── rotated_boxes.py │ │ ├── shape_spec.py │ │ └── wrappers.py │ ├── model_zoo │ │ ├── __init__.py │ │ ├── configs │ │ └── model_zoo.py │ ├── modeling │ │ ├── __init__.py │ │ ├── anchor_generator.py │ │ ├── backbone │ │ │ ├── __init__.py │ │ │ ├── backbone.py │ │ │ ├── build.py │ │ │ ├── fpn.py │ │ │ └── resnet.py │ │ ├── box_regression.py │ │ ├── matcher.py │ │ ├── meta_arch │ │ │ ├── __init__.py │ │ │ ├── build.py │ │ │ ├── panoptic_fpn.py │ │ │ ├── rcnn.py │ │ │ ├── retinanet.py │ │ │ └── semantic_seg.py │ │ ├── poolers.py │ │ ├── postprocessing.py │ │ ├── proposal_generator │ │ │ ├── __init__.py │ │ │ ├── build.py │ │ │ ├── proposal_utils.py │ │ │ ├── rpn.py │ │ │ └── rrpn.py │ │ ├── roi_heads │ │ │ ├── __init__.py │ │ │ ├── box_head.py │ │ │ ├── cascade_rcnn.py │ │ │ ├── fast_rcnn.py │ │ │ ├── keypoint_head.py │ │ │ ├── mask_head.py │ │ │ ├── roi_heads.py │ │ │ └── rotated_fast_rcnn.py │ │ ├── sampling.py │ │ └── test_time_augmentation.py │ ├── projects │ │ ├── README.md │ │ └── __init__.py │ ├── solver │ │ ├── __init__.py │ │ ├── build.py │ │ └── lr_scheduler.py │ ├── structures │ │ ├── __init__.py │ │ ├── boxes.py │ │ ├── image_list.py │ │ ├── instances.py │ │ ├── keypoints.py │ │ ├── masks.py │ │ └── rotated_boxes.py │ └── utils │ │ ├── README.md │ │ ├── __init__.py │ │ ├── analysis.py │ │ ├── collect_env.py │ │ ├── colormap.py │ │ ├── comm.py │ │ ├── env.py │ │ ├── events.py │ │ ├── logger.py │ │ ├── memory.py │ │ ├── registry.py │ │ ├── serialize.py │ │ ├── video_visualizer.py │ │ └── visualizer.py ├── detectron_README.md ├── dev │ ├── README.md │ └── packaging │ │ ├── README.md │ │ ├── gen_install_table.py │ │ └── pkg_helpers.bash ├── docker │ ├── Dockerfile │ ├── README.md │ └── docker-compose.yml ├── docs │ ├── .gitignore │ ├── Makefile │ ├── README.md │ ├── _static │ │ └── css │ │ │ └── custom.css │ ├── conf.py │ ├── index.rst │ ├── modules │ │ ├── checkpoint.rst │ │ ├── config.rst │ │ ├── data.rst │ │ ├── data_transforms.rst │ │ ├── engine.rst │ │ ├── evaluation.rst │ │ ├── export.rst │ │ ├── index.rst │ │ ├── layers.rst │ │ ├── model_zoo.rst │ │ ├── modeling.rst │ │ ├── solver.rst │ │ ├── structures.rst │ │ └── utils.rst │ ├── notes │ │ ├── benchmarks.md │ │ ├── changelog.md │ │ ├── compatibility.md │ │ ├── contributing.md │ │ └── index.rst │ ├── requirements.txt │ └── tutorials │ │ ├── README.md │ │ ├── augmentation.md │ │ ├── builtin_datasets.md │ │ ├── configs.md │ │ ├── data_loading.md │ │ ├── datasets.md │ │ ├── deployment.md │ │ ├── evaluation.md │ │ ├── extend.md │ │ ├── getting_started.md │ │ ├── index.rst │ │ ├── install.md │ │ ├── models.md │ │ ├── training.md │ │ └── write-models.md ├── lth.py ├── projects │ ├── DeepLab │ │ ├── README.md │ │ ├── configs │ │ │ └── Cityscapes-SemanticSegmentation │ │ │ │ ├── Base-DeepLabV3-OS16-Semantic.yaml │ │ │ │ ├── deeplab_v3_R_103_os16_mg124_poly_90k_bs16.yaml │ │ │ │ └── deeplab_v3_plus_R_103_os16_mg124_poly_90k_bs16.yaml │ │ ├── deeplab │ │ │ ├── __init__.py │ │ │ ├── build_solver.py │ │ │ ├── config.py │ │ │ ├── loss.py │ │ │ ├── lr_scheduler.py │ │ │ ├── resnet.py │ │ │ └── semantic_seg.py │ │ └── train_net.py │ ├── DensePose │ │ ├── README.md │ │ ├── apply_net.py │ │ ├── configs │ │ │ ├── Base-DensePose-RCNN-FPN.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_101_FPN_DL_WC1M_s1x.yaml │ │ │ ├── densepose_rcnn_R_101_FPN_DL_WC1_s1x.yaml │ │ │ ├── densepose_rcnn_R_101_FPN_DL_WC2M_s1x.yaml │ │ │ ├── densepose_rcnn_R_101_FPN_DL_WC2_s1x.yaml │ │ │ ├── densepose_rcnn_R_101_FPN_DL_s1x.yaml │ │ │ ├── densepose_rcnn_R_101_FPN_WC1M_s1x.yaml │ │ │ ├── densepose_rcnn_R_101_FPN_WC1_s1x.yaml │ │ │ ├── densepose_rcnn_R_101_FPN_WC2M_s1x.yaml │ │ │ ├── densepose_rcnn_R_101_FPN_WC2_s1x.yaml │ │ │ ├── densepose_rcnn_R_101_FPN_s1x.yaml │ │ │ ├── densepose_rcnn_R_101_FPN_s1x_legacy.yaml │ │ │ ├── densepose_rcnn_R_50_FPN_DL_WC1M_s1x.yaml │ │ │ ├── densepose_rcnn_R_50_FPN_DL_WC1_s1x.yaml │ │ │ ├── densepose_rcnn_R_50_FPN_DL_WC2M_s1x.yaml │ │ │ ├── densepose_rcnn_R_50_FPN_DL_WC2_s1x.yaml │ │ │ ├── densepose_rcnn_R_50_FPN_DL_s1x.yaml │ │ │ ├── densepose_rcnn_R_50_FPN_WC1M_s1x.yaml │ │ │ ├── densepose_rcnn_R_50_FPN_WC1_s1x.yaml │ │ │ ├── densepose_rcnn_R_50_FPN_WC2M_s1x.yaml │ │ │ ├── densepose_rcnn_R_50_FPN_WC2_s1x.yaml │ │ │ ├── densepose_rcnn_R_50_FPN_s1x.yaml │ │ │ ├── densepose_rcnn_R_50_FPN_s1x_legacy.yaml │ │ │ ├── evolution │ │ │ │ ├── Base-RCNN-FPN-MC-B.yaml │ │ │ │ ├── Base-RCNN-FPN-MC.yaml │ │ │ │ ├── densepose_R_101_FPN_1x_Atop10_toP.yaml │ │ │ │ ├── densepose_R_101_FPN_DL_1x_Atop10_toP.yaml │ │ │ │ ├── densepose_R_101_FPN_DL_WC1M_1x_Atop10_toP.yaml │ │ │ │ ├── densepose_R_101_FPN_DL_WC1_1x_Atop10_toP.yaml │ │ │ │ ├── densepose_R_101_FPN_WC1M_1x_Atop10_toP.yaml │ │ │ │ ├── densepose_R_101_FPN_WC1_1x_Atop10_toP.yaml │ │ │ │ ├── densepose_R_50_FPN_1x_Atop10_toP.yaml │ │ │ │ ├── densepose_R_50_FPN_DL_1x_Atop10_toP.yaml │ │ │ │ ├── densepose_R_50_FPN_DL_WC1M_1x_Atop10_toP.yaml │ │ │ │ ├── densepose_R_50_FPN_DL_WC1_1x_Atop10_toP.yaml │ │ │ │ ├── densepose_R_50_FPN_WC1M_1x_Atop10_toP.yaml │ │ │ │ ├── densepose_R_50_FPN_WC1M_1x_Atop10_toP_B.yaml │ │ │ │ ├── densepose_R_50_FPN_WC1_1x_Atop10_toP.yaml │ │ │ │ └── faster_rcnn_R_50_FPN_1x_MC.yaml │ │ │ └── quick_schedules │ │ │ │ ├── densepose_rcnn_HRFPN_HRNet_w32_instant_test.yaml │ │ │ │ ├── densepose_rcnn_R_50_FPN_DL_instant_test.yaml │ │ │ │ ├── densepose_rcnn_R_50_FPN_TTA_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_inference_acc_test.yaml │ │ │ │ ├── densepose_rcnn_R_50_FPN_instant_test.yaml │ │ │ │ └── densepose_rcnn_R_50_FPN_training_acc_test.yaml │ │ ├── densepose │ │ │ ├── __init__.py │ │ │ ├── config.py │ │ │ ├── converters │ │ │ │ ├── __init__.py │ │ │ │ ├── base.py │ │ │ │ ├── builtin.py │ │ │ │ ├── chart_output_hflip.py │ │ │ │ ├── chart_output_to_chart_result.py │ │ │ │ ├── hflip.py │ │ │ │ ├── segm_to_mask.py │ │ │ │ ├── to_chart_result.py │ │ │ │ └── to_mask.py │ │ │ ├── data │ │ │ │ ├── __init__.py │ │ │ │ ├── build.py │ │ │ │ ├── combined_loader.py │ │ │ │ ├── dataset_mapper.py │ │ │ │ ├── datasets │ │ │ │ │ ├── __init__.py │ │ │ │ │ ├── builtin.py │ │ │ │ │ ├── chimpnsee.py │ │ │ │ │ ├── coco.py │ │ │ │ │ └── dataset_type.py │ │ │ │ ├── image_list_dataset.py │ │ │ │ ├── inference_based_loader.py │ │ │ │ ├── samplers │ │ │ │ │ ├── __init__.py │ │ │ │ │ ├── densepose_base.py │ │ │ │ │ ├── densepose_confidence_based.py │ │ │ │ │ ├── densepose_uniform.py │ │ │ │ │ ├── mask_from_densepose.py │ │ │ │ │ └── prediction_to_gt.py │ │ │ │ ├── structures.py │ │ │ │ ├── transform │ │ │ │ │ ├── __init__.py │ │ │ │ │ └── image.py │ │ │ │ ├── utils.py │ │ │ │ └── video │ │ │ │ │ ├── __init__.py │ │ │ │ │ ├── frame_selector.py │ │ │ │ │ └── video_keyframe_dataset.py │ │ │ ├── densepose_coco_evaluation.py │ │ │ ├── engine │ │ │ │ ├── __init__.py │ │ │ │ └── trainer.py │ │ │ ├── evaluator.py │ │ │ ├── modeling │ │ │ │ ├── __init__.py │ │ │ │ ├── build.py │ │ │ │ ├── confidence.py │ │ │ │ ├── densepose_checkpoint.py │ │ │ │ ├── filter.py │ │ │ │ ├── hrfpn.py │ │ │ │ ├── hrnet.py │ │ │ │ ├── inference.py │ │ │ │ ├── losses │ │ │ │ │ ├── __init__.py │ │ │ │ │ ├── chart.py │ │ │ │ │ ├── chart_with_confidences.py │ │ │ │ │ ├── registry.py │ │ │ │ │ └── utils.py │ │ │ │ ├── predictors │ │ │ │ │ ├── __init__.py │ │ │ │ │ ├── chart.py │ │ │ │ │ ├── chart_confidence.py │ │ │ │ │ ├── chart_with_confidence.py │ │ │ │ │ └── registry.py │ │ │ │ ├── roi_heads │ │ │ │ │ ├── __init__.py │ │ │ │ │ ├── deeplab.py │ │ │ │ │ ├── registry.py │ │ │ │ │ ├── roi_head.py │ │ │ │ │ └── v1convx.py │ │ │ │ ├── test_time_augmentation.py │ │ │ │ └── utils.py │ │ │ ├── structures │ │ │ │ ├── __init__.py │ │ │ │ ├── chart.py │ │ │ │ ├── chart_confidence.py │ │ │ │ └── chart_result.py │ │ │ ├── utils │ │ │ │ ├── dbhelper.py │ │ │ │ ├── logger.py │ │ │ │ └── transform.py │ │ │ └── vis │ │ │ │ ├── base.py │ │ │ │ ├── bounding_box.py │ │ │ │ ├── densepose_data_points.py │ │ │ │ ├── densepose_outputs.py │ │ │ │ ├── densepose_results.py │ │ │ │ └── extractor.py │ │ ├── dev │ │ │ └── README.md │ │ ├── doc │ │ │ ├── GETTING_STARTED.md │ │ │ ├── MODEL_ZOO.md │ │ │ ├── TOOL_APPLY_NET.md │ │ │ ├── TOOL_QUERY_DB.md │ │ │ └── images │ │ │ │ ├── res_bbox_dp_contour.jpg │ │ │ │ ├── res_bbox_dp_segm.jpg │ │ │ │ ├── res_bbox_dp_u.jpg │ │ │ │ ├── res_bbox_dp_v.jpg │ │ │ │ ├── vis_bbox_dp_i.jpg │ │ │ │ ├── vis_bbox_dp_pts.jpg │ │ │ │ ├── vis_bbox_dp_segm.jpg │ │ │ │ ├── vis_bbox_dp_u.jpg │ │ │ │ └── vis_bbox_dp_v.jpg │ │ ├── query_db.py │ │ ├── tests │ │ │ ├── common.py │ │ │ ├── test_combine_data_loader.py │ │ │ ├── test_frame_selector.py │ │ │ ├── test_image_resize_transform.py │ │ │ ├── test_model_e2e.py │ │ │ ├── test_setup.py │ │ │ ├── test_structures.py │ │ │ └── test_video_keyframe_dataset.py │ │ └── train_net.py │ ├── Panoptic-DeepLab │ │ ├── README.md │ │ ├── configs │ │ │ └── Cityscapes-PanopticSegmentation │ │ │ │ ├── Base-PanopticDeepLab-OS16.yaml │ │ │ │ └── panoptic_deeplab_R_52_os16_mg124_poly_90k_bs32_crop_512_1024.yaml │ │ ├── panoptic_deeplab │ │ │ ├── __init__.py │ │ │ ├── config.py │ │ │ ├── dataset_mapper.py │ │ │ ├── panoptic_seg.py │ │ │ ├── post_processing.py │ │ │ └── target_generator.py │ │ └── train_net.py │ ├── PointRend │ │ ├── README.md │ │ ├── configs │ │ │ ├── InstanceSegmentation │ │ │ │ ├── Base-PointRend-RCNN-FPN.yaml │ │ │ │ ├── pointrend_rcnn_R_50_FPN_1x_cityscapes.yaml │ │ │ │ ├── pointrend_rcnn_R_50_FPN_1x_coco.yaml │ │ │ │ └── pointrend_rcnn_R_50_FPN_3x_coco.yaml │ │ │ └── SemanticSegmentation │ │ │ │ ├── Base-PointRend-Semantic-FPN.yaml │ │ │ │ └── pointrend_semantic_R_101_FPN_1x_cityscapes.yaml │ │ ├── point_rend │ │ │ ├── __init__.py │ │ │ ├── coarse_mask_head.py │ │ │ ├── color_augmentation.py │ │ │ ├── config.py │ │ │ ├── point_features.py │ │ │ ├── point_head.py │ │ │ ├── roi_heads.py │ │ │ └── semantic_seg.py │ │ └── train_net.py │ ├── README.md │ ├── TensorMask │ │ ├── README.md │ │ ├── configs │ │ │ ├── Base-TensorMask.yaml │ │ │ ├── tensormask_R_50_FPN_1x.yaml │ │ │ └── tensormask_R_50_FPN_6x.yaml │ │ ├── setup.py │ │ ├── tensormask │ │ │ ├── __init__.py │ │ │ ├── arch.py │ │ │ ├── config.py │ │ │ └── layers │ │ │ │ ├── __init__.py │ │ │ │ ├── csrc │ │ │ │ ├── SwapAlign2Nat │ │ │ │ │ ├── SwapAlign2Nat.h │ │ │ │ │ └── SwapAlign2Nat_cuda.cu │ │ │ │ └── vision.cpp │ │ │ │ └── swap_align2nat.py │ │ ├── tests │ │ │ ├── __init__.py │ │ │ └── test_swap_align2nat.py │ │ └── train_net.py │ └── TridentNet │ │ ├── README.md │ │ ├── configs │ │ ├── Base-TridentNet-Fast-C4.yaml │ │ ├── tridentnet_fast_R_101_C4_3x.yaml │ │ ├── tridentnet_fast_R_50_C4_1x.yaml │ │ └── tridentnet_fast_R_50_C4_3x.yaml │ │ ├── train_net.py │ │ └── tridentnet │ │ ├── __init__.py │ │ ├── config.py │ │ ├── trident_backbone.py │ │ ├── trident_conv.py │ │ ├── trident_rcnn.py │ │ └── trident_rpn.py ├── setup.cfg ├── setup.py ├── temp.sh ├── temp │ ├── config.yaml │ ├── events.out.tfevents.1618690048.vulcan08.umiacs.umd.edu.14725.0 │ ├── events.out.tfevents.1618690171.vulcan08.umiacs.umd.edu.14878.0 │ ├── events.out.tfevents.1618690234.vulcan08.umiacs.umd.edu.14958.0 │ ├── events.out.tfevents.1618690325.vulcan08.umiacs.umd.edu.15017.0 │ ├── log.txt │ └── log.txt.rank1 ├── tests │ ├── README.md │ ├── __init__.py │ ├── data │ │ ├── __init__.py │ │ ├── test_coco.py │ │ ├── test_coco_evaluation.py │ │ ├── test_detection_utils.py │ │ ├── test_rotation_transform.py │ │ ├── test_sampler.py │ │ └── test_transforms.py │ ├── layers │ │ ├── __init__.py │ │ ├── test_mask_ops.py │ │ ├── test_nms.py │ │ ├── test_nms_rotated.py │ │ ├── test_roi_align.py │ │ └── test_roi_align_rotated.py │ ├── modeling │ │ ├── __init__.py │ │ ├── test_anchor_generator.py │ │ ├── test_box2box_transform.py │ │ ├── test_fast_rcnn.py │ │ ├── test_matcher.py │ │ ├── test_model_e2e.py │ │ ├── test_roi_heads.py │ │ ├── test_roi_pooler.py │ │ └── test_rpn.py │ ├── structures │ │ ├── __init__.py │ │ ├── test_boxes.py │ │ ├── test_imagelist.py │ │ ├── test_instances.py │ │ ├── test_masks.py │ │ └── test_rotated_boxes.py │ ├── test_checkpoint.py │ ├── test_config.py │ ├── test_engine.py │ ├── test_events.py │ ├── test_export_caffe2.py │ ├── test_export_torchscript.py │ ├── test_model_analysis.py │ ├── test_model_zoo.py │ ├── test_packaging.py │ └── test_visualizer.py └── tools │ ├── README.md │ ├── analyze_model.py │ ├── benchmark.py │ ├── convert-torchvision-to-d2.py │ ├── deploy │ ├── CMakeLists.txt │ ├── README.md │ ├── caffe2_converter.py │ ├── caffe2_mask_rcnn.cpp │ └── torchscript_traced_mask_rcnn.cpp │ ├── lth.py │ ├── plain_train_net.py │ ├── train_net.py │ ├── train_net_prune.py │ ├── visualize_data.py │ └── visualize_json_results.py ├── prune_imagenet ├── imagenet_prune.py └── lth_imagenet.py └── prune_voc ├── LICENSE ├── README.md ├── _init_paths.py ├── cfgs ├── res101.yml ├── res101_ls.yml ├── res18.yml ├── res50.yml └── vgg16.yml ├── demo.py ├── images ├── img1.jpg ├── img1_det.jpg ├── img1_det_res101.jpg ├── img2.jpg ├── img2_det.jpg ├── img2_det_res101.jpg ├── img3.jpg ├── img3_det.jpg ├── img3_det_res101.jpg ├── img4.jpg ├── img4_det.jpg └── img4_det_res101.jpg ├── lib ├── datasets │ ├── VOCdevkit-matlab-wrapper │ │ ├── get_voc_opts.m │ │ ├── voc_eval.m │ │ └── xVOCap.m │ ├── __init__.py │ ├── coco.py │ ├── ds_utils.py │ ├── factory.py │ ├── imagenet.py │ ├── imdb.py │ ├── pascal_voc.py │ ├── pascal_voc_rbg.py │ ├── tools │ │ └── mcg_munge.py │ ├── vg.py │ ├── vg_eval.py │ └── voc_eval.py ├── faster_rcnn.egg-info │ ├── PKG-INFO │ ├── SOURCES.txt │ ├── dependency_links.txt │ └── top_level.txt ├── make.sh ├── model │ ├── __init__.py │ ├── csrc │ │ ├── ROIAlign.h │ │ ├── ROIPool.h │ │ ├── cpu │ │ │ ├── ROIAlign_cpu.cpp │ │ │ ├── nms_cpu.cpp │ │ │ └── vision.h │ │ ├── cuda │ │ │ ├── ROIAlign_cuda.cu │ │ │ ├── ROIPool_cuda.cu │ │ │ ├── nms.cu │ │ │ └── vision.h │ │ ├── nms.h │ │ └── vision.cpp │ ├── faster_rcnn │ │ ├── __init__.py │ │ ├── faster_rcnn.py │ │ ├── lth.py │ │ ├── resnet.py │ │ └── vgg16.py │ ├── nms │ │ ├── .gitignore │ │ ├── __init__.py │ │ ├── build.py │ │ ├── make.sh │ │ ├── nms_cpu.py │ │ ├── nms_gpu.py │ │ ├── nms_kernel.cu │ │ ├── nms_wrapper.py │ │ └── src │ │ │ ├── nms_cuda.h │ │ │ ├── nms_cuda_kernel.cu │ │ │ ├── nms_cuda_kernel.cu.o │ │ │ └── nms_cuda_kernel.h │ ├── roi_align │ │ ├── __init__.py │ │ ├── build.py │ │ ├── functions │ │ │ ├── __init__.py │ │ │ └── roi_align.py │ │ ├── make.sh │ │ ├── modules │ │ │ ├── __init__.py │ │ │ └── roi_align.py │ │ └── src │ │ │ ├── roi_align.c │ │ │ ├── roi_align.h │ │ │ ├── roi_align_cuda.c │ │ │ ├── roi_align_cuda.h │ │ │ ├── roi_align_kernel.cu │ │ │ ├── roi_align_kernel.cu.o │ │ │ └── roi_align_kernel.h │ ├── roi_crop │ │ ├── __init__.py │ │ ├── build.py │ │ ├── functions │ │ │ ├── __init__.py │ │ │ ├── crop_resize.py │ │ │ ├── gridgen.py │ │ │ └── roi_crop.py │ │ ├── make.sh │ │ ├── modules │ │ │ ├── __init__.py │ │ │ ├── gridgen.py │ │ │ └── roi_crop.py │ │ └── src │ │ │ ├── roi_crop.c │ │ │ ├── roi_crop.h │ │ │ ├── roi_crop_cuda.c │ │ │ ├── roi_crop_cuda.h │ │ │ ├── roi_crop_cuda_kernel.cu │ │ │ ├── roi_crop_cuda_kernel.cu.o │ │ │ └── roi_crop_cuda_kernel.h │ ├── roi_layers │ │ ├── __init__.py │ │ ├── nms.py │ │ ├── roi_align.py │ │ └── roi_pool.py │ ├── roi_pooling │ │ ├── __init__.py │ │ ├── build.py │ │ ├── functions │ │ │ ├── __init__.py │ │ │ └── roi_pool.py │ │ ├── modules │ │ │ ├── __init__.py │ │ │ └── roi_pool.py │ │ └── src │ │ │ ├── roi_pooling.c │ │ │ ├── roi_pooling.cu.o │ │ │ ├── roi_pooling.h │ │ │ ├── roi_pooling_cuda.c │ │ │ ├── roi_pooling_cuda.h │ │ │ ├── roi_pooling_kernel.cu │ │ │ └── roi_pooling_kernel.h │ ├── rpn │ │ ├── __init__.py │ │ ├── anchor_target_layer.py │ │ ├── bbox_transform.py │ │ ├── generate_anchors.py │ │ ├── proposal_layer.py │ │ ├── proposal_target_layer_cascade.py │ │ └── rpn.py │ └── utils │ │ ├── .gitignore │ │ ├── __init__.py │ │ ├── bbox.pyx │ │ ├── blob.py │ │ ├── config.py │ │ ├── logger.py │ │ └── net_utils.py ├── pycocotools │ ├── UPSTREAM_REV │ ├── __init__.py │ ├── _mask.c │ ├── _mask.pyx │ ├── coco.py │ ├── cocoeval.py │ ├── license.txt │ ├── mask.py │ ├── maskApi.c │ └── maskApi.h ├── roi_data_layer │ ├── __init__.py │ ├── minibatch.py │ ├── roibatchLoader.py │ └── roidb.py └── setup.py ├── requirements.txt ├── test_net.py ├── test_net_in_pretrain.py ├── trainval_net.py └── trainval_net_in_pretrain.py /.gitignore: -------------------------------------------------------------------------------- 1 | prune_voc/models 2 | prune_voc/data 3 | prune_voc/output 4 | prune_imagenet/models 5 | prune_imagenet/run_lth.sh 6 | 7 | *.png 8 | *.json 9 | *.diff 10 | 11 | # compilation and distribution 12 | __pycache__ 13 | _ext 14 | *.pyc 15 | *.pyd 16 | *.so 17 | detectron2.egg-info/ 18 | build/ 19 | dist/ 20 | wheels/ 21 | 22 | # pytorch/python/numpy formats 23 | *.pth 24 | *.pkl 25 | *.npy 26 | 27 | 28 | # ipython/jupyter notebooks 29 | *.ipynb 30 | **/.ipynb_checkpoints/ 31 | 32 | # Editor temporaries 33 | *.swn 34 | *.swo 35 | *.swp 36 | *~ 37 | 38 | # editor settings 39 | .idea 40 | .vscode 41 | 42 | # project dirs 43 | /detectron2/model_zoo/configs 44 | /datasets/* 45 | !/datasets/*.* 46 | /projects/*/datasets 47 | /models 48 | /temp 49 | 50 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # LTH-ObjectRecognition 2 | 3 | ### The Lottery Ticket Hypothesis for Object Recognition 4 | [Sharath Girish](http://sharath-girish.github.io/)\*, [Shishira R Maiya](https://scholar.google.com/citations?user=43zd4zIAAAAJ&hl=en)\*, 5 | [Kamal Gupta](https://kampta.github.io/), [Hao Chen](https://haochen-rye.github.io/), [Larry Davis](http://users.umiacs.umd.edu/~lsd/), 6 | [Abhinav Shrivastava](http://www.cs.umd.edu/~abhinav/) 7 | 8 | [CVPR](https://arxiv.org/pdf/2012.04643.pdf) 2021 9 | 10 | This repository contains the code for the various experiments in our paper. 11 | 12 | `prune_voc` contains the code for training directly pruned tickets and ImageNet transferred tickets on Pascal-VOC, `prune_coco` is for the COCO dataset and `prune_imagenet` contains the code for ImageNet training. Refer to the directories for installation and run instructions. 13 | 14 | # Citation 15 | To cite this work, please use 16 | ``` 17 | @article{girish2020lottery, 18 | title={The Lottery Ticket Hypothesis for Object Recognition}, 19 | author={Girish, Sharath and Maiya, Shishira R and Gupta, Kamal and Chen, Hao and Davis, Larry and Shrivastava, Abhinav}, 20 | journal={arXiv preprint arXiv:2012.04643}, 21 | year={2020} 22 | } 23 | ``` 24 | -------------------------------------------------------------------------------- /prune_coco/check_models.py: -------------------------------------------------------------------------------- 1 | import glob,os 2 | import torch 3 | import pickle 4 | import argparse 5 | 6 | 7 | def count_zeros(state,path): 8 | n_zeros = 0 9 | n_params = 0 10 | 11 | for name in state: 12 | n_zeros += len(state[name][state[name]==0]) 13 | n_params += state[name].numel() 14 | 15 | print(path,' Zero percentage : ',n_zeros/n_params) 16 | 17 | parser = argparse.ArgumentParser() 18 | parser.add_argument("--folder", type=str,default='',help='path to folder to check') 19 | parser.add_argument("--all",action='store_true',help='check all ') 20 | args = parser.parse_args() 21 | 22 | 23 | states_path = glob.glob(args.folder+'/*.pth') 24 | 25 | path = args.folder+'model_final.pth' 26 | 27 | 28 | if args.all: 29 | for path in states_path: 30 | state = torch.load(path) 31 | state = state['model'] 32 | count_zeros(state,path) 33 | 34 | elif path in states_path: 35 | state = torch.load(path)['model'] 36 | count_zeros(state,path) 37 | else: 38 | for path in states_path: 39 | state = torch.load(path) 40 | state = state['model'] 41 | count_zeros(state,path) 42 | 43 | 44 | -------------------------------------------------------------------------------- /prune_coco/check_transfer.py: -------------------------------------------------------------------------------- 1 | import pickle 2 | import torch 3 | 4 | 5 | def load(filename): 6 | with open(filename,'rb') as fout: 7 | model = pickle.load(fout) 8 | return model 9 | 10 | def get_param_dict(model): 11 | d = {} 12 | for name,param in model.named_parameters(): 13 | d[name] = param 14 | return d 15 | 16 | ticket_model = load('check/ticket_model.pkl') 17 | ticket_dict = get_param_dict(ticket_model) 18 | 19 | before_model = load('check/before_model.pkl') 20 | before_dict = get_param_dict(before_model) 21 | 22 | after_model = load('check/after_model.pkl') 23 | after_dict = get_param_dict(after_model) 24 | 25 | 26 | #Is it because of batchnorm?? 27 | 28 | for t in after_dict.keys(): 29 | #if t in before_dict.keys(): 30 | print(before_dict[t].requires_grad,after_dict[t].requires_grad) 31 | 32 | -------------------------------------------------------------------------------- /prune_coco/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 | -------------------------------------------------------------------------------- /prune_coco/configs/Base-RCNN-DilatedC5.yaml: -------------------------------------------------------------------------------- 1 | MODEL: 2 | META_ARCHITECTURE: "GeneralizedRCNN" 3 | RESNETS: 4 | OUT_FEATURES: ["res5"] 5 | RES5_DILATION: 2 6 | RPN: 7 | IN_FEATURES: ["res5"] 8 | PRE_NMS_TOPK_TEST: 6000 9 | POST_NMS_TOPK_TEST: 1000 10 | ROI_HEADS: 11 | NAME: "StandardROIHeads" 12 | IN_FEATURES: ["res5"] 13 | ROI_BOX_HEAD: 14 | NAME: "FastRCNNConvFCHead" 15 | NUM_FC: 2 16 | POOLER_RESOLUTION: 7 17 | ROI_MASK_HEAD: 18 | NAME: "MaskRCNNConvUpsampleHead" 19 | NUM_CONV: 4 20 | POOLER_RESOLUTION: 14 21 | DATASETS: 22 | TRAIN: ("coco_2017_train",) 23 | TEST: ("coco_2017_val",) 24 | SOLVER: 25 | IMS_PER_BATCH: 16 26 | BASE_LR: 0.02 27 | STEPS: (60000, 80000) 28 | MAX_ITER: 90000 29 | INPUT: 30 | MIN_SIZE_TRAIN: (640, 672, 704, 736, 768, 800) 31 | VERSION: 2 32 | -------------------------------------------------------------------------------- /prune_coco/configs/Base-RetinaNet.yaml: -------------------------------------------------------------------------------- 1 | MODEL: 2 | META_ARCHITECTURE: "RetinaNet" 3 | BACKBONE: 4 | NAME: "build_retinanet_resnet_fpn_backbone" 5 | RESNETS: 6 | OUT_FEATURES: ["res3", "res4", "res5"] 7 | ANCHOR_GENERATOR: 8 | SIZES: !!python/object/apply:eval ["[[x, x * 2**(1.0/3), x * 2**(2.0/3) ] for x in [32, 64, 128, 256, 512 ]]"] 9 | FPN: 10 | IN_FEATURES: ["res3", "res4", "res5"] 11 | RETINANET: 12 | IOU_THRESHOLDS: [0.4, 0.5] 13 | IOU_LABELS: [0, -1, 1] 14 | SMOOTH_L1_LOSS_BETA: 0.0 15 | DATASETS: 16 | TRAIN: ("coco_2017_train",) 17 | TEST: ("coco_2017_val",) 18 | SOLVER: 19 | IMS_PER_BATCH: 16 20 | BASE_LR: 0.01 # Note that RetinaNet uses a different default learning rate 21 | STEPS: (60000, 80000) 22 | MAX_ITER: 90000 23 | INPUT: 24 | MIN_SIZE_TRAIN: (640, 672, 704, 736, 768, 800) 25 | VERSION: 2 26 | -------------------------------------------------------------------------------- /prune_coco/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 | -------------------------------------------------------------------------------- /prune_coco/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 | -------------------------------------------------------------------------------- /prune_coco/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 | -------------------------------------------------------------------------------- /prune_coco/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 | -------------------------------------------------------------------------------- /prune_coco/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 | -------------------------------------------------------------------------------- /prune_coco/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 | -------------------------------------------------------------------------------- /prune_coco/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 | -------------------------------------------------------------------------------- /prune_coco/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 | -------------------------------------------------------------------------------- /prune_coco/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 | -------------------------------------------------------------------------------- /prune_coco/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 | -------------------------------------------------------------------------------- /prune_coco/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 | -------------------------------------------------------------------------------- /prune_coco/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 | -------------------------------------------------------------------------------- /prune_coco/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 | -------------------------------------------------------------------------------- /prune_coco/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 | -------------------------------------------------------------------------------- /prune_coco/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 | -------------------------------------------------------------------------------- /prune_coco/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 | -------------------------------------------------------------------------------- /prune_coco/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 | -------------------------------------------------------------------------------- /prune_coco/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 | -------------------------------------------------------------------------------- /prune_coco/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 | -------------------------------------------------------------------------------- /prune_coco/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 | -------------------------------------------------------------------------------- /prune_coco/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 | -------------------------------------------------------------------------------- /prune_coco/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 | -------------------------------------------------------------------------------- /prune_coco/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 | -------------------------------------------------------------------------------- /prune_coco/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 | # FPN: 8 | # OUT_CHANNELS: 128 -------------------------------------------------------------------------------- /prune_coco/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 | -------------------------------------------------------------------------------- /prune_coco/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 | -------------------------------------------------------------------------------- /prune_coco/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 | -------------------------------------------------------------------------------- /prune_coco/configs/COCO-InstanceSegmentation/mask_rcnn_r18_FPN_1x.yaml: -------------------------------------------------------------------------------- 1 | _BASE_: "../Base-RCNN-FPN.yaml" 2 | MODEL: 3 | WEIGHTS: "https://download.pytorch.org/models/resnet18-5c106cde.pth" 4 | MASK_ON: True 5 | RESNETS: 6 | DEPTH: 18 7 | RES2_OUT_CHANNELS: 64 8 | # DATASETS: 9 | # TRAIN: ("coco_2017_val",) 10 | # TEST: ("coco_2017_val",) #("coco_2017_test-dev",) 11 | SOLVER: 12 | BASE_LR: 0.02 13 | CHECKPOINT_PERIOD: 7330 14 | # IMS_PER_BATCH: 24 15 | # STEPS: (40000, 53500) 16 | # MAX_ITER: 60000 17 | # WARMUP_FACTOR: 5e-4 18 | # WARMUP_ITERS: 2000 19 | OUTPUT_DIR: output/faster_r18_fpn 20 | -------------------------------------------------------------------------------- /prune_coco/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 | -------------------------------------------------------------------------------- /prune_coco/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 | -------------------------------------------------------------------------------- /prune_coco/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 | -------------------------------------------------------------------------------- /prune_coco/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 | -------------------------------------------------------------------------------- /prune_coco/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 | -------------------------------------------------------------------------------- /prune_coco/configs/COCO-Keypoints/keypoint_rcnn_r18_FPN_1x.yaml: -------------------------------------------------------------------------------- 1 | _BASE_: "Base-Keypoint-RCNN-FPN.yaml" 2 | MODEL: 3 | WEIGHTS: "https://download.pytorch.org/models/resnet18-5c106cde.pth" 4 | RESNETS: 5 | DEPTH: 18 6 | RES2_OUT_CHANNELS: 64 7 | SOLVER: 8 | CHECKPOINT_PERIOD: 3535 9 | -------------------------------------------------------------------------------- /prune_coco/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 | -------------------------------------------------------------------------------- /prune_coco/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 | -------------------------------------------------------------------------------- /prune_coco/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 | -------------------------------------------------------------------------------- /prune_coco/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 | -------------------------------------------------------------------------------- /prune_coco/configs/Cityscapes/mask_rcnn_R_50_FPN.yaml: -------------------------------------------------------------------------------- 1 | _BASE_: "../Base-RCNN-FPN.yaml" 2 | MODEL: 3 | # WEIGHTS: "detectron2://ImageNetPretrained/MSRA/R-50.pkl" 4 | # For better, more stable performance initialize from COCO 5 | WEIGHTS: "detectron2://COCO-InstanceSegmentation/mask_rcnn_R_50_FPN_3x/137849600/model_final_f10217.pkl" 6 | MASK_ON: True 7 | ROI_HEADS: 8 | NUM_CLASSES: 8 9 | # This is similar to the setting used in Mask R-CNN paper, Appendix A 10 | # But there are some differences, e.g., we did not initialize the output 11 | # layer using the corresponding classes from COCO 12 | INPUT: 13 | MIN_SIZE_TRAIN: (800, 832, 864, 896, 928, 960, 992, 1024) 14 | MIN_SIZE_TRAIN_SAMPLING: "choice" 15 | MIN_SIZE_TEST: 1024 16 | MAX_SIZE_TRAIN: 2048 17 | MAX_SIZE_TEST: 2048 18 | DATASETS: 19 | TRAIN: ("cityscapes_fine_instance_seg_train",) 20 | TEST: ("cityscapes_fine_instance_seg_val",) 21 | SOLVER: 22 | BASE_LR: 0.01 23 | STEPS: (18000,) 24 | MAX_ITER: 24000 25 | IMS_PER_BATCH: 8 26 | TEST: 27 | EVAL_PERIOD: 8000 28 | -------------------------------------------------------------------------------- /prune_coco/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 | -------------------------------------------------------------------------------- /prune_coco/configs/Detectron1-Comparisons/keypoint_rcnn_R_50_FPN_1x.yaml: -------------------------------------------------------------------------------- 1 | _BASE_: "../Base-RCNN-FPN.yaml" 2 | MODEL: 3 | WEIGHTS: "detectron2://ImageNetPretrained/MSRA/R-50.pkl" 4 | KEYPOINT_ON: True 5 | RESNETS: 6 | DEPTH: 50 7 | ROI_HEADS: 8 | NUM_CLASSES: 1 9 | ROI_KEYPOINT_HEAD: 10 | POOLER_RESOLUTION: 14 11 | POOLER_SAMPLING_RATIO: 2 12 | POOLER_TYPE: "ROIAlign" 13 | # Detectron1 uses smooth L1 loss with some magic beta values. 14 | # The defaults are changed to L1 loss in Detectron2. 15 | ROI_BOX_HEAD: 16 | SMOOTH_L1_BETA: 1.0 17 | POOLER_SAMPLING_RATIO: 2 18 | POOLER_TYPE: "ROIAlign" 19 | RPN: 20 | SMOOTH_L1_BETA: 0.1111 21 | # Detectron1 uses 2000 proposals per-batch, but this option is per-image in detectron2 22 | # 1000 proposals per-image is found to hurt box AP. 23 | # Therefore we increase it to 1500 per-image. 24 | POST_NMS_TOPK_TRAIN: 1500 25 | DATASETS: 26 | TRAIN: ("keypoints_coco_2017_train",) 27 | TEST: ("keypoints_coco_2017_val",) 28 | -------------------------------------------------------------------------------- /prune_coco/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 | -------------------------------------------------------------------------------- /prune_coco/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 | -------------------------------------------------------------------------------- /prune_coco/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 | -------------------------------------------------------------------------------- /prune_coco/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 | -------------------------------------------------------------------------------- /prune_coco/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 | -------------------------------------------------------------------------------- /prune_coco/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 | -------------------------------------------------------------------------------- /prune_coco/configs/LVISv1-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: 1203 13 | SCORE_THRESH_TEST: 0.0001 14 | INPUT: 15 | MIN_SIZE_TRAIN: (640, 672, 704, 736, 768, 800) 16 | DATASETS: 17 | TRAIN: ("lvis_v1_train",) 18 | TEST: ("lvis_v1_val",) 19 | SOLVER: 20 | STEPS: (120000, 160000) 21 | MAX_ITER: 180000 # 180000 * 16 / 100000 ~ 28.8 epochs 22 | TEST: 23 | DETECTIONS_PER_IMAGE: 300 # LVIS allows up to 300 24 | DATALOADER: 25 | SAMPLER_TRAIN: "RepeatFactorTrainingSampler" 26 | REPEAT_THRESHOLD: 0.001 27 | -------------------------------------------------------------------------------- /prune_coco/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 | -------------------------------------------------------------------------------- /prune_coco/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 | -------------------------------------------------------------------------------- /prune_coco/configs/Misc/cascade_mask_rcnn_X_152_32x8d_FPN_IN5k_gn_dconv.yaml: -------------------------------------------------------------------------------- 1 | _BASE_: "../Base-RCNN-FPN.yaml" 2 | MODEL: 3 | MASK_ON: True 4 | WEIGHTS: "catalog://ImageNetPretrained/FAIR/X-152-32x8d-IN5k" 5 | RESNETS: 6 | STRIDE_IN_1X1: False # this is a C2 model 7 | NUM_GROUPS: 32 8 | WIDTH_PER_GROUP: 8 9 | DEPTH: 152 10 | DEFORM_ON_PER_STAGE: [False, True, True, True] 11 | ROI_HEADS: 12 | NAME: "CascadeROIHeads" 13 | ROI_BOX_HEAD: 14 | NAME: "FastRCNNConvFCHead" 15 | NUM_CONV: 4 16 | NUM_FC: 1 17 | NORM: "GN" 18 | CLS_AGNOSTIC_BBOX_REG: True 19 | ROI_MASK_HEAD: 20 | NUM_CONV: 8 21 | NORM: "GN" 22 | RPN: 23 | POST_NMS_TOPK_TRAIN: 2000 24 | SOLVER: 25 | IMS_PER_BATCH: 128 26 | STEPS: (35000, 45000) 27 | MAX_ITER: 50000 28 | BASE_LR: 0.16 29 | INPUT: 30 | MIN_SIZE_TRAIN: (640, 864) 31 | MIN_SIZE_TRAIN_SAMPLING: "range" 32 | MAX_SIZE_TRAIN: 1440 33 | CROP: 34 | ENABLED: True 35 | TEST: 36 | EVAL_PERIOD: 2500 37 | -------------------------------------------------------------------------------- /prune_coco/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 | -------------------------------------------------------------------------------- /prune_coco/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 | -------------------------------------------------------------------------------- /prune_coco/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 | -------------------------------------------------------------------------------- /prune_coco/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 | -------------------------------------------------------------------------------- /prune_coco/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 | -------------------------------------------------------------------------------- /prune_coco/configs/Misc/panoptic_fpn_R_101_dconv_cascade_gn_3x.yaml: -------------------------------------------------------------------------------- 1 | # A large PanopticFPN for demo purposes. 2 | # Use GN on backbone to support semantic seg. 3 | # Use Cascade + Deform Conv to improve localization. 4 | _BASE_: "../COCO-PanopticSegmentation/Base-Panoptic-FPN.yaml" 5 | MODEL: 6 | WEIGHTS: "catalog://ImageNetPretrained/FAIR/R-101-GN" 7 | RESNETS: 8 | DEPTH: 101 9 | NORM: "GN" 10 | DEFORM_ON_PER_STAGE: [False, True, True, True] 11 | STRIDE_IN_1X1: False 12 | FPN: 13 | NORM: "GN" 14 | ROI_HEADS: 15 | NAME: CascadeROIHeads 16 | ROI_BOX_HEAD: 17 | CLS_AGNOSTIC_BBOX_REG: True 18 | ROI_MASK_HEAD: 19 | NORM: "GN" 20 | RPN: 21 | POST_NMS_TOPK_TRAIN: 2000 22 | SOLVER: 23 | STEPS: (105000, 125000) 24 | MAX_ITER: 135000 25 | IMS_PER_BATCH: 32 26 | BASE_LR: 0.04 27 | -------------------------------------------------------------------------------- /prune_coco/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 | -------------------------------------------------------------------------------- /prune_coco/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 | -------------------------------------------------------------------------------- /prune_coco/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 | -------------------------------------------------------------------------------- /prune_coco/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 | -------------------------------------------------------------------------------- /prune_coco/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 | -------------------------------------------------------------------------------- /prune_coco/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 | -------------------------------------------------------------------------------- /prune_coco/configs/quick_schedules/README.md: -------------------------------------------------------------------------------- 1 | These are quick configs for performance or accuracy regression tracking purposes. 2 | -------------------------------------------------------------------------------- /prune_coco/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 | -------------------------------------------------------------------------------- /prune_coco/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 | -------------------------------------------------------------------------------- /prune_coco/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 | -------------------------------------------------------------------------------- /prune_coco/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 | -------------------------------------------------------------------------------- /prune_coco/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 | -------------------------------------------------------------------------------- /prune_coco/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 | DATASETS: 6 | TRAIN: ("keypoints_coco_2017_val_100",) 7 | TEST: ("keypoints_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 | -------------------------------------------------------------------------------- /prune_coco/configs/quick_schedules/keypoint_rcnn_R_50_FPN_normalized_training_acc_test.yaml: -------------------------------------------------------------------------------- 1 | _BASE_: "../Base-RCNN-FPN.yaml" 2 | MODEL: 3 | WEIGHTS: "detectron2://ImageNetPretrained/MSRA/R-50.pkl" 4 | KEYPOINT_ON: True 5 | RESNETS: 6 | DEPTH: 50 7 | ROI_HEADS: 8 | BATCH_SIZE_PER_IMAGE: 256 9 | NUM_CLASSES: 1 10 | ROI_KEYPOINT_HEAD: 11 | POOLER_RESOLUTION: 14 12 | POOLER_SAMPLING_RATIO: 2 13 | NORMALIZE_LOSS_BY_VISIBLE_KEYPOINTS: False 14 | LOSS_WEIGHT: 4.0 15 | ROI_BOX_HEAD: 16 | SMOOTH_L1_BETA: 1.0 # Keypoint AP degrades when using plain L1 loss 17 | RPN: 18 | SMOOTH_L1_BETA: 0.2 # Keypoint AP degrades when using plain L1 loss 19 | DATASETS: 20 | TRAIN: ("keypoints_coco_2017_val",) 21 | TEST: ("keypoints_coco_2017_val",) 22 | INPUT: 23 | MIN_SIZE_TRAIN: (640, 672, 704, 736, 768, 800) 24 | SOLVER: 25 | WARMUP_FACTOR: 0.33333333 26 | WARMUP_ITERS: 100 27 | STEPS: (5500, 5800) 28 | MAX_ITER: 6000 29 | TEST: 30 | EXPECTED_RESULTS: [["bbox", "AP", 55.35, 1.0], ["keypoints", "AP", 76.91, 1.0]] 31 | -------------------------------------------------------------------------------- /prune_coco/configs/quick_schedules/keypoint_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 | KEYPOINT_ON: True 5 | RESNETS: 6 | DEPTH: 50 7 | ROI_HEADS: 8 | BATCH_SIZE_PER_IMAGE: 256 9 | NUM_CLASSES: 1 10 | ROI_KEYPOINT_HEAD: 11 | POOLER_RESOLUTION: 14 12 | POOLER_SAMPLING_RATIO: 2 13 | ROI_BOX_HEAD: 14 | SMOOTH_L1_BETA: 1.0 # Keypoint AP degrades when using plain L1 loss 15 | RPN: 16 | SMOOTH_L1_BETA: 0.2 # Keypoint AP degrades when using plain L1 loss 17 | DATASETS: 18 | TRAIN: ("keypoints_coco_2017_val",) 19 | TEST: ("keypoints_coco_2017_val",) 20 | INPUT: 21 | MIN_SIZE_TRAIN: (640, 672, 704, 736, 768, 800) 22 | SOLVER: 23 | WARMUP_FACTOR: 0.33333333 24 | WARMUP_ITERS: 100 25 | STEPS: (5500, 5800) 26 | MAX_ITER: 6000 27 | TEST: 28 | EXPECTED_RESULTS: [["bbox", "AP", 53.5, 1.0], ["keypoints", "AP", 72.4, 1.0]] 29 | -------------------------------------------------------------------------------- /prune_coco/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 | -------------------------------------------------------------------------------- /prune_coco/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 | -------------------------------------------------------------------------------- /prune_coco/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 | -------------------------------------------------------------------------------- /prune_coco/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 | -------------------------------------------------------------------------------- /prune_coco/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 | -------------------------------------------------------------------------------- /prune_coco/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 | -------------------------------------------------------------------------------- /prune_coco/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 | -------------------------------------------------------------------------------- /prune_coco/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 | -------------------------------------------------------------------------------- /prune_coco/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 | -------------------------------------------------------------------------------- /prune_coco/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 | -------------------------------------------------------------------------------- /prune_coco/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 | -------------------------------------------------------------------------------- /prune_coco/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 | -------------------------------------------------------------------------------- /prune_coco/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 | -------------------------------------------------------------------------------- /prune_coco/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 | -------------------------------------------------------------------------------- /prune_coco/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 | -------------------------------------------------------------------------------- /prune_coco/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 | -------------------------------------------------------------------------------- /prune_coco/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 | -------------------------------------------------------------------------------- /prune_coco/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 | -------------------------------------------------------------------------------- /prune_coco/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 | -------------------------------------------------------------------------------- /prune_coco/datasets/prepare_ade20k_sem_seg.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | # -*- coding: utf-8 -*- 3 | # Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved 4 | import numpy as np 5 | import os 6 | from pathlib import Path 7 | import tqdm 8 | from PIL import Image 9 | 10 | 11 | def convert(input, output): 12 | img = np.asarray(Image.open(input)) 13 | assert img.dtype == np.uint8 14 | img = img - 1 # 0 (ignore) becomes 255. others are shifted by 1 15 | Image.fromarray(img).save(output) 16 | 17 | 18 | if __name__ == "__main__": 19 | dataset_dir = Path(os.getenv("DETECTRON2_DATASETS", "datasets")) / "ADEChallengeData2016" 20 | for name in ["training", "validation"]: 21 | annotation_dir = dataset_dir / "annotations" / name 22 | output_dir = dataset_dir / "annotations_detectron2" / name 23 | output_dir.mkdir(parents=True, exist_ok=True) 24 | for file in tqdm.tqdm(list(annotation_dir.iterdir())): 25 | output_file = output_dir / file.name 26 | convert(file, output_file) 27 | -------------------------------------------------------------------------------- /prune_coco/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 | -------------------------------------------------------------------------------- /prune_coco/detectron2/__init__.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. 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.2.1" 11 | -------------------------------------------------------------------------------- /prune_coco/detectron2/checkpoint/__init__.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | # Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved 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 | -------------------------------------------------------------------------------- /prune_coco/detectron2/config/__init__.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved 2 | from .compat import downgrade_config, upgrade_config 3 | from .config import CfgNode, get_cfg, global_cfg, set_global_cfg, configurable 4 | 5 | __all__ = [ 6 | "CfgNode", 7 | "get_cfg", 8 | "global_cfg", 9 | "set_global_cfg", 10 | "downgrade_config", 11 | "upgrade_config", 12 | "configurable", 13 | ] 14 | -------------------------------------------------------------------------------- /prune_coco/detectron2/data/__init__.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved 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 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 | -------------------------------------------------------------------------------- /prune_coco/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 | -------------------------------------------------------------------------------- /prune_coco/detectron2/data/datasets/__init__.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved 2 | from .coco import load_coco_json, load_sem_seg, register_coco_instances 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 | -------------------------------------------------------------------------------- /prune_coco/detectron2/data/datasets/register_coco.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved 2 | from .coco import register_coco_instances # noqa 3 | from .coco_panoptic import register_coco_panoptic_separated # noqa 4 | -------------------------------------------------------------------------------- /prune_coco/detectron2/data/samplers/__init__.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved 2 | from .distributed_sampler import InferenceSampler, RepeatFactorTrainingSampler, TrainingSampler 3 | from .grouped_batch_sampler import GroupedBatchSampler 4 | 5 | __all__ = [ 6 | "GroupedBatchSampler", 7 | "TrainingSampler", 8 | "InferenceSampler", 9 | "RepeatFactorTrainingSampler", 10 | ] 11 | -------------------------------------------------------------------------------- /prune_coco/detectron2/data/transforms/__init__.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved 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 | -------------------------------------------------------------------------------- /prune_coco/detectron2/engine/__init__.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. 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 | -------------------------------------------------------------------------------- /prune_coco/detectron2/evaluation/__init__.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved 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 | -------------------------------------------------------------------------------- /prune_coco/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 Caffe2 format through ONNX. 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 | -------------------------------------------------------------------------------- /prune_coco/detectron2/export/__init__.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | 3 | from .api import * 4 | 5 | __all__ = [k for k in globals().keys() if not k.startswith("_")] 6 | -------------------------------------------------------------------------------- /prune_coco/detectron2/layers/__init__.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved 2 | from .batch_norm import FrozenBatchNorm2d, get_norm, NaiveSyncBatchNorm 3 | from .deform_conv import DeformConv, ModulatedDeformConv 4 | from .mask_ops import paste_masks_in_image 5 | from .nms import batched_nms, batched_nms_rotated, nms, nms_rotated 6 | from .roi_align import ROIAlign, roi_align 7 | from .roi_align_rotated import ROIAlignRotated, roi_align_rotated 8 | from .shape_spec import ShapeSpec 9 | from .wrappers import BatchNorm2d, Conv2d, ConvTranspose2d, cat, interpolate, Linear, nonzero_tuple 10 | from .blocks import CNNBlockBase 11 | from .aspp import ASPP 12 | 13 | __all__ = [k for k in globals().keys() if not k.startswith("_")] 14 | -------------------------------------------------------------------------------- /prune_coco/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 | -------------------------------------------------------------------------------- /prune_coco/detectron2/layers/csrc/box_iou_rotated/box_iou_rotated.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved 2 | #pragma once 3 | #include 4 | 5 | namespace detectron2 { 6 | 7 | at::Tensor box_iou_rotated_cpu( 8 | const at::Tensor& boxes1, 9 | const at::Tensor& boxes2); 10 | 11 | #if defined(WITH_CUDA) || defined(WITH_HIP) 12 | at::Tensor box_iou_rotated_cuda( 13 | const at::Tensor& boxes1, 14 | const at::Tensor& boxes2); 15 | #endif 16 | 17 | // Interface for Python 18 | // inline is needed to prevent multiple function definitions when this header is 19 | // included by different cpps 20 | inline at::Tensor box_iou_rotated( 21 | const at::Tensor& boxes1, 22 | const at::Tensor& boxes2) { 23 | assert(boxes1.device().is_cuda() == boxes2.device().is_cuda()); 24 | if (boxes1.device().is_cuda()) { 25 | #if defined(WITH_CUDA) || defined(WITH_HIP) 26 | return box_iou_rotated_cuda(boxes1.contiguous(), boxes2.contiguous()); 27 | #else 28 | AT_ERROR("Not compiled with GPU support"); 29 | #endif 30 | } 31 | 32 | return box_iou_rotated_cpu(boxes1.contiguous(), boxes2.contiguous()); 33 | } 34 | 35 | } // namespace detectron2 36 | -------------------------------------------------------------------------------- /prune_coco/detectron2/layers/csrc/cuda_version.cu: -------------------------------------------------------------------------------- 1 | // Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. 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 | -------------------------------------------------------------------------------- /prune_coco/detectron2/layers/rotated_boxes.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved 2 | from __future__ import absolute_import, division, print_function, unicode_literals 3 | 4 | from detectron2 import _C 5 | 6 | 7 | def pairwise_iou_rotated(boxes1, boxes2): 8 | """ 9 | Return intersection-over-union (Jaccard index) of boxes. 10 | 11 | Both sets of boxes are expected to be in 12 | (x_center, y_center, width, height, angle) format. 13 | 14 | Arguments: 15 | boxes1 (Tensor[N, 5]) 16 | boxes2 (Tensor[M, 5]) 17 | 18 | Returns: 19 | iou (Tensor[N, M]): the NxM matrix containing the pairwise 20 | IoU values for every element in boxes1 and boxes2 21 | """ 22 | return _C.box_iou_rotated(boxes1, boxes2) 23 | -------------------------------------------------------------------------------- /prune_coco/detectron2/layers/shape_spec.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | # Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved 3 | from collections import namedtuple 4 | 5 | 6 | class ShapeSpec(namedtuple("_ShapeSpec", ["channels", "height", "width", "stride"])): 7 | """ 8 | A simple structure that contains basic shape specification about a tensor. 9 | It is often used as the auxiliary inputs/outputs of models, 10 | to complement the lack of shape inference ability among pytorch modules. 11 | 12 | Attributes: 13 | channels: 14 | height: 15 | width: 16 | stride: 17 | """ 18 | 19 | def __new__(cls, *, channels=None, height=None, width=None, stride=None): 20 | return super().__new__(cls, channels, height, width, stride) 21 | -------------------------------------------------------------------------------- /prune_coco/detectron2/model_zoo/__init__.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved 2 | """ 3 | Model Zoo API for Detectron2: a collection of functions to create common model architectures and 4 | optionally load pre-trained weights as released in 5 | `MODEL_ZOO.md `_. 6 | """ 7 | from .model_zoo import get, get_config_file, get_checkpoint_url 8 | 9 | __all__ = ["get_checkpoint_url", "get", "get_config_file"] 10 | -------------------------------------------------------------------------------- /prune_coco/detectron2/model_zoo/configs: -------------------------------------------------------------------------------- 1 | /fs/vulcan-projects/pruning_sgirish/LTH-ObjectRecognition/prune_coco/configs -------------------------------------------------------------------------------- /prune_coco/detectron2/modeling/backbone/__init__.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved 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 .resnet import ResNet, ResNetBlockBase, build_resnet_backbone, make_stage 7 | 8 | __all__ = [k for k in globals().keys() if not k.startswith("_")] 9 | # TODO can expose more resnet blocks after careful consideration 10 | -------------------------------------------------------------------------------- /prune_coco/detectron2/modeling/backbone/build.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved 2 | from detectron2.layers import ShapeSpec 3 | from detectron2.utils.registry import Registry 4 | 5 | from .backbone import Backbone 6 | 7 | BACKBONE_REGISTRY = Registry("BACKBONE") 8 | BACKBONE_REGISTRY.__doc__ = """ 9 | Registry for backbones, which extract feature maps from images 10 | 11 | The registered object must be a callable that accepts two arguments: 12 | 13 | 1. A :class:`detectron2.config.CfgNode` 14 | 2. A :class:`detectron2.layers.ShapeSpec`, which contains the input shape specification. 15 | 16 | Registered object must return instance of :class:`Backbone`. 17 | """ 18 | 19 | 20 | def build_backbone(cfg, input_shape=None): 21 | """ 22 | Build a backbone from `cfg.MODEL.BACKBONE.NAME`. 23 | 24 | Returns: 25 | an instance of :class:`Backbone` 26 | """ 27 | if input_shape is None: 28 | input_shape = ShapeSpec(channels=len(cfg.MODEL.PIXEL_MEAN)) 29 | 30 | backbone_name = cfg.MODEL.BACKBONE.NAME 31 | backbone = BACKBONE_REGISTRY.get(backbone_name)(cfg, input_shape) 32 | assert isinstance(backbone, Backbone) 33 | return backbone 34 | -------------------------------------------------------------------------------- /prune_coco/detectron2/modeling/meta_arch/__init__.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | # Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved 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 .retinanet import RetinaNet 11 | from .semantic_seg import SEM_SEG_HEADS_REGISTRY, SemanticSegmentor, build_sem_seg_head 12 | 13 | 14 | __all__ = list(globals().keys()) 15 | -------------------------------------------------------------------------------- /prune_coco/detectron2/modeling/meta_arch/build.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved 2 | import torch 3 | 4 | from detectron2.utils.registry import Registry 5 | 6 | META_ARCH_REGISTRY = Registry("META_ARCH") # noqa F401 isort:skip 7 | META_ARCH_REGISTRY.__doc__ = """ 8 | Registry for meta-architectures, i.e. the whole model. 9 | 10 | The registered object will be called with `obj(cfg)` 11 | and expected to return a `nn.Module` object. 12 | """ 13 | 14 | 15 | def build_model(cfg): 16 | """ 17 | Build the whole model architecture, defined by ``cfg.MODEL.META_ARCHITECTURE``. 18 | Note that it does not load any weights from ``cfg``. 19 | """ 20 | meta_arch = cfg.MODEL.META_ARCHITECTURE 21 | model = META_ARCH_REGISTRY.get(meta_arch)(cfg) 22 | model.to(torch.device(cfg.MODEL.DEVICE)) 23 | return model 24 | -------------------------------------------------------------------------------- /prune_coco/detectron2/modeling/proposal_generator/__init__.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved 2 | from .build import PROPOSAL_GENERATOR_REGISTRY, build_proposal_generator 3 | from .rpn import RPN_HEAD_REGISTRY, build_rpn_head, RPN 4 | 5 | __all__ = list(globals().keys()) 6 | -------------------------------------------------------------------------------- /prune_coco/detectron2/modeling/proposal_generator/build.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved 2 | from detectron2.utils.registry import Registry 3 | 4 | PROPOSAL_GENERATOR_REGISTRY = Registry("PROPOSAL_GENERATOR") 5 | PROPOSAL_GENERATOR_REGISTRY.__doc__ = """ 6 | Registry for proposal generator, which produces object proposals from feature maps. 7 | 8 | The registered object will be called with `obj(cfg, input_shape)`. 9 | The call should return a `nn.Module` object. 10 | """ 11 | 12 | from . import rpn, rrpn # noqa F401 isort:skip 13 | 14 | 15 | def build_proposal_generator(cfg, input_shape): 16 | """ 17 | Build a proposal generator from `cfg.MODEL.PROPOSAL_GENERATOR.NAME`. 18 | The name can be "PrecomputedProposals" to use no proposal generator. 19 | """ 20 | name = cfg.MODEL.PROPOSAL_GENERATOR.NAME 21 | if name == "PrecomputedProposals": 22 | return None 23 | 24 | return PROPOSAL_GENERATOR_REGISTRY.get(name)(cfg, input_shape) 25 | -------------------------------------------------------------------------------- /prune_coco/detectron2/modeling/roi_heads/__init__.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved 2 | from .box_head import ROI_BOX_HEAD_REGISTRY, build_box_head, FastRCNNConvFCHead 3 | from .keypoint_head import ( 4 | ROI_KEYPOINT_HEAD_REGISTRY, 5 | build_keypoint_head, 6 | BaseKeypointRCNNHead, 7 | KRCNNConvDeconvUpsampleHead, 8 | ) 9 | from .mask_head import ( 10 | ROI_MASK_HEAD_REGISTRY, 11 | build_mask_head, 12 | BaseMaskRCNNHead, 13 | MaskRCNNConvUpsampleHead, 14 | ) 15 | from .roi_heads import ( 16 | ROI_HEADS_REGISTRY, 17 | ROIHeads, 18 | Res5ROIHeads, 19 | StandardROIHeads, 20 | build_roi_heads, 21 | select_foreground_proposals, 22 | ) 23 | from .rotated_fast_rcnn import RROIHeads 24 | from .fast_rcnn import FastRCNNOutputLayers 25 | 26 | from . import cascade_rcnn # isort:skip 27 | 28 | __all__ = list(globals().keys()) 29 | -------------------------------------------------------------------------------- /prune_coco/detectron2/projects/README.md: -------------------------------------------------------------------------------- 1 | 2 | Projects live in the [`projects` directory](../../projects) under the root of this repository, but not here. 3 | -------------------------------------------------------------------------------- /prune_coco/detectron2/solver/__init__.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved 2 | from .build import build_lr_scheduler, build_optimizer, get_default_optimizer_params 3 | from .lr_scheduler import WarmupCosineLR, WarmupMultiStepLR 4 | 5 | __all__ = [k for k in globals().keys() if not k.startswith("_")] 6 | -------------------------------------------------------------------------------- /prune_coco/detectron2/structures/__init__.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved 2 | from .boxes import Boxes, BoxMode, pairwise_iou, pairwise_ioa 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, rasterize_polygons_within_box, polygons_to_bitmask 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 | -------------------------------------------------------------------------------- /prune_coco/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 | -------------------------------------------------------------------------------- /prune_coco/detectron2/utils/__init__.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved 2 | -------------------------------------------------------------------------------- /prune_coco/detectron2/utils/registry.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved 2 | 3 | # Keep this module for backward compatibility. 4 | from fvcore.common.registry import Registry # noqa 5 | 6 | __all__ = ["Registry"] 7 | -------------------------------------------------------------------------------- /prune_coco/detectron2/utils/serialize.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved 2 | import cloudpickle 3 | 4 | 5 | class PicklableWrapper(object): 6 | """ 7 | Wrap an object to make it more picklable, note that it uses 8 | heavy weight serialization libraries that are slower than pickle. 9 | It's best to use it only on closures (which are usually not picklable). 10 | 11 | This is a simplified version of 12 | https://github.com/joblib/joblib/blob/master/joblib/externals/loky/cloudpickle_wrapper.py 13 | """ 14 | 15 | def __init__(self, obj): 16 | self._obj = obj 17 | 18 | def __reduce__(self): 19 | s = cloudpickle.dumps(self._obj) 20 | return cloudpickle.loads, (s,) 21 | 22 | def __call__(self, *args, **kwargs): 23 | return self._obj(*args, **kwargs) 24 | 25 | def __getattr__(self, attr): 26 | # Ensure that the wrapped object can be used seamlessly as the previous object. 27 | if attr not in ["_obj"]: 28 | return getattr(self._obj, attr) 29 | return getattr(self, attr) 30 | -------------------------------------------------------------------------------- /prune_coco/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 | -------------------------------------------------------------------------------- /prune_coco/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.6 10 | # ./dev/packaging/build_wheel.sh 11 | ``` 12 | 13 | ## To build all wheels for `CUDA {9.2,10.0,10.1}` x `Python {3.6,3.7,3.8}`: 14 | ``` 15 | ./dev/packaging/build_all_wheels.sh 16 | ./dev/packaging/gen_wheel_index.sh /path/to/wheels 17 | ``` 18 | -------------------------------------------------------------------------------- /prune_coco/docker/README.md: -------------------------------------------------------------------------------- 1 | 2 | ## Use the container (with docker ≥ 19.03) 3 | 4 | ``` 5 | cd docker/ 6 | # Build: 7 | docker build --build-arg USER_ID=$UID -t detectron2:v0 . 8 | # Run: 9 | docker run --gpus all -it \ 10 | --shm-size=8gb --env="DISPLAY" --volume="/tmp/.X11-unix:/tmp/.X11-unix:rw" \ 11 | --name=detectron2 detectron2:v0 12 | 13 | # Grant docker access to host X server to show images 14 | xhost +local:`docker inspect --format='{{ .Config.Hostname }}' detectron2` 15 | ``` 16 | 17 | ## Use the container (with docker < 19.03) 18 | 19 | Install docker-compose and nvidia-docker2, then run: 20 | ``` 21 | cd docker && USER_ID=$UID docker-compose run detectron2 22 | ``` 23 | 24 | #### Using a persistent cache directory 25 | 26 | You can prevent models from being re-downloaded on every run, 27 | by storing them in a cache directory. 28 | 29 | To do this, add `--volume=$HOME/.torch/fvcore_cache:/tmp:rw` in the run command. 30 | 31 | ## Install new dependencies 32 | Add the following to `Dockerfile` to make persistent changes. 33 | ``` 34 | RUN sudo apt-get update && sudo apt-get install -y vim 35 | ``` 36 | Or run them in the container to make temporary changes. 37 | -------------------------------------------------------------------------------- /prune_coco/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 | runtime: nvidia # TODO: Exchange with "gpu: all" in the future (see https://github.com/facebookresearch/detectron2/pull/197/commits/00545e1f376918db4a8ce264d427a07c1e896c5a). 10 | shm_size: "8gb" 11 | ulimits: 12 | memlock: -1 13 | stack: 67108864 14 | volumes: 15 | - /tmp/.X11-unix:/tmp/.X11-unix:ro 16 | environment: 17 | - DISPLAY=$DISPLAY 18 | - NVIDIA_VISIBLE_DEVICES=all 19 | -------------------------------------------------------------------------------- /prune_coco/docs/.gitignore: -------------------------------------------------------------------------------- 1 | _build 2 | -------------------------------------------------------------------------------- /prune_coco/docs/Makefile: -------------------------------------------------------------------------------- 1 | # Minimal makefile for Sphinx documentation 2 | # Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved 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 | -------------------------------------------------------------------------------- /prune_coco/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](https://github.com/facebookresearch/detectron2/blob/master/INSTALL.md). 9 | 2. Install additional libraries required to build docs: 10 | - docutils==0.16 11 | - Sphinx==3.0.0 12 | - recommonmark==0.6.0 13 | - sphinx_rtd_theme 14 | - mock 15 | 16 | 3. Run `make html` from this directory. 17 | -------------------------------------------------------------------------------- /prune_coco/docs/_static/css/custom.css: -------------------------------------------------------------------------------- 1 | /* 2 | * some extra css to make markdown look similar between github/sphinx 3 | */ 4 | 5 | /* 6 | * Below is for install.md: 7 | */ 8 | .rst-content code { 9 | white-space: pre; 10 | border: 0px; 11 | } 12 | 13 | .rst-content th { 14 | border: 1px solid #e1e4e5; 15 | } 16 | 17 | .rst-content th p { 18 | /* otherwise will be default 24px for regular paragraph */ 19 | margin-bottom: 0px; 20 | } 21 | 22 | div.section > details { 23 | padding-bottom: 1em; 24 | } 25 | -------------------------------------------------------------------------------- /prune_coco/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 | -------------------------------------------------------------------------------- /prune_coco/docs/modules/checkpoint.rst: -------------------------------------------------------------------------------- 1 | detectron2.checkpoint package 2 | ============================= 3 | 4 | .. automodule:: detectron2.checkpoint 5 | :members: 6 | :undoc-members: 7 | :show-inheritance: 8 | -------------------------------------------------------------------------------- /prune_coco/docs/modules/config.rst: -------------------------------------------------------------------------------- 1 | detectron2.config package 2 | ========================= 3 | 4 | Related tutorials: :doc:`../tutorials/config`, :doc:`../tutorials/extend`. 5 | 6 | .. automodule:: detectron2.config 7 | :members: 8 | :undoc-members: 9 | :show-inheritance: 10 | :inherited-members: 11 | 12 | 13 | Config References 14 | ----------------- 15 | 16 | .. literalinclude:: ../../detectron2/config/defaults.py 17 | :language: python 18 | :linenos: 19 | :lines: 4- 20 | -------------------------------------------------------------------------------- /prune_coco/docs/modules/data.rst: -------------------------------------------------------------------------------- 1 | detectron2.data package 2 | ======================= 3 | 4 | .. autodata:: detectron2.data.DatasetCatalog(dict) 5 | :annotation: 6 | 7 | .. autodata:: detectron2.data.MetadataCatalog(dict) 8 | :annotation: 9 | 10 | .. automodule:: detectron2.data 11 | :members: 12 | :undoc-members: 13 | :show-inheritance: 14 | 15 | detectron2.data.detection\_utils module 16 | --------------------------------------- 17 | 18 | .. automodule:: detectron2.data.detection_utils 19 | :members: 20 | :undoc-members: 21 | :show-inheritance: 22 | 23 | detectron2.data.datasets module 24 | --------------------------------------- 25 | 26 | .. automodule:: detectron2.data.datasets 27 | :members: 28 | :undoc-members: 29 | :show-inheritance: 30 | 31 | detectron2.data.samplers module 32 | --------------------------------------- 33 | 34 | .. automodule:: detectron2.data.samplers 35 | :members: 36 | :undoc-members: 37 | :show-inheritance: 38 | 39 | 40 | detectron2.data.transforms module 41 | --------------------------------------- 42 | 43 | .. automodule:: detectron2.data.transforms 44 | :members: 45 | :undoc-members: 46 | :show-inheritance: 47 | :imported-members: 48 | -------------------------------------------------------------------------------- /prune_coco/docs/modules/data_transforms.rst: -------------------------------------------------------------------------------- 1 | detectron2.data.transforms package 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 | -------------------------------------------------------------------------------- /prune_coco/docs/modules/engine.rst: -------------------------------------------------------------------------------- 1 | detectron2.engine package 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 | -------------------------------------------------------------------------------- /prune_coco/docs/modules/evaluation.rst: -------------------------------------------------------------------------------- 1 | detectron2.evaluation package 2 | ============================= 3 | 4 | .. automodule:: detectron2.evaluation 5 | :members: 6 | :undoc-members: 7 | :show-inheritance: 8 | -------------------------------------------------------------------------------- /prune_coco/docs/modules/export.rst: -------------------------------------------------------------------------------- 1 | detectron2.export package 2 | ========================= 3 | 4 | Related tutorial: :doc:`../tutorials/deployment`. 5 | 6 | .. automodule:: detectron2.export 7 | :members: 8 | :undoc-members: 9 | :show-inheritance: 10 | -------------------------------------------------------------------------------- /prune_coco/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 | -------------------------------------------------------------------------------- /prune_coco/docs/modules/layers.rst: -------------------------------------------------------------------------------- 1 | detectron2.layers package 2 | ========================= 3 | 4 | .. automodule:: detectron2.layers 5 | :members: 6 | :undoc-members: 7 | :show-inheritance: 8 | -------------------------------------------------------------------------------- /prune_coco/docs/modules/model_zoo.rst: -------------------------------------------------------------------------------- 1 | detectron2.model_zoo package 2 | ============================ 3 | 4 | .. automodule:: detectron2.model_zoo 5 | :members: 6 | :undoc-members: 7 | :show-inheritance: 8 | -------------------------------------------------------------------------------- /prune_coco/docs/modules/solver.rst: -------------------------------------------------------------------------------- 1 | detectron2.solver package 2 | ========================= 3 | 4 | .. automodule:: detectron2.solver 5 | :members: 6 | :undoc-members: 7 | :show-inheritance: 8 | -------------------------------------------------------------------------------- /prune_coco/docs/modules/structures.rst: -------------------------------------------------------------------------------- 1 | detectron2.structures package 2 | ============================= 3 | 4 | .. automodule:: detectron2.structures 5 | :members: 6 | :undoc-members: 7 | :show-inheritance: 8 | -------------------------------------------------------------------------------- /prune_coco/docs/notes/contributing.md: -------------------------------------------------------------------------------- 1 | ../../.github/CONTRIBUTING.md -------------------------------------------------------------------------------- /prune_coco/docs/notes/index.rst: -------------------------------------------------------------------------------- 1 | Notes 2 | ====================================== 3 | 4 | .. toctree:: 5 | :maxdepth: 2 6 | 7 | benchmarks 8 | compatibility 9 | contributing 10 | changelog 11 | -------------------------------------------------------------------------------- /prune_coco/docs/requirements.txt: -------------------------------------------------------------------------------- 1 | termcolor 2 | numpy 3 | tqdm 4 | docutils==0.16 5 | # https://github.com/sphinx-doc/sphinx/commit/7acd3ada3f38076af7b2b5c9f3b60bb9c2587a3d 6 | git+git://github.com/sphinx-doc/sphinx.git@7acd3ada3f38076af7b2b5c9f3b60bb9c2587a3d 7 | recommonmark==0.6.0 8 | sphinx_rtd_theme 9 | mock 10 | matplotlib 11 | termcolor 12 | yacs 13 | tabulate 14 | cloudpickle 15 | Pillow==6.2.2 16 | future 17 | requests 18 | six 19 | git+git://github.com/facebookresearch/fvcore.git 20 | https://download.pytorch.org/whl/cpu/torch-1.5.0%2Bcpu-cp37-cp37m-linux_x86_64.whl 21 | https://download.pytorch.org/whl/cpu/torchvision-0.6.0%2Bcpu-cp37-cp37m-linux_x86_64.whl 22 | -------------------------------------------------------------------------------- /prune_coco/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 | -------------------------------------------------------------------------------- /prune_coco/docs/tutorials/builtin_datasets.md: -------------------------------------------------------------------------------- 1 | ../../datasets/README.md -------------------------------------------------------------------------------- /prune_coco/docs/tutorials/getting_started.md: -------------------------------------------------------------------------------- 1 | ../../GETTING_STARTED.md -------------------------------------------------------------------------------- /prune_coco/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 | deployment 20 | -------------------------------------------------------------------------------- /prune_coco/docs/tutorials/install.md: -------------------------------------------------------------------------------- 1 | ../../INSTALL.md -------------------------------------------------------------------------------- /prune_coco/projects/DeepLab/configs/Cityscapes-SemanticSegmentation/Base-DeepLabV3-OS16-Semantic.yaml: -------------------------------------------------------------------------------- 1 | _BASE_: "../../../../configs/Base-RCNN-DilatedC5.yaml" 2 | MODEL: 3 | META_ARCHITECTURE: "SemanticSegmentor" 4 | BACKBONE: 5 | FREEZE_AT: 0 6 | SEM_SEG_HEAD: 7 | NAME: "DeepLabV3Head" 8 | IN_FEATURES: ["res5"] 9 | ASPP_CHANNELS: 256 10 | ASPP_DILATIONS: [6, 12, 18] 11 | ASPP_DROPOUT: 0.1 12 | CONVS_DIM: 256 13 | COMMON_STRIDE: 16 14 | NUM_CLASSES: 19 15 | LOSS_TYPE: "hard_pixel_mining" 16 | DATASETS: 17 | TRAIN: ("cityscapes_fine_sem_seg_train",) 18 | TEST: ("cityscapes_fine_sem_seg_val",) 19 | SOLVER: 20 | BASE_LR: 0.01 21 | MAX_ITER: 90000 22 | LR_SCHEDULER_NAME: "WarmupPolyLR" 23 | IMS_PER_BATCH: 16 24 | INPUT: 25 | MIN_SIZE_TRAIN: (512, 768, 1024, 1280, 1536, 1792, 2048) 26 | MIN_SIZE_TRAIN_SAMPLING: "choice" 27 | MIN_SIZE_TEST: 1024 28 | MAX_SIZE_TRAIN: 4096 29 | MAX_SIZE_TEST: 2048 30 | CROP: 31 | ENABLED: True 32 | TYPE: "absolute" 33 | SIZE: (512, 1024) 34 | SINGLE_CATEGORY_MAX_AREA: 1.0 35 | DATALOADER: 36 | NUM_WORKERS: 10 37 | -------------------------------------------------------------------------------- /prune_coco/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 | -------------------------------------------------------------------------------- /prune_coco/projects/DeepLab/configs/Cityscapes-SemanticSegmentation/deeplab_v3_plus_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 | OUT_FEATURES: ["res2", "res5"] 12 | RES5_MULTI_GRID: [1, 2, 4] 13 | STEM_TYPE: "deeplab" 14 | STEM_OUT_CHANNELS: 128 15 | STRIDE_IN_1X1: False 16 | SEM_SEG_HEAD: 17 | NAME: "DeepLabV3PlusHead" 18 | IN_FEATURES: ["res2", "res5"] 19 | PROJECT_FEATURES: ["res2"] 20 | PROJECT_CHANNELS: [48] 21 | NORM: "SyncBN" 22 | COMMON_STRIDE: 4 23 | INPUT: 24 | FORMAT: "RGB" 25 | -------------------------------------------------------------------------------- /prune_coco/projects/DeepLab/deeplab/__init__.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved 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 | -------------------------------------------------------------------------------- /prune_coco/projects/DeepLab/deeplab/build_solver.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved 2 | import torch 3 | 4 | from detectron2.config import CfgNode 5 | from detectron2.solver import build_lr_scheduler as build_d2_lr_scheduler 6 | 7 | from .lr_scheduler import WarmupPolyLR 8 | 9 | 10 | def build_lr_scheduler( 11 | cfg: CfgNode, optimizer: torch.optim.Optimizer 12 | ) -> torch.optim.lr_scheduler._LRScheduler: 13 | """ 14 | Build a LR scheduler from config. 15 | """ 16 | name = cfg.SOLVER.LR_SCHEDULER_NAME 17 | if name == "WarmupPolyLR": 18 | return WarmupPolyLR( 19 | optimizer, 20 | cfg.SOLVER.MAX_ITER, 21 | warmup_factor=cfg.SOLVER.WARMUP_FACTOR, 22 | warmup_iters=cfg.SOLVER.WARMUP_ITERS, 23 | warmup_method=cfg.SOLVER.WARMUP_METHOD, 24 | power=cfg.SOLVER.POLY_LR_POWER, 25 | constant_ending=cfg.SOLVER.POLY_LR_CONSTANT_ENDING, 26 | ) 27 | else: 28 | return build_d2_lr_scheduler(cfg, optimizer) 29 | -------------------------------------------------------------------------------- /prune_coco/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 | -------------------------------------------------------------------------------- /prune_coco/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 | -------------------------------------------------------------------------------- /prune_coco/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 | -------------------------------------------------------------------------------- /prune_coco/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 | -------------------------------------------------------------------------------- /prune_coco/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 | -------------------------------------------------------------------------------- /prune_coco/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 | -------------------------------------------------------------------------------- /prune_coco/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 | -------------------------------------------------------------------------------- /prune_coco/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 | -------------------------------------------------------------------------------- /prune_coco/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 | -------------------------------------------------------------------------------- /prune_coco/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 | -------------------------------------------------------------------------------- /prune_coco/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 | -------------------------------------------------------------------------------- /prune_coco/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 | -------------------------------------------------------------------------------- /prune_coco/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 | -------------------------------------------------------------------------------- /prune_coco/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 | -------------------------------------------------------------------------------- /prune_coco/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 | -------------------------------------------------------------------------------- /prune_coco/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 | -------------------------------------------------------------------------------- /prune_coco/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 | -------------------------------------------------------------------------------- /prune_coco/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 | -------------------------------------------------------------------------------- /prune_coco/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 | -------------------------------------------------------------------------------- /prune_coco/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 | -------------------------------------------------------------------------------- /prune_coco/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 | -------------------------------------------------------------------------------- /prune_coco/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 | -------------------------------------------------------------------------------- /prune_coco/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 | -------------------------------------------------------------------------------- /prune_coco/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 | -------------------------------------------------------------------------------- /prune_coco/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 | -------------------------------------------------------------------------------- /prune_coco/projects/DensePose/configs/evolution/densepose_R_101_FPN_1x_Atop10_toP.yaml: -------------------------------------------------------------------------------- 1 | _BASE_: "Base-RCNN-FPN-MC.yaml" 2 | MODEL: 3 | WEIGHTS: "detectron2://ImageNetPretrained/MSRA/R-101.pkl" 4 | RESNETS: 5 | DEPTH: 101 6 | DENSEPOSE_ON: True 7 | ROI_HEADS: 8 | NAME: "DensePoseROIHeads" 9 | IN_FEATURES: ["p2", "p3", "p4", "p5"] 10 | NUM_CLASSES: 1 11 | ROI_DENSEPOSE_HEAD: 12 | NAME: "DensePoseV1ConvXHead" 13 | POOLER_TYPE: "ROIAlign" 14 | NUM_COARSE_SEGM_CHANNELS: 2 15 | COARSE_SEGM_TRAINED_BY_MASKS: True 16 | INDEX_WEIGHTS: 1.0 17 | DATASETS: 18 | TRAIN: ("base_coco_2017_train", "densepose_coco_2014_train") 19 | TEST: ("densepose_chimps",) 20 | -------------------------------------------------------------------------------- /prune_coco/projects/DensePose/configs/evolution/densepose_R_101_FPN_DL_1x_Atop10_toP.yaml: -------------------------------------------------------------------------------- 1 | _BASE_: "Base-RCNN-FPN-MC.yaml" 2 | MODEL: 3 | WEIGHTS: "detectron2://ImageNetPretrained/MSRA/R-101.pkl" 4 | RESNETS: 5 | DEPTH: 101 6 | DENSEPOSE_ON: True 7 | ROI_HEADS: 8 | NAME: "DensePoseROIHeads" 9 | IN_FEATURES: ["p2", "p3", "p4", "p5"] 10 | NUM_CLASSES: 1 11 | ROI_DENSEPOSE_HEAD: 12 | NAME: "DensePoseDeepLabHead" 13 | POOLER_TYPE: "ROIAlign" 14 | NUM_COARSE_SEGM_CHANNELS: 2 15 | COARSE_SEGM_TRAINED_BY_MASKS: True 16 | INDEX_WEIGHTS: 1.0 17 | DATASETS: 18 | TRAIN: ("base_coco_2017_train", "densepose_coco_2014_train") 19 | TEST: ("densepose_chimps",) 20 | -------------------------------------------------------------------------------- /prune_coco/projects/DensePose/configs/evolution/densepose_R_101_FPN_DL_WC1M_1x_Atop10_toP.yaml: -------------------------------------------------------------------------------- 1 | _BASE_: "Base-RCNN-FPN-MC.yaml" 2 | MODEL: 3 | WEIGHTS: "detectron2://ImageNetPretrained/MSRA/R-101.pkl" 4 | RESNETS: 5 | DEPTH: 101 6 | DENSEPOSE_ON: True 7 | ROI_HEADS: 8 | NAME: "DensePoseROIHeads" 9 | IN_FEATURES: ["p2", "p3", "p4", "p5"] 10 | NUM_CLASSES: 1 11 | ROI_DENSEPOSE_HEAD: 12 | NAME: "DensePoseDeepLabHead" 13 | UV_CONFIDENCE: 14 | ENABLED: True 15 | TYPE: "iid_iso" 16 | SEGM_CONFIDENCE: 17 | ENABLED: True 18 | POINT_REGRESSION_WEIGHTS: 0.0005 19 | POOLER_TYPE: "ROIAlign" 20 | NUM_COARSE_SEGM_CHANNELS: 2 21 | COARSE_SEGM_TRAINED_BY_MASKS: True 22 | INDEX_WEIGHTS: 1.0 23 | SOLVER: 24 | CLIP_GRADIENTS: 25 | ENABLED: True 26 | WARMUP_FACTOR: 0.025 27 | DATASETS: 28 | TRAIN: ("base_coco_2017_train", "densepose_coco_2014_train") 29 | TEST: ("densepose_chimps",) 30 | -------------------------------------------------------------------------------- /prune_coco/projects/DensePose/configs/evolution/densepose_R_101_FPN_DL_WC1_1x_Atop10_toP.yaml: -------------------------------------------------------------------------------- 1 | _BASE_: "Base-RCNN-FPN-MC.yaml" 2 | MODEL: 3 | WEIGHTS: "detectron2://ImageNetPretrained/MSRA/R-101.pkl" 4 | RESNETS: 5 | DEPTH: 101 6 | DENSEPOSE_ON: True 7 | ROI_HEADS: 8 | NAME: "DensePoseROIHeads" 9 | IN_FEATURES: ["p2", "p3", "p4", "p5"] 10 | NUM_CLASSES: 1 11 | ROI_DENSEPOSE_HEAD: 12 | NAME: "DensePoseDeepLabHead" 13 | UV_CONFIDENCE: 14 | ENABLED: True 15 | TYPE: "iid_iso" 16 | POINT_REGRESSION_WEIGHTS: 0.0005 17 | POOLER_TYPE: "ROIAlign" 18 | NUM_COARSE_SEGM_CHANNELS: 2 19 | COARSE_SEGM_TRAINED_BY_MASKS: True 20 | INDEX_WEIGHTS: 1.0 21 | SOLVER: 22 | CLIP_GRADIENTS: 23 | ENABLED: True 24 | WARMUP_FACTOR: 0.025 25 | DATASETS: 26 | TRAIN: ("base_coco_2017_train", "densepose_coco_2014_train") 27 | TEST: ("densepose_chimps",) 28 | -------------------------------------------------------------------------------- /prune_coco/projects/DensePose/configs/evolution/densepose_R_101_FPN_WC1M_1x_Atop10_toP.yaml: -------------------------------------------------------------------------------- 1 | _BASE_: "Base-RCNN-FPN-MC.yaml" 2 | MODEL: 3 | WEIGHTS: "detectron2://ImageNetPretrained/MSRA/R-101.pkl" 4 | RESNETS: 5 | DEPTH: 101 6 | DENSEPOSE_ON: True 7 | ROI_HEADS: 8 | NAME: "DensePoseROIHeads" 9 | IN_FEATURES: ["p2", "p3", "p4", "p5"] 10 | NUM_CLASSES: 1 11 | ROI_DENSEPOSE_HEAD: 12 | NAME: "DensePoseV1ConvXHead" 13 | UV_CONFIDENCE: 14 | ENABLED: True 15 | TYPE: "iid_iso" 16 | SEGM_CONFIDENCE: 17 | ENABLED: True 18 | POINT_REGRESSION_WEIGHTS: 0.0005 19 | POOLER_TYPE: "ROIAlign" 20 | NUM_COARSE_SEGM_CHANNELS: 2 21 | COARSE_SEGM_TRAINED_BY_MASKS: True 22 | INDEX_WEIGHTS: 1.0 23 | SOLVER: 24 | CLIP_GRADIENTS: 25 | ENABLED: True 26 | WARMUP_FACTOR: 0.025 27 | DATASETS: 28 | TRAIN: ("base_coco_2017_train", "densepose_coco_2014_train") 29 | TEST: ("densepose_chimps",) 30 | -------------------------------------------------------------------------------- /prune_coco/projects/DensePose/configs/evolution/densepose_R_101_FPN_WC1_1x_Atop10_toP.yaml: -------------------------------------------------------------------------------- 1 | _BASE_: "Base-RCNN-FPN-MC.yaml" 2 | MODEL: 3 | WEIGHTS: "detectron2://ImageNetPretrained/MSRA/R-101.pkl" 4 | RESNETS: 5 | DEPTH: 101 6 | DENSEPOSE_ON: True 7 | ROI_HEADS: 8 | NAME: "DensePoseROIHeads" 9 | IN_FEATURES: ["p2", "p3", "p4", "p5"] 10 | NUM_CLASSES: 1 11 | ROI_DENSEPOSE_HEAD: 12 | NAME: "DensePoseV1ConvXHead" 13 | UV_CONFIDENCE: 14 | ENABLED: True 15 | TYPE: "iid_iso" 16 | POINT_REGRESSION_WEIGHTS: 0.0005 17 | POOLER_TYPE: "ROIAlign" 18 | NUM_COARSE_SEGM_CHANNELS: 2 19 | COARSE_SEGM_TRAINED_BY_MASKS: True 20 | INDEX_WEIGHTS: 1.0 21 | SOLVER: 22 | CLIP_GRADIENTS: 23 | ENABLED: True 24 | WARMUP_FACTOR: 0.025 25 | DATASETS: 26 | TRAIN: ("base_coco_2017_train", "densepose_coco_2014_train") 27 | TEST: ("densepose_chimps",) 28 | -------------------------------------------------------------------------------- /prune_coco/projects/DensePose/configs/evolution/densepose_R_50_FPN_1x_Atop10_toP.yaml: -------------------------------------------------------------------------------- 1 | _BASE_: "Base-RCNN-FPN-MC.yaml" 2 | MODEL: 3 | WEIGHTS: "detectron2://ImageNetPretrained/MSRA/R-50.pkl" 4 | RESNETS: 5 | DEPTH: 50 6 | DENSEPOSE_ON: True 7 | ROI_HEADS: 8 | NAME: "DensePoseROIHeads" 9 | IN_FEATURES: ["p2", "p3", "p4", "p5"] 10 | NUM_CLASSES: 1 11 | ROI_DENSEPOSE_HEAD: 12 | NAME: "DensePoseV1ConvXHead" 13 | POOLER_TYPE: "ROIAlign" 14 | NUM_COARSE_SEGM_CHANNELS: 2 15 | COARSE_SEGM_TRAINED_BY_MASKS: True 16 | INDEX_WEIGHTS: 1.0 17 | DATASETS: 18 | TRAIN: ("base_coco_2017_train", "densepose_coco_2014_train") 19 | TEST: ("densepose_chimps",) 20 | -------------------------------------------------------------------------------- /prune_coco/projects/DensePose/configs/evolution/densepose_R_50_FPN_DL_1x_Atop10_toP.yaml: -------------------------------------------------------------------------------- 1 | _BASE_: "Base-RCNN-FPN-MC.yaml" 2 | MODEL: 3 | WEIGHTS: "detectron2://ImageNetPretrained/MSRA/R-50.pkl" 4 | RESNETS: 5 | DEPTH: 50 6 | DENSEPOSE_ON: True 7 | ROI_HEADS: 8 | NAME: "DensePoseROIHeads" 9 | IN_FEATURES: ["p2", "p3", "p4", "p5"] 10 | NUM_CLASSES: 1 11 | ROI_DENSEPOSE_HEAD: 12 | NAME: "DensePoseDeepLabHead" 13 | POOLER_TYPE: "ROIAlign" 14 | NUM_COARSE_SEGM_CHANNELS: 2 15 | COARSE_SEGM_TRAINED_BY_MASKS: True 16 | INDEX_WEIGHTS: 1.0 17 | DATASETS: 18 | TRAIN: ("base_coco_2017_train", "densepose_coco_2014_train") 19 | TEST: ("densepose_chimps",) 20 | -------------------------------------------------------------------------------- /prune_coco/projects/DensePose/configs/evolution/densepose_R_50_FPN_DL_WC1M_1x_Atop10_toP.yaml: -------------------------------------------------------------------------------- 1 | _BASE_: "Base-RCNN-FPN-MC.yaml" 2 | MODEL: 3 | WEIGHTS: "detectron2://ImageNetPretrained/MSRA/R-50.pkl" 4 | RESNETS: 5 | DEPTH: 50 6 | DENSEPOSE_ON: True 7 | ROI_HEADS: 8 | NAME: "DensePoseROIHeads" 9 | IN_FEATURES: ["p2", "p3", "p4", "p5"] 10 | NUM_CLASSES: 1 11 | ROI_DENSEPOSE_HEAD: 12 | NAME: "DensePoseDeepLabHead" 13 | UV_CONFIDENCE: 14 | ENABLED: True 15 | TYPE: "iid_iso" 16 | SEGM_CONFIDENCE: 17 | ENABLED: True 18 | POINT_REGRESSION_WEIGHTS: 0.0005 19 | POOLER_TYPE: "ROIAlign" 20 | NUM_COARSE_SEGM_CHANNELS: 2 21 | COARSE_SEGM_TRAINED_BY_MASKS: True 22 | INDEX_WEIGHTS: 1.0 23 | SOLVER: 24 | CLIP_GRADIENTS: 25 | ENABLED: True 26 | WARMUP_FACTOR: 0.025 27 | DATASETS: 28 | TRAIN: ("base_coco_2017_train", "densepose_coco_2014_train") 29 | TEST: ("densepose_chimps",) 30 | -------------------------------------------------------------------------------- /prune_coco/projects/DensePose/configs/evolution/densepose_R_50_FPN_DL_WC1_1x_Atop10_toP.yaml: -------------------------------------------------------------------------------- 1 | _BASE_: "Base-RCNN-FPN-MC.yaml" 2 | MODEL: 3 | WEIGHTS: "detectron2://ImageNetPretrained/MSRA/R-50.pkl" 4 | RESNETS: 5 | DEPTH: 50 6 | DENSEPOSE_ON: True 7 | ROI_HEADS: 8 | NAME: "DensePoseROIHeads" 9 | IN_FEATURES: ["p2", "p3", "p4", "p5"] 10 | NUM_CLASSES: 1 11 | ROI_DENSEPOSE_HEAD: 12 | NAME: "DensePoseDeepLabHead" 13 | UV_CONFIDENCE: 14 | ENABLED: True 15 | TYPE: "iid_iso" 16 | POINT_REGRESSION_WEIGHTS: 0.0005 17 | POOLER_TYPE: "ROIAlign" 18 | NUM_COARSE_SEGM_CHANNELS: 2 19 | COARSE_SEGM_TRAINED_BY_MASKS: True 20 | INDEX_WEIGHTS: 1.0 21 | SOLVER: 22 | CLIP_GRADIENTS: 23 | ENABLED: True 24 | WARMUP_FACTOR: 0.025 25 | DATASETS: 26 | TRAIN: ("base_coco_2017_train", "densepose_coco_2014_train") 27 | TEST: ("densepose_chimps",) 28 | -------------------------------------------------------------------------------- /prune_coco/projects/DensePose/configs/evolution/densepose_R_50_FPN_WC1M_1x_Atop10_toP.yaml: -------------------------------------------------------------------------------- 1 | _BASE_: "Base-RCNN-FPN-MC.yaml" 2 | MODEL: 3 | WEIGHTS: "detectron2://ImageNetPretrained/MSRA/R-50.pkl" 4 | RESNETS: 5 | DEPTH: 50 6 | DENSEPOSE_ON: True 7 | ROI_HEADS: 8 | NAME: "DensePoseROIHeads" 9 | IN_FEATURES: ["p2", "p3", "p4", "p5"] 10 | NUM_CLASSES: 1 11 | ROI_DENSEPOSE_HEAD: 12 | NAME: "DensePoseV1ConvXHead" 13 | UV_CONFIDENCE: 14 | ENABLED: True 15 | TYPE: "iid_iso" 16 | SEGM_CONFIDENCE: 17 | ENABLED: True 18 | POINT_REGRESSION_WEIGHTS: 0.0005 19 | POOLER_TYPE: "ROIAlign" 20 | NUM_COARSE_SEGM_CHANNELS: 2 21 | COARSE_SEGM_TRAINED_BY_MASKS: True 22 | INDEX_WEIGHTS: 1.0 23 | SOLVER: 24 | CLIP_GRADIENTS: 25 | ENABLED: True 26 | WARMUP_FACTOR: 0.025 27 | DATASETS: 28 | TRAIN: ("base_coco_2017_train", "densepose_coco_2014_train") 29 | TEST: ("densepose_chimps",) 30 | -------------------------------------------------------------------------------- /prune_coco/projects/DensePose/configs/evolution/densepose_R_50_FPN_WC1M_1x_Atop10_toP_B.yaml: -------------------------------------------------------------------------------- 1 | _BASE_: "Base-RCNN-FPN-MC-B.yaml" 2 | MODEL: 3 | WEIGHTS: "detectron2://ImageNetPretrained/MSRA/R-50.pkl" 4 | RESNETS: 5 | DEPTH: 50 6 | DENSEPOSE_ON: True 7 | ROI_HEADS: 8 | NAME: "DensePoseROIHeads" 9 | IN_FEATURES: ["p2", "p3", "p4", "p5"] 10 | NUM_CLASSES: 1 11 | ROI_DENSEPOSE_HEAD: 12 | NAME: "DensePoseV1ConvXHead" 13 | UV_CONFIDENCE: 14 | ENABLED: True 15 | TYPE: "iid_iso" 16 | SEGM_CONFIDENCE: 17 | ENABLED: True 18 | POINT_REGRESSION_WEIGHTS: 0.0005 19 | POOLER_TYPE: "ROIAlign" 20 | NUM_COARSE_SEGM_CHANNELS: 2 21 | COARSE_SEGM_TRAINED_BY_MASKS: True 22 | INDEX_WEIGHTS: 1.0 23 | SOLVER: 24 | CLIP_GRADIENTS: 25 | ENABLED: True 26 | CLIP_TYPE: "norm" 27 | WARMUP_FACTOR: 0.025 28 | DATASETS: 29 | TRAIN: ("base_coco_2017_train", "densepose_coco_2014_train") 30 | TEST: ("densepose_chimps",) 31 | -------------------------------------------------------------------------------- /prune_coco/projects/DensePose/configs/evolution/densepose_R_50_FPN_WC1_1x_Atop10_toP.yaml: -------------------------------------------------------------------------------- 1 | _BASE_: "Base-RCNN-FPN-MC.yaml" 2 | MODEL: 3 | WEIGHTS: "detectron2://ImageNetPretrained/MSRA/R-50.pkl" 4 | RESNETS: 5 | DEPTH: 50 6 | DENSEPOSE_ON: True 7 | ROI_HEADS: 8 | NAME: "DensePoseROIHeads" 9 | IN_FEATURES: ["p2", "p3", "p4", "p5"] 10 | NUM_CLASSES: 1 11 | ROI_DENSEPOSE_HEAD: 12 | NAME: "DensePoseV1ConvXHead" 13 | UV_CONFIDENCE: 14 | ENABLED: True 15 | TYPE: "iid_iso" 16 | POINT_REGRESSION_WEIGHTS: 0.0005 17 | POOLER_TYPE: "ROIAlign" 18 | NUM_COARSE_SEGM_CHANNELS: 2 19 | COARSE_SEGM_TRAINED_BY_MASKS: True 20 | INDEX_WEIGHTS: 1.0 21 | SOLVER: 22 | CLIP_GRADIENTS: 23 | ENABLED: True 24 | WARMUP_FACTOR: 0.025 25 | DATASETS: 26 | TRAIN: ("base_coco_2017_train", "densepose_coco_2014_train") 27 | TEST: ("densepose_chimps",) 28 | -------------------------------------------------------------------------------- /prune_coco/projects/DensePose/configs/evolution/faster_rcnn_R_50_FPN_1x_MC.yaml: -------------------------------------------------------------------------------- 1 | _BASE_: "Base-RCNN-FPN-MC.yaml" 2 | MODEL: 3 | WEIGHTS: "detectron2://ImageNetPretrained/MSRA/R-50.pkl" 4 | MASK_ON: False 5 | DENSEPOSE_ON: False 6 | RESNETS: 7 | DEPTH: 50 8 | -------------------------------------------------------------------------------- /prune_coco/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 | -------------------------------------------------------------------------------- /prune_coco/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 | -------------------------------------------------------------------------------- /prune_coco/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 | -------------------------------------------------------------------------------- /prune_coco/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 | -------------------------------------------------------------------------------- /prune_coco/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 | -------------------------------------------------------------------------------- /prune_coco/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 | -------------------------------------------------------------------------------- /prune_coco/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 | -------------------------------------------------------------------------------- /prune_coco/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 | -------------------------------------------------------------------------------- /prune_coco/projects/DensePose/densepose/__init__.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved 2 | from .data.datasets import builtin # just to register data 3 | from .converters import builtin as builtin_converters # register converters 4 | from .config import ( 5 | add_densepose_config, 6 | add_densepose_head_config, 7 | add_hrnet_config, 8 | add_dataset_category_config, 9 | add_bootstrap_config, 10 | load_bootstrap_config, 11 | ) 12 | from .evaluator import DensePoseCOCOEvaluator 13 | from .modeling.roi_heads import DensePoseROIHeads 14 | from .data.structures import DensePoseDataRelative, DensePoseList, DensePoseTransformData 15 | from .modeling.test_time_augmentation import ( 16 | DensePoseGeneralizedRCNNWithTTA, 17 | DensePoseDatasetMapperTTA, 18 | ) 19 | from .utils.transform import load_from_cfg 20 | from .modeling.hrfpn import build_hrfpn_backbone 21 | -------------------------------------------------------------------------------- /prune_coco/projects/DensePose/densepose/converters/__init__.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved 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 | resample_fine_and_coarse_segm_to_bbox, 9 | ) 10 | from .chart_output_to_chart_result import ( 11 | densepose_chart_predictor_output_to_result, 12 | densepose_chart_predictor_output_to_result_with_confidences, 13 | ) 14 | from .chart_output_hflip import densepose_chart_predictor_output_hflip 15 | -------------------------------------------------------------------------------- /prune_coco/projects/DensePose/densepose/converters/builtin.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved 2 | 3 | from ..structures import DensePoseChartPredictorOutput 4 | from . import ( 5 | HFlipConverter, 6 | ToChartResultConverter, 7 | ToChartResultConverterWithConfidences, 8 | ToMaskConverter, 9 | densepose_chart_predictor_output_hflip, 10 | densepose_chart_predictor_output_to_result, 11 | densepose_chart_predictor_output_to_result_with_confidences, 12 | predictor_output_with_fine_and_coarse_segm_to_mask, 13 | ) 14 | 15 | ToMaskConverter.register( 16 | DensePoseChartPredictorOutput, predictor_output_with_fine_and_coarse_segm_to_mask 17 | ) 18 | 19 | ToChartResultConverter.register( 20 | DensePoseChartPredictorOutput, densepose_chart_predictor_output_to_result 21 | ) 22 | 23 | ToChartResultConverterWithConfidences.register( 24 | DensePoseChartPredictorOutput, densepose_chart_predictor_output_to_result_with_confidences 25 | ) 26 | 27 | HFlipConverter.register(DensePoseChartPredictorOutput, densepose_chart_predictor_output_hflip) 28 | -------------------------------------------------------------------------------- /prune_coco/projects/DensePose/densepose/converters/hflip.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved 2 | 3 | from typing import Any 4 | 5 | from .base import BaseConverter 6 | 7 | 8 | class HFlipConverter(BaseConverter): 9 | """ 10 | Converts various DensePose predictor outputs to DensePose results. 11 | Each DensePose predictor output type has to register its convertion strategy. 12 | """ 13 | 14 | registry = {} 15 | dst_type = None 16 | 17 | @classmethod 18 | def convert(cls, predictor_outputs: Any, transform_data: Any, *args, **kwargs): 19 | """ 20 | Performs an horizontal flip on DensePose predictor outputs. 21 | Does recursive lookup for base classes, so there's no need 22 | for explicit registration for derived classes. 23 | 24 | Args: 25 | predictor_outputs: DensePose predictor output to be converted to BitMasks 26 | transform_data: Anything useful for the flip 27 | Return: 28 | An instance of the same type as predictor_outputs 29 | """ 30 | return super(HFlipConverter, cls).convert( 31 | predictor_outputs, transform_data, *args, **kwargs 32 | ) 33 | -------------------------------------------------------------------------------- /prune_coco/projects/DensePose/densepose/data/__init__.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved 2 | 3 | from .build import ( 4 | build_detection_test_loader, 5 | build_detection_train_loader, 6 | build_combined_loader, 7 | build_frame_selector, 8 | build_inference_based_loaders, 9 | has_inference_based_loaders, 10 | BootstrapDatasetFactoryCatalog, 11 | ) 12 | from .combined_loader import CombinedDataLoader 13 | from .dataset_mapper import DatasetMapper 14 | from .inference_based_loader import InferenceBasedLoader, ScoreBasedFilter 15 | from .utils import is_relative_local_path, maybe_prepend_base_path 16 | 17 | # ensure the builtin datasets are registered 18 | from . import datasets 19 | 20 | # ensure the bootstrap datasets builders are registered 21 | from . import build 22 | 23 | __all__ = [k for k in globals().keys() if not k.startswith("_")] 24 | -------------------------------------------------------------------------------- /prune_coco/projects/DensePose/densepose/data/datasets/__init__.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved 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 | -------------------------------------------------------------------------------- /prune_coco/projects/DensePose/densepose/data/datasets/builtin.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved 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 | 7 | DEFAULT_DATASETS_ROOT = "datasets" 8 | 9 | 10 | register_coco_datasets(COCO_DATASETS, DEFAULT_DATASETS_ROOT) 11 | register_coco_datasets(BASE_COCO_DATASETS, DEFAULT_DATASETS_ROOT) 12 | 13 | register_chimpnsee_dataset(DEFAULT_DATASETS_ROOT) 14 | -------------------------------------------------------------------------------- /prune_coco/projects/DensePose/densepose/data/datasets/chimpnsee.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved 2 | 3 | import os 4 | from typing import Optional 5 | 6 | from detectron2.data import DatasetCatalog, MetadataCatalog 7 | 8 | from ..utils import maybe_prepend_base_path 9 | from .dataset_type import DatasetType 10 | 11 | CHIMPNSEE_DATASET_NAME = "chimpnsee" 12 | 13 | 14 | def register_dataset(datasets_root: Optional[os.PathLike] = None): 15 | def empty_load_callback(): 16 | pass 17 | 18 | video_list_fpath = maybe_prepend_base_path( 19 | datasets_root, "chimpnsee/cdna.eva.mpg.de/video_list.txt" 20 | ) 21 | video_base_path = maybe_prepend_base_path(datasets_root, "chimpnsee/cdna.eva.mpg.de") 22 | 23 | DatasetCatalog.register(CHIMPNSEE_DATASET_NAME, empty_load_callback) 24 | MetadataCatalog.get(CHIMPNSEE_DATASET_NAME).set( 25 | dataset_type=DatasetType.VIDEO_LIST, 26 | video_list_fpath=video_list_fpath, 27 | video_base_path=video_base_path, 28 | ) 29 | -------------------------------------------------------------------------------- /prune_coco/projects/DensePose/densepose/data/datasets/dataset_type.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved 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 | -------------------------------------------------------------------------------- /prune_coco/projects/DensePose/densepose/data/samplers/__init__.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved 2 | 3 | from .densepose_uniform import DensePoseUniformSampler 4 | from .densepose_confidence_based import DensePoseConfidenceBasedSampler 5 | from .mask_from_densepose import MaskFromDensePoseSampler 6 | from .prediction_to_gt import PredictionToGroundTruthSampler 7 | -------------------------------------------------------------------------------- /prune_coco/projects/DensePose/densepose/data/samplers/mask_from_densepose.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved 2 | 3 | from detectron2.structures import BitMasks, Instances 4 | 5 | from densepose.converters import ToMaskConverter 6 | 7 | 8 | class MaskFromDensePoseSampler: 9 | """ 10 | Produce mask GT from DensePose predictions 11 | This sampler simply converts DensePose predictions to BitMasks 12 | that a contain a bool tensor of the size of the input image 13 | """ 14 | 15 | def __call__(self, instances: Instances) -> BitMasks: 16 | """ 17 | Converts predicted data from `instances` into the GT mask data 18 | 19 | Args: 20 | instances (Instances): predicted results, expected to have `pred_densepose` field 21 | 22 | Returns: 23 | Boolean Tensor of the size of the input image that has non-zero 24 | values at pixels that are estimated to belong to the detected object 25 | """ 26 | return ToMaskConverter.convert( 27 | instances.pred_densepose, instances.pred_boxes, instances.image_size 28 | ) 29 | -------------------------------------------------------------------------------- /prune_coco/projects/DensePose/densepose/data/transform/__init__.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved 2 | 3 | from .image import ImageResizeTransform 4 | -------------------------------------------------------------------------------- /prune_coco/projects/DensePose/densepose/data/utils.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved 2 | 3 | import os 4 | from typing import Optional 5 | 6 | 7 | def is_relative_local_path(path: os.PathLike): 8 | path_str = os.fsdecode(path) 9 | return ("://" not in path_str) and not os.path.isabs(path) 10 | 11 | 12 | def maybe_prepend_base_path(base_path: Optional[os.PathLike], path: os.PathLike): 13 | """ 14 | Prepends the provided path with a base path prefix if: 15 | 1) base path is not None; 16 | 2) path is a local path 17 | """ 18 | if base_path is None: 19 | return path 20 | if is_relative_local_path(path): 21 | return os.path.join(base_path, path) 22 | return path 23 | -------------------------------------------------------------------------------- /prune_coco/projects/DensePose/densepose/data/video/__init__.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved 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 | -------------------------------------------------------------------------------- /prune_coco/projects/DensePose/densepose/engine/__init__.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved 2 | 3 | from .trainer import Trainer 4 | -------------------------------------------------------------------------------- /prune_coco/projects/DensePose/densepose/modeling/__init__.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved 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_head, 10 | build_densepose_losses, 11 | build_densepose_predictor, 12 | ) 13 | -------------------------------------------------------------------------------- /prune_coco/projects/DensePose/densepose/modeling/losses/__init__.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved 2 | 3 | from .chart import DensePoseChartLoss 4 | from .chart_with_confidences import DensePoseChartWithConfidenceLoss 5 | -------------------------------------------------------------------------------- /prune_coco/projects/DensePose/densepose/modeling/losses/registry.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved 2 | 3 | from detectron2.utils.registry import Registry 4 | 5 | DENSEPOSE_LOSS_REGISTRY = Registry("DENSEPOSE_LOSS") 6 | -------------------------------------------------------------------------------- /prune_coco/projects/DensePose/densepose/modeling/predictors/__init__.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved 2 | 3 | from .chart import DensePoseChartPredictor 4 | from .chart_confidence import DensePoseChartConfidencePredictorMixin 5 | from .chart_with_confidence import DensePoseChartWithConfidencePredictor 6 | -------------------------------------------------------------------------------- /prune_coco/projects/DensePose/densepose/modeling/predictors/chart_with_confidence.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved 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 | -------------------------------------------------------------------------------- /prune_coco/projects/DensePose/densepose/modeling/predictors/registry.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved 2 | 3 | from detectron2.utils.registry import Registry 4 | 5 | DENSEPOSE_PREDICTOR_REGISTRY = Registry("DENSEPOSE_PREDICTOR") 6 | -------------------------------------------------------------------------------- /prune_coco/projects/DensePose/densepose/modeling/roi_heads/__init__.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved 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 | -------------------------------------------------------------------------------- /prune_coco/projects/DensePose/densepose/modeling/roi_heads/registry.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved 2 | 3 | from detectron2.utils.registry import Registry 4 | 5 | ROI_DENSEPOSE_HEAD_REGISTRY = Registry("ROI_DENSEPOSE_HEAD") 6 | -------------------------------------------------------------------------------- /prune_coco/projects/DensePose/densepose/modeling/utils.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved 2 | 3 | from torch import nn 4 | 5 | 6 | def initialize_module_params(module: nn.Module): 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 | -------------------------------------------------------------------------------- /prune_coco/projects/DensePose/densepose/structures/__init__.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved 2 | 3 | from .chart import DensePoseChartPredictorOutput 4 | from .chart_confidence import decorate_predictor_output_class_with_confidences 5 | from .chart_result import ( 6 | DensePoseChartResult, 7 | DensePoseChartResultWithConfidences, 8 | quantize_densepose_chart_result, 9 | compress_quantized_densepose_chart_result, 10 | decompress_compressed_densepose_chart_result, 11 | ) 12 | -------------------------------------------------------------------------------- /prune_coco/projects/DensePose/densepose/utils/logger.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved 2 | import logging 3 | 4 | 5 | def verbosity_to_level(verbosity): 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 | -------------------------------------------------------------------------------- /prune_coco/projects/DensePose/densepose/utils/transform.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved 2 | from fvcore.common.file_io import PathManager 3 | 4 | from detectron2.data import MetadataCatalog 5 | 6 | from densepose import DensePoseTransformData 7 | 8 | 9 | def load_for_dataset(dataset_name): 10 | path = MetadataCatalog.get(dataset_name).densepose_transform_src 11 | densepose_transform_data_fpath = PathManager.get_local_path(path) 12 | return DensePoseTransformData.load(densepose_transform_data_fpath) 13 | 14 | 15 | def load_from_cfg(cfg): 16 | return load_for_dataset(cfg.DATASETS.TEST[0]) 17 | -------------------------------------------------------------------------------- /prune_coco/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 | -------------------------------------------------------------------------------- /prune_coco/projects/DensePose/doc/images/res_bbox_dp_contour.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Sharath-girish/LTH-ObjectRecognition/cba60fe5b92119346e81fe270da55a4b3a54cc67/prune_coco/projects/DensePose/doc/images/res_bbox_dp_contour.jpg -------------------------------------------------------------------------------- /prune_coco/projects/DensePose/doc/images/res_bbox_dp_segm.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Sharath-girish/LTH-ObjectRecognition/cba60fe5b92119346e81fe270da55a4b3a54cc67/prune_coco/projects/DensePose/doc/images/res_bbox_dp_segm.jpg -------------------------------------------------------------------------------- /prune_coco/projects/DensePose/doc/images/res_bbox_dp_u.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Sharath-girish/LTH-ObjectRecognition/cba60fe5b92119346e81fe270da55a4b3a54cc67/prune_coco/projects/DensePose/doc/images/res_bbox_dp_u.jpg -------------------------------------------------------------------------------- /prune_coco/projects/DensePose/doc/images/res_bbox_dp_v.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Sharath-girish/LTH-ObjectRecognition/cba60fe5b92119346e81fe270da55a4b3a54cc67/prune_coco/projects/DensePose/doc/images/res_bbox_dp_v.jpg -------------------------------------------------------------------------------- /prune_coco/projects/DensePose/doc/images/vis_bbox_dp_i.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Sharath-girish/LTH-ObjectRecognition/cba60fe5b92119346e81fe270da55a4b3a54cc67/prune_coco/projects/DensePose/doc/images/vis_bbox_dp_i.jpg -------------------------------------------------------------------------------- /prune_coco/projects/DensePose/doc/images/vis_bbox_dp_pts.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Sharath-girish/LTH-ObjectRecognition/cba60fe5b92119346e81fe270da55a4b3a54cc67/prune_coco/projects/DensePose/doc/images/vis_bbox_dp_pts.jpg -------------------------------------------------------------------------------- /prune_coco/projects/DensePose/doc/images/vis_bbox_dp_segm.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Sharath-girish/LTH-ObjectRecognition/cba60fe5b92119346e81fe270da55a4b3a54cc67/prune_coco/projects/DensePose/doc/images/vis_bbox_dp_segm.jpg -------------------------------------------------------------------------------- /prune_coco/projects/DensePose/doc/images/vis_bbox_dp_u.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Sharath-girish/LTH-ObjectRecognition/cba60fe5b92119346e81fe270da55a4b3a54cc67/prune_coco/projects/DensePose/doc/images/vis_bbox_dp_u.jpg -------------------------------------------------------------------------------- /prune_coco/projects/DensePose/doc/images/vis_bbox_dp_v.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Sharath-girish/LTH-ObjectRecognition/cba60fe5b92119346e81fe270da55a4b3a54cc67/prune_coco/projects/DensePose/doc/images/vis_bbox_dp_v.jpg -------------------------------------------------------------------------------- /prune_coco/projects/DensePose/tests/test_image_resize_transform.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved 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, 100, 100, 3), 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 | -------------------------------------------------------------------------------- /prune_coco/projects/DensePose/tests/test_structures.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. 2 | 3 | import unittest 4 | 5 | from densepose.data.structures import normalized_coords_transform 6 | 7 | 8 | class TestStructures(unittest.TestCase): 9 | def test_normalized_coords_transform(self): 10 | bbox = (32, 24, 288, 216) 11 | x0, y0, w, h = bbox 12 | xmin, ymin, xmax, ymax = x0, y0, x0 + w, y0 + h 13 | f = normalized_coords_transform(*bbox) 14 | # Top-left 15 | expected_p, actual_p = (-1, -1), f((xmin, ymin)) 16 | self.assertEqual(expected_p, actual_p) 17 | # Top-right 18 | expected_p, actual_p = (1, -1), f((xmax, ymin)) 19 | self.assertEqual(expected_p, actual_p) 20 | # Bottom-left 21 | expected_p, actual_p = (-1, 1), f((xmin, ymax)) 22 | self.assertEqual(expected_p, actual_p) 23 | # Bottom-right 24 | expected_p, actual_p = (1, 1), f((xmax, ymax)) 25 | self.assertEqual(expected_p, actual_p) 26 | -------------------------------------------------------------------------------- /prune_coco/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 | -------------------------------------------------------------------------------- /prune_coco/projects/Panoptic-DeepLab/panoptic_deeplab/__init__.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved 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 | -------------------------------------------------------------------------------- /prune_coco/projects/PointRend/configs/InstanceSegmentation/Base-PointRend-RCNN-FPN.yaml: -------------------------------------------------------------------------------- 1 | _BASE_: "../../../../configs/Base-RCNN-FPN.yaml" 2 | MODEL: 3 | MASK_ON: true 4 | ROI_HEADS: 5 | NAME: "PointRendROIHeads" 6 | IN_FEATURES: ["p2", "p3", "p4", "p5"] 7 | ROI_BOX_HEAD: 8 | TRAIN_ON_PRED_BOXES: True 9 | ROI_MASK_HEAD: 10 | NAME: "CoarseMaskHead" 11 | FC_DIM: 1024 12 | NUM_FC: 2 13 | OUTPUT_SIDE_RESOLUTION: 7 14 | IN_FEATURES: ["p2"] 15 | POINT_HEAD_ON: True 16 | POINT_HEAD: 17 | FC_DIM: 256 18 | NUM_FC: 3 19 | IN_FEATURES: ["p2"] 20 | INPUT: 21 | # PointRend for instance segmenation does not work with "polygon" mask_format. 22 | MASK_FORMAT: "bitmask" 23 | -------------------------------------------------------------------------------- /prune_coco/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 | -------------------------------------------------------------------------------- /prune_coco/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 | -------------------------------------------------------------------------------- /prune_coco/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 | -------------------------------------------------------------------------------- /prune_coco/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 | -------------------------------------------------------------------------------- /prune_coco/projects/PointRend/configs/SemanticSegmentation/pointrend_semantic_R_101_FPN_1x_cityscapes.yaml: -------------------------------------------------------------------------------- 1 | _BASE_: Base-PointRend-Semantic-FPN.yaml 2 | MODEL: 3 | WEIGHTS: detectron2://ImageNetPretrained/MSRA/R-101.pkl 4 | RESNETS: 5 | DEPTH: 101 6 | SEM_SEG_HEAD: 7 | NUM_CLASSES: 19 8 | POINT_HEAD: 9 | NUM_CLASSES: 19 10 | TRAIN_NUM_POINTS: 2048 11 | SUBDIVISION_NUM_POINTS: 8192 12 | DATASETS: 13 | TRAIN: ("cityscapes_fine_sem_seg_train",) 14 | TEST: ("cityscapes_fine_sem_seg_val",) 15 | SOLVER: 16 | BASE_LR: 0.01 17 | STEPS: (40000, 55000) 18 | MAX_ITER: 65000 19 | IMS_PER_BATCH: 32 20 | INPUT: 21 | MIN_SIZE_TRAIN: (512, 768, 1024, 1280, 1536, 1792, 2048) 22 | MIN_SIZE_TRAIN_SAMPLING: "choice" 23 | MIN_SIZE_TEST: 1024 24 | MAX_SIZE_TRAIN: 4096 25 | MAX_SIZE_TEST: 2048 26 | CROP: 27 | ENABLED: True 28 | TYPE: "absolute" 29 | SIZE: (512, 1024) 30 | SINGLE_CATEGORY_MAX_AREA: 0.75 31 | COLOR_AUG_SSD: True 32 | DATALOADER: 33 | NUM_WORKERS: 10 34 | -------------------------------------------------------------------------------- /prune_coco/projects/PointRend/point_rend/__init__.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved 2 | from .config import add_pointrend_config 3 | from .coarse_mask_head import CoarseMaskHead 4 | from .roi_heads import PointRendROIHeads 5 | from .semantic_seg import PointRendSemSegHead 6 | from .color_augmentation import ColorAugSSDTransform 7 | -------------------------------------------------------------------------------- /prune_coco/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 | -------------------------------------------------------------------------------- /prune_coco/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 | -------------------------------------------------------------------------------- /prune_coco/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 | -------------------------------------------------------------------------------- /prune_coco/projects/TensorMask/tensormask/__init__.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved 2 | from .config import add_tensormask_config 3 | from .arch import TensorMask 4 | -------------------------------------------------------------------------------- /prune_coco/projects/TensorMask/tensormask/layers/__init__.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved 2 | from .swap_align2nat import SwapAlign2Nat, swap_align2nat 3 | 4 | __all__ = [k for k in globals().keys() if not k.startswith("_")] 5 | -------------------------------------------------------------------------------- /prune_coco/projects/TensorMask/tensormask/layers/csrc/vision.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved 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 | -------------------------------------------------------------------------------- /prune_coco/projects/TensorMask/tests/__init__.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved 2 | -------------------------------------------------------------------------------- /prune_coco/projects/TridentNet/configs/Base-TridentNet-Fast-C4.yaml: -------------------------------------------------------------------------------- 1 | MODEL: 2 | META_ARCHITECTURE: "GeneralizedRCNN" 3 | BACKBONE: 4 | NAME: "build_trident_resnet_backbone" 5 | ROI_HEADS: 6 | NAME: "TridentRes5ROIHeads" 7 | POSITIVE_FRACTION: 0.5 8 | BATCH_SIZE_PER_IMAGE: 128 9 | PROPOSAL_APPEND_GT: False 10 | PROPOSAL_GENERATOR: 11 | NAME: "TridentRPN" 12 | RPN: 13 | POST_NMS_TOPK_TRAIN: 500 14 | TRIDENT: 15 | NUM_BRANCH: 3 16 | BRANCH_DILATIONS: [1, 2, 3] 17 | TEST_BRANCH_IDX: 1 18 | TRIDENT_STAGE: "res4" 19 | DATASETS: 20 | TRAIN: ("coco_2017_train",) 21 | TEST: ("coco_2017_val",) 22 | SOLVER: 23 | IMS_PER_BATCH: 16 24 | BASE_LR: 0.02 25 | STEPS: (60000, 80000) 26 | MAX_ITER: 90000 27 | INPUT: 28 | MIN_SIZE_TRAIN: (640, 672, 704, 736, 768, 800) 29 | VERSION: 2 30 | -------------------------------------------------------------------------------- /prune_coco/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 | -------------------------------------------------------------------------------- /prune_coco/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 | -------------------------------------------------------------------------------- /prune_coco/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 | -------------------------------------------------------------------------------- /prune_coco/projects/TridentNet/tridentnet/__init__.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved 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 | -------------------------------------------------------------------------------- /prune_coco/projects/TridentNet/tridentnet/config.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | # Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved 3 | 4 | from detectron2.config import CfgNode as CN 5 | 6 | 7 | def add_tridentnet_config(cfg): 8 | """ 9 | Add config for tridentnet. 10 | """ 11 | _C = cfg 12 | 13 | _C.MODEL.TRIDENT = CN() 14 | 15 | # Number of branches for TridentNet. 16 | _C.MODEL.TRIDENT.NUM_BRANCH = 3 17 | # Specify the dilations for each branch. 18 | _C.MODEL.TRIDENT.BRANCH_DILATIONS = [1, 2, 3] 19 | # Specify the stage for applying trident blocks. Default stage is Res4 according to the 20 | # TridentNet paper. 21 | _C.MODEL.TRIDENT.TRIDENT_STAGE = "res4" 22 | # Specify the test branch index TridentNet Fast inference: 23 | # - use -1 to aggregate results of all branches during inference. 24 | # - otherwise, only using specified branch for fast inference. Recommended setting is 25 | # to use the middle branch. 26 | _C.MODEL.TRIDENT.TEST_BRANCH_IDX = 1 27 | -------------------------------------------------------------------------------- /prune_coco/setup.cfg: -------------------------------------------------------------------------------- 1 | [isort] 2 | line_length=100 3 | multi_line_output=3 4 | include_trailing_comma=True 5 | known_standard_library=numpy,setuptools,mock 6 | skip=./datasets,docs 7 | skip_glob=*/__init__.py 8 | known_myself=detectron2 9 | known_third_party=fvcore,matplotlib,cv2,torch,torchvision,PIL,pycocotools,yacs,termcolor,cityscapesscripts,tabulate,tqdm,scipy,lvis,psutil,pkg_resources,caffe2,onnx,panopticapi,black,isort 10 | no_lines_before=STDLIB,THIRDPARTY 11 | sections=FUTURE,STDLIB,THIRDPARTY,myself,FIRSTPARTY,LOCALFOLDER 12 | default_section=FIRSTPARTY 13 | 14 | [mypy] 15 | python_version=3.6 16 | ignore_missing_imports = True 17 | warn_unused_configs = True 18 | disallow_untyped_defs = True 19 | check_untyped_defs = True 20 | warn_unused_ignores = True 21 | warn_redundant_casts = True 22 | show_column_numbers = True 23 | follow_imports = silent 24 | allow_redefinition = True 25 | ; Require all functions to be annotated 26 | disallow_incomplete_defs = True 27 | -------------------------------------------------------------------------------- /prune_coco/temp/events.out.tfevents.1618690048.vulcan08.umiacs.umd.edu.14725.0: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Sharath-girish/LTH-ObjectRecognition/cba60fe5b92119346e81fe270da55a4b3a54cc67/prune_coco/temp/events.out.tfevents.1618690048.vulcan08.umiacs.umd.edu.14725.0 -------------------------------------------------------------------------------- /prune_coco/temp/events.out.tfevents.1618690171.vulcan08.umiacs.umd.edu.14878.0: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Sharath-girish/LTH-ObjectRecognition/cba60fe5b92119346e81fe270da55a4b3a54cc67/prune_coco/temp/events.out.tfevents.1618690171.vulcan08.umiacs.umd.edu.14878.0 -------------------------------------------------------------------------------- /prune_coco/temp/events.out.tfevents.1618690234.vulcan08.umiacs.umd.edu.14958.0: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Sharath-girish/LTH-ObjectRecognition/cba60fe5b92119346e81fe270da55a4b3a54cc67/prune_coco/temp/events.out.tfevents.1618690234.vulcan08.umiacs.umd.edu.14958.0 -------------------------------------------------------------------------------- /prune_coco/temp/events.out.tfevents.1618690325.vulcan08.umiacs.umd.edu.15017.0: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Sharath-girish/LTH-ObjectRecognition/cba60fe5b92119346e81fe270da55a4b3a54cc67/prune_coco/temp/events.out.tfevents.1618690325.vulcan08.umiacs.umd.edu.15017.0 -------------------------------------------------------------------------------- /prune_coco/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 | -------------------------------------------------------------------------------- /prune_coco/tests/__init__.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved 2 | -------------------------------------------------------------------------------- /prune_coco/tests/data/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Sharath-girish/LTH-ObjectRecognition/cba60fe5b92119346e81fe270da55a4b3a54cc67/prune_coco/tests/data/__init__.py -------------------------------------------------------------------------------- /prune_coco/tests/data/test_sampler.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. 2 | import unittest 3 | from torch.utils.data.sampler import SequentialSampler 4 | 5 | from detectron2.data.samplers import GroupedBatchSampler 6 | 7 | 8 | class TestGroupedBatchSampler(unittest.TestCase): 9 | def test_missing_group_id(self): 10 | sampler = SequentialSampler(list(range(100))) 11 | group_ids = [1] * 100 12 | samples = GroupedBatchSampler(sampler, group_ids, 2) 13 | 14 | for mini_batch in samples: 15 | self.assertEqual(len(mini_batch), 2) 16 | 17 | def test_groups(self): 18 | sampler = SequentialSampler(list(range(100))) 19 | group_ids = [1, 0] * 50 20 | samples = GroupedBatchSampler(sampler, group_ids, 2) 21 | 22 | for mini_batch in samples: 23 | self.assertEqual((mini_batch[0] + mini_batch[1]) % 2, 0) 24 | -------------------------------------------------------------------------------- /prune_coco/tests/layers/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Sharath-girish/LTH-ObjectRecognition/cba60fe5b92119346e81fe270da55a4b3a54cc67/prune_coco/tests/layers/__init__.py -------------------------------------------------------------------------------- /prune_coco/tests/modeling/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Sharath-girish/LTH-ObjectRecognition/cba60fe5b92119346e81fe270da55a4b3a54cc67/prune_coco/tests/modeling/__init__.py -------------------------------------------------------------------------------- /prune_coco/tests/structures/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Sharath-girish/LTH-ObjectRecognition/cba60fe5b92119346e81fe270da55a4b3a54cc67/prune_coco/tests/structures/__init__.py -------------------------------------------------------------------------------- /prune_coco/tests/test_model_zoo.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved 2 | import logging 3 | import unittest 4 | 5 | from detectron2 import model_zoo 6 | from detectron2.modeling import FPN, GeneralizedRCNN 7 | 8 | logger = logging.getLogger(__name__) 9 | 10 | 11 | class TestModelZoo(unittest.TestCase): 12 | def test_get_returns_model(self): 13 | model = model_zoo.get("Misc/scratch_mask_rcnn_R_50_FPN_3x_gn.yaml", trained=False) 14 | self.assertIsInstance(model, GeneralizedRCNN) 15 | self.assertIsInstance(model.backbone, FPN) 16 | 17 | def test_get_invalid_model(self): 18 | self.assertRaises(RuntimeError, model_zoo.get, "Invalid/config.yaml") 19 | 20 | def test_get_url(self): 21 | url = model_zoo.get_checkpoint_url("Misc/scratch_mask_rcnn_R_50_FPN_3x_gn.yaml") 22 | self.assertEqual( 23 | url, 24 | "https://dl.fbaipublicfiles.com/detectron2/Misc/scratch_mask_rcnn_R_50_FPN_3x_gn/138602908/model_final_01ca85.pkl", # noqa 25 | ) 26 | 27 | 28 | if __name__ == "__main__": 29 | unittest.main() 30 | -------------------------------------------------------------------------------- /prune_coco/tests/test_packaging.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved 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 | -------------------------------------------------------------------------------- /prune_coco/tools/deploy/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. 2 | # See https://pytorch.org/tutorials/advanced/cpp_frontend.html 3 | cmake_minimum_required(VERSION 3.0 FATAL_ERROR) 4 | project(caffe2_mask_rcnn) 5 | 6 | find_package(Torch REQUIRED) 7 | find_package(gflags REQUIRED) 8 | find_package(OpenCV REQUIRED) 9 | 10 | add_executable(caffe2_mask_rcnn caffe2_mask_rcnn.cpp) 11 | target_link_libraries( 12 | caffe2_mask_rcnn 13 | "${TORCH_LIBRARIES}" gflags glog protobuf ${OpenCV_LIBS}) 14 | set_property(TARGET caffe2_mask_rcnn PROPERTY CXX_STANDARD 14) 15 | 16 | 17 | add_executable(torchscript_traced_mask_rcnn torchscript_traced_mask_rcnn.cpp) 18 | target_link_libraries( 19 | torchscript_traced_mask_rcnn 20 | "${TORCH_LIBRARIES}" ${OpenCV_LIBS}) 21 | set_property(TARGET torchscript_traced_mask_rcnn PROPERTY CXX_STANDARD 14) 22 | -------------------------------------------------------------------------------- /prune_coco/tools/deploy/README.md: -------------------------------------------------------------------------------- 1 | 2 | This directory contains: 3 | 4 | 1. A script that converts a detectron2 model to caffe2 format. 5 | 6 | 2. An example that loads a Mask R-CNN model in caffe2 format and runs inference. 7 | 8 | See [tutorial](https://detectron2.readthedocs.io/tutorials/deployment.html) 9 | for their usage. 10 | -------------------------------------------------------------------------------- /prune_voc/LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2017 Jianwei Yang 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /prune_voc/_init_paths.py: -------------------------------------------------------------------------------- 1 | import os.path as osp 2 | import sys 3 | 4 | def add_path(path): 5 | if path not in sys.path: 6 | sys.path.insert(0, path) 7 | 8 | this_dir = osp.dirname(__file__) 9 | 10 | # Add lib to PYTHONPATH 11 | lib_path = osp.join(this_dir, 'lib') 12 | add_path(lib_path) 13 | 14 | coco_path = osp.join(this_dir, 'data', 'coco', 'PythonAPI') 15 | add_path(coco_path) 16 | -------------------------------------------------------------------------------- /prune_voc/cfgs/res101.yml: -------------------------------------------------------------------------------- 1 | EXP_DIR: res101 2 | TRAIN: 3 | HAS_RPN: True 4 | BBOX_NORMALIZE_TARGETS_PRECOMPUTED: True 5 | RPN_POSITIVE_OVERLAP: 0.7 6 | RPN_BATCHSIZE: 256 7 | PROPOSAL_METHOD: gt 8 | BG_THRESH_LO: 0.0 9 | DISPLAY: 20 10 | BATCH_SIZE: 128 11 | WEIGHT_DECAY: 0.0001 12 | DOUBLE_BIAS: False 13 | LEARNING_RATE: 0.001 14 | TEST: 15 | HAS_RPN: True 16 | POOLING_SIZE: 7 17 | POOLING_MODE: align 18 | CROP_RESIZE_WITH_MAX_POOL: False 19 | -------------------------------------------------------------------------------- /prune_voc/cfgs/res101_ls.yml: -------------------------------------------------------------------------------- 1 | EXP_DIR: res101 2 | TRAIN: 3 | HAS_RPN: True 4 | BBOX_NORMALIZE_TARGETS_PRECOMPUTED: True 5 | RPN_POSITIVE_OVERLAP: 0.7 6 | RPN_BATCHSIZE: 256 7 | PROPOSAL_METHOD: gt 8 | BG_THRESH_LO: 0.0 9 | DISPLAY: 20 10 | BATCH_SIZE: 128 11 | WEIGHT_DECAY: 0.0001 12 | SCALES: [800] 13 | DOUBLE_BIAS: False 14 | LEARNING_RATE: 0.001 15 | TEST: 16 | HAS_RPN: True 17 | SCALES: [800] 18 | MAX_SIZE: 1200 19 | RPN_POST_NMS_TOP_N: 1000 20 | POOLING_SIZE: 7 21 | POOLING_MODE: align 22 | CROP_RESIZE_WITH_MAX_POOL: False 23 | -------------------------------------------------------------------------------- /prune_voc/cfgs/res18.yml: -------------------------------------------------------------------------------- 1 | EXP_DIR: res18 2 | TRAIN: 3 | HAS_RPN: True 4 | BBOX_NORMALIZE_TARGETS_PRECOMPUTED: True 5 | RPN_POSITIVE_OVERLAP: 0.7 6 | RPN_BATCHSIZE: 256 7 | PROPOSAL_METHOD: gt 8 | BG_THRESH_LO: 0.0 9 | DISPLAY: 20 10 | BATCH_SIZE: 128 11 | WEIGHT_DECAY: 0.0001 12 | DOUBLE_BIAS: False 13 | LEARNING_RATE: 0.001 14 | TEST: 15 | HAS_RPN: True 16 | POOLING_SIZE: 7 17 | POOLING_MODE: align 18 | CROP_RESIZE_WITH_MAX_POOL: False 19 | -------------------------------------------------------------------------------- /prune_voc/cfgs/res50.yml: -------------------------------------------------------------------------------- 1 | EXP_DIR: res50 2 | TRAIN: 3 | HAS_RPN: True 4 | # IMS_PER_BATCH: 1 5 | BBOX_NORMALIZE_TARGETS_PRECOMPUTED: True 6 | RPN_POSITIVE_OVERLAP: 0.7 7 | RPN_BATCHSIZE: 256 8 | PROPOSAL_METHOD: gt 9 | BG_THRESH_LO: 0.0 10 | DISPLAY: 20 11 | BATCH_SIZE: 256 12 | WEIGHT_DECAY: 0.0001 13 | DOUBLE_BIAS: False 14 | SNAPSHOT_PREFIX: res50_faster_rcnn 15 | LEARNING_RATE: 0.001 16 | TEST: 17 | HAS_RPN: True 18 | # POOLING_MODE: crop 19 | POOLING_SIZE: 7 20 | POOLING_MODE: align 21 | CROP_RESIZE_WITH_MAX_POOL: False 22 | -------------------------------------------------------------------------------- /prune_voc/cfgs/vgg16.yml: -------------------------------------------------------------------------------- 1 | EXP_DIR: vgg16 2 | TRAIN: 3 | HAS_RPN: True 4 | BBOX_NORMALIZE_TARGETS_PRECOMPUTED: True 5 | RPN_POSITIVE_OVERLAP: 0.7 6 | RPN_BATCHSIZE: 256 7 | PROPOSAL_METHOD: gt 8 | BG_THRESH_LO: 0.0 9 | BATCH_SIZE: 256 10 | LEARNING_RATE: 0.01 11 | TEST: 12 | HAS_RPN: True 13 | POOLING_MODE: align 14 | CROP_RESIZE_WITH_MAX_POOL: False 15 | -------------------------------------------------------------------------------- /prune_voc/images/img1.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Sharath-girish/LTH-ObjectRecognition/cba60fe5b92119346e81fe270da55a4b3a54cc67/prune_voc/images/img1.jpg -------------------------------------------------------------------------------- /prune_voc/images/img1_det.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Sharath-girish/LTH-ObjectRecognition/cba60fe5b92119346e81fe270da55a4b3a54cc67/prune_voc/images/img1_det.jpg -------------------------------------------------------------------------------- /prune_voc/images/img1_det_res101.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Sharath-girish/LTH-ObjectRecognition/cba60fe5b92119346e81fe270da55a4b3a54cc67/prune_voc/images/img1_det_res101.jpg -------------------------------------------------------------------------------- /prune_voc/images/img2.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Sharath-girish/LTH-ObjectRecognition/cba60fe5b92119346e81fe270da55a4b3a54cc67/prune_voc/images/img2.jpg -------------------------------------------------------------------------------- /prune_voc/images/img2_det.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Sharath-girish/LTH-ObjectRecognition/cba60fe5b92119346e81fe270da55a4b3a54cc67/prune_voc/images/img2_det.jpg -------------------------------------------------------------------------------- /prune_voc/images/img2_det_res101.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Sharath-girish/LTH-ObjectRecognition/cba60fe5b92119346e81fe270da55a4b3a54cc67/prune_voc/images/img2_det_res101.jpg -------------------------------------------------------------------------------- /prune_voc/images/img3.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Sharath-girish/LTH-ObjectRecognition/cba60fe5b92119346e81fe270da55a4b3a54cc67/prune_voc/images/img3.jpg -------------------------------------------------------------------------------- /prune_voc/images/img3_det.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Sharath-girish/LTH-ObjectRecognition/cba60fe5b92119346e81fe270da55a4b3a54cc67/prune_voc/images/img3_det.jpg -------------------------------------------------------------------------------- /prune_voc/images/img3_det_res101.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Sharath-girish/LTH-ObjectRecognition/cba60fe5b92119346e81fe270da55a4b3a54cc67/prune_voc/images/img3_det_res101.jpg -------------------------------------------------------------------------------- /prune_voc/images/img4.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Sharath-girish/LTH-ObjectRecognition/cba60fe5b92119346e81fe270da55a4b3a54cc67/prune_voc/images/img4.jpg -------------------------------------------------------------------------------- /prune_voc/images/img4_det.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Sharath-girish/LTH-ObjectRecognition/cba60fe5b92119346e81fe270da55a4b3a54cc67/prune_voc/images/img4_det.jpg -------------------------------------------------------------------------------- /prune_voc/images/img4_det_res101.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Sharath-girish/LTH-ObjectRecognition/cba60fe5b92119346e81fe270da55a4b3a54cc67/prune_voc/images/img4_det_res101.jpg -------------------------------------------------------------------------------- /prune_voc/lib/datasets/VOCdevkit-matlab-wrapper/get_voc_opts.m: -------------------------------------------------------------------------------- 1 | function VOCopts = get_voc_opts(path) 2 | 3 | tmp = pwd; 4 | cd(path); 5 | try 6 | addpath('VOCcode'); 7 | VOCinit; 8 | catch 9 | rmpath('VOCcode'); 10 | cd(tmp); 11 | error(sprintf('VOCcode directory not found under %s', path)); 12 | end 13 | rmpath('VOCcode'); 14 | cd(tmp); 15 | -------------------------------------------------------------------------------- /prune_voc/lib/datasets/VOCdevkit-matlab-wrapper/xVOCap.m: -------------------------------------------------------------------------------- 1 | function ap = xVOCap(rec,prec) 2 | % From the PASCAL VOC 2011 devkit 3 | 4 | mrec=[0 ; rec ; 1]; 5 | mpre=[0 ; prec ; 0]; 6 | for i=numel(mpre)-1:-1:1 7 | mpre(i)=max(mpre(i),mpre(i+1)); 8 | end 9 | i=find(mrec(2:end)~=mrec(1:end-1))+1; 10 | ap=sum((mrec(i)-mrec(i-1)).*mpre(i)); 11 | -------------------------------------------------------------------------------- /prune_voc/lib/datasets/__init__.py: -------------------------------------------------------------------------------- 1 | # -------------------------------------------------------- 2 | # Fast R-CNN 3 | # Copyright (c) 2015 Microsoft 4 | # Licensed under The MIT License [see LICENSE for details] 5 | # Written by Ross Girshick 6 | # -------------------------------------------------------- 7 | -------------------------------------------------------------------------------- /prune_voc/lib/faster_rcnn.egg-info/PKG-INFO: -------------------------------------------------------------------------------- 1 | Metadata-Version: 1.0 2 | Name: faster-rcnn 3 | Version: 0.1 4 | Summary: object detection in pytorch 5 | Home-page: UNKNOWN 6 | Author: UNKNOWN 7 | Author-email: UNKNOWN 8 | License: UNKNOWN 9 | Description: UNKNOWN 10 | Platform: UNKNOWN 11 | -------------------------------------------------------------------------------- /prune_voc/lib/faster_rcnn.egg-info/dependency_links.txt: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /prune_voc/lib/faster_rcnn.egg-info/top_level.txt: -------------------------------------------------------------------------------- 1 | datasets 2 | model 3 | pycocotools 4 | roi_data_layer 5 | -------------------------------------------------------------------------------- /prune_voc/lib/model/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Sharath-girish/LTH-ObjectRecognition/cba60fe5b92119346e81fe270da55a4b3a54cc67/prune_voc/lib/model/__init__.py -------------------------------------------------------------------------------- /prune_voc/lib/model/csrc/cpu/vision.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. 2 | #pragma once 3 | #include 4 | 5 | 6 | at::Tensor ROIAlign_forward_cpu(const at::Tensor& input, 7 | const at::Tensor& rois, 8 | const float spatial_scale, 9 | const int pooled_height, 10 | const int pooled_width, 11 | const int sampling_ratio); 12 | 13 | 14 | at::Tensor nms_cpu(const at::Tensor& dets, 15 | const at::Tensor& scores, 16 | const float threshold); 17 | -------------------------------------------------------------------------------- /prune_voc/lib/model/csrc/nms.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. 2 | #pragma once 3 | #include "cpu/vision.h" 4 | 5 | #ifdef WITH_CUDA 6 | #include "cuda/vision.h" 7 | #endif 8 | 9 | 10 | at::Tensor nms(const at::Tensor& dets, 11 | const at::Tensor& scores, 12 | const float threshold) { 13 | 14 | if (dets.type().is_cuda()) { 15 | #ifdef WITH_CUDA 16 | // TODO raise error if not compiled with CUDA 17 | if (dets.numel() == 0) 18 | return at::empty({0}, dets.options().dtype(at::kLong).device(at::kCPU)); 19 | auto b = at::cat({dets, scores.unsqueeze(1)}, 1); 20 | return nms_cuda(b, threshold); 21 | #else 22 | AT_ERROR("Not compiled with GPU support"); 23 | #endif 24 | } 25 | 26 | at::Tensor result = nms_cpu(dets, scores, threshold); 27 | return result; 28 | } 29 | -------------------------------------------------------------------------------- /prune_voc/lib/model/csrc/vision.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. 2 | #include "nms.h" 3 | #include "ROIAlign.h" 4 | #include "ROIPool.h" 5 | 6 | 7 | PYBIND11_MODULE(TORCH_EXTENSION_NAME, m) { 8 | m.def("nms", &nms, "non-maximum suppression"); 9 | m.def("roi_align_forward", &ROIAlign_forward, "ROIAlign_forward"); 10 | m.def("roi_align_backward", &ROIAlign_backward, "ROIAlign_backward"); 11 | m.def("roi_pool_forward", &ROIPool_forward, "ROIPool_forward"); 12 | m.def("roi_pool_backward", &ROIPool_backward, "ROIPool_backward"); 13 | } 14 | -------------------------------------------------------------------------------- /prune_voc/lib/model/faster_rcnn/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Sharath-girish/LTH-ObjectRecognition/cba60fe5b92119346e81fe270da55a4b3a54cc67/prune_voc/lib/model/faster_rcnn/__init__.py -------------------------------------------------------------------------------- /prune_voc/lib/model/nms/.gitignore: -------------------------------------------------------------------------------- 1 | *.c 2 | *.cpp 3 | *.so 4 | -------------------------------------------------------------------------------- /prune_voc/lib/model/nms/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Sharath-girish/LTH-ObjectRecognition/cba60fe5b92119346e81fe270da55a4b3a54cc67/prune_voc/lib/model/nms/__init__.py -------------------------------------------------------------------------------- /prune_voc/lib/model/nms/build.py: -------------------------------------------------------------------------------- 1 | from __future__ import print_function 2 | import os 3 | import torch 4 | from torch.utils.ffi import create_extension 5 | 6 | #this_file = os.path.dirname(__file__) 7 | 8 | sources = [] 9 | headers = [] 10 | defines = [] 11 | with_cuda = False 12 | 13 | if torch.cuda.is_available(): 14 | print('Including CUDA code.') 15 | sources += ['src/nms_cuda.c'] 16 | headers += ['src/nms_cuda.h'] 17 | defines += [('WITH_CUDA', None)] 18 | with_cuda = True 19 | 20 | this_file = os.path.dirname(os.path.realpath(__file__)) 21 | print(this_file) 22 | extra_objects = ['src/nms_cuda_kernel.cu.o'] 23 | extra_objects = [os.path.join(this_file, fname) for fname in extra_objects] 24 | print(extra_objects) 25 | 26 | ffi = create_extension( 27 | '_ext.nms', 28 | headers=headers, 29 | sources=sources, 30 | define_macros=defines, 31 | relative_to=__file__, 32 | with_cuda=with_cuda, 33 | extra_objects=extra_objects 34 | ) 35 | 36 | if __name__ == '__main__': 37 | ffi.build() 38 | -------------------------------------------------------------------------------- /prune_voc/lib/model/nms/make.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | # CUDA_PATH=/usr/local/cuda/ 4 | 5 | cd src 6 | echo "Compiling stnm kernels by nvcc..." 7 | nvcc -c -o nms_cuda_kernel.cu.o nms_cuda_kernel.cu -x cu -Xcompiler -fPIC -arch=sm_52 8 | 9 | cd ../ 10 | python build.py 11 | -------------------------------------------------------------------------------- /prune_voc/lib/model/nms/nms_cpu.py: -------------------------------------------------------------------------------- 1 | from __future__ import absolute_import 2 | 3 | import numpy as np 4 | import torch 5 | 6 | def nms_cpu(dets, thresh): 7 | dets = dets.numpy() 8 | x1 = dets[:, 0] 9 | y1 = dets[:, 1] 10 | x2 = dets[:, 2] 11 | y2 = dets[:, 3] 12 | scores = dets[:, 4] 13 | 14 | areas = (x2 - x1 + 1) * (y2 - y1 + 1) 15 | order = scores.argsort()[::-1] 16 | 17 | keep = [] 18 | while order.size > 0: 19 | i = order.item(0) 20 | keep.append(i) 21 | xx1 = np.maximum(x1[i], x1[order[1:]]) 22 | yy1 = np.maximum(y1[i], y1[order[1:]]) 23 | xx2 = np.maximum(x2[i], x2[order[1:]]) 24 | yy2 = np.maximum(y2[i], y2[order[1:]]) 25 | 26 | w = np.maximum(0.0, xx2 - xx1 + 1) 27 | h = np.maximum(0.0, yy2 - yy1 + 1) 28 | inter = w * h 29 | ovr = inter / (areas[i] + areas[order[1:]] - inter) 30 | 31 | inds = np.where(ovr <= thresh)[0] 32 | order = order[inds + 1] 33 | 34 | return torch.IntTensor(keep) 35 | 36 | 37 | -------------------------------------------------------------------------------- /prune_voc/lib/model/nms/nms_gpu.py: -------------------------------------------------------------------------------- 1 | from __future__ import absolute_import 2 | import torch 3 | import numpy as np 4 | from ._ext import nms 5 | import pdb 6 | 7 | def nms_gpu(dets, thresh): 8 | keep = dets.new(dets.size(0), 1).zero_().int() 9 | num_out = dets.new(1).zero_().int() 10 | nms.nms_cuda(keep, dets, num_out, thresh) 11 | keep = keep[:num_out[0]] 12 | return keep 13 | -------------------------------------------------------------------------------- /prune_voc/lib/model/nms/nms_wrapper.py: -------------------------------------------------------------------------------- 1 | # -------------------------------------------------------- 2 | # Fast R-CNN 3 | # Copyright (c) 2015 Microsoft 4 | # Licensed under The MIT License [see LICENSE for details] 5 | # Written by Ross Girshick 6 | # -------------------------------------------------------- 7 | import torch 8 | from model.utils.config import cfg 9 | if torch.cuda.is_available(): 10 | from model.nms.nms_gpu import nms_gpu 11 | from model.nms.nms_cpu import nms_cpu 12 | 13 | def nms(dets, thresh, force_cpu=False): 14 | """Dispatch to either CPU or GPU NMS implementations.""" 15 | if dets.shape[0] == 0: 16 | return [] 17 | # ---numpy version--- 18 | # original: return gpu_nms(dets, thresh, device_id=cfg.GPU_ID) 19 | # ---pytorch version--- 20 | 21 | return nms_gpu(dets, thresh) if force_cpu == False else nms_cpu(dets, thresh) 22 | -------------------------------------------------------------------------------- /prune_voc/lib/model/nms/src/nms_cuda.h: -------------------------------------------------------------------------------- 1 | // int nms_cuda(THCudaTensor *keep_out, THCudaTensor *num_out, 2 | // THCudaTensor *boxes_host, THCudaTensor *nms_overlap_thresh); 3 | 4 | int nms_cuda(THCudaIntTensor *keep_out, THCudaTensor *boxes_host, 5 | THCudaIntTensor *num_out, float nms_overlap_thresh); 6 | -------------------------------------------------------------------------------- /prune_voc/lib/model/nms/src/nms_cuda_kernel.cu.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Sharath-girish/LTH-ObjectRecognition/cba60fe5b92119346e81fe270da55a4b3a54cc67/prune_voc/lib/model/nms/src/nms_cuda_kernel.cu.o -------------------------------------------------------------------------------- /prune_voc/lib/model/nms/src/nms_cuda_kernel.h: -------------------------------------------------------------------------------- 1 | #ifdef __cplusplus 2 | extern "C" { 3 | #endif 4 | 5 | void nms_cuda_compute(int* keep_out, int *num_out, float* boxes_host, int boxes_num, 6 | int boxes_dim, float nms_overlap_thresh); 7 | 8 | #ifdef __cplusplus 9 | } 10 | #endif 11 | -------------------------------------------------------------------------------- /prune_voc/lib/model/roi_align/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Sharath-girish/LTH-ObjectRecognition/cba60fe5b92119346e81fe270da55a4b3a54cc67/prune_voc/lib/model/roi_align/__init__.py -------------------------------------------------------------------------------- /prune_voc/lib/model/roi_align/build.py: -------------------------------------------------------------------------------- 1 | from __future__ import print_function 2 | import os 3 | import torch 4 | from torch.utils.ffi import create_extension 5 | 6 | sources = ['src/roi_align.c'] 7 | headers = ['src/roi_align.h'] 8 | extra_objects = [] 9 | #sources = [] 10 | #headers = [] 11 | defines = [] 12 | with_cuda = False 13 | 14 | this_file = os.path.dirname(os.path.realpath(__file__)) 15 | print(this_file) 16 | 17 | if torch.cuda.is_available(): 18 | print('Including CUDA code.') 19 | sources += ['src/roi_align_cuda.c'] 20 | headers += ['src/roi_align_cuda.h'] 21 | defines += [('WITH_CUDA', None)] 22 | with_cuda = True 23 | 24 | extra_objects = ['src/roi_align_kernel.cu.o'] 25 | extra_objects = [os.path.join(this_file, fname) for fname in extra_objects] 26 | 27 | ffi = create_extension( 28 | '_ext.roi_align', 29 | headers=headers, 30 | sources=sources, 31 | define_macros=defines, 32 | relative_to=__file__, 33 | with_cuda=with_cuda, 34 | extra_objects=extra_objects 35 | ) 36 | 37 | if __name__ == '__main__': 38 | ffi.build() 39 | -------------------------------------------------------------------------------- /prune_voc/lib/model/roi_align/functions/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Sharath-girish/LTH-ObjectRecognition/cba60fe5b92119346e81fe270da55a4b3a54cc67/prune_voc/lib/model/roi_align/functions/__init__.py -------------------------------------------------------------------------------- /prune_voc/lib/model/roi_align/make.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | CUDA_PATH=/usr/local/cuda/ 4 | 5 | cd src 6 | echo "Compiling my_lib kernels by nvcc..." 7 | nvcc -c -o roi_align_kernel.cu.o roi_align_kernel.cu -x cu -Xcompiler -fPIC -arch=sm_52 8 | 9 | cd ../ 10 | python build.py 11 | -------------------------------------------------------------------------------- /prune_voc/lib/model/roi_align/modules/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Sharath-girish/LTH-ObjectRecognition/cba60fe5b92119346e81fe270da55a4b3a54cc67/prune_voc/lib/model/roi_align/modules/__init__.py -------------------------------------------------------------------------------- /prune_voc/lib/model/roi_align/src/roi_align.h: -------------------------------------------------------------------------------- 1 | int roi_align_forward(int aligned_height, int aligned_width, float spatial_scale, 2 | THFloatTensor * features, THFloatTensor * rois, THFloatTensor * output); 3 | 4 | int roi_align_backward(int aligned_height, int aligned_width, float spatial_scale, 5 | THFloatTensor * top_grad, THFloatTensor * rois, THFloatTensor * bottom_grad); 6 | -------------------------------------------------------------------------------- /prune_voc/lib/model/roi_align/src/roi_align_cuda.h: -------------------------------------------------------------------------------- 1 | int roi_align_forward_cuda(int aligned_height, int aligned_width, float spatial_scale, 2 | THCudaTensor * features, THCudaTensor * rois, THCudaTensor * output); 3 | 4 | int roi_align_backward_cuda(int aligned_height, int aligned_width, float spatial_scale, 5 | THCudaTensor * top_grad, THCudaTensor * rois, THCudaTensor * bottom_grad); 6 | -------------------------------------------------------------------------------- /prune_voc/lib/model/roi_align/src/roi_align_kernel.cu.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Sharath-girish/LTH-ObjectRecognition/cba60fe5b92119346e81fe270da55a4b3a54cc67/prune_voc/lib/model/roi_align/src/roi_align_kernel.cu.o -------------------------------------------------------------------------------- /prune_voc/lib/model/roi_crop/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Sharath-girish/LTH-ObjectRecognition/cba60fe5b92119346e81fe270da55a4b3a54cc67/prune_voc/lib/model/roi_crop/__init__.py -------------------------------------------------------------------------------- /prune_voc/lib/model/roi_crop/build.py: -------------------------------------------------------------------------------- 1 | from __future__ import print_function 2 | import os 3 | import torch 4 | from torch.utils.ffi import create_extension 5 | 6 | #this_file = os.path.dirname(__file__) 7 | 8 | sources = ['src/roi_crop.c'] 9 | headers = ['src/roi_crop.h'] 10 | defines = [] 11 | with_cuda = False 12 | 13 | if torch.cuda.is_available(): 14 | print('Including CUDA code.') 15 | sources += ['src/roi_crop_cuda.c'] 16 | headers += ['src/roi_crop_cuda.h'] 17 | defines += [('WITH_CUDA', None)] 18 | with_cuda = True 19 | 20 | this_file = os.path.dirname(os.path.realpath(__file__)) 21 | print(this_file) 22 | extra_objects = ['src/roi_crop_cuda_kernel.cu.o'] 23 | extra_objects = [os.path.join(this_file, fname) for fname in extra_objects] 24 | 25 | ffi = create_extension( 26 | '_ext.roi_crop', 27 | headers=headers, 28 | sources=sources, 29 | define_macros=defines, 30 | relative_to=__file__, 31 | with_cuda=with_cuda, 32 | extra_objects=extra_objects 33 | ) 34 | 35 | if __name__ == '__main__': 36 | ffi.build() 37 | -------------------------------------------------------------------------------- /prune_voc/lib/model/roi_crop/functions/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Sharath-girish/LTH-ObjectRecognition/cba60fe5b92119346e81fe270da55a4b3a54cc67/prune_voc/lib/model/roi_crop/functions/__init__.py -------------------------------------------------------------------------------- /prune_voc/lib/model/roi_crop/functions/roi_crop.py: -------------------------------------------------------------------------------- 1 | # functions/add.py 2 | import torch 3 | from torch.autograd import Function 4 | from .._ext import roi_crop 5 | import pdb 6 | 7 | class RoICropFunction(Function): 8 | def forward(self, input1, input2): 9 | self.input1 = input1.clone() 10 | self.input2 = input2.clone() 11 | output = input2.new(input2.size()[0], input1.size()[1], input2.size()[1], input2.size()[2]).zero_() 12 | assert output.get_device() == input1.get_device(), "output and input1 must on the same device" 13 | assert output.get_device() == input2.get_device(), "output and input2 must on the same device" 14 | roi_crop.BilinearSamplerBHWD_updateOutput_cuda(input1, input2, output) 15 | return output 16 | 17 | def backward(self, grad_output): 18 | grad_input1 = self.input1.new(self.input1.size()).zero_() 19 | grad_input2 = self.input2.new(self.input2.size()).zero_() 20 | roi_crop.BilinearSamplerBHWD_updateGradInput_cuda(self.input1, self.input2, grad_input1, grad_input2, grad_output) 21 | return grad_input1, grad_input2 22 | -------------------------------------------------------------------------------- /prune_voc/lib/model/roi_crop/make.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | CUDA_PATH=/usr/local/cuda/ 4 | 5 | cd src 6 | echo "Compiling my_lib kernels by nvcc..." 7 | nvcc -c -o roi_crop_cuda_kernel.cu.o roi_crop_cuda_kernel.cu -x cu -Xcompiler -fPIC -arch=sm_52 8 | 9 | cd ../ 10 | python build.py 11 | -------------------------------------------------------------------------------- /prune_voc/lib/model/roi_crop/modules/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Sharath-girish/LTH-ObjectRecognition/cba60fe5b92119346e81fe270da55a4b3a54cc67/prune_voc/lib/model/roi_crop/modules/__init__.py -------------------------------------------------------------------------------- /prune_voc/lib/model/roi_crop/modules/roi_crop.py: -------------------------------------------------------------------------------- 1 | from torch.nn.modules.module import Module 2 | from ..functions.roi_crop import RoICropFunction 3 | 4 | class _RoICrop(Module): 5 | def __init__(self, layout = 'BHWD'): 6 | super(_RoICrop, self).__init__() 7 | def forward(self, input1, input2): 8 | return RoICropFunction()(input1, input2) 9 | -------------------------------------------------------------------------------- /prune_voc/lib/model/roi_crop/src/roi_crop.h: -------------------------------------------------------------------------------- 1 | int BilinearSamplerBHWD_updateOutput(THFloatTensor *inputImages, THFloatTensor *grids, THFloatTensor *output); 2 | 3 | int BilinearSamplerBHWD_updateGradInput(THFloatTensor *inputImages, THFloatTensor *grids, THFloatTensor *gradInputImages, 4 | THFloatTensor *gradGrids, THFloatTensor *gradOutput); 5 | 6 | 7 | 8 | int BilinearSamplerBCHW_updateOutput(THFloatTensor *inputImages, THFloatTensor *grids, THFloatTensor *output); 9 | 10 | int BilinearSamplerBCHW_updateGradInput(THFloatTensor *inputImages, THFloatTensor *grids, THFloatTensor *gradInputImages, 11 | THFloatTensor *gradGrids, THFloatTensor *gradOutput); 12 | -------------------------------------------------------------------------------- /prune_voc/lib/model/roi_crop/src/roi_crop_cuda.h: -------------------------------------------------------------------------------- 1 | // Bilinear sampling is done in BHWD (coalescing is not obvious in BDHW) 2 | // we assume BHWD format in inputImages 3 | // we assume BHW(YX) format on grids 4 | 5 | int BilinearSamplerBHWD_updateOutput_cuda(THCudaTensor *inputImages, THCudaTensor *grids, THCudaTensor *output); 6 | 7 | int BilinearSamplerBHWD_updateGradInput_cuda(THCudaTensor *inputImages, THCudaTensor *grids, THCudaTensor *gradInputImages, 8 | THCudaTensor *gradGrids, THCudaTensor *gradOutput); 9 | -------------------------------------------------------------------------------- /prune_voc/lib/model/roi_crop/src/roi_crop_cuda_kernel.cu.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Sharath-girish/LTH-ObjectRecognition/cba60fe5b92119346e81fe270da55a4b3a54cc67/prune_voc/lib/model/roi_crop/src/roi_crop_cuda_kernel.cu.o -------------------------------------------------------------------------------- /prune_voc/lib/model/roi_layers/__init__.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. 2 | import torch 3 | from .nms import nms 4 | from .roi_align import ROIAlign 5 | from .roi_align import roi_align 6 | from .roi_pool import ROIPool 7 | from .roi_pool import roi_pool 8 | 9 | __all__ = ["nms", "roi_align", "ROIAlign", "roi_pool", "ROIPool"] 10 | -------------------------------------------------------------------------------- /prune_voc/lib/model/roi_layers/nms.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. 2 | # from ._utils import _C 3 | from model import _C 4 | 5 | nms = _C.nms 6 | # nms.__doc__ = """ 7 | # This function performs Non-maximum suppresion""" 8 | -------------------------------------------------------------------------------- /prune_voc/lib/model/roi_pooling/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Sharath-girish/LTH-ObjectRecognition/cba60fe5b92119346e81fe270da55a4b3a54cc67/prune_voc/lib/model/roi_pooling/__init__.py -------------------------------------------------------------------------------- /prune_voc/lib/model/roi_pooling/build.py: -------------------------------------------------------------------------------- 1 | from __future__ import print_function 2 | import os 3 | import torch 4 | from torch.utils.ffi import create_extension 5 | 6 | 7 | sources = ['src/roi_pooling.c'] 8 | headers = ['src/roi_pooling.h'] 9 | extra_objects = [] 10 | defines = [] 11 | with_cuda = False 12 | 13 | this_file = os.path.dirname(os.path.realpath(__file__)) 14 | print(this_file) 15 | 16 | if torch.cuda.is_available(): 17 | print('Including CUDA code.') 18 | sources += ['src/roi_pooling_cuda.c'] 19 | headers += ['src/roi_pooling_cuda.h'] 20 | defines += [('WITH_CUDA', None)] 21 | with_cuda = True 22 | extra_objects = ['src/roi_pooling.cu.o'] 23 | extra_objects = [os.path.join(this_file, fname) for fname in extra_objects] 24 | 25 | ffi = create_extension( 26 | '_ext.roi_pooling', 27 | headers=headers, 28 | sources=sources, 29 | define_macros=defines, 30 | relative_to=__file__, 31 | with_cuda=with_cuda, 32 | extra_objects=extra_objects 33 | ) 34 | 35 | if __name__ == '__main__': 36 | ffi.build() 37 | -------------------------------------------------------------------------------- /prune_voc/lib/model/roi_pooling/functions/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Sharath-girish/LTH-ObjectRecognition/cba60fe5b92119346e81fe270da55a4b3a54cc67/prune_voc/lib/model/roi_pooling/functions/__init__.py -------------------------------------------------------------------------------- /prune_voc/lib/model/roi_pooling/modules/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Sharath-girish/LTH-ObjectRecognition/cba60fe5b92119346e81fe270da55a4b3a54cc67/prune_voc/lib/model/roi_pooling/modules/__init__.py -------------------------------------------------------------------------------- /prune_voc/lib/model/roi_pooling/modules/roi_pool.py: -------------------------------------------------------------------------------- 1 | from torch.nn.modules.module import Module 2 | from ..functions.roi_pool import RoIPoolFunction 3 | 4 | 5 | class _RoIPooling(Module): 6 | def __init__(self, pooled_height, pooled_width, spatial_scale): 7 | super(_RoIPooling, self).__init__() 8 | 9 | self.pooled_width = int(pooled_width) 10 | self.pooled_height = int(pooled_height) 11 | self.spatial_scale = float(spatial_scale) 12 | 13 | def forward(self, features, rois): 14 | return RoIPoolFunction(self.pooled_height, self.pooled_width, self.spatial_scale)(features, rois) 15 | -------------------------------------------------------------------------------- /prune_voc/lib/model/roi_pooling/src/roi_pooling.cu.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Sharath-girish/LTH-ObjectRecognition/cba60fe5b92119346e81fe270da55a4b3a54cc67/prune_voc/lib/model/roi_pooling/src/roi_pooling.cu.o -------------------------------------------------------------------------------- /prune_voc/lib/model/roi_pooling/src/roi_pooling.h: -------------------------------------------------------------------------------- 1 | int roi_pooling_forward(int pooled_height, int pooled_width, float spatial_scale, 2 | THFloatTensor * features, THFloatTensor * rois, THFloatTensor * output); -------------------------------------------------------------------------------- /prune_voc/lib/model/roi_pooling/src/roi_pooling_cuda.h: -------------------------------------------------------------------------------- 1 | int roi_pooling_forward_cuda(int pooled_height, int pooled_width, float spatial_scale, 2 | THCudaTensor * features, THCudaTensor * rois, THCudaTensor * output, THCudaIntTensor * argmax); 3 | 4 | int roi_pooling_backward_cuda(int pooled_height, int pooled_width, float spatial_scale, 5 | THCudaTensor * top_grad, THCudaTensor * rois, THCudaTensor * bottom_grad, THCudaIntTensor * argmax); -------------------------------------------------------------------------------- /prune_voc/lib/model/roi_pooling/src/roi_pooling_kernel.h: -------------------------------------------------------------------------------- 1 | #ifndef _ROI_POOLING_KERNEL 2 | #define _ROI_POOLING_KERNEL 3 | 4 | #ifdef __cplusplus 5 | extern "C" { 6 | #endif 7 | 8 | int ROIPoolForwardLaucher( 9 | const float* bottom_data, const float spatial_scale, const int num_rois, const int height, 10 | const int width, const int channels, const int pooled_height, 11 | const int pooled_width, const float* bottom_rois, 12 | float* top_data, int* argmax_data, cudaStream_t stream); 13 | 14 | 15 | int ROIPoolBackwardLaucher(const float* top_diff, const float spatial_scale, const int batch_size, const int num_rois, 16 | const int height, const int width, const int channels, const int pooled_height, 17 | const int pooled_width, const float* bottom_rois, 18 | float* bottom_diff, const int* argmax_data, cudaStream_t stream); 19 | 20 | #ifdef __cplusplus 21 | } 22 | #endif 23 | 24 | #endif 25 | 26 | -------------------------------------------------------------------------------- /prune_voc/lib/model/rpn/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Sharath-girish/LTH-ObjectRecognition/cba60fe5b92119346e81fe270da55a4b3a54cc67/prune_voc/lib/model/rpn/__init__.py -------------------------------------------------------------------------------- /prune_voc/lib/model/utils/.gitignore: -------------------------------------------------------------------------------- 1 | *.c 2 | *.cpp 3 | *.so 4 | -------------------------------------------------------------------------------- /prune_voc/lib/model/utils/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Sharath-girish/LTH-ObjectRecognition/cba60fe5b92119346e81fe270da55a4b3a54cc67/prune_voc/lib/model/utils/__init__.py -------------------------------------------------------------------------------- /prune_voc/lib/pycocotools/UPSTREAM_REV: -------------------------------------------------------------------------------- 1 | https://github.com/pdollar/coco/commit/3ac47c77ebd5a1ed4254a98b7fbf2ef4765a3574 2 | -------------------------------------------------------------------------------- /prune_voc/lib/pycocotools/__init__.py: -------------------------------------------------------------------------------- 1 | __author__ = 'tylin' 2 | -------------------------------------------------------------------------------- /prune_voc/lib/roi_data_layer/__init__.py: -------------------------------------------------------------------------------- 1 | # -------------------------------------------------------- 2 | # Fast R-CNN 3 | # Copyright (c) 2015 Microsoft 4 | # Licensed under The MIT License [see LICENSE for details] 5 | # Written by Ross Girshick 6 | # -------------------------------------------------------- 7 | -------------------------------------------------------------------------------- /prune_voc/requirements.txt: -------------------------------------------------------------------------------- 1 | cython 2 | cffi 3 | opencv-python 4 | scipy 5 | msgpack 6 | easydict 7 | matplotlib 8 | pyyaml 9 | tensorboardX 10 | --------------------------------------------------------------------------------