lkeab commited on
Commit
5395ccf
1 Parent(s): 0822b29
This view is limited to 50 files because it contains too many changes.   See raw diff
Files changed (50) hide show
  1. app.py +75 -0
  2. configs/Base-RCNN-C4.yaml +18 -0
  3. configs/Base-RCNN-DilatedC5.yaml +31 -0
  4. configs/Base-RCNN-FPN-4gpu.yaml +44 -0
  5. configs/Base-RCNN-FPN.yaml +42 -0
  6. configs/Base-RetinaNet.yaml +25 -0
  7. configs/COCO-Detection/fast_rcnn_R_50_FPN_1x.yaml +17 -0
  8. configs/COCO-Detection/faster_rcnn_R_101_C4_3x.yaml +9 -0
  9. configs/COCO-Detection/faster_rcnn_R_101_DC5_3x.yaml +9 -0
  10. configs/COCO-Detection/faster_rcnn_R_101_FPN_3x.yaml +9 -0
  11. configs/COCO-Detection/faster_rcnn_R_50_C4_1x.yaml +6 -0
  12. configs/COCO-Detection/faster_rcnn_R_50_C4_3x.yaml +9 -0
  13. configs/COCO-Detection/faster_rcnn_R_50_DC5_1x.yaml +6 -0
  14. configs/COCO-Detection/faster_rcnn_R_50_DC5_3x.yaml +9 -0
  15. configs/COCO-Detection/faster_rcnn_R_50_FPN_1x.yaml +6 -0
  16. configs/COCO-Detection/faster_rcnn_R_50_FPN_3x.yaml +9 -0
  17. configs/COCO-Detection/faster_rcnn_X_101_32x8d_FPN_3x.yaml +13 -0
  18. configs/COCO-Detection/retinanet_R_101_FPN_3x.yaml +8 -0
  19. configs/COCO-Detection/retinanet_R_50_FPN_1x.py +9 -0
  20. configs/COCO-Detection/retinanet_R_50_FPN_1x.yaml +5 -0
  21. configs/COCO-Detection/retinanet_R_50_FPN_3x.yaml +8 -0
  22. configs/COCO-Detection/rpn_R_50_C4_1x.yaml +10 -0
  23. configs/COCO-Detection/rpn_R_50_FPN_1x.yaml +9 -0
  24. configs/COCO-InstanceSegmentation/.mask_rcnn_R_50_FPN_1x_4gpu.yaml.swp +0 -0
  25. configs/COCO-InstanceSegmentation/mask_rcnn_R_101_C4_3x.yaml +9 -0
  26. configs/COCO-InstanceSegmentation/mask_rcnn_R_101_DC5_3x.yaml +9 -0
  27. configs/COCO-InstanceSegmentation/mask_rcnn_R_101_FPN_3x.yaml +9 -0
  28. configs/COCO-InstanceSegmentation/mask_rcnn_R_101_FPN_3x_4gpu_transfiner.yaml +9 -0
  29. configs/COCO-InstanceSegmentation/mask_rcnn_R_101_FPN_3x_4gpu_transfiner_deform.yaml +11 -0
  30. configs/COCO-InstanceSegmentation/mask_rcnn_R_101_FPN_3x_4gpu_transfiner_lvis.yaml +12 -0
  31. configs/COCO-InstanceSegmentation/mask_rcnn_R_50_C4_1x.py +7 -0
  32. configs/COCO-InstanceSegmentation/mask_rcnn_R_50_C4_1x.yaml +6 -0
  33. configs/COCO-InstanceSegmentation/mask_rcnn_R_50_C4_3x.yaml +9 -0
  34. configs/COCO-InstanceSegmentation/mask_rcnn_R_50_DC5_1x.yaml +6 -0
  35. configs/COCO-InstanceSegmentation/mask_rcnn_R_50_DC5_3x.yaml +9 -0
  36. configs/COCO-InstanceSegmentation/mask_rcnn_R_50_FPN_1x.py +7 -0
  37. configs/COCO-InstanceSegmentation/mask_rcnn_R_50_FPN_1x.yaml +6 -0
  38. configs/COCO-InstanceSegmentation/mask_rcnn_R_50_FPN_1x_4gpu.yaml +6 -0
  39. configs/COCO-InstanceSegmentation/mask_rcnn_R_50_FPN_1x_4gpu_transfiner.yaml +6 -0
  40. configs/COCO-InstanceSegmentation/mask_rcnn_R_50_FPN_1x_giou.yaml +12 -0
  41. configs/COCO-InstanceSegmentation/mask_rcnn_R_50_FPN_3x.yaml +9 -0
  42. configs/COCO-InstanceSegmentation/mask_rcnn_R_50_FPN_3x_4gpu_transfiner.yaml +9 -0
  43. configs/COCO-InstanceSegmentation/mask_rcnn_R_50_FPN_3x_4gpu_transfiner_deform.yaml +11 -0
  44. configs/COCO-InstanceSegmentation/mask_rcnn_R_50_FPN_3x_4gpu_transfiner_lvis.yaml +12 -0
  45. configs/COCO-InstanceSegmentation/mask_rcnn_X_101_32x8d_FPN_3x.yaml +13 -0
  46. configs/COCO-InstanceSegmentation/mask_rcnn_X_101_32x8d_FPN_3x_transfiner.yaml +13 -0
  47. configs/COCO-InstanceSegmentation/mask_rcnn_regnetx_4gf_dds_fpn_1x.py +34 -0
  48. configs/COCO-InstanceSegmentation/mask_rcnn_regnety_4gf_dds_fpn_1x.py +35 -0
  49. configs/COCO-Keypoints/Base-Keypoint-RCNN-FPN.yaml +15 -0
  50. configs/COCO-Keypoints/keypoint_rcnn_R_101_FPN_3x.yaml +8 -0
