|
@@ -12,6 +12,8 @@ def build_fcos_config(args):
|
|
|
else:
|
|
else:
|
|
|
raise NotImplementedError("No config for model: {}".format(args.model))
|
|
raise NotImplementedError("No config for model: {}".format(args.model))
|
|
|
|
|
|
|
|
|
|
+
|
|
|
|
|
+# --------------- Base configuration ---------------
|
|
|
class FcosBaseConfig(object):
|
|
class FcosBaseConfig(object):
|
|
|
def __init__(self):
|
|
def __init__(self):
|
|
|
# --------- Backbone ---------
|
|
# --------- Backbone ---------
|
|
@@ -106,18 +108,19 @@ class FcosBaseConfig(object):
|
|
|
for k, v in config_dict.items():
|
|
for k, v in config_dict.items():
|
|
|
print("{} : {}".format(k, v))
|
|
print("{} : {}".format(k, v))
|
|
|
|
|
|
|
|
|
|
+# --------------- 1x scheduler ---------------
|
|
|
class Fcos_R18_1x_Config(FcosBaseConfig):
|
|
class Fcos_R18_1x_Config(FcosBaseConfig):
|
|
|
def __init__(self) -> None:
|
|
def __init__(self) -> None:
|
|
|
super().__init__()
|
|
super().__init__()
|
|
|
## Backbone
|
|
## Backbone
|
|
|
self.backbone = "resnet18"
|
|
self.backbone = "resnet18"
|
|
|
|
|
|
|
|
-class Fcos_R50_1x_Config(FcosBaseConfig):
|
|
|
|
|
|
|
+class Fcos_R50_1x_Config(Fcos_R18_1x_Config):
|
|
|
def __init__(self) -> None:
|
|
def __init__(self) -> None:
|
|
|
super().__init__()
|
|
super().__init__()
|
|
|
- ## Backbone
|
|
|
|
|
self.backbone = "resnet50"
|
|
self.backbone = "resnet50"
|
|
|
|
|
|
|
|
|
|
+# --------------- RT-FCOS & 3x scheduler ---------------
|
|
|
class FcosRT_R18_3x_Config(FcosBaseConfig):
|
|
class FcosRT_R18_3x_Config(FcosBaseConfig):
|
|
|
def __init__(self) -> None:
|
|
def __init__(self) -> None:
|
|
|
super().__init__()
|
|
super().__init__()
|
|
@@ -173,57 +176,8 @@ class FcosRT_R18_3x_Config(FcosBaseConfig):
|
|
|
{'name': 'RandomResize'},
|
|
{'name': 'RandomResize'},
|
|
|
]
|
|
]
|
|
|
|
|
|
|
|
-class FcosRT_R50_3x_Config(FcosBaseConfig):
|
|
|
|
|
|
|
+class FcosRT_R50_3x_Config(FcosRT_R18_3x_Config):
|
|
|
def __init__(self) -> None:
|
|
def __init__(self) -> None:
|
|
|
super().__init__()
|
|
super().__init__()
|
|
|
- ## Backbone
|
|
|
|
|
|
|
+ # --------- Backbone ---------
|
|
|
self.backbone = "resnet50"
|
|
self.backbone = "resnet50"
|
|
|
- self.max_stride = 32
|
|
|
|
|
- self.out_stride = [8, 16, 32]
|
|
|
|
|
-
|
|
|
|
|
- # --------- Neck ---------
|
|
|
|
|
- self.neck = 'basic_fpn'
|
|
|
|
|
- self.fpn_p6_feat = False
|
|
|
|
|
- self.fpn_p7_feat = False
|
|
|
|
|
- self.fpn_p6_from_c5 = False
|
|
|
|
|
-
|
|
|
|
|
- # --------- Head ---------
|
|
|
|
|
- self.head = 'fcos_rt_head'
|
|
|
|
|
- self.head_dim = 256
|
|
|
|
|
- self.num_cls_head = 4
|
|
|
|
|
- self.num_reg_head = 4
|
|
|
|
|
- self.head_act = 'relu'
|
|
|
|
|
- self.head_norm = 'GN'
|
|
|
|
|
-
|
|
|
|
|
- # --------- Label Assignment ---------
|
|
|
|
|
- self.matcher = 'simota'
|
|
|
|
|
- self.matcher_hpy = {'soft_center_radius': 2.5,
|
|
|
|
|
- 'topk_candidates': 13}
|
|
|
|
|
-
|
|
|
|
|
- # --------- Loss weight ---------
|
|
|
|
|
- self.focal_loss_alpha = 0.25
|
|
|
|
|
- self.focal_loss_gamma = 2.0
|
|
|
|
|
- self.loss_cls_weight = 1.0
|
|
|
|
|
- self.loss_reg_weight = 2.0
|
|
|
|
|
-
|
|
|
|
|
- # --------- Train epoch ---------
|
|
|
|
|
- self.max_epoch = 36 # 3x
|
|
|
|
|
- self.lr_epoch = [24, 33] # 3x
|
|
|
|
|
-
|
|
|
|
|
- # --------- Data process ---------
|
|
|
|
|
- ## input size
|
|
|
|
|
- self.train_min_size = [256, 288, 320, 352, 384, 416, 448, 480, 512, 544, 576, 608] # short edge of image
|
|
|
|
|
- self.train_max_size = 900
|
|
|
|
|
- self.test_min_size = [512]
|
|
|
|
|
- self.test_max_size = 736
|
|
|
|
|
- ## Pixel mean & std
|
|
|
|
|
- self.pixel_mean = [0.485, 0.456, 0.406]
|
|
|
|
|
- self.pixel_std = [0.229, 0.224, 0.225]
|
|
|
|
|
- ## Transforms
|
|
|
|
|
- self.box_format = 'xyxy'
|
|
|
|
|
- self.normalize_coords = False
|
|
|
|
|
- self.detr_style = False
|
|
|
|
|
- self.trans_config = [
|
|
|
|
|
- {'name': 'RandomHFlip'},
|
|
|
|
|
- {'name': 'RandomResize'},
|
|
|
|
|
- ]
|
|
|