├── README.md ├── benchmark ├── Count │ └── cnt.py ├── DenseCap_Metrics │ ├── eval_DenseCap.py │ ├── gt │ │ ├── gt-gpt4v-prefer.json │ │ └── gt-llava-prefer.json │ ├── pycocoevalcap │ │ ├── bleu │ │ │ ├── LICENSE │ │ │ ├── __init__.py │ │ │ ├── bleu.py │ │ │ └── bleu_scorer.py │ │ ├── cider │ │ │ ├── __init__.py │ │ │ ├── cider.py │ │ │ └── cider_scorer.py │ │ ├── eval.py │ │ ├── meteor │ │ │ ├── __init__.py │ │ │ ├── data │ │ │ │ └── paraphrase-en.gz │ │ │ ├── meteor-1.5.jar │ │ │ └── meteor.py │ │ ├── rouge │ │ │ ├── __init__.py │ │ │ └── rouge.py │ │ ├── spice │ │ │ ├── __init__.py │ │ │ ├── cache │ │ │ │ ├── data.mdb │ │ │ │ └── lock.mdb │ │ │ ├── lib │ │ │ │ ├── Meteor-1.5.jar │ │ │ │ ├── SceneGraphParser-1.0.jar │ │ │ │ ├── ejml-0.23.jar │ │ │ │ ├── fst-2.47.jar │ │ │ │ ├── guava-19.0.jar │ │ │ │ ├── hamcrest-core-1.3.jar │ │ │ │ ├── jackson-core-2.5.3.jar │ │ │ │ ├── javassist-3.19.0-GA.jar │ │ │ │ ├── json-simple-1.1.1.jar │ │ │ │ ├── junit-4.12.jar │ │ │ │ ├── lmdbjni-0.4.6.jar │ │ │ │ ├── lmdbjni-linux64-0.4.6.jar │ │ │ │ ├── lmdbjni-osx64-0.4.6.jar │ │ │ │ ├── lmdbjni-win64-0.4.6.jar │ │ │ │ ├── objenesis-2.4.jar │ │ │ │ ├── slf4j-api-1.7.12.jar │ │ │ │ └── slf4j-simple-1.7.21.jar │ │ │ ├── spice-1.0.jar │ │ │ ├── spice.py │ │ │ └── tmp │ │ │ │ ├── tmpia7f3mb5 │ │ │ │ └── tmpy5tu8h2v │ │ ├── tokenizer │ │ │ ├── __init__.py │ │ │ ├── ptbtokenizer.py │ │ │ └── stanford-corenlp-3.4.1.jar │ │ └── wmd │ │ │ ├── data │ │ │ └── stopwords.txt │ │ │ └── wmd.py │ └── ques │ │ ├── ques-gpt4v-prefer.jsonl │ │ └── ques-llava-prefer.jsonl ├── Linguistic │ └── readability.py ├── POPE │ ├── POPE-jsonl │ │ ├── coco_pope_adversarial.jsonl │ │ ├── coco_pope_popular.jsonl │ │ └── coco_pope_random.jsonl │ ├── eval_pope.py │ └── eval_pope_muti_gpu.sh └── t2iGen │ ├── eval_t2i.sh │ └── eval_t2igen.py ├── docs ├── install.md └── use.md ├── extract ├── configs │ ├── Base.yaml │ ├── GRiT_B_DenseCap.yaml │ ├── GRiT_B_DenseCap_ObjectDet.yaml │ ├── GRiT_B_ObjectDet.yaml │ ├── GRiT_H_ObjectDet.yaml │ └── GRiT_L_ObjectDet.yaml ├── extract_fr_desc-gpt.py ├── extract_fr_desc-llama.py ├── extract_fr_img.py ├── grit │ ├── __init__.py │ ├── __pycache__ │ │ ├── __init__.cpython-310.pyc │ │ ├── __init__.cpython-38.pyc │ │ ├── config.cpython-310.pyc │ │ ├── config.cpython-38.pyc │ │ ├── predictor.cpython-310.pyc │ │ └── predictor.cpython-38.pyc │ ├── config.py │ ├── custom_solver.py │ ├── data │ │ ├── __pycache__ │ │ │ ├── custom_build_augmentation.cpython-310.pyc │ │ │ ├── custom_build_augmentation.cpython-38.pyc │ │ │ ├── custom_dataset_mapper.cpython-310.pyc │ │ │ └── custom_dataset_mapper.cpython-38.pyc │ │ ├── custom_build_augmentation.py │ │ ├── custom_dataset_dataloader.py │ │ ├── custom_dataset_mapper.py │ │ ├── datasets │ │ │ ├── __pycache__ │ │ │ │ ├── grit_coco.cpython-310.pyc │ │ │ │ ├── grit_coco.cpython-38.pyc │ │ │ │ ├── object365.cpython-310.pyc │ │ │ │ ├── object365.cpython-38.pyc │ │ │ │ ├── vg.cpython-310.pyc │ │ │ │ └── vg.cpython-38.pyc │ │ │ ├── grit_coco.py │ │ │ ├── object365.py │ │ │ └── vg.py │ │ └── transforms │ │ │ ├── __pycache__ │ │ │ ├── custom_augmentation_impl.cpython-310.pyc │ │ │ ├── custom_augmentation_impl.cpython-38.pyc │ │ │ ├── custom_transform.cpython-310.pyc │ │ │ └── custom_transform.cpython-38.pyc │ │ │ ├── custom_augmentation_impl.py │ │ │ └── custom_transform.py │ ├── evaluation │ │ └── eval.py │ ├── modeling │ │ ├── __pycache__ │ │ │ ├── soft_nms.cpython-310.pyc │ │ │ └── soft_nms.cpython-38.pyc │ │ ├── backbone │ │ │ ├── __pycache__ │ │ │ │ ├── utils.cpython-310.pyc │ │ │ │ ├── utils.cpython-38.pyc │ │ │ │ ├── vit.cpython-310.pyc │ │ │ │ └── vit.cpython-38.pyc │ │ │ ├── utils.py │ │ │ └── vit.py │ │ ├── meta_arch │ │ │ ├── __pycache__ │ │ │ │ ├── grit.cpython-310.pyc │ │ │ │ └── grit.cpython-38.pyc │ │ │ └── grit.py │ │ ├── roi_heads │ │ │ ├── __pycache__ │ │ │ │ ├── grit_fast_rcnn.cpython-310.pyc │ │ │ │ ├── grit_fast_rcnn.cpython-38.pyc │ │ │ │ ├── grit_roi_heads.cpython-310.pyc │ │ │ │ └── grit_roi_heads.cpython-38.pyc │ │ │ ├── grit_fast_rcnn.py │ │ │ └── grit_roi_heads.py │ │ ├── soft_nms.py │ │ └── text │ │ │ ├── __pycache__ │ │ │ ├── file_utils.cpython-310.pyc │ │ │ ├── file_utils.cpython-38.pyc │ │ │ ├── load_text_token.cpython-310.pyc │ │ │ ├── load_text_token.cpython-38.pyc │ │ │ ├── modeling_bert.cpython-310.pyc │ │ │ ├── modeling_bert.cpython-38.pyc │ │ │ ├── text_decoder.cpython-310.pyc │ │ │ └── text_decoder.cpython-38.pyc │ │ │ ├── file_utils.py │ │ │ ├── load_text_token.py │ │ │ ├── modeling_bert.py │ │ │ └── text_decoder.py │ └── predictor.py ├── third_party │ └── CenterNet2 │ │ ├── .circleci │ │ └── config.yml │ │ ├── .clang-format │ │ ├── .flake8 │ │ ├── .github │ │ ├── CODE_OF_CONDUCT.md │ │ ├── CONTRIBUTING.md │ │ ├── Detectron2-Logo-Horz.svg │ │ ├── ISSUE_TEMPLATE.md │ │ ├── ISSUE_TEMPLATE │ │ │ ├── bugs.md │ │ │ ├── config.yml │ │ │ ├── documentation.md │ │ │ ├── feature-request.md │ │ │ └── unexpected-problems-bugs.md │ │ ├── pull_request_template.md │ │ └── workflows │ │ │ ├── check-template.yml │ │ │ ├── levenshtein.js │ │ │ ├── needs-reply.yml │ │ │ ├── remove-needs-reply.yml │ │ │ └── workflow.yml │ │ ├── .gitignore │ │ ├── GETTING_STARTED.md │ │ ├── INSTALL.md │ │ ├── LICENSE │ │ ├── MODEL_ZOO.md │ │ ├── README.md │ │ ├── README_D2.md │ │ ├── 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 │ │ │ ├── fcos_R_50_FPN_1x.py │ │ │ ├── retinanet_R_101_FPN_3x.yaml │ │ │ ├── retinanet_R_50_FPN_1x.py │ │ │ ├── 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.py │ │ │ ├── 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.py │ │ │ ├── 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_regnetx_4gf_dds_fpn_1x.py │ │ │ └── mask_rcnn_regnety_4gf_dds_fpn_1x.py │ │ ├── COCO-Keypoints │ │ │ ├── Base-Keypoint-RCNN-FPN.yaml │ │ │ ├── keypoint_rcnn_R_101_FPN_3x.yaml │ │ │ ├── keypoint_rcnn_R_50_FPN_1x.py │ │ │ ├── keypoint_rcnn_R_50_FPN_1x.yaml │ │ │ ├── keypoint_rcnn_R_50_FPN_3x.yaml │ │ │ └── keypoint_rcnn_X_101_32x8d_FPN_3x.yaml │ │ ├── COCO-PanopticSegmentation │ │ │ ├── Base-Panoptic-FPN.yaml │ │ │ ├── panoptic_fpn_R_101_3x.yaml │ │ │ ├── panoptic_fpn_R_50_1x.py │ │ │ ├── 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 │ │ │ ├── mmdet_mask_rcnn_R_50_FPN_1x.py │ │ │ ├── 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 │ │ │ └── torchvision_imagenet_R_50.py │ │ ├── PascalVOC-Detection │ │ │ ├── faster_rcnn_R_50_C4.yaml │ │ │ └── faster_rcnn_R_50_FPN.yaml │ │ ├── common │ │ │ ├── README.md │ │ │ ├── coco_schedule.py │ │ │ ├── data │ │ │ │ ├── coco.py │ │ │ │ ├── coco_keypoint.py │ │ │ │ └── coco_panoptic_separated.py │ │ │ ├── models │ │ │ │ ├── cascade_rcnn.py │ │ │ │ ├── fcos.py │ │ │ │ ├── keypoint_rcnn_fpn.py │ │ │ │ ├── mask_rcnn_c4.py │ │ │ │ ├── mask_rcnn_fpn.py │ │ │ │ ├── panoptic_fpn.py │ │ │ │ └── retinanet.py │ │ │ ├── optim.py │ │ │ └── train.py │ │ ├── new_baselines │ │ │ ├── mask_rcnn_R_101_FPN_100ep_LSJ.py │ │ │ ├── mask_rcnn_R_101_FPN_200ep_LSJ.py │ │ │ ├── mask_rcnn_R_101_FPN_400ep_LSJ.py │ │ │ ├── mask_rcnn_R_50_FPN_100ep_LSJ.py │ │ │ ├── mask_rcnn_R_50_FPN_200ep_LSJ.py │ │ │ ├── mask_rcnn_R_50_FPN_400ep_LSJ.py │ │ │ ├── mask_rcnn_R_50_FPN_50ep_LSJ.py │ │ │ ├── mask_rcnn_regnetx_4gf_dds_FPN_100ep_LSJ.py │ │ │ ├── mask_rcnn_regnetx_4gf_dds_FPN_200ep_LSJ.py │ │ │ ├── mask_rcnn_regnetx_4gf_dds_FPN_400ep_LSJ.py │ │ │ ├── mask_rcnn_regnety_4gf_dds_FPN_100ep_LSJ.py │ │ │ ├── mask_rcnn_regnety_4gf_dds_FPN_200ep_LSJ.py │ │ │ └── mask_rcnn_regnety_4gf_dds_FPN_400ep_LSJ.py │ │ └── 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 │ │ ├── lvis │ │ │ └── lvis_v1_train_cat_info.json │ │ ├── prepare_ade20k_sem_seg.py │ │ ├── prepare_cocofied_lvis.py │ │ ├── prepare_for_tests.sh │ │ └── 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 │ │ │ ├── instantiate.py │ │ │ └── lazy.py │ │ ├── data │ │ │ ├── __init__.py │ │ │ ├── benchmark.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 │ │ │ ├── flatten.py │ │ │ ├── shared.py │ │ │ ├── torchscript.py │ │ │ └── torchscript_patch.py │ │ ├── layers │ │ │ ├── __init__.py │ │ │ ├── aspp.py │ │ │ ├── batch_norm.py │ │ │ ├── blocks.py │ │ │ ├── csrc │ │ │ │ ├── README.md │ │ │ │ ├── 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 │ │ │ ├── losses.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 │ │ │ └── model_zoo.py │ │ ├── modeling │ │ │ ├── __init__.py │ │ │ ├── anchor_generator.py │ │ │ ├── backbone │ │ │ │ ├── __init__.py │ │ │ │ ├── backbone.py │ │ │ │ ├── build.py │ │ │ │ ├── fpn.py │ │ │ │ ├── regnet.py │ │ │ │ └── resnet.py │ │ │ ├── box_regression.py │ │ │ ├── matcher.py │ │ │ ├── meta_arch │ │ │ │ ├── __init__.py │ │ │ │ ├── build.py │ │ │ │ ├── dense_detector.py │ │ │ │ ├── fcos.py │ │ │ │ ├── panoptic_fpn.py │ │ │ │ ├── rcnn.py │ │ │ │ ├── retinanet.py │ │ │ │ └── semantic_seg.py │ │ │ ├── mmdet_wrapper.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 │ │ │ ├── file_io.py │ │ │ ├── logger.py │ │ │ ├── memory.py │ │ │ ├── registry.py │ │ │ ├── serialize.py │ │ │ ├── testing.py │ │ │ ├── video_visualizer.py │ │ │ └── visualizer.py │ │ ├── dev │ │ ├── README.md │ │ ├── linter.sh │ │ ├── packaging │ │ │ ├── README.md │ │ │ ├── build_all_wheels.sh │ │ │ ├── build_wheel.sh │ │ │ ├── gen_install_table.py │ │ │ ├── gen_wheel_index.sh │ │ │ └── pkg_helpers.bash │ │ ├── parse_results.sh │ │ ├── run_inference_tests.sh │ │ └── run_instant_tests.sh │ │ ├── docker │ │ ├── Dockerfile │ │ ├── README.md │ │ ├── deploy.Dockerfile │ │ └── 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 │ │ │ ├── fvcore.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 │ │ │ ├── lazyconfigs.md │ │ │ ├── models.md │ │ │ ├── training.md │ │ │ └── write-models.md │ │ ├── projects │ │ └── CenterNet2 │ │ │ ├── .gitignore │ │ │ ├── centernet │ │ │ ├── __init__.py │ │ │ ├── config.py │ │ │ ├── data │ │ │ │ ├── custom_build_augmentation.py │ │ │ │ ├── custom_dataset_dataloader.py │ │ │ │ ├── datasets │ │ │ │ │ ├── coco.py │ │ │ │ │ ├── nuimages.py │ │ │ │ │ └── objects365.py │ │ │ │ └── transforms │ │ │ │ │ ├── custom_augmentation_impl.py │ │ │ │ │ └── custom_transform.py │ │ │ └── modeling │ │ │ │ ├── backbone │ │ │ │ ├── bifpn.py │ │ │ │ ├── bifpn_fcos.py │ │ │ │ ├── dla.py │ │ │ │ ├── dlafpn.py │ │ │ │ ├── fpn_p5.py │ │ │ │ └── res2net.py │ │ │ │ ├── debug.py │ │ │ │ ├── dense_heads │ │ │ │ ├── centernet.py │ │ │ │ ├── centernet_head.py │ │ │ │ └── utils.py │ │ │ │ ├── layers │ │ │ │ ├── deform_conv.py │ │ │ │ ├── heatmap_focal_loss.py │ │ │ │ ├── iou_loss.py │ │ │ │ └── ml_nms.py │ │ │ │ ├── meta_arch │ │ │ │ └── centernet_detector.py │ │ │ │ └── roi_heads │ │ │ │ ├── custom_fast_rcnn.py │ │ │ │ ├── custom_roi_heads.py │ │ │ │ └── fed_loss.py │ │ │ ├── centernet2_docs │ │ │ └── MODEL_ZOO.md │ │ │ ├── configs │ │ │ ├── Base-CenterNet-FPN.yaml │ │ │ ├── Base-CenterNet2.yaml │ │ │ ├── Base_S4_DLA.yaml │ │ │ ├── CenterNet-FPN_R50_1x.yaml │ │ │ ├── CenterNet-S4_DLA_8x.yaml │ │ │ ├── CenterNet2-F_R50_1x.yaml │ │ │ ├── CenterNet2_DLA-BiFPN-P3_24x.yaml │ │ │ ├── CenterNet2_DLA-BiFPN-P3_4x.yaml │ │ │ ├── CenterNet2_DLA-BiFPN-P5_640_16x.yaml │ │ │ ├── CenterNet2_DLA-BiFPN-P5_640_16x_ST.yaml │ │ │ ├── CenterNet2_DLA-fcosBiFPN-P5_640_16x_ST.yaml │ │ │ ├── CenterNet2_R2-101-DCN-BiFPN_1280_4x.yaml │ │ │ ├── CenterNet2_R2-101-DCN-BiFPN_4x+4x_1560_ST.yaml │ │ │ ├── CenterNet2_R2-101-DCN_896_4x.yaml │ │ │ ├── CenterNet2_R50_1x.yaml │ │ │ ├── CenterNet2_X101-DCN_2x.yaml │ │ │ ├── LVIS_CenterNet2_R50_1x.yaml │ │ │ ├── LVIS_CenterNet2_R50_Fed_1x.yaml │ │ │ ├── O365_CenterNet2_R50_1x.yaml │ │ │ └── nuImages_CenterNet2_DLA_640_8x.yaml │ │ │ ├── demo.py │ │ │ ├── predictor.py │ │ │ └── train_net.py │ │ ├── setup.cfg │ │ ├── setup.py │ │ ├── tests │ │ ├── README.md │ │ ├── __init__.py │ │ ├── config │ │ │ ├── dir1 │ │ │ │ ├── dir1_a.py │ │ │ │ └── dir1_b.py │ │ │ ├── root_cfg.py │ │ │ ├── test_instantiate_config.py │ │ │ ├── test_lazy_config.py │ │ │ └── test_yacs_config.py │ │ ├── data │ │ │ ├── __init__.py │ │ │ ├── test_coco.py │ │ │ ├── test_coco_evaluation.py │ │ │ ├── test_dataset.py │ │ │ ├── test_detection_utils.py │ │ │ ├── test_rotation_transform.py │ │ │ ├── test_sampler.py │ │ │ └── test_transforms.py │ │ ├── layers │ │ │ ├── __init__.py │ │ │ ├── test_blocks.py │ │ │ ├── test_deformable.py │ │ │ ├── test_losses.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_backbone.py │ │ │ ├── test_box2box_transform.py │ │ │ ├── test_fast_rcnn.py │ │ │ ├── test_matcher.py │ │ │ ├── test_mmdet.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_keypoints.py │ │ │ ├── test_masks.py │ │ │ └── test_rotated_boxes.py │ │ ├── test_checkpoint.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_registry.py │ │ ├── test_scheduler.py │ │ ├── test_solver.py │ │ └── test_visualizer.py │ │ └── tools │ │ ├── README.md │ │ ├── __init__.py │ │ ├── analyze_model.py │ │ ├── benchmark.py │ │ ├── convert-torchvision-to-d2.py │ │ ├── deploy │ │ ├── CMakeLists.txt │ │ ├── README.md │ │ ├── export_model.py │ │ └── torchscript_mask_rcnn.cpp │ │ ├── lazyconfig_train_net.py │ │ ├── lightning_train_net.py │ │ ├── plain_train_net.py │ │ ├── train_net.py │ │ ├── visualize_data.py │ │ └── visualize_json_results.py └── visualization │ ├── 000000000009.jpg │ ├── 000000000025.jpg │ └── 000000000030.jpg ├── fg_annotation └── mask_depth.py ├── filter └── filter_fr_desc.py ├── refine └── modify.py ├── script ├── trans_to_DenseCap_format.py └── trans_to_Linguistic_format.py └── utils └── trans_img2depth.py /benchmark/DenseCap_Metrics/eval_DenseCap.py: -------------------------------------------------------------------------------- 1 | from pycocoevalcap.eval import eval 2 | import json 3 | 4 | gt_file = './benchmark/DenseCap_Metrics/gt/' 5 | res_file = './benchmark/DenseCap_Metrics/res/' 6 | 7 | with open(gt_file, 'r') as f: 8 | gts = json.load(f) 9 | with open(res_file, 'r') as f: 10 | res = json.load(f) 11 | 12 | if __name__ == '__main__': 13 | mp = eval(gts, res) 14 | print(f"{res_file}: {mp}") 15 | -------------------------------------------------------------------------------- /benchmark/DenseCap_Metrics/pycocoevalcap/bleu/LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2015 Xinlei Chen, Hao Fang, Tsung-Yi Lin, and Ramakrishna Vedantam 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining a copy 4 | of this software and associated documentation files (the "Software"), to deal 5 | in the Software without restriction, including without limitation the rights 6 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 7 | copies of the Software, and to permit persons to whom the Software is 8 | furnished to do so, subject to the following conditions: 9 | 10 | The above copyright notice and this permission notice shall be included in 11 | all copies or substantial portions of the Software. 12 | 13 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 14 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 15 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 16 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 17 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 18 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 19 | THE SOFTWARE. 20 | -------------------------------------------------------------------------------- /benchmark/DenseCap_Metrics/pycocoevalcap/bleu/__init__.py: -------------------------------------------------------------------------------- 1 | __author__ = 'tylin' 2 | -------------------------------------------------------------------------------- /benchmark/DenseCap_Metrics/pycocoevalcap/bleu/bleu.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | # 3 | # File Name : bleu.py 4 | # 5 | # Description : Wrapper for BLEU scorer. 6 | # 7 | # Creation Date : 06-01-2015 8 | # Last Modified : Thu 19 Mar 2015 09:13:28 PM PDT 9 | # Authors : Hao Fang and Tsung-Yi Lin 10 | 11 | from .bleu_scorer import BleuScorer 12 | 13 | 14 | class Bleu: 15 | def __init__(self, n=4): 16 | # default compute Blue score up to 4 17 | self._n = n 18 | self._hypo_for_image = {} 19 | self.ref_for_image = {} 20 | 21 | def compute_score(self, gts, res): 22 | 23 | assert(list(gts.keys()) == list(res.keys())) 24 | imgIds = list(gts.keys()) 25 | 26 | bleu_scorer = BleuScorer(n=self._n) 27 | for id in imgIds: 28 | hypo = res[id] 29 | ref = gts[id] 30 | 31 | # Sanity check. 32 | assert(type(hypo) is list) 33 | assert(len(hypo) == 1) 34 | assert(type(ref) is list) 35 | assert(len(ref) >= 1) 36 | 37 | bleu_scorer += (hypo[0], ref) 38 | 39 | #score, scores = bleu_scorer.compute_score(option='shortest') 40 | score, scores = bleu_scorer.compute_score(option='closest', verbose=1) 41 | #score, scores = bleu_scorer.compute_score(option='average', verbose=1) 42 | 43 | # return (bleu, bleu_info) 44 | return score, scores 45 | 46 | def method(self): 47 | return "Bleu" 48 | -------------------------------------------------------------------------------- /benchmark/DenseCap_Metrics/pycocoevalcap/cider/__init__.py: -------------------------------------------------------------------------------- 1 | __author__ = 'tylin' 2 | -------------------------------------------------------------------------------- /benchmark/DenseCap_Metrics/pycocoevalcap/eval.py: -------------------------------------------------------------------------------- 1 | from .bleu.bleu import Bleu 2 | from .cider.cider import Cider 3 | from .meteor.meteor import Meteor 4 | from .rouge.rouge import Rouge 5 | from .spice.spice import Spice 6 | from .wmd.wmd import WMD 7 | 8 | def eval(gts,res): 9 | scorer = Bleu(n=4) 10 | s1, _ = scorer.compute_score(gts, res) 11 | 12 | scorer = Cider() 13 | s2, _ = scorer.compute_score(gts, res) 14 | 15 | scorer = Meteor() 16 | s3, _ = scorer.compute_score(gts, res) 17 | 18 | scorer = Rouge() 19 | s4, _ = scorer.compute_score(gts, res) 20 | 21 | scorer = Spice() 22 | s5, _ = scorer.compute_score(gts, res) 23 | 24 | scorer = WMD() 25 | s6, _ = scorer.compute_score(gts, res) 26 | 27 | return {'bleu':s1,'cider':s2,'meteor':s3,'rouge':s4,'spice':s5,'wmd':s6} 28 | 29 | def get_bleu(gts,res): 30 | scorer = Bleu(n=4) 31 | s, _ = scorer.compute_score(gts, res) 32 | return s 33 | 34 | def get_meteor(gts, res): 35 | scorer = Meteor() 36 | s, _ = scorer.compute_score(gts, res) 37 | return s 38 | 39 | def get_cider(gts, res): 40 | scorer = Cider() 41 | s, _ = scorer.compute_score(gts, res) 42 | return s 43 | 44 | def get_rouge(gts, res): 45 | scorer = Rouge() 46 | s, _ = scorer.compute_score(gts, res) 47 | return s 48 | 49 | 50 | def get_spice(gts, res): 51 | scorer = Spice() 52 | s, _ = scorer.compute_score(gts, res) 53 | return s 54 | 55 | 56 | def get_wmd(gts, res): 57 | scorer = WMD() 58 | s, _ = scorer.compute_score(gts, res) 59 | return s 60 | -------------------------------------------------------------------------------- /benchmark/DenseCap_Metrics/pycocoevalcap/meteor/__init__.py: -------------------------------------------------------------------------------- 1 | __author__ = 'tylin' 2 | -------------------------------------------------------------------------------- /benchmark/DenseCap_Metrics/pycocoevalcap/meteor/data/paraphrase-en.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sterzhang/image-textualization/4c72f75bf6ab0227b6bd60911234e5d818587783/benchmark/DenseCap_Metrics/pycocoevalcap/meteor/data/paraphrase-en.gz -------------------------------------------------------------------------------- /benchmark/DenseCap_Metrics/pycocoevalcap/meteor/meteor-1.5.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sterzhang/image-textualization/4c72f75bf6ab0227b6bd60911234e5d818587783/benchmark/DenseCap_Metrics/pycocoevalcap/meteor/meteor-1.5.jar -------------------------------------------------------------------------------- /benchmark/DenseCap_Metrics/pycocoevalcap/rouge/__init__.py: -------------------------------------------------------------------------------- 1 | __author__ = 'vrama91' 2 | -------------------------------------------------------------------------------- /benchmark/DenseCap_Metrics/pycocoevalcap/spice/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sterzhang/image-textualization/4c72f75bf6ab0227b6bd60911234e5d818587783/benchmark/DenseCap_Metrics/pycocoevalcap/spice/__init__.py -------------------------------------------------------------------------------- /benchmark/DenseCap_Metrics/pycocoevalcap/spice/cache/data.mdb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sterzhang/image-textualization/4c72f75bf6ab0227b6bd60911234e5d818587783/benchmark/DenseCap_Metrics/pycocoevalcap/spice/cache/data.mdb -------------------------------------------------------------------------------- /benchmark/DenseCap_Metrics/pycocoevalcap/spice/cache/lock.mdb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sterzhang/image-textualization/4c72f75bf6ab0227b6bd60911234e5d818587783/benchmark/DenseCap_Metrics/pycocoevalcap/spice/cache/lock.mdb -------------------------------------------------------------------------------- /benchmark/DenseCap_Metrics/pycocoevalcap/spice/lib/Meteor-1.5.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sterzhang/image-textualization/4c72f75bf6ab0227b6bd60911234e5d818587783/benchmark/DenseCap_Metrics/pycocoevalcap/spice/lib/Meteor-1.5.jar -------------------------------------------------------------------------------- /benchmark/DenseCap_Metrics/pycocoevalcap/spice/lib/SceneGraphParser-1.0.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sterzhang/image-textualization/4c72f75bf6ab0227b6bd60911234e5d818587783/benchmark/DenseCap_Metrics/pycocoevalcap/spice/lib/SceneGraphParser-1.0.jar -------------------------------------------------------------------------------- /benchmark/DenseCap_Metrics/pycocoevalcap/spice/lib/ejml-0.23.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sterzhang/image-textualization/4c72f75bf6ab0227b6bd60911234e5d818587783/benchmark/DenseCap_Metrics/pycocoevalcap/spice/lib/ejml-0.23.jar -------------------------------------------------------------------------------- /benchmark/DenseCap_Metrics/pycocoevalcap/spice/lib/fst-2.47.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sterzhang/image-textualization/4c72f75bf6ab0227b6bd60911234e5d818587783/benchmark/DenseCap_Metrics/pycocoevalcap/spice/lib/fst-2.47.jar -------------------------------------------------------------------------------- /benchmark/DenseCap_Metrics/pycocoevalcap/spice/lib/guava-19.0.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sterzhang/image-textualization/4c72f75bf6ab0227b6bd60911234e5d818587783/benchmark/DenseCap_Metrics/pycocoevalcap/spice/lib/guava-19.0.jar -------------------------------------------------------------------------------- /benchmark/DenseCap_Metrics/pycocoevalcap/spice/lib/hamcrest-core-1.3.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sterzhang/image-textualization/4c72f75bf6ab0227b6bd60911234e5d818587783/benchmark/DenseCap_Metrics/pycocoevalcap/spice/lib/hamcrest-core-1.3.jar -------------------------------------------------------------------------------- /benchmark/DenseCap_Metrics/pycocoevalcap/spice/lib/jackson-core-2.5.3.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sterzhang/image-textualization/4c72f75bf6ab0227b6bd60911234e5d818587783/benchmark/DenseCap_Metrics/pycocoevalcap/spice/lib/jackson-core-2.5.3.jar -------------------------------------------------------------------------------- /benchmark/DenseCap_Metrics/pycocoevalcap/spice/lib/javassist-3.19.0-GA.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sterzhang/image-textualization/4c72f75bf6ab0227b6bd60911234e5d818587783/benchmark/DenseCap_Metrics/pycocoevalcap/spice/lib/javassist-3.19.0-GA.jar -------------------------------------------------------------------------------- /benchmark/DenseCap_Metrics/pycocoevalcap/spice/lib/json-simple-1.1.1.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sterzhang/image-textualization/4c72f75bf6ab0227b6bd60911234e5d818587783/benchmark/DenseCap_Metrics/pycocoevalcap/spice/lib/json-simple-1.1.1.jar -------------------------------------------------------------------------------- /benchmark/DenseCap_Metrics/pycocoevalcap/spice/lib/junit-4.12.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sterzhang/image-textualization/4c72f75bf6ab0227b6bd60911234e5d818587783/benchmark/DenseCap_Metrics/pycocoevalcap/spice/lib/junit-4.12.jar -------------------------------------------------------------------------------- /benchmark/DenseCap_Metrics/pycocoevalcap/spice/lib/lmdbjni-0.4.6.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sterzhang/image-textualization/4c72f75bf6ab0227b6bd60911234e5d818587783/benchmark/DenseCap_Metrics/pycocoevalcap/spice/lib/lmdbjni-0.4.6.jar -------------------------------------------------------------------------------- /benchmark/DenseCap_Metrics/pycocoevalcap/spice/lib/lmdbjni-linux64-0.4.6.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sterzhang/image-textualization/4c72f75bf6ab0227b6bd60911234e5d818587783/benchmark/DenseCap_Metrics/pycocoevalcap/spice/lib/lmdbjni-linux64-0.4.6.jar -------------------------------------------------------------------------------- /benchmark/DenseCap_Metrics/pycocoevalcap/spice/lib/lmdbjni-osx64-0.4.6.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sterzhang/image-textualization/4c72f75bf6ab0227b6bd60911234e5d818587783/benchmark/DenseCap_Metrics/pycocoevalcap/spice/lib/lmdbjni-osx64-0.4.6.jar -------------------------------------------------------------------------------- /benchmark/DenseCap_Metrics/pycocoevalcap/spice/lib/lmdbjni-win64-0.4.6.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sterzhang/image-textualization/4c72f75bf6ab0227b6bd60911234e5d818587783/benchmark/DenseCap_Metrics/pycocoevalcap/spice/lib/lmdbjni-win64-0.4.6.jar -------------------------------------------------------------------------------- /benchmark/DenseCap_Metrics/pycocoevalcap/spice/lib/objenesis-2.4.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sterzhang/image-textualization/4c72f75bf6ab0227b6bd60911234e5d818587783/benchmark/DenseCap_Metrics/pycocoevalcap/spice/lib/objenesis-2.4.jar -------------------------------------------------------------------------------- /benchmark/DenseCap_Metrics/pycocoevalcap/spice/lib/slf4j-api-1.7.12.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sterzhang/image-textualization/4c72f75bf6ab0227b6bd60911234e5d818587783/benchmark/DenseCap_Metrics/pycocoevalcap/spice/lib/slf4j-api-1.7.12.jar -------------------------------------------------------------------------------- /benchmark/DenseCap_Metrics/pycocoevalcap/spice/lib/slf4j-simple-1.7.21.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sterzhang/image-textualization/4c72f75bf6ab0227b6bd60911234e5d818587783/benchmark/DenseCap_Metrics/pycocoevalcap/spice/lib/slf4j-simple-1.7.21.jar -------------------------------------------------------------------------------- /benchmark/DenseCap_Metrics/pycocoevalcap/spice/spice-1.0.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sterzhang/image-textualization/4c72f75bf6ab0227b6bd60911234e5d818587783/benchmark/DenseCap_Metrics/pycocoevalcap/spice/spice-1.0.jar -------------------------------------------------------------------------------- /benchmark/DenseCap_Metrics/pycocoevalcap/spice/tmp/tmpy5tu8h2v: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sterzhang/image-textualization/4c72f75bf6ab0227b6bd60911234e5d818587783/benchmark/DenseCap_Metrics/pycocoevalcap/spice/tmp/tmpy5tu8h2v -------------------------------------------------------------------------------- /benchmark/DenseCap_Metrics/pycocoevalcap/tokenizer/__init__.py: -------------------------------------------------------------------------------- 1 | __author__ = 'hfang' 2 | -------------------------------------------------------------------------------- /benchmark/DenseCap_Metrics/pycocoevalcap/tokenizer/stanford-corenlp-3.4.1.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sterzhang/image-textualization/4c72f75bf6ab0227b6bd60911234e5d818587783/benchmark/DenseCap_Metrics/pycocoevalcap/tokenizer/stanford-corenlp-3.4.1.jar -------------------------------------------------------------------------------- /benchmark/DenseCap_Metrics/pycocoevalcap/wmd/data/stopwords.txt: -------------------------------------------------------------------------------- 1 | i me my myself we our ours ourselves you your yours yourself yourselves he him his himself she her hers herself it its itself they them their theirs themselves what which who whom this that these those am is are was were be been being have has had having do does did doing a an the and but if or because as until while of at by for with about against between into through during before after above below to from up down in out on off over under again further then once here there when where why how all any both each few more most other some such no nor not only own same so than too very s t can will just don should now d ll m o re ve y ain aren couldn didn doesn hadn hasn haven isn ma mightn mustn needn shan shouldn wasn weren won wouldn -------------------------------------------------------------------------------- /benchmark/t2iGen/eval_t2i.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | if [ "$#" -lt 2 ]; then 4 | echo "Usage: $0 [seed2] ... [seedN]" 5 | exit 1 6 | fi 7 | 8 | cuda_device=$1 9 | shift 10 | seeds=("$@") 11 | 12 | json_path="your.jsonl" 13 | 14 | trap 'echo "Script interrupted."; exit' SIGINT 15 | 16 | for seed in "${seeds[@]}"; do 17 | record_dir="your-path/outputs/record_${seed}.jsonl" 18 | 19 | echo "Running with seed $seed on $cuda_device..." 20 | python ./benchmark/t2iGen/eval_t2igen.py --json_path $json_path --start_line 0 --end_line 3000 --seed $seed --device $cuda_device --record_dir $record_dir 21 | 22 | # 检查上一个命令的退出状态,如果失败则停止执行 23 | if [ $? -ne 0 ]; then 24 | echo "Error encountered. Exiting." 25 | exit 1 26 | fi 27 | done 28 | 29 | echo "All runs completed." 30 | 31 | 32 | -------------------------------------------------------------------------------- /extract/configs/GRiT_B_DenseCap.yaml: -------------------------------------------------------------------------------- 1 | _BASE_: "Base.yaml" 2 | MODEL: 3 | TRAIN_TASK: ["DenseCap"] 4 | TEST_TASK: "DenseCap" 5 | MASK_ON: False 6 | ROI_HEADS: 7 | SOFT_NMS_ENABLED: False 8 | BEAM_SIZE: 1 9 | WEIGHTS: "detectron2://ImageNetPretrained/MAE/mae_pretrain_vit_base.pth" 10 | BACKBONE: 11 | NAME: build_vit_fpn_backbone 12 | VIT_LAYERS: 12 13 | SOLVER: 14 | VIT_LAYER_DECAY_RATE: 0.7 15 | DATASETS: 16 | TRAIN: ("vg_train",) 17 | TEST: ("vg_test",) 18 | DATALOADER: 19 | DATASET_BS: 2 20 | OUTPUT_DIR: "./output/GRiT_B_DenseCap" -------------------------------------------------------------------------------- /extract/configs/GRiT_B_DenseCap_ObjectDet.yaml: -------------------------------------------------------------------------------- 1 | _BASE_: "Base.yaml" 2 | MODEL: 3 | TRAIN_TASK: ["ObjectDet", "DenseCap"] 4 | TEST_TASK: "DenseCap" # DenseCap or ObjectDet: Choose one for testing 5 | MASK_ON: True 6 | ROI_HEADS: 7 | SOFT_NMS_ENABLED: False 8 | BEAM_SIZE: 1 9 | WEIGHTS: "detectron2://ImageNetPretrained/MAE/mae_pretrain_vit_base.pth" 10 | BACKBONE: 11 | NAME: build_vit_fpn_backbone 12 | VIT_LAYERS: 12 13 | SOLVER: 14 | VIT_LAYER_DECAY_RATE: 0.7 15 | DATASETS: 16 | TRAIN: ("GRiT_coco2017_train", "vg_train") 17 | TEST: ("coco_2017_test-dev",) 18 | DATALOADER: 19 | DATASET_RATIO: [1, 1] 20 | DATASET_BS: 2 21 | DATASET_INPUT_SIZE: [1024, 1024] 22 | DATASET_INPUT_SCALE: [[0.1, 2.0], [0.1, 2.0]] 23 | OUTPUT_DIR: "./output/GRiT_B_DenseCap_ObjectDet" -------------------------------------------------------------------------------- /extract/configs/GRiT_B_ObjectDet.yaml: -------------------------------------------------------------------------------- 1 | _BASE_: "Base.yaml" 2 | MODEL: 3 | TRAIN_TASK: ["ObjectDet"] 4 | TEST_TASK: "ObjectDet" 5 | MASK_ON: True 6 | ROI_HEADS: 7 | SOFT_NMS_ENABLED: True 8 | BEAM_SIZE: 3 9 | WEIGHTS: "detectron2://ImageNetPretrained/MAE/mae_pretrain_vit_base.pth" 10 | BACKBONE: 11 | NAME: build_vit_fpn_backbone 12 | VIT_LAYERS: 12 13 | SOLVER: 14 | VIT_LAYER_DECAY_RATE: 0.7 15 | DATASETS: 16 | TRAIN: ("GRiT_coco2017_train",) 17 | TEST: ("coco_2017_val",) 18 | DATALOADER: 19 | DATASET_BS: 2 20 | OUTPUT_DIR: "./output/GRiT_B_ObjectDet" -------------------------------------------------------------------------------- /extract/configs/GRiT_H_ObjectDet.yaml: -------------------------------------------------------------------------------- 1 | _BASE_: "Base.yaml" 2 | MODEL: 3 | TRAIN_TASK: ["ObjectDet"] 4 | TEST_TASK: "ObjectDet" 5 | MASK_ON: True 6 | ROI_HEADS: 7 | SOFT_NMS_ENABLED: True 8 | BEAM_SIZE: 3 9 | WEIGHTS: "detectron2://ImageNetPretrained/MAE/mae_pretrain_vit_huge_p14to16.pth" 10 | BACKBONE: 11 | NAME: build_vit_fpn_backbone_huge 12 | VIT_LAYERS: 32 13 | SOLVER: 14 | MAX_ITER: 135000 15 | VIT_LAYER_DECAY_RATE: 0.9 16 | DATASETS: 17 | TRAIN: ("GRiT_coco2017_train",) 18 | TEST: ("coco_2017_val",) 19 | DATALOADER: 20 | DATASET_BS: 1 21 | OUTPUT_DIR: "./output/GRiT_H_ObjectDet" -------------------------------------------------------------------------------- /extract/configs/GRiT_L_ObjectDet.yaml: -------------------------------------------------------------------------------- 1 | _BASE_: "Base.yaml" 2 | MODEL: 3 | TRAIN_TASK: ["ObjectDet"] 4 | TEST_TASK: "ObjectDet" 5 | MASK_ON: True 6 | ROI_HEADS: 7 | SOFT_NMS_ENABLED: True 8 | BEAM_SIZE: 3 9 | WEIGHTS: "detectron2://ImageNetPretrained/MAE/mae_pretrain_vit_large.pth" 10 | BACKBONE: 11 | NAME: build_vit_fpn_backbone_large 12 | VIT_LAYERS: 24 13 | SOLVER: 14 | VIT_LAYER_DECAY_RATE: 0.8 15 | DATASETS: 16 | TRAIN: ("GRiT_coco2017_train",) 17 | TEST: ("coco_2017_val",) 18 | DATALOADER: 19 | DATASET_BS: 1 20 | OUTPUT_DIR: "./output/GRiT_L_ObjectDet" -------------------------------------------------------------------------------- /extract/grit/__init__.py: -------------------------------------------------------------------------------- 1 | from .modeling.meta_arch import grit 2 | from .modeling.roi_heads import grit_roi_heads 3 | from .modeling.backbone import vit 4 | 5 | from .data.datasets import object365 6 | from .data.datasets import vg 7 | from .data.datasets import grit_coco -------------------------------------------------------------------------------- /extract/grit/__pycache__/__init__.cpython-310.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sterzhang/image-textualization/4c72f75bf6ab0227b6bd60911234e5d818587783/extract/grit/__pycache__/__init__.cpython-310.pyc -------------------------------------------------------------------------------- /extract/grit/__pycache__/__init__.cpython-38.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sterzhang/image-textualization/4c72f75bf6ab0227b6bd60911234e5d818587783/extract/grit/__pycache__/__init__.cpython-38.pyc -------------------------------------------------------------------------------- /extract/grit/__pycache__/config.cpython-310.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sterzhang/image-textualization/4c72f75bf6ab0227b6bd60911234e5d818587783/extract/grit/__pycache__/config.cpython-310.pyc -------------------------------------------------------------------------------- /extract/grit/__pycache__/config.cpython-38.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sterzhang/image-textualization/4c72f75bf6ab0227b6bd60911234e5d818587783/extract/grit/__pycache__/config.cpython-38.pyc -------------------------------------------------------------------------------- /extract/grit/__pycache__/predictor.cpython-310.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sterzhang/image-textualization/4c72f75bf6ab0227b6bd60911234e5d818587783/extract/grit/__pycache__/predictor.cpython-310.pyc -------------------------------------------------------------------------------- /extract/grit/__pycache__/predictor.cpython-38.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sterzhang/image-textualization/4c72f75bf6ab0227b6bd60911234e5d818587783/extract/grit/__pycache__/predictor.cpython-38.pyc -------------------------------------------------------------------------------- /extract/grit/data/__pycache__/custom_build_augmentation.cpython-310.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sterzhang/image-textualization/4c72f75bf6ab0227b6bd60911234e5d818587783/extract/grit/data/__pycache__/custom_build_augmentation.cpython-310.pyc -------------------------------------------------------------------------------- /extract/grit/data/__pycache__/custom_build_augmentation.cpython-38.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sterzhang/image-textualization/4c72f75bf6ab0227b6bd60911234e5d818587783/extract/grit/data/__pycache__/custom_build_augmentation.cpython-38.pyc -------------------------------------------------------------------------------- /extract/grit/data/__pycache__/custom_dataset_mapper.cpython-310.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sterzhang/image-textualization/4c72f75bf6ab0227b6bd60911234e5d818587783/extract/grit/data/__pycache__/custom_dataset_mapper.cpython-310.pyc -------------------------------------------------------------------------------- /extract/grit/data/__pycache__/custom_dataset_mapper.cpython-38.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sterzhang/image-textualization/4c72f75bf6ab0227b6bd60911234e5d818587783/extract/grit/data/__pycache__/custom_dataset_mapper.cpython-38.pyc -------------------------------------------------------------------------------- /extract/grit/data/datasets/__pycache__/grit_coco.cpython-310.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sterzhang/image-textualization/4c72f75bf6ab0227b6bd60911234e5d818587783/extract/grit/data/datasets/__pycache__/grit_coco.cpython-310.pyc -------------------------------------------------------------------------------- /extract/grit/data/datasets/__pycache__/grit_coco.cpython-38.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sterzhang/image-textualization/4c72f75bf6ab0227b6bd60911234e5d818587783/extract/grit/data/datasets/__pycache__/grit_coco.cpython-38.pyc -------------------------------------------------------------------------------- /extract/grit/data/datasets/__pycache__/object365.cpython-310.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sterzhang/image-textualization/4c72f75bf6ab0227b6bd60911234e5d818587783/extract/grit/data/datasets/__pycache__/object365.cpython-310.pyc -------------------------------------------------------------------------------- /extract/grit/data/datasets/__pycache__/object365.cpython-38.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sterzhang/image-textualization/4c72f75bf6ab0227b6bd60911234e5d818587783/extract/grit/data/datasets/__pycache__/object365.cpython-38.pyc -------------------------------------------------------------------------------- /extract/grit/data/datasets/__pycache__/vg.cpython-310.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sterzhang/image-textualization/4c72f75bf6ab0227b6bd60911234e5d818587783/extract/grit/data/datasets/__pycache__/vg.cpython-310.pyc -------------------------------------------------------------------------------- /extract/grit/data/datasets/__pycache__/vg.cpython-38.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sterzhang/image-textualization/4c72f75bf6ab0227b6bd60911234e5d818587783/extract/grit/data/datasets/__pycache__/vg.cpython-38.pyc -------------------------------------------------------------------------------- /extract/grit/data/transforms/__pycache__/custom_augmentation_impl.cpython-310.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sterzhang/image-textualization/4c72f75bf6ab0227b6bd60911234e5d818587783/extract/grit/data/transforms/__pycache__/custom_augmentation_impl.cpython-310.pyc -------------------------------------------------------------------------------- /extract/grit/data/transforms/__pycache__/custom_augmentation_impl.cpython-38.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sterzhang/image-textualization/4c72f75bf6ab0227b6bd60911234e5d818587783/extract/grit/data/transforms/__pycache__/custom_augmentation_impl.cpython-38.pyc -------------------------------------------------------------------------------- /extract/grit/data/transforms/__pycache__/custom_transform.cpython-310.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sterzhang/image-textualization/4c72f75bf6ab0227b6bd60911234e5d818587783/extract/grit/data/transforms/__pycache__/custom_transform.cpython-310.pyc -------------------------------------------------------------------------------- /extract/grit/data/transforms/__pycache__/custom_transform.cpython-38.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sterzhang/image-textualization/4c72f75bf6ab0227b6bd60911234e5d818587783/extract/grit/data/transforms/__pycache__/custom_transform.cpython-38.pyc -------------------------------------------------------------------------------- /extract/grit/modeling/__pycache__/soft_nms.cpython-310.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sterzhang/image-textualization/4c72f75bf6ab0227b6bd60911234e5d818587783/extract/grit/modeling/__pycache__/soft_nms.cpython-310.pyc -------------------------------------------------------------------------------- /extract/grit/modeling/__pycache__/soft_nms.cpython-38.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sterzhang/image-textualization/4c72f75bf6ab0227b6bd60911234e5d818587783/extract/grit/modeling/__pycache__/soft_nms.cpython-38.pyc -------------------------------------------------------------------------------- /extract/grit/modeling/backbone/__pycache__/utils.cpython-310.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sterzhang/image-textualization/4c72f75bf6ab0227b6bd60911234e5d818587783/extract/grit/modeling/backbone/__pycache__/utils.cpython-310.pyc -------------------------------------------------------------------------------- /extract/grit/modeling/backbone/__pycache__/utils.cpython-38.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sterzhang/image-textualization/4c72f75bf6ab0227b6bd60911234e5d818587783/extract/grit/modeling/backbone/__pycache__/utils.cpython-38.pyc -------------------------------------------------------------------------------- /extract/grit/modeling/backbone/__pycache__/vit.cpython-310.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sterzhang/image-textualization/4c72f75bf6ab0227b6bd60911234e5d818587783/extract/grit/modeling/backbone/__pycache__/vit.cpython-310.pyc -------------------------------------------------------------------------------- /extract/grit/modeling/backbone/__pycache__/vit.cpython-38.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sterzhang/image-textualization/4c72f75bf6ab0227b6bd60911234e5d818587783/extract/grit/modeling/backbone/__pycache__/vit.cpython-38.pyc -------------------------------------------------------------------------------- /extract/grit/modeling/meta_arch/__pycache__/grit.cpython-310.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sterzhang/image-textualization/4c72f75bf6ab0227b6bd60911234e5d818587783/extract/grit/modeling/meta_arch/__pycache__/grit.cpython-310.pyc -------------------------------------------------------------------------------- /extract/grit/modeling/meta_arch/__pycache__/grit.cpython-38.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sterzhang/image-textualization/4c72f75bf6ab0227b6bd60911234e5d818587783/extract/grit/modeling/meta_arch/__pycache__/grit.cpython-38.pyc -------------------------------------------------------------------------------- /extract/grit/modeling/roi_heads/__pycache__/grit_fast_rcnn.cpython-310.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sterzhang/image-textualization/4c72f75bf6ab0227b6bd60911234e5d818587783/extract/grit/modeling/roi_heads/__pycache__/grit_fast_rcnn.cpython-310.pyc -------------------------------------------------------------------------------- /extract/grit/modeling/roi_heads/__pycache__/grit_fast_rcnn.cpython-38.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sterzhang/image-textualization/4c72f75bf6ab0227b6bd60911234e5d818587783/extract/grit/modeling/roi_heads/__pycache__/grit_fast_rcnn.cpython-38.pyc -------------------------------------------------------------------------------- /extract/grit/modeling/roi_heads/__pycache__/grit_roi_heads.cpython-310.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sterzhang/image-textualization/4c72f75bf6ab0227b6bd60911234e5d818587783/extract/grit/modeling/roi_heads/__pycache__/grit_roi_heads.cpython-310.pyc -------------------------------------------------------------------------------- /extract/grit/modeling/roi_heads/__pycache__/grit_roi_heads.cpython-38.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sterzhang/image-textualization/4c72f75bf6ab0227b6bd60911234e5d818587783/extract/grit/modeling/roi_heads/__pycache__/grit_roi_heads.cpython-38.pyc -------------------------------------------------------------------------------- /extract/grit/modeling/text/__pycache__/file_utils.cpython-310.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sterzhang/image-textualization/4c72f75bf6ab0227b6bd60911234e5d818587783/extract/grit/modeling/text/__pycache__/file_utils.cpython-310.pyc -------------------------------------------------------------------------------- /extract/grit/modeling/text/__pycache__/file_utils.cpython-38.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sterzhang/image-textualization/4c72f75bf6ab0227b6bd60911234e5d818587783/extract/grit/modeling/text/__pycache__/file_utils.cpython-38.pyc -------------------------------------------------------------------------------- /extract/grit/modeling/text/__pycache__/load_text_token.cpython-310.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sterzhang/image-textualization/4c72f75bf6ab0227b6bd60911234e5d818587783/extract/grit/modeling/text/__pycache__/load_text_token.cpython-310.pyc -------------------------------------------------------------------------------- /extract/grit/modeling/text/__pycache__/load_text_token.cpython-38.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sterzhang/image-textualization/4c72f75bf6ab0227b6bd60911234e5d818587783/extract/grit/modeling/text/__pycache__/load_text_token.cpython-38.pyc -------------------------------------------------------------------------------- /extract/grit/modeling/text/__pycache__/modeling_bert.cpython-310.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sterzhang/image-textualization/4c72f75bf6ab0227b6bd60911234e5d818587783/extract/grit/modeling/text/__pycache__/modeling_bert.cpython-310.pyc -------------------------------------------------------------------------------- /extract/grit/modeling/text/__pycache__/modeling_bert.cpython-38.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sterzhang/image-textualization/4c72f75bf6ab0227b6bd60911234e5d818587783/extract/grit/modeling/text/__pycache__/modeling_bert.cpython-38.pyc -------------------------------------------------------------------------------- /extract/grit/modeling/text/__pycache__/text_decoder.cpython-310.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sterzhang/image-textualization/4c72f75bf6ab0227b6bd60911234e5d818587783/extract/grit/modeling/text/__pycache__/text_decoder.cpython-310.pyc -------------------------------------------------------------------------------- /extract/grit/modeling/text/__pycache__/text_decoder.cpython-38.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sterzhang/image-textualization/4c72f75bf6ab0227b6bd60911234e5d818587783/extract/grit/modeling/text/__pycache__/text_decoder.cpython-38.pyc -------------------------------------------------------------------------------- /extract/third_party/CenterNet2/.flake8: -------------------------------------------------------------------------------- 1 | # This is an example .flake8 config, used when developing *Black* itself. 2 | # Keep in sync with setup.cfg which is used for source packages. 3 | 4 | [flake8] 5 | ignore = W503, E203, E221, C901, C408, E741, C407, B017 6 | max-line-length = 100 7 | max-complexity = 18 8 | select = B,C,E,F,W,T4,B9 9 | exclude = build 10 | per-file-ignores = 11 | **/__init__.py:F401,F403,E402 12 | **/configs/**.py:F401,E402 13 | configs/**.py:F401,E402 14 | **/tests/config/**.py:F401,E402 15 | tests/config/**.py:F401,E402 16 | -------------------------------------------------------------------------------- /extract/third_party/CenterNet2/.github/CODE_OF_CONDUCT.md: -------------------------------------------------------------------------------- 1 | # Code of Conduct 2 | 3 | Facebook has adopted a Code of Conduct that we expect project participants to adhere to. 4 | Please read the [full text](https://code.fb.com/codeofconduct/) 5 | so that you can understand what actions will and will not be tolerated. 6 | -------------------------------------------------------------------------------- /extract/third_party/CenterNet2/.github/ISSUE_TEMPLATE.md: -------------------------------------------------------------------------------- 1 | 2 | Please select an issue template from 3 | https://github.com/facebookresearch/detectron2/issues/new/choose . 4 | 5 | Otherwise your issue will be closed. 6 | -------------------------------------------------------------------------------- /extract/third_party/CenterNet2/.github/ISSUE_TEMPLATE/bugs.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: "🐛 Bugs" 3 | about: Report bugs in detectron2 4 | title: Please read & provide the following 5 | 6 | --- 7 | 8 | ## Instructions To Reproduce the 🐛 Bug: 9 | 1. Full runnable code or full changes you made: 10 | ``` 11 | If making changes to the project itself, please use output of the following command: 12 | git rev-parse HEAD; git diff 13 | 14 | 15 | ``` 16 | 2. What exact command you run: 17 | 3. __Full logs__ or other relevant observations: 18 | ``` 19 | 20 | ``` 21 | 4. please simplify the steps as much as possible so they do not require additional resources to 22 | run, such as a private dataset. 23 | 24 | ## Expected behavior: 25 | 26 | If there are no obvious error in "full logs" provided above, 27 | please tell us the expected behavior. 28 | 29 | ## Environment: 30 | 31 | Provide your environment information using the following command: 32 | ``` 33 | wget -nc -q https://github.com/facebookresearch/detectron2/raw/main/detectron2/utils/collect_env.py && python collect_env.py 34 | ``` 35 | 36 | If your issue looks like an installation issue / environment issue, 37 | please first try to solve it yourself with the instructions in 38 | https://detectron2.readthedocs.io/tutorials/install.html#common-installation-issues 39 | -------------------------------------------------------------------------------- /extract/third_party/CenterNet2/.github/ISSUE_TEMPLATE/config.yml: -------------------------------------------------------------------------------- 1 | # require an issue template to be chosen 2 | blank_issues_enabled: false 3 | 4 | contact_links: 5 | - name: How-To / All Other Questions 6 | url: https://github.com/facebookresearch/detectron2/discussions 7 | about: Use "github discussions" for community support on general questions that don't belong to the above issue categories 8 | - name: Detectron2 Documentation 9 | url: https://detectron2.readthedocs.io/index.html 10 | about: Check if your question is answered in tutorials or API docs 11 | 12 | # Unexpected behaviors & bugs are split to two templates. 13 | # When they are one template, users think "it's not a bug" and don't choose the template. 14 | # 15 | # But the file name is still "unexpected-problems-bugs.md" so that old references 16 | # to this issue template still works. 17 | # It's ok since this template should be a superset of "bugs.md" (unexpected behaviors is a superset of bugs) 18 | -------------------------------------------------------------------------------- /extract/third_party/CenterNet2/.github/ISSUE_TEMPLATE/documentation.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: "\U0001F4DA Documentation Issue" 3 | about: Report a problem about existing documentation, comments, website or tutorials. 4 | labels: documentation 5 | 6 | --- 7 | 8 | ## 📚 Documentation Issue 9 | 10 | This issue category is for problems about existing documentation, not for asking how-to questions. 11 | 12 | * Provide a link to an existing documentation/comment/tutorial: 13 | 14 | * How should the above documentation/comment/tutorial improve: 15 | -------------------------------------------------------------------------------- /extract/third_party/CenterNet2/.github/ISSUE_TEMPLATE/feature-request.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: "\U0001F680Feature Request" 3 | about: Suggest an improvement or new feature 4 | labels: enhancement 5 | 6 | --- 7 | 8 | ## 🚀 Feature 9 | A clear and concise description of the feature proposal. 10 | 11 | ## Motivation & Examples 12 | 13 | Tell us why the feature is useful. 14 | 15 | Describe what the feature would look like, if it is implemented. 16 | Best demonstrated using **code examples** in addition to words. 17 | 18 | ## Note 19 | 20 | We only consider adding new features if they are relevant to many users. 21 | 22 | If you request implementation of research papers -- we only consider papers that have enough significance and prevalance in the object detection field. 23 | 24 | We do not take requests for most projects in the `projects/` directory, because they are research code release that is mainly for other researchers to reproduce results. 25 | 26 | "Make X faster/accurate" is not a valid feature request. "Implement a concrete feature that can make X faster/accurate" can be a valid feature request. 27 | 28 | Instead of adding features inside detectron2, 29 | you can implement many features by [extending detectron2](https://detectron2.readthedocs.io/tutorials/extend.html). 30 | The [projects/](https://github.com/facebookresearch/detectron2/tree/main/projects/) directory contains many of such examples. 31 | 32 | -------------------------------------------------------------------------------- /extract/third_party/CenterNet2/.github/pull_request_template.md: -------------------------------------------------------------------------------- 1 | Thanks for your contribution! 2 | 3 | If you're sending a large PR (e.g., >100 lines), 4 | please open an issue first about the feature / bug, and indicate how you want to contribute. 5 | 6 | We do not always accept features. 7 | See https://detectron2.readthedocs.io/notes/contributing.html#pull-requests about how we handle PRs. 8 | 9 | Before submitting a PR, please run `dev/linter.sh` to lint the code. 10 | 11 | -------------------------------------------------------------------------------- /extract/third_party/CenterNet2/.github/workflows/remove-needs-reply.yml: -------------------------------------------------------------------------------- 1 | name: Remove needs-more-info label 2 | 3 | on: 4 | issue_comment: 5 | types: [created] 6 | issues: 7 | types: [edited] 8 | 9 | jobs: 10 | remove-needs-more-info-label: 11 | runs-on: ubuntu-latest 12 | # 1. issue_comment events could include PR comment, filter them out 13 | # 2. Only trigger action if event was produced by the original author 14 | if: ${{ !github.event.issue.pull_request && github.event.sender.login == github.event.issue.user.login }} 15 | steps: 16 | - name: Remove needs-more-info label 17 | uses: octokit/request-action@v2.x 18 | continue-on-error: true 19 | with: 20 | route: DELETE /repos/:repository/issues/:issue/labels/:label 21 | repository: ${{ github.repository }} 22 | issue: ${{ github.event.issue.number }} 23 | label: needs-more-info 24 | env: 25 | GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} 26 | -------------------------------------------------------------------------------- /extract/third_party/CenterNet2/.gitignore: -------------------------------------------------------------------------------- 1 | slurm* 2 | # output dir 3 | output 4 | instant_test_output 5 | inference_test_output 6 | 7 | 8 | *.png 9 | *.json 10 | *.diff 11 | # *.jpg 12 | !/projects/DensePose/doc/images/*.jpg 13 | 14 | # compilation and distribution 15 | __pycache__ 16 | _ext 17 | *.pyc 18 | *.pyd 19 | *.so 20 | *.dll 21 | *.egg-info/ 22 | build/ 23 | dist/ 24 | wheels/ 25 | 26 | # pytorch/python/numpy formats 27 | *.pth 28 | *.pkl 29 | *.npy 30 | *.ts 31 | model_ts*.txt 32 | 33 | # ipython/jupyter notebooks 34 | *.ipynb 35 | **/.ipynb_checkpoints/ 36 | 37 | # Editor temporaries 38 | *.swn 39 | *.swo 40 | *.swp 41 | *~ 42 | 43 | # editor settings 44 | .idea 45 | .vscode 46 | _darcs 47 | 48 | # project dirs 49 | /detectron2/model_zoo/configs 50 | /datasets/* 51 | !/datasets/*.* 52 | !/datasets/lvis/ 53 | /datasets/lvis/* 54 | !/datasets/lvis/lvis_v1_train_cat_info.json 55 | /projects/*/datasets 56 | /models 57 | /snippet 58 | -------------------------------------------------------------------------------- /extract/third_party/CenterNet2/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 | -------------------------------------------------------------------------------- /extract/third_party/CenterNet2/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 | -------------------------------------------------------------------------------- /extract/third_party/CenterNet2/configs/Base-RCNN-FPN.yaml: -------------------------------------------------------------------------------- 1 | MODEL: 2 | META_ARCHITECTURE: "GeneralizedRCNN" 3 | BACKBONE: 4 | NAME: "build_resnet_fpn_backbone" 5 | RESNETS: 6 | OUT_FEATURES: ["res2", "res3", "res4", "res5"] 7 | FPN: 8 | IN_FEATURES: ["res2", "res3", "res4", "res5"] 9 | ANCHOR_GENERATOR: 10 | SIZES: [[32], [64], [128], [256], [512]] # One size for each in feature map 11 | ASPECT_RATIOS: [[0.5, 1.0, 2.0]] # Three aspect ratios (same for all in feature maps) 12 | RPN: 13 | IN_FEATURES: ["p2", "p3", "p4", "p5", "p6"] 14 | PRE_NMS_TOPK_TRAIN: 2000 # Per FPN level 15 | PRE_NMS_TOPK_TEST: 1000 # Per FPN level 16 | # Detectron1 uses 2000 proposals per-batch, 17 | # (See "modeling/rpn/rpn_outputs.py" for details of this legacy issue) 18 | # which is approximately 1000 proposals per-image since the default batch size for FPN is 2. 19 | POST_NMS_TOPK_TRAIN: 1000 20 | POST_NMS_TOPK_TEST: 1000 21 | ROI_HEADS: 22 | NAME: "StandardROIHeads" 23 | IN_FEATURES: ["p2", "p3", "p4", "p5"] 24 | ROI_BOX_HEAD: 25 | NAME: "FastRCNNConvFCHead" 26 | NUM_FC: 2 27 | POOLER_RESOLUTION: 7 28 | ROI_MASK_HEAD: 29 | NAME: "MaskRCNNConvUpsampleHead" 30 | NUM_CONV: 4 31 | POOLER_RESOLUTION: 14 32 | DATASETS: 33 | TRAIN: ("coco_2017_train",) 34 | TEST: ("coco_2017_val",) 35 | SOLVER: 36 | IMS_PER_BATCH: 16 37 | BASE_LR: 0.02 38 | STEPS: (60000, 80000) 39 | MAX_ITER: 90000 40 | INPUT: 41 | MIN_SIZE_TRAIN: (640, 672, 704, 736, 768, 800) 42 | VERSION: 2 43 | -------------------------------------------------------------------------------- /extract/third_party/CenterNet2/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 | -------------------------------------------------------------------------------- /extract/third_party/CenterNet2/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 | -------------------------------------------------------------------------------- /extract/third_party/CenterNet2/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 | -------------------------------------------------------------------------------- /extract/third_party/CenterNet2/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 | -------------------------------------------------------------------------------- /extract/third_party/CenterNet2/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 | -------------------------------------------------------------------------------- /extract/third_party/CenterNet2/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 | -------------------------------------------------------------------------------- /extract/third_party/CenterNet2/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 | -------------------------------------------------------------------------------- /extract/third_party/CenterNet2/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 | -------------------------------------------------------------------------------- /extract/third_party/CenterNet2/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 | -------------------------------------------------------------------------------- /extract/third_party/CenterNet2/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 | -------------------------------------------------------------------------------- /extract/third_party/CenterNet2/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 | -------------------------------------------------------------------------------- /extract/third_party/CenterNet2/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 | -------------------------------------------------------------------------------- /extract/third_party/CenterNet2/configs/COCO-Detection/fcos_R_50_FPN_1x.py: -------------------------------------------------------------------------------- 1 | from ..common.optim import SGD as optimizer 2 | from ..common.coco_schedule import lr_multiplier_1x as lr_multiplier 3 | from ..common.data.coco import dataloader 4 | from ..common.models.fcos import model 5 | from ..common.train import train 6 | 7 | dataloader.train.mapper.use_instance_mask = False 8 | optimizer.lr = 0.01 9 | 10 | model.backbone.bottom_up.freeze_at = 2 11 | train.init_checkpoint = "detectron2://ImageNetPretrained/MSRA/R-50.pkl" 12 | -------------------------------------------------------------------------------- /extract/third_party/CenterNet2/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 | -------------------------------------------------------------------------------- /extract/third_party/CenterNet2/configs/COCO-Detection/retinanet_R_50_FPN_1x.py: -------------------------------------------------------------------------------- 1 | from ..common.optim import SGD as optimizer 2 | from ..common.coco_schedule import lr_multiplier_1x as lr_multiplier 3 | from ..common.data.coco import dataloader 4 | from ..common.models.retinanet import model 5 | from ..common.train import train 6 | 7 | dataloader.train.mapper.use_instance_mask = False 8 | model.backbone.bottom_up.freeze_at = 2 9 | optimizer.lr = 0.01 10 | 11 | train.init_checkpoint = "detectron2://ImageNetPretrained/MSRA/R-50.pkl" 12 | -------------------------------------------------------------------------------- /extract/third_party/CenterNet2/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 | -------------------------------------------------------------------------------- /extract/third_party/CenterNet2/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 | -------------------------------------------------------------------------------- /extract/third_party/CenterNet2/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 | -------------------------------------------------------------------------------- /extract/third_party/CenterNet2/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 | -------------------------------------------------------------------------------- /extract/third_party/CenterNet2/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 | -------------------------------------------------------------------------------- /extract/third_party/CenterNet2/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 | -------------------------------------------------------------------------------- /extract/third_party/CenterNet2/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 | -------------------------------------------------------------------------------- /extract/third_party/CenterNet2/configs/COCO-InstanceSegmentation/mask_rcnn_R_50_C4_1x.py: -------------------------------------------------------------------------------- 1 | from ..common.train import train 2 | from ..common.optim import SGD as optimizer 3 | from ..common.coco_schedule import lr_multiplier_1x as lr_multiplier 4 | from ..common.data.coco import dataloader 5 | from ..common.models.mask_rcnn_c4 import model 6 | 7 | model.backbone.freeze_at = 2 8 | train.init_checkpoint = "detectron2://ImageNetPretrained/MSRA/R-50.pkl" 9 | -------------------------------------------------------------------------------- /extract/third_party/CenterNet2/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 | -------------------------------------------------------------------------------- /extract/third_party/CenterNet2/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 | -------------------------------------------------------------------------------- /extract/third_party/CenterNet2/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 | -------------------------------------------------------------------------------- /extract/third_party/CenterNet2/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 | -------------------------------------------------------------------------------- /extract/third_party/CenterNet2/configs/COCO-InstanceSegmentation/mask_rcnn_R_50_FPN_1x.py: -------------------------------------------------------------------------------- 1 | from ..common.optim import SGD as optimizer 2 | from ..common.coco_schedule import lr_multiplier_1x as lr_multiplier 3 | from ..common.data.coco import dataloader 4 | from ..common.models.mask_rcnn_fpn import model 5 | from ..common.train import train 6 | 7 | model.backbone.bottom_up.freeze_at = 2 8 | train.init_checkpoint = "detectron2://ImageNetPretrained/MSRA/R-50.pkl" 9 | -------------------------------------------------------------------------------- /extract/third_party/CenterNet2/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 | -------------------------------------------------------------------------------- /extract/third_party/CenterNet2/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 | -------------------------------------------------------------------------------- /extract/third_party/CenterNet2/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 | -------------------------------------------------------------------------------- /extract/third_party/CenterNet2/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 | -------------------------------------------------------------------------------- /extract/third_party/CenterNet2/configs/COCO-InstanceSegmentation/mask_rcnn_regnetx_4gf_dds_fpn_1x.py: -------------------------------------------------------------------------------- 1 | from ..common.optim import SGD as optimizer 2 | from ..common.coco_schedule import lr_multiplier_1x as lr_multiplier 3 | from ..common.data.coco import dataloader 4 | from ..common.models.mask_rcnn_fpn import model 5 | from ..common.train import train 6 | 7 | from detectron2.config import LazyCall as L 8 | from detectron2.modeling.backbone import RegNet 9 | from detectron2.modeling.backbone.regnet import SimpleStem, ResBottleneckBlock 10 | 11 | 12 | # Replace default ResNet with RegNetX-4GF from the DDS paper. Config source: 13 | # https://github.com/facebookresearch/pycls/blob/2c152a6e5d913e898cca4f0a758f41e6b976714d/configs/dds_baselines/regnetx/RegNetX-4.0GF_dds_8gpu.yaml#L4-L9 # noqa 14 | model.backbone.bottom_up = L(RegNet)( 15 | stem_class=SimpleStem, 16 | stem_width=32, 17 | block_class=ResBottleneckBlock, 18 | depth=23, 19 | w_a=38.65, 20 | w_0=96, 21 | w_m=2.43, 22 | group_width=40, 23 | freeze_at=2, 24 | norm="FrozenBN", 25 | out_features=["s1", "s2", "s3", "s4"], 26 | ) 27 | model.pixel_std = [57.375, 57.120, 58.395] 28 | 29 | optimizer.weight_decay = 5e-5 30 | train.init_checkpoint = ( 31 | "https://dl.fbaipublicfiles.com/pycls/dds_baselines/160906383/RegNetX-4.0GF_dds_8gpu.pyth" 32 | ) 33 | # RegNets benefit from enabling cudnn benchmark mode 34 | train.cudnn_benchmark = True 35 | -------------------------------------------------------------------------------- /extract/third_party/CenterNet2/configs/COCO-InstanceSegmentation/mask_rcnn_regnety_4gf_dds_fpn_1x.py: -------------------------------------------------------------------------------- 1 | from ..common.optim import SGD as optimizer 2 | from ..common.coco_schedule import lr_multiplier_1x as lr_multiplier 3 | from ..common.data.coco import dataloader 4 | from ..common.models.mask_rcnn_fpn import model 5 | from ..common.train import train 6 | 7 | from detectron2.config import LazyCall as L 8 | from detectron2.modeling.backbone import RegNet 9 | from detectron2.modeling.backbone.regnet import SimpleStem, ResBottleneckBlock 10 | 11 | 12 | # Replace default ResNet with RegNetY-4GF from the DDS paper. Config source: 13 | # https://github.com/facebookresearch/pycls/blob/2c152a6e5d913e898cca4f0a758f41e6b976714d/configs/dds_baselines/regnety/RegNetY-4.0GF_dds_8gpu.yaml#L4-L10 # noqa 14 | model.backbone.bottom_up = L(RegNet)( 15 | stem_class=SimpleStem, 16 | stem_width=32, 17 | block_class=ResBottleneckBlock, 18 | depth=22, 19 | w_a=31.41, 20 | w_0=96, 21 | w_m=2.24, 22 | group_width=64, 23 | se_ratio=0.25, 24 | freeze_at=2, 25 | norm="FrozenBN", 26 | out_features=["s1", "s2", "s3", "s4"], 27 | ) 28 | model.pixel_std = [57.375, 57.120, 58.395] 29 | 30 | optimizer.weight_decay = 5e-5 31 | train.init_checkpoint = ( 32 | "https://dl.fbaipublicfiles.com/pycls/dds_baselines/160906838/RegNetY-4.0GF_dds_8gpu.pyth" 33 | ) 34 | # RegNets benefit from enabling cudnn benchmark mode 35 | train.cudnn_benchmark = True 36 | -------------------------------------------------------------------------------- /extract/third_party/CenterNet2/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 | -------------------------------------------------------------------------------- /extract/third_party/CenterNet2/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 | -------------------------------------------------------------------------------- /extract/third_party/CenterNet2/configs/COCO-Keypoints/keypoint_rcnn_R_50_FPN_1x.py: -------------------------------------------------------------------------------- 1 | from ..common.optim import SGD as optimizer 2 | from ..common.coco_schedule import lr_multiplier_1x as lr_multiplier 3 | from ..common.data.coco_keypoint import dataloader 4 | from ..common.models.keypoint_rcnn_fpn import model 5 | from ..common.train import train 6 | 7 | model.backbone.bottom_up.freeze_at = 2 8 | train.init_checkpoint = "detectron2://ImageNetPretrained/MSRA/R-50.pkl" 9 | -------------------------------------------------------------------------------- /extract/third_party/CenterNet2/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 | -------------------------------------------------------------------------------- /extract/third_party/CenterNet2/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 | -------------------------------------------------------------------------------- /extract/third_party/CenterNet2/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 | -------------------------------------------------------------------------------- /extract/third_party/CenterNet2/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 | -------------------------------------------------------------------------------- /extract/third_party/CenterNet2/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 | -------------------------------------------------------------------------------- /extract/third_party/CenterNet2/configs/COCO-PanopticSegmentation/panoptic_fpn_R_50_1x.py: -------------------------------------------------------------------------------- 1 | from ..common.optim import SGD as optimizer 2 | from ..common.coco_schedule import lr_multiplier_1x as lr_multiplier 3 | from ..common.data.coco_panoptic_separated import dataloader 4 | from ..common.models.panoptic_fpn import model 5 | from ..common.train import train 6 | 7 | model.backbone.bottom_up.freeze_at = 2 8 | train.init_checkpoint = "detectron2://ImageNetPretrained/MSRA/R-50.pkl" 9 | -------------------------------------------------------------------------------- /extract/third_party/CenterNet2/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 | -------------------------------------------------------------------------------- /extract/third_party/CenterNet2/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 | -------------------------------------------------------------------------------- /extract/third_party/CenterNet2/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 | -------------------------------------------------------------------------------- /extract/third_party/CenterNet2/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 | -------------------------------------------------------------------------------- /extract/third_party/CenterNet2/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 | -------------------------------------------------------------------------------- /extract/third_party/CenterNet2/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 | -------------------------------------------------------------------------------- /extract/third_party/CenterNet2/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 | -------------------------------------------------------------------------------- /extract/third_party/CenterNet2/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 | -------------------------------------------------------------------------------- /extract/third_party/CenterNet2/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 | -------------------------------------------------------------------------------- /extract/third_party/CenterNet2/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 | -------------------------------------------------------------------------------- /extract/third_party/CenterNet2/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 | -------------------------------------------------------------------------------- /extract/third_party/CenterNet2/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 | -------------------------------------------------------------------------------- /extract/third_party/CenterNet2/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 | -------------------------------------------------------------------------------- /extract/third_party/CenterNet2/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 | -------------------------------------------------------------------------------- /extract/third_party/CenterNet2/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 | -------------------------------------------------------------------------------- /extract/third_party/CenterNet2/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 | -------------------------------------------------------------------------------- /extract/third_party/CenterNet2/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 | -------------------------------------------------------------------------------- /extract/third_party/CenterNet2/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 | -------------------------------------------------------------------------------- /extract/third_party/CenterNet2/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 | -------------------------------------------------------------------------------- /extract/third_party/CenterNet2/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 | -------------------------------------------------------------------------------- /extract/third_party/CenterNet2/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 | -------------------------------------------------------------------------------- /extract/third_party/CenterNet2/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 | -------------------------------------------------------------------------------- /extract/third_party/CenterNet2/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 | -------------------------------------------------------------------------------- /extract/third_party/CenterNet2/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 | -------------------------------------------------------------------------------- /extract/third_party/CenterNet2/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 | -------------------------------------------------------------------------------- /extract/third_party/CenterNet2/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 | -------------------------------------------------------------------------------- /extract/third_party/CenterNet2/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 | -------------------------------------------------------------------------------- /extract/third_party/CenterNet2/configs/common/README.md: -------------------------------------------------------------------------------- 1 | This directory provides definitions for a few common models, dataloaders, scheduler, 2 | and optimizers that are often used in training. 3 | The definition of these objects are provided in the form of lazy instantiation: 4 | their arguments can be edited by users before constructing the objects. 5 | 6 | They can be imported, or loaded by `model_zoo.get_config` API in users' own configs. 7 | -------------------------------------------------------------------------------- /extract/third_party/CenterNet2/configs/common/data/coco.py: -------------------------------------------------------------------------------- 1 | from omegaconf import OmegaConf 2 | 3 | import detectron2.data.transforms as T 4 | from detectron2.config import LazyCall as L 5 | from detectron2.data import ( 6 | DatasetMapper, 7 | build_detection_test_loader, 8 | build_detection_train_loader, 9 | get_detection_dataset_dicts, 10 | ) 11 | from detectron2.evaluation import COCOEvaluator 12 | 13 | dataloader = OmegaConf.create() 14 | 15 | dataloader.train = L(build_detection_train_loader)( 16 | dataset=L(get_detection_dataset_dicts)(names="coco_2017_train"), 17 | mapper=L(DatasetMapper)( 18 | is_train=True, 19 | augmentations=[ 20 | L(T.ResizeShortestEdge)( 21 | short_edge_length=(640, 672, 704, 736, 768, 800), 22 | sample_style="choice", 23 | max_size=1333, 24 | ), 25 | L(T.RandomFlip)(horizontal=True), 26 | ], 27 | image_format="BGR", 28 | use_instance_mask=True, 29 | ), 30 | total_batch_size=16, 31 | num_workers=4, 32 | ) 33 | 34 | dataloader.test = L(build_detection_test_loader)( 35 | dataset=L(get_detection_dataset_dicts)(names="coco_2017_val", filter_empty=False), 36 | mapper=L(DatasetMapper)( 37 | is_train=False, 38 | augmentations=[ 39 | L(T.ResizeShortestEdge)(short_edge_length=800, max_size=1333), 40 | ], 41 | image_format="${...train.mapper.image_format}", 42 | ), 43 | num_workers=4, 44 | ) 45 | 46 | dataloader.evaluator = L(COCOEvaluator)( 47 | dataset_name="${..test.dataset.names}", 48 | ) 49 | -------------------------------------------------------------------------------- /extract/third_party/CenterNet2/configs/common/data/coco_keypoint.py: -------------------------------------------------------------------------------- 1 | from detectron2.data.detection_utils import create_keypoint_hflip_indices 2 | 3 | from .coco import dataloader 4 | 5 | dataloader.train.dataset.min_keypoints = 1 6 | dataloader.train.dataset.names = "keypoints_coco_2017_train" 7 | dataloader.test.dataset.names = "keypoints_coco_2017_val" 8 | 9 | dataloader.train.mapper.update( 10 | use_instance_mask=False, 11 | use_keypoint=True, 12 | keypoint_hflip_indices=create_keypoint_hflip_indices(dataloader.train.dataset.names), 13 | ) 14 | -------------------------------------------------------------------------------- /extract/third_party/CenterNet2/configs/common/data/coco_panoptic_separated.py: -------------------------------------------------------------------------------- 1 | from detectron2.config import LazyCall as L 2 | from detectron2.evaluation import ( 3 | COCOEvaluator, 4 | COCOPanopticEvaluator, 5 | DatasetEvaluators, 6 | SemSegEvaluator, 7 | ) 8 | 9 | from .coco import dataloader 10 | 11 | dataloader.train.dataset.names = "coco_2017_train_panoptic_separated" 12 | dataloader.train.dataset.filter_empty = False 13 | dataloader.test.dataset.names = "coco_2017_val_panoptic_separated" 14 | 15 | 16 | dataloader.evaluator = [ 17 | L(COCOEvaluator)( 18 | dataset_name="${...test.dataset.names}", 19 | ), 20 | L(SemSegEvaluator)( 21 | dataset_name="${...test.dataset.names}", 22 | ), 23 | L(COCOPanopticEvaluator)( 24 | dataset_name="${...test.dataset.names}", 25 | ), 26 | ] 27 | -------------------------------------------------------------------------------- /extract/third_party/CenterNet2/configs/common/models/cascade_rcnn.py: -------------------------------------------------------------------------------- 1 | from detectron2.config import LazyCall as L 2 | from detectron2.layers import ShapeSpec 3 | from detectron2.modeling.box_regression import Box2BoxTransform 4 | from detectron2.modeling.matcher import Matcher 5 | from detectron2.modeling.roi_heads import FastRCNNOutputLayers, FastRCNNConvFCHead, CascadeROIHeads 6 | 7 | from .mask_rcnn_fpn import model 8 | 9 | # arguments that don't exist for Cascade R-CNN 10 | [model.roi_heads.pop(k) for k in ["box_head", "box_predictor", "proposal_matcher"]] 11 | 12 | model.roi_heads.update( 13 | _target_=CascadeROIHeads, 14 | box_heads=[ 15 | L(FastRCNNConvFCHead)( 16 | input_shape=ShapeSpec(channels=256, height=7, width=7), 17 | conv_dims=[], 18 | fc_dims=[1024, 1024], 19 | ) 20 | for k in range(3) 21 | ], 22 | box_predictors=[ 23 | L(FastRCNNOutputLayers)( 24 | input_shape=ShapeSpec(channels=1024), 25 | test_score_thresh=0.05, 26 | box2box_transform=L(Box2BoxTransform)(weights=(w1, w1, w2, w2)), 27 | cls_agnostic_bbox_reg=True, 28 | num_classes="${...num_classes}", 29 | ) 30 | for (w1, w2) in [(10, 5), (20, 10), (30, 15)] 31 | ], 32 | proposal_matchers=[ 33 | L(Matcher)(thresholds=[th], labels=[0, 1], allow_low_quality_matches=False) 34 | for th in [0.5, 0.6, 0.7] 35 | ], 36 | ) 37 | -------------------------------------------------------------------------------- /extract/third_party/CenterNet2/configs/common/models/fcos.py: -------------------------------------------------------------------------------- 1 | from detectron2.modeling.meta_arch.fcos import FCOS, FCOSHead 2 | 3 | from .retinanet import model 4 | 5 | model._target_ = FCOS 6 | 7 | del model.anchor_generator 8 | del model.box2box_transform 9 | del model.anchor_matcher 10 | del model.input_format 11 | 12 | # Use P5 instead of C5 to compute P6/P7 13 | # (Sec 2.2 of https://arxiv.org/abs/2006.09214) 14 | model.backbone.top_block.in_feature = "p5" 15 | model.backbone.top_block.in_channels = 256 16 | 17 | # New score threshold determined based on sqrt(cls_score * centerness) 18 | model.test_score_thresh = 0.2 19 | model.test_nms_thresh = 0.6 20 | 21 | model.head._target_ = FCOSHead 22 | del model.head.num_anchors 23 | model.head.norm = "GN" 24 | -------------------------------------------------------------------------------- /extract/third_party/CenterNet2/configs/common/models/keypoint_rcnn_fpn.py: -------------------------------------------------------------------------------- 1 | from detectron2.config import LazyCall as L 2 | from detectron2.layers import ShapeSpec 3 | from detectron2.modeling.poolers import ROIPooler 4 | from detectron2.modeling.roi_heads import KRCNNConvDeconvUpsampleHead 5 | 6 | from .mask_rcnn_fpn import model 7 | 8 | [model.roi_heads.pop(x) for x in ["mask_in_features", "mask_pooler", "mask_head"]] 9 | 10 | model.roi_heads.update( 11 | num_classes=1, 12 | keypoint_in_features=["p2", "p3", "p4", "p5"], 13 | keypoint_pooler=L(ROIPooler)( 14 | output_size=14, 15 | scales=(1.0 / 4, 1.0 / 8, 1.0 / 16, 1.0 / 32), 16 | sampling_ratio=0, 17 | pooler_type="ROIAlignV2", 18 | ), 19 | keypoint_head=L(KRCNNConvDeconvUpsampleHead)( 20 | input_shape=ShapeSpec(channels=256, width=14, height=14), 21 | num_keypoints=17, 22 | conv_dims=[512] * 8, 23 | loss_normalizer="visible", 24 | ), 25 | ) 26 | 27 | # Detectron1 uses 2000 proposals per-batch, but this option is per-image in detectron2. 28 | # 1000 proposals per-image is found to hurt box AP. 29 | # Therefore we increase it to 1500 per-image. 30 | model.proposal_generator.post_nms_topk = (1500, 1000) 31 | 32 | # Keypoint AP degrades (though box AP improves) when using plain L1 loss 33 | model.roi_heads.box_predictor.smooth_l1_beta = 0.5 34 | -------------------------------------------------------------------------------- /extract/third_party/CenterNet2/configs/common/models/panoptic_fpn.py: -------------------------------------------------------------------------------- 1 | from detectron2.config import LazyCall as L 2 | from detectron2.layers import ShapeSpec 3 | from detectron2.modeling import PanopticFPN 4 | from detectron2.modeling.meta_arch.semantic_seg import SemSegFPNHead 5 | 6 | from .mask_rcnn_fpn import model 7 | 8 | model._target_ = PanopticFPN 9 | model.sem_seg_head = L(SemSegFPNHead)( 10 | input_shape={ 11 | f: L(ShapeSpec)(stride=s, channels="${....backbone.out_channels}") 12 | for f, s in zip(["p2", "p3", "p4", "p5"], [4, 8, 16, 32]) 13 | }, 14 | ignore_value=255, 15 | num_classes=54, # COCO stuff + 1 16 | conv_dims=128, 17 | common_stride=4, 18 | loss_weight=0.5, 19 | norm="GN", 20 | ) 21 | -------------------------------------------------------------------------------- /extract/third_party/CenterNet2/configs/common/optim.py: -------------------------------------------------------------------------------- 1 | import torch 2 | 3 | from detectron2.config import LazyCall as L 4 | from detectron2.solver.build import get_default_optimizer_params 5 | 6 | SGD = L(torch.optim.SGD)( 7 | params=L(get_default_optimizer_params)( 8 | # params.model is meant to be set to the model object, before instantiating 9 | # the optimizer. 10 | weight_decay_norm=0.0 11 | ), 12 | lr=0.02, 13 | momentum=0.9, 14 | weight_decay=1e-4, 15 | ) 16 | -------------------------------------------------------------------------------- /extract/third_party/CenterNet2/configs/common/train.py: -------------------------------------------------------------------------------- 1 | # Common training-related configs that are designed for "tools/lazyconfig_train_net.py" 2 | # You can use your own instead, together with your own train_net.py 3 | train = dict( 4 | output_dir="./output", 5 | init_checkpoint="", 6 | max_iter=90000, 7 | amp=dict(enabled=False), # options for Automatic Mixed Precision 8 | ddp=dict( # options for DistributedDataParallel 9 | broadcast_buffers=False, 10 | find_unused_parameters=False, 11 | fp16_compression=False, 12 | ), 13 | checkpointer=dict(period=5000, max_to_keep=100), # options for PeriodicCheckpointer 14 | eval_period=5000, 15 | log_period=20, 16 | device="cuda" 17 | # ... 18 | ) 19 | -------------------------------------------------------------------------------- /extract/third_party/CenterNet2/configs/new_baselines/mask_rcnn_R_101_FPN_100ep_LSJ.py: -------------------------------------------------------------------------------- 1 | from .mask_rcnn_R_50_FPN_100ep_LSJ import ( 2 | dataloader, 3 | lr_multiplier, 4 | model, 5 | optimizer, 6 | train, 7 | ) 8 | 9 | model.backbone.bottom_up.stages.depth = 101 10 | -------------------------------------------------------------------------------- /extract/third_party/CenterNet2/configs/new_baselines/mask_rcnn_R_101_FPN_200ep_LSJ.py: -------------------------------------------------------------------------------- 1 | from .mask_rcnn_R_101_FPN_100ep_LSJ import ( 2 | dataloader, 3 | lr_multiplier, 4 | model, 5 | optimizer, 6 | train, 7 | ) 8 | 9 | train.max_iter *= 2 # 100ep -> 200ep 10 | 11 | lr_multiplier.scheduler.milestones = [ 12 | milestone * 2 for milestone in lr_multiplier.scheduler.milestones 13 | ] 14 | lr_multiplier.scheduler.num_updates = train.max_iter 15 | -------------------------------------------------------------------------------- /extract/third_party/CenterNet2/configs/new_baselines/mask_rcnn_R_101_FPN_400ep_LSJ.py: -------------------------------------------------------------------------------- 1 | from .mask_rcnn_R_101_FPN_100ep_LSJ import ( 2 | dataloader, 3 | lr_multiplier, 4 | model, 5 | optimizer, 6 | train, 7 | ) 8 | 9 | train.max_iter *= 4 # 100ep -> 400ep 10 | 11 | lr_multiplier.scheduler.milestones = [ 12 | milestone * 4 for milestone in lr_multiplier.scheduler.milestones 13 | ] 14 | lr_multiplier.scheduler.num_updates = train.max_iter 15 | -------------------------------------------------------------------------------- /extract/third_party/CenterNet2/configs/new_baselines/mask_rcnn_R_50_FPN_200ep_LSJ.py: -------------------------------------------------------------------------------- 1 | from .mask_rcnn_R_50_FPN_100ep_LSJ import ( 2 | dataloader, 3 | lr_multiplier, 4 | model, 5 | optimizer, 6 | train, 7 | ) 8 | 9 | train.max_iter *= 2 # 100ep -> 200ep 10 | 11 | lr_multiplier.scheduler.milestones = [ 12 | milestone * 2 for milestone in lr_multiplier.scheduler.milestones 13 | ] 14 | lr_multiplier.scheduler.num_updates = train.max_iter 15 | -------------------------------------------------------------------------------- /extract/third_party/CenterNet2/configs/new_baselines/mask_rcnn_R_50_FPN_400ep_LSJ.py: -------------------------------------------------------------------------------- 1 | from .mask_rcnn_R_50_FPN_100ep_LSJ import ( 2 | dataloader, 3 | lr_multiplier, 4 | model, 5 | optimizer, 6 | train, 7 | ) 8 | 9 | train.max_iter *= 4 # 100ep -> 400ep 10 | 11 | lr_multiplier.scheduler.milestones = [ 12 | milestone * 4 for milestone in lr_multiplier.scheduler.milestones 13 | ] 14 | lr_multiplier.scheduler.num_updates = train.max_iter 15 | -------------------------------------------------------------------------------- /extract/third_party/CenterNet2/configs/new_baselines/mask_rcnn_R_50_FPN_50ep_LSJ.py: -------------------------------------------------------------------------------- 1 | from .mask_rcnn_R_50_FPN_100ep_LSJ import ( 2 | dataloader, 3 | lr_multiplier, 4 | model, 5 | optimizer, 6 | train, 7 | ) 8 | 9 | train.max_iter //= 2 # 100ep -> 50ep 10 | 11 | lr_multiplier.scheduler.milestones = [ 12 | milestone // 2 for milestone in lr_multiplier.scheduler.milestones 13 | ] 14 | lr_multiplier.scheduler.num_updates = train.max_iter 15 | -------------------------------------------------------------------------------- /extract/third_party/CenterNet2/configs/new_baselines/mask_rcnn_regnetx_4gf_dds_FPN_100ep_LSJ.py: -------------------------------------------------------------------------------- 1 | from .mask_rcnn_R_50_FPN_100ep_LSJ import ( 2 | dataloader, 3 | lr_multiplier, 4 | model, 5 | optimizer, 6 | train, 7 | ) 8 | from detectron2.config import LazyCall as L 9 | from detectron2.modeling.backbone import RegNet 10 | from detectron2.modeling.backbone.regnet import SimpleStem, ResBottleneckBlock 11 | 12 | # Config source: 13 | # https://github.com/facebookresearch/detectron2/blob/main/configs/COCO-InstanceSegmentation/mask_rcnn_regnetx_4gf_dds_fpn_1x.py # noqa 14 | model.backbone.bottom_up = L(RegNet)( 15 | stem_class=SimpleStem, 16 | stem_width=32, 17 | block_class=ResBottleneckBlock, 18 | depth=23, 19 | w_a=38.65, 20 | w_0=96, 21 | w_m=2.43, 22 | group_width=40, 23 | norm="SyncBN", 24 | out_features=["s1", "s2", "s3", "s4"], 25 | ) 26 | model.pixel_std = [57.375, 57.120, 58.395] 27 | 28 | # RegNets benefit from enabling cudnn benchmark mode 29 | train.cudnn_benchmark = True 30 | -------------------------------------------------------------------------------- /extract/third_party/CenterNet2/configs/new_baselines/mask_rcnn_regnetx_4gf_dds_FPN_200ep_LSJ.py: -------------------------------------------------------------------------------- 1 | from .mask_rcnn_regnetx_4gf_dds_FPN_100ep_LSJ import ( 2 | dataloader, 3 | lr_multiplier, 4 | model, 5 | optimizer, 6 | train, 7 | ) 8 | 9 | train.max_iter *= 2 # 100ep -> 200ep 10 | 11 | lr_multiplier.scheduler.milestones = [ 12 | milestone * 2 for milestone in lr_multiplier.scheduler.milestones 13 | ] 14 | lr_multiplier.scheduler.num_updates = train.max_iter 15 | -------------------------------------------------------------------------------- /extract/third_party/CenterNet2/configs/new_baselines/mask_rcnn_regnetx_4gf_dds_FPN_400ep_LSJ.py: -------------------------------------------------------------------------------- 1 | from .mask_rcnn_regnetx_4gf_dds_FPN_100ep_LSJ import ( 2 | dataloader, 3 | lr_multiplier, 4 | model, 5 | optimizer, 6 | train, 7 | ) 8 | 9 | train.max_iter *= 4 # 100ep -> 400ep 10 | 11 | lr_multiplier.scheduler.milestones = [ 12 | milestone * 4 for milestone in lr_multiplier.scheduler.milestones 13 | ] 14 | lr_multiplier.scheduler.num_updates = train.max_iter 15 | -------------------------------------------------------------------------------- /extract/third_party/CenterNet2/configs/new_baselines/mask_rcnn_regnety_4gf_dds_FPN_100ep_LSJ.py: -------------------------------------------------------------------------------- 1 | from .mask_rcnn_R_50_FPN_100ep_LSJ import ( 2 | dataloader, 3 | lr_multiplier, 4 | model, 5 | optimizer, 6 | train, 7 | ) 8 | from detectron2.config import LazyCall as L 9 | from detectron2.modeling.backbone import RegNet 10 | from detectron2.modeling.backbone.regnet import SimpleStem, ResBottleneckBlock 11 | 12 | # Config source: 13 | # https://github.com/facebookresearch/detectron2/blob/main/configs/COCO-InstanceSegmentation/mask_rcnn_regnety_4gf_dds_fpn_1x.py # noqa 14 | model.backbone.bottom_up = L(RegNet)( 15 | stem_class=SimpleStem, 16 | stem_width=32, 17 | block_class=ResBottleneckBlock, 18 | depth=22, 19 | w_a=31.41, 20 | w_0=96, 21 | w_m=2.24, 22 | group_width=64, 23 | se_ratio=0.25, 24 | norm="SyncBN", 25 | out_features=["s1", "s2", "s3", "s4"], 26 | ) 27 | model.pixel_std = [57.375, 57.120, 58.395] 28 | 29 | # RegNets benefit from enabling cudnn benchmark mode 30 | train.cudnn_benchmark = True 31 | -------------------------------------------------------------------------------- /extract/third_party/CenterNet2/configs/new_baselines/mask_rcnn_regnety_4gf_dds_FPN_200ep_LSJ.py: -------------------------------------------------------------------------------- 1 | from .mask_rcnn_regnety_4gf_dds_FPN_100ep_LSJ import ( 2 | dataloader, 3 | lr_multiplier, 4 | model, 5 | optimizer, 6 | train, 7 | ) 8 | 9 | train.max_iter *= 2 # 100ep -> 200ep 10 | 11 | lr_multiplier.scheduler.milestones = [ 12 | milestone * 2 for milestone in lr_multiplier.scheduler.milestones 13 | ] 14 | lr_multiplier.scheduler.num_updates = train.max_iter 15 | -------------------------------------------------------------------------------- /extract/third_party/CenterNet2/configs/new_baselines/mask_rcnn_regnety_4gf_dds_FPN_400ep_LSJ.py: -------------------------------------------------------------------------------- 1 | from .mask_rcnn_regnety_4gf_dds_FPN_100ep_LSJ import ( 2 | dataloader, 3 | lr_multiplier, 4 | model, 5 | optimizer, 6 | train, 7 | ) 8 | 9 | train.max_iter *= 4 # 100ep -> 400ep 10 | 11 | lr_multiplier.scheduler.milestones = [ 12 | milestone * 4 for milestone in lr_multiplier.scheduler.milestones 13 | ] 14 | lr_multiplier.scheduler.num_updates = train.max_iter 15 | -------------------------------------------------------------------------------- /extract/third_party/CenterNet2/configs/quick_schedules/README.md: -------------------------------------------------------------------------------- 1 | These are quick configs for performance or accuracy regression tracking purposes. 2 | 3 | * `*instance_test.yaml`: can train on 2 GPUs. They are used to test whether the training can 4 | successfully finish. They are not expected to produce reasonable training results. 5 | * `*inference_acc_test.yaml`: They should be run using `--eval-only`. They run inference using pre-trained models and verify 6 | the results are as expected. 7 | * `*training_acc_test.yaml`: They should be trained on 8 GPUs. They finish in about an hour and verify the training accuracy 8 | is within the normal range. 9 | -------------------------------------------------------------------------------- /extract/third_party/CenterNet2/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 | -------------------------------------------------------------------------------- /extract/third_party/CenterNet2/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 | -------------------------------------------------------------------------------- /extract/third_party/CenterNet2/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 | -------------------------------------------------------------------------------- /extract/third_party/CenterNet2/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 | -------------------------------------------------------------------------------- /extract/third_party/CenterNet2/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 | -------------------------------------------------------------------------------- /extract/third_party/CenterNet2/configs/quick_schedules/keypoint_rcnn_R_50_FPN_instant_test.yaml: -------------------------------------------------------------------------------- 1 | _BASE_: "../Base-RCNN-FPN.yaml" 2 | MODEL: 3 | WEIGHTS: "detectron2://ImageNetPretrained/MSRA/R-50.pkl" 4 | KEYPOINT_ON: True 5 | ROI_HEADS: 6 | NUM_CLASSES: 1 7 | DATASETS: 8 | TRAIN: ("keypoints_coco_2017_val_100",) 9 | TEST: ("keypoints_coco_2017_val_100",) 10 | SOLVER: 11 | BASE_LR: 0.005 12 | STEPS: (30,) 13 | MAX_ITER: 40 14 | IMS_PER_BATCH: 4 15 | DATALOADER: 16 | NUM_WORKERS: 2 17 | -------------------------------------------------------------------------------- /extract/third_party/CenterNet2/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 | -------------------------------------------------------------------------------- /extract/third_party/CenterNet2/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 | -------------------------------------------------------------------------------- /extract/third_party/CenterNet2/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 | -------------------------------------------------------------------------------- /extract/third_party/CenterNet2/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 | -------------------------------------------------------------------------------- /extract/third_party/CenterNet2/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 | -------------------------------------------------------------------------------- /extract/third_party/CenterNet2/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 | -------------------------------------------------------------------------------- /extract/third_party/CenterNet2/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 | -------------------------------------------------------------------------------- /extract/third_party/CenterNet2/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 | -------------------------------------------------------------------------------- /extract/third_party/CenterNet2/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 | -------------------------------------------------------------------------------- /extract/third_party/CenterNet2/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 | -------------------------------------------------------------------------------- /extract/third_party/CenterNet2/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 | -------------------------------------------------------------------------------- /extract/third_party/CenterNet2/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 | -------------------------------------------------------------------------------- /extract/third_party/CenterNet2/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 | -------------------------------------------------------------------------------- /extract/third_party/CenterNet2/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 | -------------------------------------------------------------------------------- /extract/third_party/CenterNet2/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 | -------------------------------------------------------------------------------- /extract/third_party/CenterNet2/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 | -------------------------------------------------------------------------------- /extract/third_party/CenterNet2/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 | -------------------------------------------------------------------------------- /extract/third_party/CenterNet2/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 | -------------------------------------------------------------------------------- /extract/third_party/CenterNet2/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 | -------------------------------------------------------------------------------- /extract/third_party/CenterNet2/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 | -------------------------------------------------------------------------------- /extract/third_party/CenterNet2/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 | -------------------------------------------------------------------------------- /extract/third_party/CenterNet2/datasets/prepare_ade20k_sem_seg.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | # -*- coding: utf-8 -*- 3 | # Copyright (c) Facebook, Inc. and its affiliates. 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 | -------------------------------------------------------------------------------- /extract/third_party/CenterNet2/datasets/prepare_for_tests.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash -e 2 | # Copyright (c) Facebook, Inc. and its affiliates. 3 | 4 | # Download the mini dataset (coco val2017_100, with only 100 images) 5 | # to be used in unittests & integration tests. 6 | 7 | cd "${0%/*}" 8 | 9 | BASE=https://dl.fbaipublicfiles.com/detectron2 10 | ROOT=${DETECTRON2_DATASETS:-./} 11 | ROOT=${ROOT/#\~/$HOME} # expand ~ to HOME 12 | mkdir -p $ROOT/coco/annotations 13 | 14 | for anno in instances_val2017_100 \ 15 | person_keypoints_val2017_100 ; do 16 | 17 | dest=$ROOT/coco/annotations/$anno.json 18 | [[ -s $dest ]] && { 19 | echo "$dest exists. Skipping ..." 20 | } || { 21 | wget $BASE/annotations/coco/$anno.json -O $dest 22 | } 23 | done 24 | 25 | dest=$ROOT/coco/val2017_100.tgz 26 | [[ -d $ROOT/coco/val2017 ]] && { 27 | echo "$ROOT/coco/val2017 exists. Skipping ..." 28 | } || { 29 | wget $BASE/annotations/coco/val2017_100.tgz -O $dest 30 | tar xzf $dest -C $ROOT/coco/ && rm -f $dest 31 | } 32 | -------------------------------------------------------------------------------- /extract/third_party/CenterNet2/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 | -------------------------------------------------------------------------------- /extract/third_party/CenterNet2/detectron2/__init__.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) Facebook, Inc. and its affiliates. 2 | 3 | from .utils.env import setup_environment 4 | 5 | setup_environment() 6 | 7 | 8 | # This line will be programatically read/write by setup.py. 9 | # Leave them at the bottom of this file and don't touch them. 10 | __version__ = "0.6" 11 | -------------------------------------------------------------------------------- /extract/third_party/CenterNet2/detectron2/checkpoint/__init__.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | # Copyright (c) Facebook, Inc. and its affiliates. 3 | # File: 4 | 5 | 6 | from . import catalog as _UNUSED # register the handler 7 | from .detection_checkpoint import DetectionCheckpointer 8 | from fvcore.common.checkpoint import Checkpointer, PeriodicCheckpointer 9 | 10 | __all__ = ["Checkpointer", "PeriodicCheckpointer", "DetectionCheckpointer"] 11 | -------------------------------------------------------------------------------- /extract/third_party/CenterNet2/detectron2/config/__init__.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) Facebook, Inc. and its affiliates. 2 | from .compat import downgrade_config, upgrade_config 3 | from .config import CfgNode, get_cfg, global_cfg, set_global_cfg, configurable 4 | from .instantiate import instantiate 5 | from .lazy import LazyCall, LazyConfig 6 | 7 | __all__ = [ 8 | "CfgNode", 9 | "get_cfg", 10 | "global_cfg", 11 | "set_global_cfg", 12 | "downgrade_config", 13 | "upgrade_config", 14 | "configurable", 15 | "instantiate", 16 | "LazyCall", 17 | "LazyConfig", 18 | ] 19 | 20 | 21 | from detectron2.utils.env import fixup_module_metadata 22 | 23 | fixup_module_metadata(__name__, globals(), __all__) 24 | del fixup_module_metadata 25 | -------------------------------------------------------------------------------- /extract/third_party/CenterNet2/detectron2/data/__init__.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) Facebook, Inc. and its affiliates. 2 | from . import transforms # isort:skip 3 | 4 | from .build import ( 5 | build_batch_data_loader, 6 | build_detection_test_loader, 7 | build_detection_train_loader, 8 | get_detection_dataset_dicts, 9 | load_proposals_into_dataset, 10 | print_instances_class_histogram, 11 | ) 12 | from .catalog import DatasetCatalog, MetadataCatalog, Metadata 13 | from .common import DatasetFromList, MapDataset, ToIterableDataset 14 | from .dataset_mapper import DatasetMapper 15 | 16 | # ensure the builtin datasets are registered 17 | from . import datasets, samplers # isort:skip 18 | 19 | __all__ = [k for k in globals().keys() if not k.startswith("_")] 20 | -------------------------------------------------------------------------------- /extract/third_party/CenterNet2/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 | -------------------------------------------------------------------------------- /extract/third_party/CenterNet2/detectron2/data/datasets/__init__.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) Facebook, Inc. and its affiliates. 2 | from .coco import load_coco_json, load_sem_seg, register_coco_instances, convert_to_coco_json 3 | from .coco_panoptic import register_coco_panoptic, register_coco_panoptic_separated 4 | from .lvis import load_lvis_json, register_lvis_instances, get_lvis_instances_meta 5 | from .pascal_voc import load_voc_instances, register_pascal_voc 6 | from . import builtin as _builtin # ensure the builtin datasets are registered 7 | 8 | 9 | __all__ = [k for k in globals().keys() if not k.startswith("_")] 10 | -------------------------------------------------------------------------------- /extract/third_party/CenterNet2/detectron2/data/datasets/register_coco.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) Facebook, Inc. and its affiliates. 2 | from .coco import register_coco_instances # noqa 3 | from .coco_panoptic import register_coco_panoptic_separated # noqa 4 | -------------------------------------------------------------------------------- /extract/third_party/CenterNet2/detectron2/data/samplers/__init__.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) Facebook, Inc. and its affiliates. 2 | from .distributed_sampler import ( 3 | InferenceSampler, 4 | RandomSubsetTrainingSampler, 5 | RepeatFactorTrainingSampler, 6 | TrainingSampler, 7 | ) 8 | 9 | from .grouped_batch_sampler import GroupedBatchSampler 10 | 11 | __all__ = [ 12 | "GroupedBatchSampler", 13 | "TrainingSampler", 14 | "RandomSubsetTrainingSampler", 15 | "InferenceSampler", 16 | "RepeatFactorTrainingSampler", 17 | ] 18 | -------------------------------------------------------------------------------- /extract/third_party/CenterNet2/detectron2/data/transforms/__init__.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) Facebook, Inc. and its affiliates. 2 | from fvcore.transforms.transform import Transform, TransformList # order them first 3 | from fvcore.transforms.transform import * 4 | from .transform import * 5 | from .augmentation import * 6 | from .augmentation_impl import * 7 | 8 | __all__ = [k for k in globals().keys() if not k.startswith("_")] 9 | 10 | 11 | from detectron2.utils.env import fixup_module_metadata 12 | 13 | fixup_module_metadata(__name__, globals(), __all__) 14 | del fixup_module_metadata 15 | -------------------------------------------------------------------------------- /extract/third_party/CenterNet2/detectron2/engine/__init__.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) Facebook, Inc. and its affiliates. 2 | 3 | from .launch import * 4 | from .train_loop import * 5 | 6 | __all__ = [k for k in globals().keys() if not k.startswith("_")] 7 | 8 | 9 | # prefer to let hooks and defaults live in separate namespaces (therefore not in __all__) 10 | # but still make them available here 11 | from .hooks import * 12 | from .defaults import * 13 | -------------------------------------------------------------------------------- /extract/third_party/CenterNet2/detectron2/evaluation/__init__.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) Facebook, Inc. and its affiliates. 2 | from .cityscapes_evaluation import CityscapesInstanceEvaluator, CityscapesSemSegEvaluator 3 | from .coco_evaluation import COCOEvaluator 4 | from .rotated_coco_evaluation import RotatedCOCOEvaluator 5 | from .evaluator import DatasetEvaluator, DatasetEvaluators, inference_context, inference_on_dataset 6 | from .lvis_evaluation import LVISEvaluator 7 | from .panoptic_evaluation import COCOPanopticEvaluator 8 | from .pascal_voc_evaluation import PascalVOCDetectionEvaluator 9 | from .sem_seg_evaluation import SemSegEvaluator 10 | from .testing import print_csv_format, verify_results 11 | 12 | __all__ = [k for k in globals().keys() if not k.startswith("_")] 13 | -------------------------------------------------------------------------------- /extract/third_party/CenterNet2/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 | -------------------------------------------------------------------------------- /extract/third_party/CenterNet2/detectron2/export/__init__.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | 3 | try: 4 | from caffe2.proto import caffe2_pb2 as _tmp 5 | 6 | # caffe2 is optional 7 | except ImportError: 8 | pass 9 | else: 10 | from .api import * 11 | 12 | from .flatten import TracingAdapter 13 | from .torchscript import scripting_with_instances, dump_torchscript_IR 14 | 15 | __all__ = [k for k in globals().keys() if not k.startswith("_")] 16 | -------------------------------------------------------------------------------- /extract/third_party/CenterNet2/detectron2/layers/__init__.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) Facebook, Inc. and its affiliates. 2 | from .batch_norm import FrozenBatchNorm2d, get_norm, NaiveSyncBatchNorm, CycleBatchNormList 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 ( 10 | BatchNorm2d, 11 | Conv2d, 12 | ConvTranspose2d, 13 | cat, 14 | interpolate, 15 | Linear, 16 | nonzero_tuple, 17 | cross_entropy, 18 | shapes_to_tensor, 19 | ) 20 | from .blocks import CNNBlockBase, DepthwiseSeparableConv2d 21 | from .aspp import ASPP 22 | from .losses import ciou_loss, diou_loss 23 | 24 | __all__ = [k for k in globals().keys() if not k.startswith("_")] 25 | -------------------------------------------------------------------------------- /extract/third_party/CenterNet2/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 | -------------------------------------------------------------------------------- /extract/third_party/CenterNet2/detectron2/layers/csrc/box_iou_rotated/box_iou_rotated.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) Facebook, Inc. and its affiliates. 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("Detectron2 is 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 | -------------------------------------------------------------------------------- /extract/third_party/CenterNet2/detectron2/layers/csrc/box_iou_rotated/box_iou_rotated_cpu.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (c) Facebook, Inc. and its affiliates. 2 | #include "box_iou_rotated.h" 3 | #include "box_iou_rotated_utils.h" 4 | 5 | namespace detectron2 { 6 | 7 | template 8 | void box_iou_rotated_cpu_kernel( 9 | const at::Tensor& boxes1, 10 | const at::Tensor& boxes2, 11 | at::Tensor& ious) { 12 | auto num_boxes1 = boxes1.size(0); 13 | auto num_boxes2 = boxes2.size(0); 14 | 15 | for (int i = 0; i < num_boxes1; i++) { 16 | for (int j = 0; j < num_boxes2; j++) { 17 | ious[i * num_boxes2 + j] = single_box_iou_rotated( 18 | boxes1[i].data_ptr(), boxes2[j].data_ptr()); 19 | } 20 | } 21 | } 22 | 23 | at::Tensor box_iou_rotated_cpu( 24 | // input must be contiguous: 25 | const at::Tensor& boxes1, 26 | const at::Tensor& boxes2) { 27 | auto num_boxes1 = boxes1.size(0); 28 | auto num_boxes2 = boxes2.size(0); 29 | at::Tensor ious = 30 | at::empty({num_boxes1 * num_boxes2}, boxes1.options().dtype(at::kFloat)); 31 | 32 | box_iou_rotated_cpu_kernel(boxes1, boxes2, ious); 33 | 34 | // reshape from 1d array to 2d array 35 | auto shape = std::vector{num_boxes1, num_boxes2}; 36 | return ious.reshape(shape); 37 | } 38 | 39 | } // namespace detectron2 40 | -------------------------------------------------------------------------------- /extract/third_party/CenterNet2/detectron2/layers/csrc/cuda_version.cu: -------------------------------------------------------------------------------- 1 | // Copyright (c) Facebook, Inc. and its affiliates. 2 | 3 | #include 4 | 5 | namespace detectron2 { 6 | int get_cudart_version() { 7 | // Not a ROCM platform: Either HIP is not used, or 8 | // it is used, but platform is not ROCM (i.e. it is CUDA) 9 | #if !defined(__HIP_PLATFORM_HCC__) 10 | return CUDART_VERSION; 11 | #else 12 | int version = 0; 13 | 14 | #if HIP_VERSION_MAJOR != 0 15 | // Create a convention similar to that of CUDA, as assumed by other 16 | // parts of the code. 17 | 18 | version = HIP_VERSION_MINOR; 19 | version += (HIP_VERSION_MAJOR * 100); 20 | #else 21 | hipRuntimeGetVersion(&version); 22 | #endif 23 | return version; 24 | #endif 25 | } 26 | } // namespace detectron2 27 | -------------------------------------------------------------------------------- /extract/third_party/CenterNet2/detectron2/layers/csrc/nms_rotated/nms_rotated.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) Facebook, Inc. and its affiliates. 2 | #pragma once 3 | #include 4 | 5 | namespace detectron2 { 6 | 7 | at::Tensor nms_rotated_cpu( 8 | const at::Tensor& dets, 9 | const at::Tensor& scores, 10 | const double iou_threshold); 11 | 12 | #if defined(WITH_CUDA) || defined(WITH_HIP) 13 | at::Tensor nms_rotated_cuda( 14 | const at::Tensor& dets, 15 | const at::Tensor& scores, 16 | const double iou_threshold); 17 | #endif 18 | 19 | // Interface for Python 20 | // inline is needed to prevent multiple function definitions when this header is 21 | // included by different cpps 22 | inline at::Tensor nms_rotated( 23 | const at::Tensor& dets, 24 | const at::Tensor& scores, 25 | const double iou_threshold) { 26 | assert(dets.device().is_cuda() == scores.device().is_cuda()); 27 | if (dets.device().is_cuda()) { 28 | #if defined(WITH_CUDA) || defined(WITH_HIP) 29 | return nms_rotated_cuda( 30 | dets.contiguous(), scores.contiguous(), iou_threshold); 31 | #else 32 | AT_ERROR("Detectron2 is not compiled with GPU support!"); 33 | #endif 34 | } 35 | 36 | return nms_rotated_cpu(dets.contiguous(), scores.contiguous(), iou_threshold); 37 | } 38 | 39 | } // namespace detectron2 40 | -------------------------------------------------------------------------------- /extract/third_party/CenterNet2/detectron2/layers/rotated_boxes.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) Facebook, Inc. and its affiliates. 2 | from __future__ import absolute_import, division, print_function, unicode_literals 3 | import torch 4 | 5 | 6 | def pairwise_iou_rotated(boxes1, boxes2): 7 | """ 8 | Return intersection-over-union (Jaccard index) of boxes. 9 | 10 | Both sets of boxes are expected to be in 11 | (x_center, y_center, width, height, angle) format. 12 | 13 | Arguments: 14 | boxes1 (Tensor[N, 5]) 15 | boxes2 (Tensor[M, 5]) 16 | 17 | Returns: 18 | iou (Tensor[N, M]): the NxM matrix containing the pairwise 19 | IoU values for every element in boxes1 and boxes2 20 | """ 21 | return torch.ops.detectron2.box_iou_rotated(boxes1, boxes2) 22 | -------------------------------------------------------------------------------- /extract/third_party/CenterNet2/detectron2/layers/shape_spec.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | # Copyright (c) Facebook, Inc. and its affiliates. 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 | -------------------------------------------------------------------------------- /extract/third_party/CenterNet2/detectron2/model_zoo/__init__.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) Facebook, Inc. and its affiliates. 2 | """ 3 | Model Zoo API for Detectron2: a collection of functions to create common model architectures 4 | listed in `MODEL_ZOO.md `_, 5 | and optionally load their pre-trained weights. 6 | """ 7 | 8 | from .model_zoo import get, get_config_file, get_checkpoint_url, get_config 9 | 10 | __all__ = ["get_checkpoint_url", "get", "get_config_file", "get_config"] 11 | -------------------------------------------------------------------------------- /extract/third_party/CenterNet2/detectron2/modeling/backbone/__init__.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) Facebook, Inc. and its affiliates. 2 | from .build import build_backbone, BACKBONE_REGISTRY # noqa F401 isort:skip 3 | 4 | from .backbone import Backbone 5 | from .fpn import FPN 6 | from .regnet import RegNet 7 | from .resnet import ( 8 | BasicStem, 9 | ResNet, 10 | ResNetBlockBase, 11 | build_resnet_backbone, 12 | make_stage, 13 | BottleneckBlock, 14 | ) 15 | 16 | __all__ = [k for k in globals().keys() if not k.startswith("_")] 17 | # TODO can expose more resnet blocks after careful consideration 18 | -------------------------------------------------------------------------------- /extract/third_party/CenterNet2/detectron2/modeling/backbone/build.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) Facebook, Inc. and its affiliates. 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 | -------------------------------------------------------------------------------- /extract/third_party/CenterNet2/detectron2/modeling/meta_arch/__init__.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | # Copyright (c) Facebook, Inc. and its affiliates. 3 | 4 | from .build import META_ARCH_REGISTRY, build_model # isort:skip 5 | 6 | from .panoptic_fpn import PanopticFPN 7 | 8 | # import all the meta_arch, so they will be registered 9 | from .rcnn import GeneralizedRCNN, ProposalNetwork 10 | from .dense_detector import DenseDetector 11 | from .retinanet import RetinaNet 12 | from .fcos import FCOS 13 | from .semantic_seg import SEM_SEG_HEADS_REGISTRY, SemanticSegmentor, build_sem_seg_head 14 | 15 | 16 | __all__ = list(globals().keys()) 17 | -------------------------------------------------------------------------------- /extract/third_party/CenterNet2/detectron2/modeling/meta_arch/build.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) Facebook, Inc. and its affiliates. 2 | import torch 3 | 4 | from detectron2.utils.logger import _log_api_usage 5 | from detectron2.utils.registry import Registry 6 | 7 | META_ARCH_REGISTRY = Registry("META_ARCH") # noqa F401 isort:skip 8 | META_ARCH_REGISTRY.__doc__ = """ 9 | Registry for meta-architectures, i.e. the whole model. 10 | 11 | The registered object will be called with `obj(cfg)` 12 | and expected to return a `nn.Module` object. 13 | """ 14 | 15 | 16 | def build_model(cfg): 17 | """ 18 | Build the whole model architecture, defined by ``cfg.MODEL.META_ARCHITECTURE``. 19 | Note that it does not load any weights from ``cfg``. 20 | """ 21 | meta_arch = cfg.MODEL.META_ARCHITECTURE 22 | model = META_ARCH_REGISTRY.get(meta_arch)(cfg) 23 | model.to(torch.device(cfg.MODEL.DEVICE)) 24 | _log_api_usage("modeling.meta_arch." + meta_arch) 25 | return model 26 | -------------------------------------------------------------------------------- /extract/third_party/CenterNet2/detectron2/modeling/proposal_generator/__init__.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) Facebook, Inc. and its affiliates. 2 | from .build import PROPOSAL_GENERATOR_REGISTRY, build_proposal_generator 3 | from .rpn import RPN_HEAD_REGISTRY, build_rpn_head, RPN, StandardRPNHead 4 | 5 | __all__ = list(globals().keys()) 6 | -------------------------------------------------------------------------------- /extract/third_party/CenterNet2/detectron2/modeling/proposal_generator/build.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) Facebook, Inc. and its affiliates. 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 | -------------------------------------------------------------------------------- /extract/third_party/CenterNet2/detectron2/modeling/roi_heads/__init__.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) Facebook, Inc. and its affiliates. 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 .cascade_rcnn import CascadeROIHeads 24 | from .rotated_fast_rcnn import RROIHeads 25 | from .fast_rcnn import FastRCNNOutputLayers 26 | 27 | from . import cascade_rcnn # isort:skip 28 | 29 | __all__ = list(globals().keys()) 30 | -------------------------------------------------------------------------------- /extract/third_party/CenterNet2/detectron2/projects/README.md: -------------------------------------------------------------------------------- 1 | 2 | Projects live in the [`projects` directory](../../projects) under the root of this repository, but not here. 3 | -------------------------------------------------------------------------------- /extract/third_party/CenterNet2/detectron2/projects/__init__.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) Facebook, Inc. and its affiliates. 2 | import importlib 3 | from pathlib import Path 4 | 5 | _PROJECTS = { 6 | "point_rend": "PointRend", 7 | "deeplab": "DeepLab", 8 | "panoptic_deeplab": "Panoptic-DeepLab", 9 | } 10 | _PROJECT_ROOT = Path(__file__).resolve().parent.parent.parent / "projects" 11 | 12 | if _PROJECT_ROOT.is_dir(): 13 | # This is true only for in-place installation (pip install -e, setup.py develop), 14 | # where setup(package_dir=) does not work: https://github.com/pypa/setuptools/issues/230 15 | 16 | class _D2ProjectsFinder(importlib.abc.MetaPathFinder): 17 | def find_spec(self, name, path, target=None): 18 | if not name.startswith("detectron2.projects."): 19 | return 20 | project_name = name.split(".")[-1] 21 | project_dir = _PROJECTS.get(project_name) 22 | if not project_dir: 23 | return 24 | target_file = _PROJECT_ROOT / f"{project_dir}/{project_name}/__init__.py" 25 | if not target_file.is_file(): 26 | return 27 | return importlib.util.spec_from_file_location(name, target_file) 28 | 29 | import sys 30 | 31 | sys.meta_path.append(_D2ProjectsFinder()) 32 | -------------------------------------------------------------------------------- /extract/third_party/CenterNet2/detectron2/solver/__init__.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) Facebook, Inc. and its affiliates. 2 | from .build import build_lr_scheduler, build_optimizer, get_default_optimizer_params 3 | from .lr_scheduler import WarmupCosineLR, WarmupMultiStepLR, LRMultiplier, WarmupParamScheduler 4 | 5 | __all__ = [k for k in globals().keys() if not k.startswith("_")] 6 | -------------------------------------------------------------------------------- /extract/third_party/CenterNet2/detectron2/structures/__init__.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) Facebook, Inc. and its affiliates. 2 | from .boxes import Boxes, BoxMode, pairwise_iou, pairwise_ioa, pairwise_point_box_distance 3 | from .image_list import ImageList 4 | 5 | from .instances import Instances 6 | from .keypoints import Keypoints, heatmaps_to_keypoints 7 | from .masks import BitMasks, PolygonMasks, polygons_to_bitmask, ROIMasks 8 | from .rotated_boxes import RotatedBoxes 9 | from .rotated_boxes import pairwise_iou as pairwise_iou_rotated 10 | 11 | __all__ = [k for k in globals().keys() if not k.startswith("_")] 12 | 13 | 14 | from detectron2.utils.env import fixup_module_metadata 15 | 16 | fixup_module_metadata(__name__, globals(), __all__) 17 | del fixup_module_metadata 18 | -------------------------------------------------------------------------------- /extract/third_party/CenterNet2/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 | -------------------------------------------------------------------------------- /extract/third_party/CenterNet2/detectron2/utils/__init__.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) Facebook, Inc. and its affiliates. 2 | -------------------------------------------------------------------------------- /extract/third_party/CenterNet2/detectron2/utils/file_io.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) Facebook, Inc. and its affiliates. 2 | from iopath.common.file_io import HTTPURLHandler, OneDrivePathHandler, PathHandler 3 | from iopath.common.file_io import PathManager as PathManagerBase 4 | 5 | __all__ = ["PathManager", "PathHandler"] 6 | 7 | 8 | PathManager = PathManagerBase() 9 | """ 10 | This is a detectron2 project-specific PathManager. 11 | We try to stay away from global PathManager in fvcore as it 12 | introduces potential conflicts among other libraries. 13 | """ 14 | 15 | 16 | class Detectron2Handler(PathHandler): 17 | """ 18 | Resolve anything that's hosted under detectron2's namespace. 19 | """ 20 | 21 | PREFIX = "detectron2://" 22 | S3_DETECTRON2_PREFIX = "https://dl.fbaipublicfiles.com/detectron2/" 23 | 24 | def _get_supported_prefixes(self): 25 | return [self.PREFIX] 26 | 27 | def _get_local_path(self, path, **kwargs): 28 | name = path[len(self.PREFIX) :] 29 | return PathManager.get_local_path(self.S3_DETECTRON2_PREFIX + name, **kwargs) 30 | 31 | def _open(self, path, mode="r", **kwargs): 32 | return PathManager.open(self._get_local_path(path), mode, **kwargs) 33 | 34 | 35 | PathManager.register_handler(HTTPURLHandler()) 36 | PathManager.register_handler(OneDrivePathHandler()) 37 | PathManager.register_handler(Detectron2Handler()) 38 | -------------------------------------------------------------------------------- /extract/third_party/CenterNet2/detectron2/utils/serialize.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) Facebook, Inc. and its affiliates. 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 | while isinstance(obj, PicklableWrapper): 17 | # Wrapping an object twice is no-op 18 | obj = obj._obj 19 | self._obj = obj 20 | 21 | def __reduce__(self): 22 | s = cloudpickle.dumps(self._obj) 23 | return cloudpickle.loads, (s,) 24 | 25 | def __call__(self, *args, **kwargs): 26 | return self._obj(*args, **kwargs) 27 | 28 | def __getattr__(self, attr): 29 | # Ensure that the wrapped object can be used seamlessly as the previous object. 30 | if attr not in ["_obj"]: 31 | return getattr(self._obj, attr) 32 | return getattr(self, attr) 33 | -------------------------------------------------------------------------------- /extract/third_party/CenterNet2/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 | -------------------------------------------------------------------------------- /extract/third_party/CenterNet2/dev/linter.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash -e 2 | # Copyright (c) Facebook, Inc. and its affiliates. 3 | 4 | # cd to detectron2 project root 5 | cd "$(dirname "${BASH_SOURCE[0]}")/.." 6 | 7 | { 8 | black --version | grep -E "21\." > /dev/null 9 | } || { 10 | echo "Linter requires 'black==21.*' !" 11 | exit 1 12 | } 13 | 14 | ISORT_VERSION=$(isort --version-number) 15 | if [[ "$ISORT_VERSION" != 4.3* ]]; then 16 | echo "Linter requires isort==4.3.21 !" 17 | exit 1 18 | fi 19 | 20 | set -v 21 | 22 | echo "Running isort ..." 23 | isort -y -sp . --atomic 24 | 25 | echo "Running black ..." 26 | black -l 100 . 27 | 28 | echo "Running flake8 ..." 29 | if [ -x "$(command -v flake8-3)" ]; then 30 | flake8-3 . 31 | else 32 | python3 -m flake8 . 33 | fi 34 | 35 | # echo "Running mypy ..." 36 | # Pytorch does not have enough type annotations 37 | # mypy detectron2/solver detectron2/structures detectron2/config 38 | 39 | echo "Running clang-format ..." 40 | find . -regex ".*\.\(cpp\|c\|cc\|cu\|cxx\|h\|hh\|hpp\|hxx\|tcc\|mm\|m\)" -print0 | xargs -0 clang-format -i 41 | 42 | command -v arc > /dev/null && arc lint 43 | -------------------------------------------------------------------------------- /extract/third_party/CenterNet2/dev/packaging/README.md: -------------------------------------------------------------------------------- 1 | 2 | ## To build a cu101 wheel for release: 3 | 4 | ``` 5 | $ nvidia-docker run -it --storage-opt "size=20GB" --name pt pytorch/manylinux-cuda101 6 | # inside the container: 7 | # git clone https://github.com/facebookresearch/detectron2/ 8 | # cd detectron2 9 | # export CU_VERSION=cu101 D2_VERSION_SUFFIX= PYTHON_VERSION=3.7 PYTORCH_VERSION=1.8 10 | # ./dev/packaging/build_wheel.sh 11 | ``` 12 | 13 | ## To build all wheels for combinations of CUDA and Python 14 | ``` 15 | ./dev/packaging/build_all_wheels.sh 16 | ./dev/packaging/gen_wheel_index.sh /path/to/wheels 17 | ``` 18 | -------------------------------------------------------------------------------- /extract/third_party/CenterNet2/dev/packaging/build_wheel.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # Copyright (c) Facebook, Inc. and its affiliates. 3 | set -ex 4 | 5 | ldconfig # https://github.com/NVIDIA/nvidia-docker/issues/854 6 | 7 | script_dir="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )" 8 | . "$script_dir/pkg_helpers.bash" 9 | 10 | echo "Build Settings:" 11 | echo "CU_VERSION: $CU_VERSION" # e.g. cu101 12 | echo "D2_VERSION_SUFFIX: $D2_VERSION_SUFFIX" # e.g. +cu101 or "" 13 | echo "PYTHON_VERSION: $PYTHON_VERSION" # e.g. 3.6 14 | echo "PYTORCH_VERSION: $PYTORCH_VERSION" # e.g. 1.4 15 | 16 | setup_cuda 17 | setup_wheel_python 18 | 19 | yum install ninja-build -y 20 | ln -sv /usr/bin/ninja-build /usr/bin/ninja || true 21 | 22 | pip_install pip numpy -U 23 | pip_install "torch==$PYTORCH_VERSION" \ 24 | -f https://download.pytorch.org/whl/"$CU_VERSION"/torch_stable.html 25 | 26 | # use separate directories to allow parallel build 27 | BASE_BUILD_DIR=build/$CU_VERSION-py$PYTHON_VERSION-pt$PYTORCH_VERSION 28 | python setup.py \ 29 | build -b "$BASE_BUILD_DIR" \ 30 | bdist_wheel -b "$BASE_BUILD_DIR/build_dist" -d "wheels/$CU_VERSION/torch$PYTORCH_VERSION" 31 | rm -rf "$BASE_BUILD_DIR" 32 | -------------------------------------------------------------------------------- /extract/third_party/CenterNet2/dev/packaging/gen_wheel_index.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash -e 2 | # Copyright (c) Facebook, Inc. and its affiliates. 3 | 4 | 5 | root=$(readlink -f $1) 6 | if [[ -z "$root" ]]; then 7 | echo "Usage: ./gen_wheel_index.sh /absolute/path/to/wheels" 8 | exit 9 | fi 10 | 11 | export LC_ALL=C # reproducible sort 12 | # NOTE: all sort in this script might not work when xx.10 is released 13 | 14 | index=$root/index.html 15 | 16 | cd "$root" 17 | for cu in cpu cu92 cu100 cu101 cu102 cu110 cu111 cu113; do 18 | mkdir -p "$root/$cu" 19 | cd "$root/$cu" 20 | echo "Creating $PWD/index.html ..." 21 | # First sort by torch version, then stable sort by d2 version with unique. 22 | # As a result, the latest torch version for each d2 version is kept. 23 | for whl in $(find -type f -name '*.whl' -printf '%P\n' \ 24 | | sort -k 1 -r | sort -t '/' -k 2 --stable -r --unique); do 25 | echo "$whl
" 26 | done > index.html 27 | 28 | 29 | for torch in torch*; do 30 | cd "$root/$cu/$torch" 31 | 32 | # list all whl for each cuda,torch version 33 | echo "Creating $PWD/index.html ..." 34 | for whl in $(find . -type f -name '*.whl' -printf '%P\n' | sort -r); do 35 | echo "$whl
" 36 | done > index.html 37 | done 38 | done 39 | 40 | cd "$root" 41 | # Just list everything: 42 | echo "Creating $index ..." 43 | for whl in $(find . -type f -name '*.whl' -printf '%P\n' | sort -r); do 44 | echo "$whl
" 45 | done > "$index" 46 | 47 | -------------------------------------------------------------------------------- /extract/third_party/CenterNet2/dev/run_inference_tests.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash -e 2 | # Copyright (c) Facebook, Inc. and its affiliates. 3 | 4 | BIN="python tools/train_net.py" 5 | OUTPUT="inference_test_output" 6 | NUM_GPUS=2 7 | 8 | CFG_LIST=( "${@:1}" ) 9 | 10 | if [ ${#CFG_LIST[@]} -eq 0 ]; then 11 | CFG_LIST=( ./configs/quick_schedules/*inference_acc_test.yaml ) 12 | fi 13 | 14 | echo "========================================================================" 15 | echo "Configs to run:" 16 | echo "${CFG_LIST[@]}" 17 | echo "========================================================================" 18 | 19 | 20 | for cfg in "${CFG_LIST[@]}"; do 21 | echo "========================================================================" 22 | echo "Running $cfg ..." 23 | echo "========================================================================" 24 | $BIN \ 25 | --eval-only \ 26 | --num-gpus $NUM_GPUS \ 27 | --config-file "$cfg" \ 28 | OUTPUT_DIR $OUTPUT 29 | rm -rf $OUTPUT 30 | done 31 | 32 | 33 | echo "========================================================================" 34 | echo "Running demo.py ..." 35 | echo "========================================================================" 36 | DEMO_BIN="python demo/demo.py" 37 | COCO_DIR=datasets/coco/val2014 38 | mkdir -pv $OUTPUT 39 | 40 | set -v 41 | 42 | $DEMO_BIN --config-file ./configs/quick_schedules/panoptic_fpn_R_50_inference_acc_test.yaml \ 43 | --input $COCO_DIR/COCO_val2014_0000001933* --output $OUTPUT 44 | rm -rf $OUTPUT 45 | -------------------------------------------------------------------------------- /extract/third_party/CenterNet2/dev/run_instant_tests.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash -e 2 | # Copyright (c) Facebook, Inc. and its affiliates. 3 | 4 | BIN="python tools/train_net.py" 5 | OUTPUT="instant_test_output" 6 | NUM_GPUS=2 7 | 8 | CFG_LIST=( "${@:1}" ) 9 | if [ ${#CFG_LIST[@]} -eq 0 ]; then 10 | CFG_LIST=( ./configs/quick_schedules/*instant_test.yaml ) 11 | fi 12 | 13 | echo "========================================================================" 14 | echo "Configs to run:" 15 | echo "${CFG_LIST[@]}" 16 | echo "========================================================================" 17 | 18 | for cfg in "${CFG_LIST[@]}"; do 19 | echo "========================================================================" 20 | echo "Running $cfg ..." 21 | echo "========================================================================" 22 | $BIN --num-gpus $NUM_GPUS --config-file "$cfg" \ 23 | SOLVER.IMS_PER_BATCH $(($NUM_GPUS * 2)) \ 24 | OUTPUT_DIR "$OUTPUT" 25 | rm -rf "$OUTPUT" 26 | done 27 | 28 | -------------------------------------------------------------------------------- /extract/third_party/CenterNet2/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 | # Launch (require GPUs): 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-compose ≥ 1.28.0) 18 | 19 | Install docker-compose and nvidia-docker-toolkit, then run: 20 | ``` 21 | cd docker && USER_ID=$UID docker-compose run detectron2 22 | ``` 23 | 24 | ## Use the deployment container (to test C++ examples) 25 | After building the base detectron2 container as above, do: 26 | ``` 27 | # Build: 28 | docker build -t detectron2-deploy:v0 -f deploy.Dockerfile . 29 | # Launch: 30 | docker run --gpus all -it detectron2-deploy:v0 31 | ``` 32 | 33 | #### Using a persistent cache directory 34 | 35 | You can prevent models from being re-downloaded on every run, 36 | by storing them in a cache directory. 37 | 38 | To do this, add `--volume=$HOME/.torch/fvcore_cache:/tmp:rw` in the run command. 39 | 40 | ## Install new dependencies 41 | Add the following to `Dockerfile` to make persistent changes. 42 | ``` 43 | RUN sudo apt-get update && sudo apt-get install -y vim 44 | ``` 45 | Or run them in the container to make temporary changes. 46 | -------------------------------------------------------------------------------- /extract/third_party/CenterNet2/docker/deploy.Dockerfile: -------------------------------------------------------------------------------- 1 | # Copyright (c) Facebook, Inc. and its affiliates. 2 | # This file defines a container that compiles the C++ examples of detectron2. 3 | # See docker/README.md for usage. 4 | 5 | # Depends on the image produced by "./Dockerfile" 6 | FROM detectron2:v0 7 | 8 | USER appuser 9 | ENV HOME=/home/appuser 10 | WORKDIR $HOME 11 | 12 | # Let torchvision find libtorch 13 | ENV CMAKE_PREFIX_PATH=$HOME/.local/lib/python3.6/site-packages/torch/ 14 | 15 | RUN sudo apt-get update && sudo apt-get install libopencv-dev --yes 16 | 17 | # install libtorchvision 18 | RUN git clone --branch v0.11.1 https://github.com/pytorch/vision/ 19 | RUN mkdir vision/build && cd vision/build && \ 20 | cmake .. -DCMAKE_INSTALL_PREFIX=$HOME/.local -DCMAKE_BUILD_TYPE=Release -DWITH_CUDA=on -DTORCH_CUDA_ARCH_LIST=$TORCH_CUDA_ARCH_LIST && \ 21 | make -j && make install 22 | 23 | # make our installation take effect 24 | ENV CPATH=$HOME/.local/include \ 25 | LIBRARY_PATH=$HOME/.local/lib \ 26 | LD_LIBRARY_PATH=$HOME/.local/lib 27 | 28 | 29 | # build C++ examples of detectron2 30 | RUN cd detectron2_repo/tools/deploy && mkdir build && cd build && \ 31 | cmake -DTORCH_CUDA_ARCH_LIST=$TORCH_CUDA_ARCH_LIST .. && make 32 | # binaries will be available under tools/deploy/build 33 | -------------------------------------------------------------------------------- /extract/third_party/CenterNet2/docker/docker-compose.yml: -------------------------------------------------------------------------------- 1 | version: "2.3" 2 | services: 3 | detectron2: 4 | build: 5 | context: . 6 | dockerfile: Dockerfile 7 | args: 8 | USER_ID: ${USER_ID:-1000} 9 | deploy: 10 | resources: 11 | reservations: 12 | devices: 13 | - capabilities: 14 | - gpu 15 | shm_size: "8gb" 16 | ulimits: 17 | memlock: -1 18 | stack: 67108864 19 | volumes: 20 | - /tmp/.X11-unix:/tmp/.X11-unix:ro 21 | environment: 22 | - DISPLAY=$DISPLAY 23 | - NVIDIA_VISIBLE_DEVICES=all 24 | # Uncomment with proper source to access webcam from docker 25 | # devices: 26 | # - /dev/video0:/dev/video0 27 | -------------------------------------------------------------------------------- /extract/third_party/CenterNet2/docs/.gitignore: -------------------------------------------------------------------------------- 1 | _build 2 | -------------------------------------------------------------------------------- /extract/third_party/CenterNet2/docs/Makefile: -------------------------------------------------------------------------------- 1 | # Minimal makefile for Sphinx documentation 2 | # Copyright (c) Facebook, Inc. and its affiliates. 3 | 4 | # You can set these variables from the command line. 5 | SPHINXOPTS = 6 | SPHINXBUILD = sphinx-build 7 | SOURCEDIR = . 8 | BUILDDIR = _build 9 | 10 | # Put it first so that "make" without argument is like "make help". 11 | help: 12 | @$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O) 13 | 14 | .PHONY: help Makefile 15 | 16 | # Catch-all target: route all unknown targets to Sphinx using the new 17 | # "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS). 18 | %: Makefile 19 | @$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O) 20 | -------------------------------------------------------------------------------- /extract/third_party/CenterNet2/docs/README.md: -------------------------------------------------------------------------------- 1 | # Read the docs: 2 | 3 | The latest documentation built from this directory is available at [detectron2.readthedocs.io](https://detectron2.readthedocs.io/). 4 | Documents in this directory are not meant to be read on github. 5 | 6 | # Build the docs: 7 | 8 | 1. Install detectron2 according to [INSTALL.md](../INSTALL.md). 9 | 2. Install additional libraries required to build docs: 10 | - docutils==0.16 11 | - Sphinx==3.2.0 12 | - recommonmark==0.6.0 13 | - sphinx_rtd_theme 14 | 15 | 3. Run `make html` from this directory. 16 | -------------------------------------------------------------------------------- /extract/third_party/CenterNet2/docs/_static/css/custom.css: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Facebook, Inc. and its affiliates. 3 | * some extra css to make markdown look similar between github/sphinx 4 | */ 5 | 6 | /* 7 | * Below is for install.md: 8 | */ 9 | .rst-content code { 10 | white-space: pre; 11 | border: 0px; 12 | } 13 | 14 | .rst-content th { 15 | border: 1px solid #e1e4e5; 16 | } 17 | 18 | .rst-content th p { 19 | /* otherwise will be default 24px for regular paragraph */ 20 | margin-bottom: 0px; 21 | } 22 | 23 | .rst-content .line-block { 24 | /* otherwise will be 24px */ 25 | margin-bottom: 0px; 26 | } 27 | 28 | div.section > details { 29 | padding-bottom: 1em; 30 | } 31 | -------------------------------------------------------------------------------- /extract/third_party/CenterNet2/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 | -------------------------------------------------------------------------------- /extract/third_party/CenterNet2/docs/modules/checkpoint.rst: -------------------------------------------------------------------------------- 1 | detectron2.checkpoint 2 | ============================= 3 | 4 | .. automodule:: detectron2.checkpoint 5 | :members: 6 | :undoc-members: 7 | :show-inheritance: 8 | -------------------------------------------------------------------------------- /extract/third_party/CenterNet2/docs/modules/config.rst: -------------------------------------------------------------------------------- 1 | detectron2.config 2 | ========================= 3 | 4 | Related tutorials: :doc:`../tutorials/configs`, :doc:`../tutorials/extend`. 5 | 6 | .. automodule:: detectron2.config 7 | :members: 8 | :undoc-members: 9 | :show-inheritance: 10 | 11 | 12 | Yaml Config References 13 | ----------------- 14 | 15 | .. literalinclude:: ../../detectron2/config/defaults.py 16 | :language: python 17 | :linenos: 18 | :lines: 7- 19 | -------------------------------------------------------------------------------- /extract/third_party/CenterNet2/docs/modules/data.rst: -------------------------------------------------------------------------------- 1 | detectron2.data 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 | -------------------------------------------------------------------------------- /extract/third_party/CenterNet2/docs/modules/data_transforms.rst: -------------------------------------------------------------------------------- 1 | detectron2.data.transforms 2 | ==================================== 3 | 4 | Related tutorial: :doc:`../tutorials/augmentation`. 5 | 6 | .. automodule:: detectron2.data.transforms 7 | :members: 8 | :undoc-members: 9 | :show-inheritance: 10 | :imported-members: 11 | -------------------------------------------------------------------------------- /extract/third_party/CenterNet2/docs/modules/engine.rst: -------------------------------------------------------------------------------- 1 | detectron2.engine 2 | ========================= 3 | 4 | Related tutorial: :doc:`../tutorials/training`. 5 | 6 | .. automodule:: detectron2.engine 7 | :members: 8 | :undoc-members: 9 | :show-inheritance: 10 | 11 | 12 | detectron2.engine.defaults module 13 | --------------------------------- 14 | 15 | .. automodule:: detectron2.engine.defaults 16 | :members: 17 | :undoc-members: 18 | :show-inheritance: 19 | 20 | detectron2.engine.hooks module 21 | --------------------------------- 22 | 23 | .. automodule:: detectron2.engine.hooks 24 | :members: 25 | :undoc-members: 26 | :show-inheritance: 27 | -------------------------------------------------------------------------------- /extract/third_party/CenterNet2/docs/modules/evaluation.rst: -------------------------------------------------------------------------------- 1 | detectron2.evaluation 2 | ============================= 3 | 4 | .. automodule:: detectron2.evaluation 5 | :members: 6 | :undoc-members: 7 | :show-inheritance: 8 | -------------------------------------------------------------------------------- /extract/third_party/CenterNet2/docs/modules/export.rst: -------------------------------------------------------------------------------- 1 | detectron2.export 2 | ========================= 3 | 4 | Related tutorial: :doc:`../tutorials/deployment`. 5 | 6 | .. automodule:: detectron2.export 7 | :members: 8 | :undoc-members: 9 | :show-inheritance: 10 | -------------------------------------------------------------------------------- /extract/third_party/CenterNet2/docs/modules/fvcore.rst: -------------------------------------------------------------------------------- 1 | fvcore documentation 2 | ==================== 3 | 4 | Detectron2 depends on utilities in 5 | `fvcore `_. 6 | We include part of fvcore documentation here for easier reference. 7 | 8 | fvcore.nn 9 | ----------------- 10 | 11 | .. automodule:: fvcore.nn 12 | :members: 13 | :inherited-members: 14 | :undoc-members: 15 | :show-inheritance: 16 | 17 | fvcore.common 18 | --------------------- 19 | 20 | .. automodule:: fvcore.common.checkpoint 21 | :members: 22 | :undoc-members: 23 | :show-inheritance: 24 | 25 | .. automodule:: fvcore.common.config 26 | :members: 27 | :undoc-members: 28 | :show-inheritance: 29 | 30 | .. automodule:: fvcore.common.history_buffer 31 | :members: 32 | :undoc-members: 33 | :show-inheritance: 34 | 35 | .. automodule:: fvcore.common.param_scheduler 36 | :members: 37 | :inherited-members: 38 | :undoc-members: 39 | :show-inheritance: 40 | 41 | .. automodule:: fvcore.common.registry 42 | :members: 43 | :undoc-members: 44 | :show-inheritance: 45 | 46 | .. automodule:: fvcore.common.timer 47 | :members: 48 | :undoc-members: 49 | :show-inheritance: 50 | -------------------------------------------------------------------------------- /extract/third_party/CenterNet2/docs/modules/index.rst: -------------------------------------------------------------------------------- 1 | API Documentation 2 | ================== 3 | 4 | .. toctree:: 5 | 6 | checkpoint 7 | config 8 | data 9 | data_transforms 10 | engine 11 | evaluation 12 | layers 13 | model_zoo 14 | modeling 15 | solver 16 | structures 17 | utils 18 | export 19 | fvcore 20 | -------------------------------------------------------------------------------- /extract/third_party/CenterNet2/docs/modules/layers.rst: -------------------------------------------------------------------------------- 1 | detectron2.layers 2 | ========================= 3 | 4 | .. automodule:: detectron2.layers 5 | :members: 6 | :undoc-members: 7 | :show-inheritance: 8 | -------------------------------------------------------------------------------- /extract/third_party/CenterNet2/docs/modules/model_zoo.rst: -------------------------------------------------------------------------------- 1 | detectron2.model_zoo 2 | ============================ 3 | 4 | .. automodule:: detectron2.model_zoo 5 | :members: 6 | :undoc-members: 7 | :show-inheritance: 8 | -------------------------------------------------------------------------------- /extract/third_party/CenterNet2/docs/modules/solver.rst: -------------------------------------------------------------------------------- 1 | detectron2.solver 2 | ========================= 3 | 4 | .. automodule:: detectron2.solver 5 | :members: 6 | :undoc-members: 7 | :show-inheritance: 8 | -------------------------------------------------------------------------------- /extract/third_party/CenterNet2/docs/modules/structures.rst: -------------------------------------------------------------------------------- 1 | detectron2.structures 2 | ============================= 3 | 4 | .. automodule:: detectron2.structures 5 | :members: 6 | :undoc-members: 7 | :show-inheritance: 8 | -------------------------------------------------------------------------------- /extract/third_party/CenterNet2/docs/notes/contributing.md: -------------------------------------------------------------------------------- 1 | ../../.github/CONTRIBUTING.md -------------------------------------------------------------------------------- /extract/third_party/CenterNet2/docs/notes/index.rst: -------------------------------------------------------------------------------- 1 | Notes 2 | ====================================== 3 | 4 | .. toctree:: 5 | :maxdepth: 2 6 | 7 | benchmarks 8 | compatibility 9 | contributing 10 | changelog 11 | -------------------------------------------------------------------------------- /extract/third_party/CenterNet2/docs/requirements.txt: -------------------------------------------------------------------------------- 1 | docutils==0.16 2 | # https://github.com/sphinx-doc/sphinx/commit/7acd3ada3f38076af7b2b5c9f3b60bb9c2587a3d 3 | sphinx==3.2.0 4 | recommonmark==0.6.0 5 | sphinx_rtd_theme 6 | # Dependencies here are only those required by import 7 | termcolor 8 | numpy 9 | tqdm 10 | matplotlib 11 | termcolor 12 | yacs 13 | tabulate 14 | cloudpickle 15 | Pillow 16 | future 17 | git+git://github.com/facebookresearch/fvcore.git 18 | https://download.pytorch.org/whl/cpu/torch-1.8.1%2Bcpu-cp37-cp37m-linux_x86_64.whl 19 | https://download.pytorch.org/whl/cpu/torchvision-0.9.1%2Bcpu-cp37-cp37m-linux_x86_64.whl 20 | omegaconf>=2.1.0.dev24 21 | hydra-core>=1.1.0.dev5 22 | -------------------------------------------------------------------------------- /extract/third_party/CenterNet2/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 | -------------------------------------------------------------------------------- /extract/third_party/CenterNet2/docs/tutorials/builtin_datasets.md: -------------------------------------------------------------------------------- 1 | ../../datasets/README.md -------------------------------------------------------------------------------- /extract/third_party/CenterNet2/docs/tutorials/getting_started.md: -------------------------------------------------------------------------------- 1 | ../../GETTING_STARTED.md -------------------------------------------------------------------------------- /extract/third_party/CenterNet2/docs/tutorials/index.rst: -------------------------------------------------------------------------------- 1 | Tutorials 2 | ====================================== 3 | 4 | .. toctree:: 5 | :maxdepth: 2 6 | 7 | install 8 | getting_started 9 | builtin_datasets 10 | extend 11 | datasets 12 | data_loading 13 | augmentation 14 | models 15 | write-models 16 | training 17 | evaluation 18 | configs 19 | lazyconfigs 20 | deployment 21 | -------------------------------------------------------------------------------- /extract/third_party/CenterNet2/docs/tutorials/install.md: -------------------------------------------------------------------------------- 1 | ../../INSTALL.md -------------------------------------------------------------------------------- /extract/third_party/CenterNet2/projects/CenterNet2/.gitignore: -------------------------------------------------------------------------------- 1 | # compilation and distribution 2 | __pycache__ 3 | _ext 4 | *.pyc 5 | *.pyd 6 | *.so 7 | centernet.egg-info/ 8 | build/ 9 | dist/ 10 | wheels/ 11 | -------------------------------------------------------------------------------- /extract/third_party/CenterNet2/projects/CenterNet2/centernet/__init__.py: -------------------------------------------------------------------------------- 1 | from .modeling.meta_arch.centernet_detector import CenterNetDetector 2 | from .modeling.dense_heads.centernet import CenterNet 3 | from .modeling.roi_heads.custom_roi_heads import CustomROIHeads, CustomCascadeROIHeads 4 | 5 | from .modeling.backbone.fpn_p5 import build_p67_resnet_fpn_backbone 6 | from .modeling.backbone.dla import build_dla_backbone 7 | from .modeling.backbone.dlafpn import build_dla_fpn3_backbone 8 | from .modeling.backbone.bifpn import build_resnet_bifpn_backbone 9 | from .modeling.backbone.bifpn_fcos import build_fcos_resnet_bifpn_backbone 10 | from .modeling.backbone.res2net import build_p67_res2net_fpn_backbone 11 | 12 | from .data.datasets.objects365 import categories_v1 13 | from .data.datasets.coco import _PREDEFINED_SPLITS_COCO 14 | from .data.datasets import nuimages 15 | -------------------------------------------------------------------------------- /extract/third_party/CenterNet2/projects/CenterNet2/centernet/data/datasets/nuimages.py: -------------------------------------------------------------------------------- 1 | from detectron2.data.datasets.register_coco import register_coco_instances 2 | import os 3 | 4 | categories = [ 5 | {'id': 0, 'name': 'car'}, 6 | {'id': 1, 'name': 'truck'}, 7 | {'id': 2, 'name': 'trailer'}, 8 | {'id': 3, 'name': 'bus'}, 9 | {'id': 4, 'name': 'construction_vehicle'}, 10 | {'id': 5, 'name': 'bicycle'}, 11 | {'id': 6, 'name': 'motorcycle'}, 12 | {'id': 7, 'name': 'pedestrian'}, 13 | {'id': 8, 'name': 'traffic_cone'}, 14 | {'id': 9, 'name': 'barrier'}, 15 | ] 16 | 17 | def _get_builtin_metadata(): 18 | id_to_name = {x['id']: x['name'] for x in categories} 19 | thing_dataset_id_to_contiguous_id = {i: i for i in range(len(categories))} 20 | thing_classes = [id_to_name[k] for k in sorted(id_to_name)] 21 | return { 22 | "thing_dataset_id_to_contiguous_id": thing_dataset_id_to_contiguous_id, 23 | "thing_classes": thing_classes} 24 | 25 | _PREDEFINED_SPLITS = { 26 | "nuimages_train": ("nuimages", "nuimages/annotations/nuimages_v1.0-train.json"), 27 | "nuimages_val": ("nuimages", "nuimages/annotations/nuimages_v1.0-val.json"), 28 | "nuimages_mini": ("nuimages", "nuimages/annotations/nuimages_v1.0-mini.json"), 29 | } 30 | 31 | for key, (image_root, json_file) in _PREDEFINED_SPLITS.items(): 32 | register_coco_instances( 33 | key, 34 | _get_builtin_metadata(), 35 | os.path.join("datasets", json_file) if "://" not in json_file else json_file, 36 | os.path.join("datasets", image_root), 37 | ) 38 | -------------------------------------------------------------------------------- /extract/third_party/CenterNet2/projects/CenterNet2/centernet/modeling/dense_heads/utils.py: -------------------------------------------------------------------------------- 1 | import cv2 2 | import torch 3 | from torch import nn 4 | from detectron2.utils.comm import get_world_size 5 | from detectron2.structures import pairwise_iou, Boxes 6 | # from .data import CenterNetCrop 7 | import torch.nn.functional as F 8 | import numpy as np 9 | from detectron2.structures import Boxes, ImageList, Instances 10 | 11 | __all__ = ['reduce_sum', '_transpose'] 12 | 13 | INF = 1000000000 14 | 15 | def _transpose(training_targets, num_loc_list): 16 | ''' 17 | This function is used to transpose image first training targets to 18 | level first ones 19 | :return: level first training targets 20 | ''' 21 | for im_i in range(len(training_targets)): 22 | training_targets[im_i] = torch.split( 23 | training_targets[im_i], num_loc_list, dim=0) 24 | 25 | targets_level_first = [] 26 | for targets_per_level in zip(*training_targets): 27 | targets_level_first.append( 28 | torch.cat(targets_per_level, dim=0)) 29 | return targets_level_first 30 | 31 | 32 | def reduce_sum(tensor): 33 | world_size = get_world_size() 34 | if world_size < 2: 35 | return tensor 36 | tensor = tensor.clone() 37 | torch.distributed.all_reduce(tensor, op=torch.distributed.ReduceOp.SUM) 38 | return tensor -------------------------------------------------------------------------------- /extract/third_party/CenterNet2/projects/CenterNet2/centernet/modeling/layers/ml_nms.py: -------------------------------------------------------------------------------- 1 | from detectron2.layers import batched_nms 2 | 3 | 4 | def ml_nms(boxlist, nms_thresh, max_proposals=-1, 5 | score_field="scores", label_field="labels"): 6 | """ 7 | Performs non-maximum suppression on a boxlist, with scores specified 8 | in a boxlist field via score_field. 9 | Arguments: 10 | boxlist(BoxList) 11 | nms_thresh (float) 12 | max_proposals (int): if > 0, then only the top max_proposals are kept 13 | after non-maximum suppression 14 | score_field (str) 15 | """ 16 | if nms_thresh <= 0: 17 | return boxlist 18 | if boxlist.has('pred_boxes'): 19 | boxes = boxlist.pred_boxes.tensor 20 | labels = boxlist.pred_classes 21 | else: 22 | boxes = boxlist.proposal_boxes.tensor 23 | labels = boxlist.proposal_boxes.tensor.new_zeros( 24 | len(boxlist.proposal_boxes.tensor)) 25 | scores = boxlist.scores 26 | 27 | keep = batched_nms(boxes, scores, labels, nms_thresh) 28 | if max_proposals > 0: 29 | keep = keep[: max_proposals] 30 | boxlist = boxlist[keep] 31 | return boxlist 32 | -------------------------------------------------------------------------------- /extract/third_party/CenterNet2/projects/CenterNet2/centernet/modeling/roi_heads/fed_loss.py: -------------------------------------------------------------------------------- 1 | import torch 2 | import json 3 | import numpy as np 4 | from torch.nn import functional as F 5 | 6 | def load_class_freq( 7 | path='datasets/lvis/lvis_v1_train_cat_info.json', 8 | freq_weight=0.5): 9 | cat_info = json.load(open(path, 'r')) 10 | cat_info = torch.tensor( 11 | [c['image_count'] for c in sorted(cat_info, key=lambda x: x['id'])]) 12 | freq_weight = cat_info.float() ** freq_weight 13 | return freq_weight 14 | 15 | def get_fed_loss_inds( 16 | gt_classes, num_sample_cats=50, C=1203, \ 17 | weight=None, fed_cls_inds=-1): 18 | appeared = torch.unique(gt_classes) # C' 19 | prob = appeared.new_ones(C + 1).float() 20 | prob[-1] = 0 21 | if len(appeared) < num_sample_cats: 22 | if weight is not None: 23 | prob[:C] = weight.float().clone() 24 | prob[appeared] = 0 25 | if fed_cls_inds > 0: 26 | prob[fed_cls_inds:] = 0 27 | more_appeared = torch.multinomial( 28 | prob, num_sample_cats - len(appeared), 29 | replacement=False) 30 | appeared = torch.cat([appeared, more_appeared]) 31 | return appeared -------------------------------------------------------------------------------- /extract/third_party/CenterNet2/projects/CenterNet2/configs/Base-CenterNet-FPN.yaml: -------------------------------------------------------------------------------- 1 | MODEL: 2 | META_ARCHITECTURE: "CenterNetDetector" 3 | PROPOSAL_GENERATOR: 4 | NAME: "CenterNet" 5 | BACKBONE: 6 | NAME: "build_p67_resnet_fpn_backbone" 7 | WEIGHTS: "detectron2://ImageNetPretrained/MSRA/R-50.pkl" 8 | RESNETS: 9 | DEPTH: 50 10 | OUT_FEATURES: ["res3", "res4", "res5"] 11 | FPN: 12 | IN_FEATURES: ["res3", "res4", "res5"] 13 | DATASETS: 14 | TRAIN: ("coco_2017_train",) 15 | TEST: ("coco_2017_val",) 16 | SOLVER: 17 | IMS_PER_BATCH: 16 18 | BASE_LR: 0.01 19 | STEPS: (60000, 80000) 20 | MAX_ITER: 90000 21 | CHECKPOINT_PERIOD: 1000000000 22 | WARMUP_ITERS: 4000 23 | WARMUP_FACTOR: 0.00025 24 | CLIP_GRADIENTS: 25 | ENABLED: True 26 | INPUT: 27 | MIN_SIZE_TRAIN: (640, 672, 704, 736, 768, 800) 28 | OUTPUT_DIR: "./output/CenterNet2/auto" 29 | -------------------------------------------------------------------------------- /extract/third_party/CenterNet2/projects/CenterNet2/configs/Base_S4_DLA.yaml: -------------------------------------------------------------------------------- 1 | MODEL: 2 | META_ARCHITECTURE: "CenterNetDetector" 3 | PROPOSAL_GENERATOR: 4 | NAME: "CenterNet" 5 | PIXEL_STD: [57.375, 57.120, 58.395] 6 | BACKBONE: 7 | NAME: "build_dla_backbone" 8 | DLA: 9 | NORM: "BN" 10 | CENTERNET: 11 | IN_FEATURES: ["dla2"] 12 | FPN_STRIDES: [4] 13 | SOI: [[0, 1000000]] 14 | NUM_CLS_CONVS: 1 15 | NUM_BOX_CONVS: 1 16 | REG_WEIGHT: 1. 17 | MORE_POS: True 18 | HM_FOCAL_ALPHA: 0.25 19 | DATASETS: 20 | TRAIN: ("coco_2017_train",) 21 | TEST: ("coco_2017_val",) 22 | SOLVER: 23 | LR_SCHEDULER_NAME: "WarmupCosineLR" 24 | MAX_ITER: 90000 25 | BASE_LR: 0.04 26 | IMS_PER_BATCH: 64 27 | WEIGHT_DECAY: 0.0001 28 | CHECKPOINT_PERIOD: 1000000 29 | CLIP_GRADIENTS: 30 | ENABLED: True 31 | INPUT: 32 | CUSTOM_AUG: EfficientDetResizeCrop 33 | TRAIN_SIZE: 640 34 | MIN_SIZE_TEST: 608 35 | MAX_SIZE_TEST: 900 36 | TEST: 37 | EVAL_PERIOD: 7500 38 | DATALOADER: 39 | NUM_WORKERS: 8 40 | OUTPUT_DIR: "output/CenterNet2/auto" 41 | -------------------------------------------------------------------------------- /extract/third_party/CenterNet2/projects/CenterNet2/configs/CenterNet-FPN_R50_1x.yaml: -------------------------------------------------------------------------------- 1 | _BASE_: "Base-CenterNet-FPN.yaml" 2 | MODEL: 3 | CENTERNET: 4 | MORE_POS: True -------------------------------------------------------------------------------- /extract/third_party/CenterNet2/projects/CenterNet2/configs/CenterNet-S4_DLA_8x.yaml: -------------------------------------------------------------------------------- 1 | _BASE_: "Base_S4_DLA.yaml" 2 | SOLVER: 3 | MAX_ITER: 90000 4 | BASE_LR: 0.08 5 | IMS_PER_BATCH: 128 -------------------------------------------------------------------------------- /extract/third_party/CenterNet2/projects/CenterNet2/configs/CenterNet2-F_R50_1x.yaml: -------------------------------------------------------------------------------- 1 | _BASE_: "Base-CenterNet2.yaml" 2 | MODEL: 3 | ROI_HEADS: 4 | NAME: CustomROIHeads -------------------------------------------------------------------------------- /extract/third_party/CenterNet2/projects/CenterNet2/configs/CenterNet2_DLA-BiFPN-P3_24x.yaml: -------------------------------------------------------------------------------- 1 | _BASE_: "Base-CenterNet2.yaml" 2 | MODEL: 3 | BACKBONE: 4 | NAME: "build_p35_fcos_dla_bifpn_backbone" 5 | BIFPN: 6 | OUT_CHANNELS: 160 7 | NUM_LEVELS: 3 8 | NUM_BIFPN: 4 9 | DLA: 10 | NUM_LAYERS: 34 11 | NORM: "SyncBN" 12 | FPN: 13 | IN_FEATURES: ["dla3", "dla4", "dla5"] 14 | ROI_HEADS: 15 | IN_FEATURES: ["p3", "p4", "p5"] 16 | CENTERNET: 17 | POST_NMS_TOPK_TEST: 128 18 | FPN_STRIDES: [8, 16, 32] 19 | IN_FEATURES: ['p3', 'p4', 'p5'] 20 | SOI: [[0, 64], [48, 192], [128, 1000000]] 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: (300000, 340000) 28 | MAX_ITER: 360000 29 | CHECKPOINT_PERIOD: 100000 30 | WARMUP_ITERS: 4000 31 | WARMUP_FACTOR: 0.00025 32 | INPUT: 33 | MIN_SIZE_TRAIN: (256, 288, 320, 352, 384, 416, 448, 480, 512, 544, 576, 608) 34 | MAX_SIZE_TRAIN: 900 35 | MAX_SIZE_TEST: 736 36 | MIN_SIZE_TEST: 512 -------------------------------------------------------------------------------- /extract/third_party/CenterNet2/projects/CenterNet2/configs/CenterNet2_DLA-BiFPN-P3_4x.yaml: -------------------------------------------------------------------------------- 1 | _BASE_: "Base-CenterNet2.yaml" 2 | MODEL: 3 | BACKBONE: 4 | NAME: "build_p35_fcos_dla_bifpn_backbone" 5 | BIFPN: 6 | OUT_CHANNELS: 160 7 | NUM_LEVELS: 3 8 | NUM_BIFPN: 4 9 | DLA: 10 | NUM_LAYERS: 34 11 | NORM: "SyncBN" 12 | FPN: 13 | IN_FEATURES: ["dla3", "dla4", "dla5"] 14 | ROI_HEADS: 15 | IN_FEATURES: ["p3", "p4", "p5"] 16 | CENTERNET: 17 | POST_NMS_TOPK_TEST: 128 18 | FPN_STRIDES: [8, 16, 32] 19 | IN_FEATURES: ['p3', 'p4', 'p5'] 20 | SOI: [[0, 64], [48, 192], [128, 1000000]] 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: (300000, 340000) 28 | MAX_ITER: 360000 29 | CHECKPOINT_PERIOD: 100000 30 | WARMUP_ITERS: 4000 31 | WARMUP_FACTOR: 0.00025 32 | INPUT: 33 | MIN_SIZE_TRAIN: (256, 288, 320, 352, 384, 416, 448, 480, 512, 544, 576, 608) 34 | MAX_SIZE_TRAIN: 900 35 | MAX_SIZE_TEST: 736 36 | MIN_SIZE_TEST: 512 -------------------------------------------------------------------------------- /extract/third_party/CenterNet2/projects/CenterNet2/configs/CenterNet2_DLA-BiFPN-P5_640_16x.yaml: -------------------------------------------------------------------------------- 1 | _BASE_: "Base-CenterNet2.yaml" 2 | MODEL: 3 | BACKBONE: 4 | NAME: "build_p37_dla_bifpn_backbone" 5 | BIFPN: 6 | OUT_CHANNELS: 160 7 | NUM_LEVELS: 5 8 | NUM_BIFPN: 3 9 | CENTERNET: 10 | POST_NMS_TOPK_TEST: 128 11 | WEIGHTS: '' 12 | PIXEL_MEAN: [123.675, 116.280, 103.530] 13 | PIXEL_STD: [58.395, 57.12, 57.375] 14 | FPN: 15 | IN_FEATURES: ["dla3", "dla4", "dla5"] 16 | SOLVER: 17 | LR_SCHEDULER_NAME: "WarmupCosineLR" 18 | MAX_ITER: 360000 19 | BASE_LR: 0.08 20 | IMS_PER_BATCH: 64 21 | CHECKPOINT_PERIOD: 90000 22 | TEST: 23 | EVAL_PERIOD: 7500 24 | INPUT: 25 | FORMAT: RGB 26 | CUSTOM_AUG: EfficientDetResizeCrop 27 | TRAIN_SIZE: 640 28 | MIN_SIZE_TEST: 608 29 | MAX_SIZE_TEST: 900 30 | -------------------------------------------------------------------------------- /extract/third_party/CenterNet2/projects/CenterNet2/configs/CenterNet2_DLA-BiFPN-P5_640_16x_ST.yaml: -------------------------------------------------------------------------------- 1 | _BASE_: "Base-CenterNet2.yaml" 2 | MODEL: 3 | BACKBONE: 4 | NAME: "build_p37_dla_bifpn_backbone" 5 | BIFPN: 6 | OUT_CHANNELS: 160 7 | NUM_LEVELS: 5 8 | NUM_BIFPN: 3 9 | CENTERNET: 10 | POST_NMS_TOPK_TEST: 128 11 | WEIGHTS: '' 12 | PIXEL_MEAN: [123.675, 116.280, 103.530] 13 | PIXEL_STD: [58.395, 57.12, 57.375] 14 | FPN: 15 | IN_FEATURES: ["dla3", "dla4", "dla5"] 16 | SOLVER: 17 | LR_SCHEDULER_NAME: "WarmupCosineLR" 18 | MAX_ITER: 360000 19 | BASE_LR: 0.08 20 | IMS_PER_BATCH: 64 21 | TEST: 22 | EVAL_PERIOD: 7500 23 | INPUT: 24 | FORMAT: RGB 25 | CUSTOM_AUG: EfficientDetResizeCrop 26 | TRAIN_SIZE: 640 27 | MIN_SIZE_TEST: 608 28 | MAX_SIZE_TEST: 900 29 | DATASETS: 30 | TRAIN: ("coco_2017_train","coco_un_yolov4_55_0.5",) 31 | -------------------------------------------------------------------------------- /extract/third_party/CenterNet2/projects/CenterNet2/configs/CenterNet2_DLA-fcosBiFPN-P5_640_16x_ST.yaml: -------------------------------------------------------------------------------- 1 | _BASE_: "Base-CenterNet2.yaml" 2 | MODEL: 3 | BACKBONE: 4 | NAME: "build_p37_fcos_dla_bifpn_backbone" 5 | BIFPN: 6 | OUT_CHANNELS: 160 7 | NUM_LEVELS: 5 8 | NUM_BIFPN: 3 9 | CENTERNET: 10 | POST_NMS_TOPK_TEST: 128 11 | WEIGHTS: '' 12 | PIXEL_MEAN: [123.675, 116.280, 103.530] 13 | PIXEL_STD: [58.395, 57.12, 57.375] 14 | FPN: 15 | IN_FEATURES: ["dla3", "dla4", "dla5"] 16 | TEST: 17 | EVAL_PERIOD: 7500 18 | SOLVER: 19 | LR_SCHEDULER_NAME: "WarmupCosineLR" 20 | MAX_ITER: 360000 21 | BASE_LR: 0.08 22 | IMS_PER_BATCH: 64 23 | INPUT: 24 | FORMAT: RGB 25 | CUSTOM_AUG: EfficientDetResizeCrop 26 | TRAIN_SIZE: 640 27 | MIN_SIZE_TEST: 608 28 | MAX_SIZE_TEST: 900 29 | DATASETS: 30 | TRAIN: ("coco_2017_train","coco_un_yolov4_55_0.5",) 31 | -------------------------------------------------------------------------------- /extract/third_party/CenterNet2/projects/CenterNet2/configs/CenterNet2_R2-101-DCN-BiFPN_1280_4x.yaml: -------------------------------------------------------------------------------- 1 | _BASE_: "Base-CenterNet2.yaml" 2 | MODEL: 3 | BACKBONE: 4 | NAME: "build_res2net_bifpn_backbone" 5 | BIFPN: 6 | NUM_BIFPN: 7 7 | OUT_CHANNELS: 288 8 | WEIGHTS: "output/r2_101.pkl" 9 | RESNETS: 10 | DEPTH: 101 11 | WIDTH_PER_GROUP: 26 12 | DEFORM_ON_PER_STAGE: [False, False, True, True] # on Res4, Res5 13 | DEFORM_MODULATED: True 14 | PIXEL_MEAN: [123.675, 116.280, 103.530] 15 | PIXEL_STD: [58.395, 57.12, 57.375] 16 | CENTERNET: 17 | USE_DEFORMABLE: True 18 | ROI_HEADS: 19 | IN_FEATURES: ["p3", "p4"] 20 | INPUT: 21 | FORMAT: RGB 22 | TEST: 23 | EVAL_PERIOD: 7500 24 | SOLVER: 25 | MAX_ITER: 180000 26 | CHECKPOINT_PERIOD: 60000 27 | LR_SCHEDULER_NAME: "WarmupCosineLR" 28 | BASE_LR: 0.04 29 | IMS_PER_BATCH: 32 30 | INPUT: 31 | CUSTOM_AUG: EfficientDetResizeCrop 32 | TRAIN_SIZE: 1280 33 | -------------------------------------------------------------------------------- /extract/third_party/CenterNet2/projects/CenterNet2/configs/CenterNet2_R2-101-DCN-BiFPN_4x+4x_1560_ST.yaml: -------------------------------------------------------------------------------- 1 | _BASE_: "Base-CenterNet2.yaml" 2 | MODEL: 3 | BACKBONE: 4 | NAME: "build_res2net_bifpn_backbone" 5 | BIFPN: 6 | NUM_BIFPN: 7 7 | OUT_CHANNELS: 288 8 | WEIGHTS: "output/r2_101.pkl" 9 | RESNETS: 10 | DEPTH: 101 11 | WIDTH_PER_GROUP: 26 12 | DEFORM_ON_PER_STAGE: [False, False, True, True] # on Res4, Res5 13 | DEFORM_MODULATED: True 14 | PIXEL_MEAN: [123.675, 116.280, 103.530] 15 | PIXEL_STD: [58.395, 57.12, 57.375] 16 | CENTERNET: 17 | USE_DEFORMABLE: True 18 | ROI_HEADS: 19 | IN_FEATURES: ["p3", "p4"] 20 | TEST: 21 | EVAL_PERIOD: 7500 22 | SOLVER: 23 | MAX_ITER: 180000 24 | CHECKPOINT_PERIOD: 7500 25 | LR_SCHEDULER_NAME: "WarmupCosineLR" 26 | BASE_LR: 0.04 27 | IMS_PER_BATCH: 32 28 | DATASETS: 29 | TRAIN: "('coco_2017_train', 'coco_un_yolov4_55_0.5')" 30 | INPUT: 31 | FORMAT: RGB 32 | CUSTOM_AUG: EfficientDetResizeCrop 33 | TRAIN_SIZE: 1280 34 | TEST_SIZE: 1560 35 | TEST_INPUT_TYPE: 'square' 36 | -------------------------------------------------------------------------------- /extract/third_party/CenterNet2/projects/CenterNet2/configs/CenterNet2_R2-101-DCN_896_4x.yaml: -------------------------------------------------------------------------------- 1 | _BASE_: "Base-CenterNet2.yaml" 2 | MODEL: 3 | BACKBONE: 4 | NAME: "build_p67_res2net_fpn_backbone" 5 | WEIGHTS: "output/r2_101.pkl" 6 | RESNETS: 7 | DEPTH: 101 8 | WIDTH_PER_GROUP: 26 9 | DEFORM_ON_PER_STAGE: [False, False, True, True] # on Res4, Res5 10 | DEFORM_MODULATED: True 11 | PIXEL_MEAN: [123.675, 116.280, 103.530] 12 | PIXEL_STD: [58.395, 57.12, 57.375] 13 | CENTERNET: 14 | USE_DEFORMABLE: True 15 | ROI_HEADS: 16 | IN_FEATURES: ["p3", "p4"] 17 | INPUT: 18 | FORMAT: RGB 19 | TEST: 20 | EVAL_PERIOD: 7500 21 | SOLVER: 22 | MAX_ITER: 180000 23 | CHECKPOINT_PERIOD: 600000 24 | LR_SCHEDULER_NAME: "WarmupCosineLR" 25 | BASE_LR: 0.04 26 | IMS_PER_BATCH: 32 27 | INPUT: 28 | CUSTOM_AUG: EfficientDetResizeCrop 29 | TRAIN_SIZE: 896 -------------------------------------------------------------------------------- /extract/third_party/CenterNet2/projects/CenterNet2/configs/CenterNet2_R50_1x.yaml: -------------------------------------------------------------------------------- 1 | _BASE_: "Base-CenterNet2.yaml" 2 | -------------------------------------------------------------------------------- /extract/third_party/CenterNet2/projects/CenterNet2/configs/CenterNet2_X101-DCN_2x.yaml: -------------------------------------------------------------------------------- 1 | _BASE_: "Base-CenterNet2.yaml" 2 | MODEL: 3 | CENTERNET: 4 | USE_DEFORMABLE: True 5 | WEIGHTS: "detectron2://ImageNetPretrained/FAIR/X-101-32x8d.pkl" 6 | PIXEL_STD: [57.375, 57.120, 58.395] 7 | RESNETS: 8 | STRIDE_IN_1X1: False 9 | NUM_GROUPS: 32 10 | WIDTH_PER_GROUP: 8 11 | DEPTH: 101 12 | DEFORM_ON_PER_STAGE: [False, False, True, True] # on Res4, Res5 13 | DEFORM_MODULATED: True 14 | ROI_HEADS: 15 | IN_FEATURES: ["p3", "p4"] 16 | SOLVER: 17 | STEPS: (120000, 160000) 18 | MAX_ITER: 180000 19 | CHECKPOINT_PERIOD: 40000 20 | INPUT: 21 | MIN_SIZE_TRAIN: (480, 960) 22 | MIN_SIZE_TRAIN_SAMPLING: "range" 23 | -------------------------------------------------------------------------------- /extract/third_party/CenterNet2/projects/CenterNet2/configs/LVIS_CenterNet2_R50_1x.yaml: -------------------------------------------------------------------------------- 1 | _BASE_: "Base-CenterNet2.yaml" 2 | MODEL: 3 | ROI_HEADS: 4 | NUM_CLASSES: 1203 5 | SCORE_THRESH_TEST: 0.02 6 | NMS_THRESH_TEST: 0.5 7 | CENTERNET: 8 | NUM_CLASSES: 1203 9 | 10 | DATASETS: 11 | TRAIN: ("lvis_v1_train",) 12 | TEST: ("lvis_v1_val",) 13 | DATALOADER: 14 | SAMPLER_TRAIN: "RepeatFactorTrainingSampler" 15 | REPEAT_THRESHOLD: 0.001 16 | TEST: 17 | DETECTIONS_PER_IMAGE: 300 18 | -------------------------------------------------------------------------------- /extract/third_party/CenterNet2/projects/CenterNet2/configs/LVIS_CenterNet2_R50_Fed_1x.yaml: -------------------------------------------------------------------------------- 1 | _BASE_: "Base-CenterNet2.yaml" 2 | MODEL: 3 | ROI_HEADS: 4 | NUM_CLASSES: 1203 5 | SCORE_THRESH_TEST: 0.02 6 | NMS_THRESH_TEST: 0.5 7 | CENTERNET: 8 | NUM_CLASSES: 1203 9 | ROI_BOX_HEAD: 10 | USE_SIGMOID_CE: True 11 | USE_FED_LOSS: True 12 | DATASETS: 13 | TRAIN: ("lvis_v1_train",) 14 | TEST: ("lvis_v1_val",) 15 | DATALOADER: 16 | SAMPLER_TRAIN: "RepeatFactorTrainingSampler" 17 | REPEAT_THRESHOLD: 0.001 18 | TEST: 19 | DETECTIONS_PER_IMAGE: 300 20 | -------------------------------------------------------------------------------- /extract/third_party/CenterNet2/projects/CenterNet2/configs/O365_CenterNet2_R50_1x.yaml: -------------------------------------------------------------------------------- 1 | _BASE_: "Base-CenterNet2.yaml" 2 | MODEL: 3 | ROI_HEADS: 4 | NUM_CLASSES: 365 5 | CENTERNET: 6 | NUM_CLASSES: 365 7 | DATASETS: 8 | TRAIN: ("objects365_train",) 9 | TEST: ("objects365_val",) 10 | DATALOADER: 11 | SAMPLER_TRAIN: "ClassAwareSampler" 12 | TEST: 13 | DETECTIONS_PER_IMAGE: 300 -------------------------------------------------------------------------------- /extract/third_party/CenterNet2/projects/CenterNet2/configs/nuImages_CenterNet2_DLA_640_8x.yaml: -------------------------------------------------------------------------------- 1 | _BASE_: "Base-CenterNet2.yaml" 2 | MODEL: 3 | MASK_ON: True 4 | ROI_MASK_HEAD: 5 | NAME: "MaskRCNNConvUpsampleHead" 6 | NUM_CONV: 4 7 | POOLER_RESOLUTION: 14 8 | ROI_HEADS: 9 | NUM_CLASSES: 10 10 | IN_FEATURES: ["dla2"] 11 | BACKBONE: 12 | NAME: "build_dla_backbone" 13 | DLA: 14 | NORM: "BN" 15 | CENTERNET: 16 | IN_FEATURES: ["dla2"] 17 | FPN_STRIDES: [4] 18 | SOI: [[0, 1000000]] 19 | NUM_CLS_CONVS: 1 20 | NUM_BOX_CONVS: 1 21 | REG_WEIGHT: 1. 22 | MORE_POS: True 23 | HM_FOCAL_ALPHA: 0.25 24 | POST_NMS_TOPK_TEST: 128 25 | WEIGHTS: '' 26 | PIXEL_MEAN: [123.675, 116.280, 103.530] 27 | PIXEL_STD: [58.395, 57.12, 57.375] 28 | SOLVER: 29 | MAX_ITER: 180000 30 | STEPS: (120000, 160000) 31 | BASE_LR: 0.08 32 | IMS_PER_BATCH: 64 33 | INPUT: 34 | FORMAT: RGB 35 | CUSTOM_AUG: EfficientDetResizeCrop 36 | TRAIN_SIZE: 640 37 | MIN_SIZE_TEST: 608 38 | MAX_SIZE_TEST: 900 39 | MASK_FORMAT: bitmask 40 | DATASETS: 41 | TRAIN: ("nuimages_train",) 42 | TEST: ("nuimages_val",) 43 | -------------------------------------------------------------------------------- /extract/third_party/CenterNet2/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,**/configs/**,tests/config/** 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,av,iopath,omegaconf,hydra,yaml,pydoc,submitit,cloudpickle 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 | -------------------------------------------------------------------------------- /extract/third_party/CenterNet2/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 | -------------------------------------------------------------------------------- /extract/third_party/CenterNet2/tests/__init__.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) Facebook, Inc. and its affiliates. 2 | -------------------------------------------------------------------------------- /extract/third_party/CenterNet2/tests/config/dir1/dir1_a.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) Facebook, Inc. and its affiliates. 2 | dir1a_str = "base_a_1" 3 | dir1a_dict = {"a": 1, "b": 2} 4 | -------------------------------------------------------------------------------- /extract/third_party/CenterNet2/tests/config/dir1/dir1_b.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) Facebook, Inc. and its affiliates. 2 | from detectron2.config import LazyConfig 3 | 4 | # equivalent to relative import 5 | dir1a_str, dir1a_dict = LazyConfig.load_rel("dir1_a.py", ("dir1a_str", "dir1a_dict")) 6 | 7 | dir1b_str = dir1a_str + "_from_b" 8 | dir1b_dict = dir1a_dict 9 | 10 | # Every import is a reload: not modified by other config files 11 | assert dir1a_dict.a == 1 12 | -------------------------------------------------------------------------------- /extract/third_party/CenterNet2/tests/config/root_cfg.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) Facebook, Inc. and its affiliates. 2 | from itertools import count 3 | 4 | from detectron2.config import LazyCall as L 5 | 6 | from .dir1.dir1_a import dir1a_dict, dir1a_str 7 | 8 | dir1a_dict.a = "modified" 9 | 10 | # modification above won't affect future imports 11 | from .dir1.dir1_b import dir1b_dict, dir1b_str 12 | 13 | 14 | lazyobj = L(count)(x=dir1a_str, y=dir1b_str) 15 | -------------------------------------------------------------------------------- /extract/third_party/CenterNet2/tests/data/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sterzhang/image-textualization/4c72f75bf6ab0227b6bd60911234e5d818587783/extract/third_party/CenterNet2/tests/data/__init__.py -------------------------------------------------------------------------------- /extract/third_party/CenterNet2/tests/layers/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sterzhang/image-textualization/4c72f75bf6ab0227b6bd60911234e5d818587783/extract/third_party/CenterNet2/tests/layers/__init__.py -------------------------------------------------------------------------------- /extract/third_party/CenterNet2/tests/layers/test_nms.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) Facebook, Inc. and its affiliates. 2 | from __future__ import absolute_import, division, print_function, unicode_literals 3 | import unittest 4 | import torch 5 | 6 | from detectron2.layers import batched_nms 7 | from detectron2.utils.testing import random_boxes 8 | 9 | 10 | class TestNMS(unittest.TestCase): 11 | def _create_tensors(self, N): 12 | boxes = random_boxes(N, 200) 13 | scores = torch.rand(N) 14 | return boxes, scores 15 | 16 | def test_nms_scriptability(self): 17 | N = 2000 18 | num_classes = 50 19 | boxes, scores = self._create_tensors(N) 20 | idxs = torch.randint(0, num_classes, (N,)) 21 | scripted_batched_nms = torch.jit.script(batched_nms) 22 | err_msg = "NMS is incompatible with jit-scripted NMS for IoU={}" 23 | 24 | for iou in [0.2, 0.5, 0.8]: 25 | keep_ref = batched_nms(boxes, scores, idxs, iou) 26 | backup = boxes.clone() 27 | scripted_keep = scripted_batched_nms(boxes, scores, idxs, iou) 28 | assert torch.allclose(boxes, backup), "boxes modified by jit-scripted batched_nms" 29 | self.assertTrue(torch.equal(keep_ref, scripted_keep), err_msg.format(iou)) 30 | 31 | 32 | if __name__ == "__main__": 33 | unittest.main() 34 | -------------------------------------------------------------------------------- /extract/third_party/CenterNet2/tests/modeling/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sterzhang/image-textualization/4c72f75bf6ab0227b6bd60911234e5d818587783/extract/third_party/CenterNet2/tests/modeling/__init__.py -------------------------------------------------------------------------------- /extract/third_party/CenterNet2/tests/modeling/test_backbone.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved 2 | 3 | import unittest 4 | import torch 5 | 6 | import detectron2.export.torchscript # apply patch # noqa 7 | from detectron2 import model_zoo 8 | from detectron2.config import get_cfg 9 | from detectron2.layers import ShapeSpec 10 | from detectron2.modeling.backbone import build_resnet_backbone 11 | from detectron2.modeling.backbone.fpn import build_resnet_fpn_backbone 12 | 13 | 14 | class TestBackBone(unittest.TestCase): 15 | def test_resnet_scriptability(self): 16 | cfg = get_cfg() 17 | resnet = build_resnet_backbone(cfg, ShapeSpec(channels=3)) 18 | 19 | scripted_resnet = torch.jit.script(resnet) 20 | 21 | inp = torch.rand(2, 3, 100, 100) 22 | out1 = resnet(inp)["res4"] 23 | out2 = scripted_resnet(inp)["res4"] 24 | self.assertTrue(torch.allclose(out1, out2)) 25 | 26 | def test_fpn_scriptability(self): 27 | cfg = model_zoo.get_config("Misc/scratch_mask_rcnn_R_50_FPN_3x_gn.yaml") 28 | bb = build_resnet_fpn_backbone(cfg, ShapeSpec(channels=3)) 29 | bb_s = torch.jit.script(bb) 30 | 31 | inp = torch.rand(2, 3, 128, 128) 32 | out1 = bb(inp)["p5"] 33 | out2 = bb_s(inp)["p5"] 34 | self.assertTrue(torch.allclose(out1, out2)) 35 | -------------------------------------------------------------------------------- /extract/third_party/CenterNet2/tests/structures/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sterzhang/image-textualization/4c72f75bf6ab0227b6bd60911234e5d818587783/extract/third_party/CenterNet2/tests/structures/__init__.py -------------------------------------------------------------------------------- /extract/third_party/CenterNet2/tests/structures/test_keypoints.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) Facebook, Inc. and its affiliates. 2 | import unittest 3 | import torch 4 | 5 | from detectron2.structures.keypoints import Keypoints 6 | 7 | 8 | class TestKeypoints(unittest.TestCase): 9 | def test_cat_keypoints(self): 10 | keypoints1 = Keypoints(torch.rand(2, 21, 3)) 11 | keypoints2 = Keypoints(torch.rand(4, 21, 3)) 12 | 13 | cat_keypoints = keypoints1.cat([keypoints1, keypoints2]) 14 | self.assertTrue(torch.all(cat_keypoints.tensor[:2] == keypoints1.tensor).item()) 15 | self.assertTrue(torch.all(cat_keypoints.tensor[2:] == keypoints2.tensor).item()) 16 | 17 | 18 | if __name__ == "__main__": 19 | unittest.main() 20 | -------------------------------------------------------------------------------- /extract/third_party/CenterNet2/tests/test_packaging.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) Facebook, Inc. and its affiliates. 2 | import unittest 3 | 4 | from detectron2.utils.collect_env import collect_env_info 5 | 6 | 7 | class TestProjects(unittest.TestCase): 8 | def test_import(self): 9 | from detectron2.projects import point_rend 10 | 11 | _ = point_rend.add_pointrend_config 12 | 13 | import detectron2.projects.deeplab as deeplab 14 | 15 | _ = deeplab.add_deeplab_config 16 | 17 | # import detectron2.projects.panoptic_deeplab as panoptic_deeplab 18 | 19 | # _ = panoptic_deeplab.add_panoptic_deeplab_config 20 | 21 | 22 | class TestCollectEnv(unittest.TestCase): 23 | def test(self): 24 | _ = collect_env_info() 25 | -------------------------------------------------------------------------------- /extract/third_party/CenterNet2/tests/test_registry.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) Facebook, Inc. and its affiliates. 2 | import unittest 3 | import torch 4 | 5 | from detectron2.modeling.meta_arch import GeneralizedRCNN 6 | from detectron2.utils.registry import _convert_target_to_string, locate 7 | 8 | 9 | class A: 10 | class B: 11 | pass 12 | 13 | 14 | class TestLocate(unittest.TestCase): 15 | def _test_obj(self, obj): 16 | name = _convert_target_to_string(obj) 17 | newobj = locate(name) 18 | self.assertIs(obj, newobj) 19 | 20 | def test_basic(self): 21 | self._test_obj(GeneralizedRCNN) 22 | 23 | def test_inside_class(self): 24 | # requires using __qualname__ instead of __name__ 25 | self._test_obj(A.B) 26 | 27 | def test_builtin(self): 28 | self._test_obj(len) 29 | self._test_obj(dict) 30 | 31 | def test_pytorch_optim(self): 32 | # pydoc.locate does not work for it 33 | self._test_obj(torch.optim.SGD) 34 | 35 | def test_failure(self): 36 | with self.assertRaises(ImportError): 37 | locate("asdf") 38 | 39 | def test_compress_target(self): 40 | from detectron2.data.transforms import RandomCrop 41 | 42 | name = _convert_target_to_string(RandomCrop) 43 | # name shouldn't contain 'augmentation_impl' 44 | self.assertEqual(name, "detectron2.data.transforms.RandomCrop") 45 | self.assertIs(RandomCrop, locate(name)) 46 | -------------------------------------------------------------------------------- /extract/third_party/CenterNet2/tools/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sterzhang/image-textualization/4c72f75bf6ab0227b6bd60911234e5d818587783/extract/third_party/CenterNet2/tools/__init__.py -------------------------------------------------------------------------------- /extract/third_party/CenterNet2/tools/deploy/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Copyright (c) Facebook, Inc. and its affiliates. 2 | # See https://pytorch.org/tutorials/advanced/cpp_frontend.html 3 | cmake_minimum_required(VERSION 3.12 FATAL_ERROR) 4 | project(torchscript_mask_rcnn) 5 | 6 | find_package(Torch REQUIRED) 7 | find_package(OpenCV REQUIRED) 8 | find_package(TorchVision REQUIRED) # needed by export-method=tracing/scripting 9 | 10 | add_executable(torchscript_mask_rcnn torchscript_mask_rcnn.cpp) 11 | target_link_libraries( 12 | torchscript_mask_rcnn 13 | -Wl,--no-as-needed TorchVision::TorchVision -Wl,--as-needed 14 | "${TORCH_LIBRARIES}" ${OpenCV_LIBS}) 15 | set_property(TARGET torchscript_mask_rcnn PROPERTY CXX_STANDARD 14) 16 | -------------------------------------------------------------------------------- /extract/visualization/000000000009.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sterzhang/image-textualization/4c72f75bf6ab0227b6bd60911234e5d818587783/extract/visualization/000000000009.jpg -------------------------------------------------------------------------------- /extract/visualization/000000000025.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sterzhang/image-textualization/4c72f75bf6ab0227b6bd60911234e5d818587783/extract/visualization/000000000025.jpg -------------------------------------------------------------------------------- /extract/visualization/000000000030.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sterzhang/image-textualization/4c72f75bf6ab0227b6bd60911234e5d818587783/extract/visualization/000000000030.jpg -------------------------------------------------------------------------------- /script/trans_to_DenseCap_format.py: -------------------------------------------------------------------------------- 1 | import json 2 | 3 | def convert_jsonl_to_json(jsonl_file, output_file): 4 | data_dict = {} 5 | with open(jsonl_file, 'r', encoding='utf-8') as f: 6 | for line in f: 7 | entry = json.loads(line.strip()) 8 | image_id = entry["image"].split('.')[0] 9 | description = entry["description"].replace('\n', '') 10 | if image_id not in data_dict: 11 | data_dict[image_id] = [description] 12 | else: 13 | data_dict[image_id].append(description) 14 | 15 | with open(output_file, 'w', encoding='utf-8') as f: 16 | json.dump(data_dict, f, ensure_ascii=False) 17 | 18 | 19 | jsonl_file = "" 20 | output_file = "" 21 | convert_jsonl_to_json(jsonl_file, output_file) 22 | -------------------------------------------------------------------------------- /script/trans_to_Linguistic_format.py: -------------------------------------------------------------------------------- 1 | import json 2 | 3 | # Define the file paths 4 | modi_file_path = '' 5 | unmodi_file_path = '' 6 | output_file_path = '' 7 | 8 | 9 | with open(modi_file_path, 'r', encoding='utf-8') as modi_file: 10 | modi_lines = [json.loads(line) for line in modi_file] 11 | 12 | with open(unmodi_file_path, 'r', encoding='utf-8') as unmodi_file: 13 | unmodi_lines = [json.loads(line) for line in unmodi_file] 14 | 15 | if len(modi_lines) != len(unmodi_lines): 16 | raise ValueError("The number of lines in modi_gpt.jsonl and unmodi_gpt.jsonl do not match.") 17 | 18 | output_lines = [] 19 | for modi_line, unmodi_line in zip(modi_lines, unmodi_lines): 20 | output_lines.append({ 21 | "modi_desc": modi_line.get('description'), 22 | "unmodi_desc": unmodi_line.get('description') 23 | }) 24 | 25 | with open(output_file_path, 'w', encoding='utf-8') as output_file: 26 | for line in output_lines: 27 | output_file.write(json.dumps(line) + '\n') 28 | 29 | 30 | --------------------------------------------------------------------------------