app.py ADDED
@@ -0,0 +1,75 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #try:
2
+ # import detectron2
3
+ #except:
4
+ import os
5
+ os.system('pip install git+https://github.com/SysCV/transfiner.git')
6
+
7
+ from matplotlib.pyplot import axis
8
+ import gradio as gr
9
+ import requests
10
+ import numpy as np
11
+ from torch import nn
12
+ import requests
13
+
14
+ import torch
15
+
16
+ from detectron2 import model_zoo
17
+ from detectron2.engine import DefaultPredictor
18
+ from detectron2.config import get_cfg
19
+ from detectron2.utils.visualizer import Visualizer
20
+ from detectron2.data import MetadataCatalog
21
+
22
+ '''
23
+ url1 = 'https://cdn.pixabay.com/photo/2014/09/07/21/52/city-438393_1280.jpg'
24
+ r = requests.get(url1, allow_redirects=True)
25
+ open("city1.jpg", 'wb').write(r.content)
26
+ url2 = 'https://cdn.pixabay.com/photo/2016/02/19/11/36/canal-1209808_1280.jpg'
27
+ r = requests.get(url2, allow_redirects=True)
28
+ open("city2.jpg", 'wb').write(r.content)
29
+ '''
30
+
31
+ model_name='./configs/COCO-InstanceSegmentation/mask_rcnn_X_101_32x8d_FPN_3x.yaml'
32
+
33
+ # model = model_zoo.get(model_name, trained=True)
34
+
35
+ cfg = get_cfg()
36
+ # add project-specific config (e.g., TensorMask) here if you're not running a model in detectron2's core library
37
+ cfg.merge_from_file(model_zoo.get_config_file(model_name))
38
+ cfg.MODEL.ROI_HEADS.SCORE_THRESH_TEST = 0.5 # set threshold for this model
39
+ # Find a model from detectron2's model zoo. You can use the https://dl.fbaipublicfiles... url as w ell
40
+ cfg.MODEL.WEIGHTS = model_zoo.get_checkpoint_url(model_name)
41
+
42
+ if not torch.cuda.is_available():
43
+ cfg.MODEL.DEVICE='cpu'
44
+
45
+ predictor = DefaultPredictor(cfg)
46
+
47
+
48
+ def inference(image):
49
+ img = np.array(image.resize((1024,1024)))
50
+ outputs = predictor(img)
51
+
52
+ v = Visualizer(img, MetadataCatalog.get(cfg.DATASETS.TRAIN[0]), scale=1.2)
53
+ out = v.draw_instance_predictions(outputs["instances"].to("cpu"))
54
+
55
+ return out.get_image()
56
+
57
+
58
+
59
+ title = "Detectron2-MaskRCNN X101"
60
+ description = "demo for Detectron2. To use it, simply upload your image, or click one of the examples to load them. Read more at the links below.\
61
+ </br><b>Model: COCO-InstanceSegmentation/mask_rcnn_X_101_32x8d_FPN_3x.yaml</b>"
62
+ article = "<p style='text-align: center'><a href='https://arxiv.org/abs/2012.07177'>Simple Copy-Paste is a Strong Data Augmentation Method for Instance Segmentation</a> | <a href='https://github.com/facebookresearch/detectron2/blob/main/MODEL_ZOO.md'>Detectron model ZOO</a></p>"
63
+
64
+ gr.Interface(
65
+ inference,
66
+ [gr.inputs.Image(type="pil", label="Input")],
67
+ gr.outputs.Image(type="numpy", label="Output"),
68
+ title=title,
69
+ description=description,
70
+ article=article,
71
+ examples=[
72
+ ["demo/sample_imgs/000000224200.jpg"],
73
+ ["demo/sample_imgs/000000344909.jpg"]
74
+ ]).launch()
75
+
configs/Base-RCNN-C4.yaml ADDED
@@ -0,0 +1,18 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
configs/Base-RCNN-DilatedC5.yaml ADDED
@@ -0,0 +1,31 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
configs/Base-RCNN-FPN-4gpu.yaml ADDED
@@ -0,0 +1,44 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
+ #TEST: ("lvis_v0.5_val_cocofied",)
36
+ TEST: ("coco_2017_test-dev",)
37
+ SOLVER:
38
+ IMS_PER_BATCH: 16 #8 #16
39
+ BASE_LR: 0.02 # 0.02
40
+ STEPS: (60000, 80000)
41
+ MAX_ITER: 90000
42
+ INPUT:
43
+ MIN_SIZE_TRAIN: (640, 672, 704, 736, 768, 800)
44
+ VERSION: 2
configs/Base-RCNN-FPN.yaml ADDED
@@ -0,0 +1,42 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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 #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
configs/Base-RetinaNet.yaml ADDED
@@ -0,0 +1,25 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
configs/COCO-Detection/fast_rcnn_R_50_FPN_1x.yaml ADDED
@@ -0,0 +1,17 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
configs/COCO-Detection/faster_rcnn_R_101_C4_3x.yaml ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
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
configs/COCO-Detection/faster_rcnn_R_101_DC5_3x.yaml ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
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
configs/COCO-Detection/faster_rcnn_R_101_FPN_3x.yaml ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
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
configs/COCO-Detection/faster_rcnn_R_50_C4_1x.yaml ADDED
@@ -0,0 +1,6 @@
 
 
 
 
 
 
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
configs/COCO-Detection/faster_rcnn_R_50_C4_3x.yaml ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
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
configs/COCO-Detection/faster_rcnn_R_50_DC5_1x.yaml ADDED
@@ -0,0 +1,6 @@
 
 
 
 
 
 
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
configs/COCO-Detection/faster_rcnn_R_50_DC5_3x.yaml ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
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
configs/COCO-Detection/faster_rcnn_R_50_FPN_1x.yaml ADDED
@@ -0,0 +1,6 @@
 
 
 
 
 
 
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
configs/COCO-Detection/faster_rcnn_R_50_FPN_3x.yaml ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
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
configs/COCO-Detection/faster_rcnn_X_101_32x8d_FPN_3x.yaml ADDED
@@ -0,0 +1,13 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
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
configs/COCO-Detection/retinanet_R_101_FPN_3x.yaml ADDED
@@ -0,0 +1,8 @@
 
 
 
 
 
 
 
 
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
configs/COCO-Detection/retinanet_R_50_FPN_1x.py ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
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
configs/COCO-Detection/retinanet_R_50_FPN_1x.yaml ADDED
@@ -0,0 +1,5 @@
 
 
 
 
 
