| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336 |
- # Fully Convolutional One-Stage object detector
- class FcosBaseConfig(object):
- def __init__(self):
- pass
- def print_config(self):
- config_dict = {key: value for key, value in self.__dict__.items() if not key.startswith('__')}
- for k, v in config_dict.items():
- print("{} : {}".format(k, v))
- fcos_cfg = {
- 'fcos_r18_1x':{
- # ----------------- Model-----------------
- ## Backbone
- 'backbone': 'resnet18',
- 'backbone_norm': 'FrozeBN',
- 'res5_dilation': False,
- 'pretrained': True,
- 'freeze_at': 1, # freeze stem layer + layer1 of the backbone
- 'pretrained_weight': 'imagenet1k_v1',
- 'max_stride': 128,
- 'out_stride': [8, 16, 32, 64, 128],
- ## Neck
- 'neck': 'basic_fpn',
- 'fpn_p6_feat': True,
- 'fpn_p7_feat': True,
- 'fpn_p6_from_c5': False,
- ## Head
- 'head': 'fcos_head',
- 'head_dim': 256,
- 'num_cls_head': 4,
- 'num_reg_head': 4,
- 'head_act': 'relu',
- 'head_norm': 'GN',
- ## Post-process
- 'train_topk': 1000,
- 'train_conf_thresh': 0.05,
- 'train_nms_thresh': 0.6,
- 'test_topk': 100,
- 'test_conf_thresh': 0.5,
- 'test_nms_thresh': 0.45,
- 'nms_class_agnostic': True, # We prefer to use class-agnostic NMS in the demo.
- # ----------------- Label Assignment -----------------
- 'matcher': 'fcos_matcher',
- 'matcher_hpy':{'center_sampling_radius': 1.5,
- 'object_sizes_of_interest': [[-1, 64], [64, 128], [128, 256], [256, 512], [512, float('inf')]]
- },
- # ----------------- Loss weight -----------------
- ## Loss hyper-parameters
- 'focal_loss_alpha': 0.25,
- 'focal_loss_gamma': 2.0,
- 'loss_cls_weight': 1.0,
- 'loss_reg_weight': 1.0,
- 'loss_ctn_weight': 1.0,
- # ----------------- Training -----------------
- ## Training scheduler
- 'scheduler': '1x',
- ## Optimizer
- 'optimizer': 'sgd',
- 'base_lr': 0.01 / 16,
- 'backbone_lr_ratio': 1.0 / 1.0,
- 'momentum': 0.9,
- 'weight_decay': 1e-4,
- 'clip_max_norm': -1.0,
- 'param_dict_type': 'default',
- ## LR Scheduler
- 'lr_scheduler': 'step',
- 'warmup': 'linear',
- 'warmup_iters': 500,
- 'warmup_factor': 0.00066667,
- ## Epoch
- 'max_epoch': 12, # 1x
- 'lr_epoch': [8, 11], # 1x
- # ----------------- Input -----------------
- ## Transforms
- 'train_min_size': [800], # short edge of image
- 'train_max_size': 1333,
- 'test_min_size': [800],
- 'test_max_size': 1333,
- ## Pixel mean & std
- 'pixel_mean': [0.485, 0.456, 0.406],
- 'pixel_std': [0.229, 0.224, 0.225],
- ## Transforms
- 'detr_style': False,
- 'trans_config': [
- {'name': 'RandomHFlip'},
- {'name': 'RandomResize'},
- ],
- 'box_format': 'xyxy',
- 'normalize_coords': False,
- },
- 'fcos_r50_1x':{
- # ----------------- Model-----------------
- ## Backbone
- 'backbone': 'resnet50',
- 'backbone_norm': 'FrozeBN',
- 'res5_dilation': False,
- 'pretrained': True,
- 'freeze_at': 1, # freeze stem layer + layer1 of the backbone
- 'pretrained_weight': 'imagenet1k_v1',
- 'max_stride': 128,
- 'out_stride': [8, 16, 32, 64, 128],
- ## Neck
- 'neck': 'basic_fpn',
- 'fpn_p6_feat': True,
- 'fpn_p7_feat': True,
- 'fpn_p6_from_c5': False,
- ## Head
- 'head': 'fcos_head',
- 'head_dim': 256,
- 'num_cls_head': 4,
- 'num_reg_head': 4,
- 'head_act': 'relu',
- 'head_norm': 'GN',
- ## Post-process
- 'train_topk': 1000,
- 'train_conf_thresh': 0.05,
- 'train_nms_thresh': 0.65,
- 'test_topk': 100,
- 'test_conf_thresh': 0.5,
- 'test_nms_thresh': 0.45,
- 'nms_class_agnostic': True, # We prefer to use class-agnostic NMS in the demo.
- # ----------------- Label Assignment -----------------
- 'matcher': 'fcos_matcher',
- 'matcher_hpy':{'center_sampling_radius': 1.5,
- 'object_sizes_of_interest': [[-1, 64], [64, 128], [128, 256], [256, 512], [512, float('inf')]]
- },
- # ----------------- Loss weight -----------------
- ## Loss hyper-parameters
- 'focal_loss_alpha': 0.25,
- 'focal_loss_gamma': 2.0,
- 'loss_cls_weight': 1.0,
- 'loss_reg_weight': 1.0,
- 'loss_ctn_weight': 1.0,
- # ----------------- Training -----------------
- ## Training scheduler
- 'scheduler': '1x',
- ## Optimizer
- 'optimizer': 'sgd',
- 'base_lr': 0.01 / 16,
- 'backbone_lr_ratio': 1.0 / 1.0,
- 'momentum': 0.9,
- 'weight_decay': 1e-4,
- 'clip_max_norm': -1.0,
- 'param_dict_type': 'default',
- ## LR Scheduler
- 'lr_scheduler': 'step',
- 'warmup': 'linear',
- 'warmup_iters': 500,
- 'warmup_factor': 0.00066667,
- ## Epoch
- 'max_epoch': 12, # 1x
- 'lr_epoch': [8, 11], # 1x
- # ----------------- Input -----------------
- ## Transforms
- 'train_min_size': [800], # short edge of image
- 'train_max_size': 1333,
- 'test_min_size': [800],
- 'test_max_size': 1333,
- ## Pixel mean & std
- 'pixel_mean': [0.485, 0.456, 0.406],
- 'pixel_std': [0.229, 0.224, 0.225],
- ## Transforms
- 'detr_style': False,
- 'trans_config': [
- {'name': 'RandomHFlip'},
- {'name': 'RandomResize'},
- ],
- 'box_format': 'xyxy',
- 'normalize_coords': False,
- },
- 'fcos_rt_r18_1x':{
- # ----------------- Model-----------------
- ## Backbone
- 'backbone': 'resnet18',
- 'backbone_norm': 'FrozeBN',
- 'res5_dilation': False,
- 'pretrained': True,
- 'freeze_at': 1, # freeze stem layer + layer1 of the backbone
- 'pretrained_weight': 'imagenet1k_v1',
- 'max_stride': 32,
- 'out_stride': [8, 16, 32],
- ## Neck
- 'neck': 'basic_fpn',
- 'fpn_p6_feat': False,
- 'fpn_p7_feat': False,
- 'fpn_p6_from_c5': False,
- ## Head
- 'head': 'fcos_head',
- 'head_dim': 256,
- 'num_cls_head': 4,
- 'num_reg_head': 4,
- 'head_act': 'relu',
- 'head_norm': 'GN',
- ## Post-process
- 'train_topk': 1000,
- 'train_conf_thresh': 0.05,
- 'train_nms_thresh': 0.6,
- 'test_topk': 100,
- 'test_conf_thresh': 0.5,
- 'test_nms_thresh': 0.45,
- 'nms_class_agnostic': True, # We prefer to use class-agnostic NMS in the demo.
- # ----------------- Label Assignment -----------------
- 'matcher': 'fcos_matcher',
- 'matcher_hpy':{'center_sampling_radius': 1.5,
- 'object_sizes_of_interest': [[-1, 64], [64, 128], [128, float('inf')]]
- },
- # ----------------- Loss weight -----------------
- ## Loss hyper-parameters
- 'focal_loss_alpha': 0.25,
- 'focal_loss_gamma': 2.0,
- 'loss_cls_weight': 1.0,
- 'loss_reg_weight': 1.0,
- 'loss_ctn_weight': 1.0,
- # ----------------- Training -----------------
- ## Training scheduler
- 'scheduler': '1x',
- ## Optimizer
- 'optimizer': 'sgd',
- 'base_lr': 0.01 / 16,
- 'backbone_lr_ratio': 1.0 / 1.0,
- 'momentum': 0.9,
- 'weight_decay': 1e-4,
- 'clip_max_norm': -1.0,
- ## LR Scheduler
- 'lr_scheduler': 'step',
- 'warmup': 'linear',
- 'warmup_iters': 500,
- 'warmup_factor': 0.00066667,
- ## Epoch
- 'max_epoch': 36, # 1x
- 'lr_epoch': [24, 33], # 1x
- # ----------------- Input -----------------
- ## Transforms
- 'train_min_size': [256, 288, 320, 352, 384, 416, 448, 480, 512, 544, 576, 608], # short edge of image
- 'train_max_size': 900,
- 'test_min_size': [512],
- 'test_max_size': 736,
- ## Pixel mean & std
- 'pixel_mean': [0.485, 0.456, 0.406],
- 'pixel_std': [0.229, 0.224, 0.225],
- ## Transforms
- 'detr_style': False,
- 'trans_config': [
- {'name': 'RandomHFlip'},
- {'name': 'RandomResize'},
- ],
- 'box_format': 'xyxy',
- 'normalize_coords': False,
- },
- 'fcos_rt_r50_1x':{
- # ----------------- Model-----------------
- ## Backbone
- 'backbone': 'resnet50',
- 'backbone_norm': 'FrozeBN',
- 'res5_dilation': False,
- 'pretrained': True,
- 'freeze_at': 1, # freeze stem layer + layer1 of the backbone
- 'pretrained_weight': 'imagenet1k_v1',
- 'max_stride': 32,
- 'out_stride': [8, 16, 32],
- ## Neck
- 'neck': 'basic_fpn',
- 'fpn_p6_feat': False,
- 'fpn_p7_feat': False,
- 'fpn_p6_from_c5': False,
- ## Head
- 'head': 'fcos_head',
- 'head_dim': 256,
- 'num_cls_head': 4,
- 'num_reg_head': 4,
- 'head_act': 'relu',
- 'head_norm': 'GN',
- ## Post-process
- 'train_topk': 1000,
- 'train_conf_thresh': 0.05,
- 'train_nms_thresh': 0.6,
- 'test_topk': 100,
- 'test_conf_thresh': 0.5,
- 'test_nms_thresh': 0.45,
- 'nms_class_agnostic': True, # We prefer to use class-agnostic NMS in the demo.
- # ----------------- Label Assignment -----------------
- 'matcher': 'fcos_matcher',
- 'matcher_hpy':{'center_sampling_radius': 1.5,
- 'object_sizes_of_interest': [[-1, 64], [64, 128], [128, float('inf')]]
- },
- # ----------------- Loss weight -----------------
- ## Loss hyper-parameters
- 'focal_loss_alpha': 0.25,
- 'focal_loss_gamma': 2.0,
- 'loss_cls_weight': 1.0,
- 'loss_reg_weight': 1.0,
- 'loss_ctn_weight': 1.0,
- # ----------------- Training -----------------
- ## Training scheduler
- 'scheduler': '1x',
- ## Optimizer
- 'optimizer': 'sgd',
- 'base_lr': 0.01 / 16,
- 'backbone_lr_ratio': 1.0 / 1.0,
- 'momentum': 0.9,
- 'weight_decay': 1e-4,
- 'clip_max_norm': -1.0,
- ## LR Scheduler
- 'lr_scheduler': 'step',
- 'warmup': 'linear',
- 'warmup_iters': 500,
- 'warmup_factor': 0.00066667,
- ## Epoch
- 'max_epoch': 36, # 1x
- 'lr_epoch': [24, 33], # 1x
- # ----------------- Input -----------------
- ## Transforms
- 'train_min_size': [256, 288, 320, 352, 384, 416, 448, 480, 512, 544, 576, 608], # short edge of image
- 'train_max_size': 900,
- 'test_min_size': [512],
- 'test_max_size': 736,
- ## Pixel mean & std
- 'pixel_mean': [0.485, 0.456, 0.406],
- 'pixel_std': [0.229, 0.224, 0.225],
- ## Transforms
- 'detr_style': False,
- 'trans_config': [
- {'name': 'RandomHFlip'},
- {'name': 'RandomResize'},
- ],
- 'box_format': 'xyxy',
- 'normalize_coords': False,
- },
- }
|