1
+ _BASE_: "../Base-RetinaNet.yaml"
2
+ MODEL:
3
+ WEIGHTS: "detectron2://ImageNetPretrained/MSRA/R-50.pkl"
4
+ RESNETS:
5
+ DEPTH: 50
configs/COCO-Detection/retinanet_R_50_FPN_3x.yaml ADDED
@@ -0,0 +1,8 @@
 
 
 
 
 
 
 
 
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
configs/COCO-Detection/rpn_R_50_C4_1x.yaml ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
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
configs/COCO-Detection/rpn_R_50_FPN_1x.yaml ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
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
configs/COCO-InstanceSegmentation/.mask_rcnn_R_50_FPN_1x_4gpu.yaml.swp ADDED
Binary file (12.3 kB). View file
configs/COCO-InstanceSegmentation/mask_rcnn_R_101_C4_3x.yaml ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
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
configs/COCO-InstanceSegmentation/mask_rcnn_R_101_DC5_3x.yaml ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
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
configs/COCO-InstanceSegmentation/mask_rcnn_R_101_FPN_3x.yaml ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
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
configs/COCO-InstanceSegmentation/mask_rcnn_R_101_FPN_3x_4gpu_transfiner.yaml ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
1
+ _BASE_: "../Base-RCNN-FPN-4gpu.yaml"
2
+ MODEL:
3
+ WEIGHTS: "./init_weights/model_final_a3ec72.pkl"
4
+ MASK_ON: True
5
+ RESNETS:
6
+ DEPTH: 101
7
+ SOLVER:
8
+ STEPS: (210000, 250000)
9
+ MAX_ITER: 270000
configs/COCO-InstanceSegmentation/mask_rcnn_R_101_FPN_3x_4gpu_transfiner_deform.yaml ADDED
@@ -0,0 +1,11 @@
 
 
 
 
 
 
 
 
 
 
 
1
+ _BASE_: "../Base-RCNN-FPN-4gpu.yaml"
2
+ MODEL:
3
+ WEIGHTS: "./init_weights/model_final_a3ec72.pkl"
4
+ MASK_ON: True
5
+ RESNETS:
6
+ DEPTH: 101
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
configs/COCO-InstanceSegmentation/mask_rcnn_R_101_FPN_3x_4gpu_transfiner_lvis.yaml ADDED
@@ -0,0 +1,12 @@
 
 
 
 
 
 
 
 
 
 
 
 
1
+ _BASE_: "../Base-RCNN-FPN-4gpu.yaml"
2
+ MODEL:
3
+ WEIGHTS: "./init_weights/model_final_a3ec72.pkl"
4
+ MASK_ON: True
5
+ RESNETS:
6
+ DEPTH: 101
7
+ SOLVER:
8
+ STEPS: (210000, 250000)
9
+ MAX_ITER: 270000
10
+ DATASETS:
11
+ TEST: ("lvis_v0.5_val_cocofied",)
12
+
configs/COCO-InstanceSegmentation/mask_rcnn_R_50_C4_1x.py ADDED
@@ -0,0 +1,7 @@
 
 
 
 
 
 
 
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
configs/COCO-InstanceSegmentation/mask_rcnn_R_50_C4_1x.yaml ADDED
@@ -0,0 +1,6 @@
 
 
 
 
 
 
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
configs/COCO-InstanceSegmentation/mask_rcnn_R_50_C4_3x.yaml ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
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
configs/COCO-InstanceSegmentation/mask_rcnn_R_50_DC5_1x.yaml ADDED
@@ -0,0 +1,6 @@
 
 
 
 
 
 
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
configs/COCO-InstanceSegmentation/mask_rcnn_R_50_DC5_3x.yaml ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
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
configs/COCO-InstanceSegmentation/mask_rcnn_R_50_FPN_1x.py ADDED
@@ -0,0 +1,7 @@
 
 
 
 
 
 
 
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
configs/COCO-InstanceSegmentation/mask_rcnn_R_50_FPN_1x.yaml ADDED
@@ -0,0 +1,6 @@
 
 
 
 
 
 
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
configs/COCO-InstanceSegmentation/mask_rcnn_R_50_FPN_1x_4gpu.yaml ADDED
@@ -0,0 +1,6 @@
 
 
 
 
 
 
1
+ _BASE_: "../Base-RCNN-FPN-4gpu.yaml"
2
+ MODEL:
3
+ WEIGHTS: "detectron2://ImageNetPretrained/MSRA/R-50.pkl"
4
+ MASK_ON: True
5
+ RESNETS:
6
+ DEPTH: 50
configs/COCO-InstanceSegmentation/mask_rcnn_R_50_FPN_1x_4gpu_transfiner.yaml ADDED
@@ -0,0 +1,6 @@
 
 
 
 
 
 
1
+ _BASE_: "../Base-RCNN-FPN-4gpu.yaml"
2
+ MODEL:
3
+ WEIGHTS: "./init_weights/model_final_a54504.pkl"
4
+ MASK_ON: True
5
+ RESNETS:
6
+ DEPTH: 50
configs/COCO-InstanceSegmentation/mask_rcnn_R_50_FPN_1x_giou.yaml ADDED
@@ -0,0 +1,12 @@
 
 
 
 
 
 
 
 
 
 
 
 
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
configs/COCO-InstanceSegmentation/mask_rcnn_R_50_FPN_3x.yaml ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
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
configs/COCO-InstanceSegmentation/mask_rcnn_R_50_FPN_3x_4gpu_transfiner.yaml ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
1
+ _BASE_: "../Base-RCNN-FPN-4gpu.yaml"
2
+ MODEL:
3
+ WEIGHTS: "./init_weights/model_final_f10217.pkl"
4
+ MASK_ON: True
5
+ RESNETS:
6
+ DEPTH: 50
7
+ SOLVER:
8
+ STEPS: (210000, 250000)
9
+ MAX_ITER: 270000
configs/COCO-InstanceSegmentation/mask_rcnn_R_50_FPN_3x_4gpu_transfiner_deform.yaml ADDED
@@ -0,0 +1,11 @@
 
 
 
 
 
 
 
 
 
 
 
1
+ _BASE_: "../Base-RCNN-FPN-4gpu.yaml"
2
+ MODEL:
3
+ WEIGHTS: "./init_weights/model_final_f10217.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
configs/COCO-InstanceSegmentation/mask_rcnn_R_50_FPN_3x_4gpu_transfiner_lvis.yaml ADDED
@@ -0,0 +1,12 @@
 
 
 
 
 
 
 
 
 
 
 
 
1
+ _BASE_: "../Base-RCNN-FPN-4gpu.yaml"
2
+ MODEL:
3
+ WEIGHTS: "./init_weights/model_final_f10217.pkl"
4
+ MASK_ON: True
5
+ RESNETS:
6
+ DEPTH: 50
7
+ SOLVER:
8
+ STEPS: (210000, 250000)
9
+ MAX_ITER: 270000
10
+ DATASETS:
11
+ TEST: ("lvis_v0.5_val_cocofied",)
12
+
configs/COCO-InstanceSegmentation/mask_rcnn_X_101_32x8d_FPN_3x.yaml ADDED
@@ -0,0 +1,13 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
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
configs/COCO-InstanceSegmentation/mask_rcnn_X_101_32x8d_FPN_3x_transfiner.yaml ADDED
@@ -0,0 +1,13 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ _BASE_: "../Base-RCNN-FPN-4gpu.yaml"
2
+ MODEL:
3
+ MASK_ON: True
4
+ WEIGHTS: "./init_weights/model_final_x101.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
configs/COCO-InstanceSegmentation/mask_rcnn_regnetx_4gf_dds_fpn_1x.py ADDED
@@ -0,0 +1,34 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
configs/COCO-InstanceSegmentation/mask_rcnn_regnety_4gf_dds_fpn_1x.py ADDED
@@ -0,0 +1,35 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
configs/COCO-Keypoints/Base-Keypoint-RCNN-FPN.yaml ADDED
@@ -0,0 +1,15 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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",)
configs/COCO-Keypoints/keypoint_rcnn_R_101_FPN_3x.yaml ADDED
@@ -0,0 +1,8 @@
 
 
 
 
 
 
 
 
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