예제 #1
0
 def __init__(self,
              num_classes=81,
              fpn_stride=[8, 16, 32, 64, 128],
              prior_prob=0.01,
              num_convs=4,
              norm_type="gn",
              fcos_loss=None,
              norm_reg_targets=False,
              centerness_on_reg=False,
              use_dcn_in_tower=False,
              nms=MultiClassNMS(score_threshold=0.01,
                                nms_top_k=1000,
                                keep_top_k=100,
                                nms_threshold=0.45,
                                background_label=-1).__dict__):
     self.num_classes = num_classes - 1
     self.fpn_stride = fpn_stride[::-1]
     self.prior_prob = prior_prob
     self.num_convs = num_convs
     self.norm_reg_targets = norm_reg_targets
     self.centerness_on_reg = centerness_on_reg
     self.use_dcn_in_tower = use_dcn_in_tower
     self.norm_type = norm_type
     self.fcos_loss = fcos_loss
     self.batch_size = 8
     self.nms = nms
     if isinstance(nms, dict):
         self.nms = MultiClassNMS(**nms)
예제 #2
0
 def __init__(self, head, nms=MultiClassNMS().__dict__, num_classes=81):
     super(CascadeBBoxHead, self).__init__()
     self.head = head
     self.nms = nms
     self.num_classes = num_classes
     if isinstance(nms, dict):
         self.nms = MultiClassNMS(**nms)
예제 #3
0
 def __init__(self,
              norm_decay=0.,
              num_classes=80,
              anchors=[[10, 13], [16, 30], [33, 23], [30, 61], [62, 45],
                       [59, 119], [116, 90], [156, 198], [373, 326]],
              anchor_masks=[[6, 7, 8], [3, 4, 5], [0, 1, 2]],
              drop_block=False,
              block_size=3,
              keep_prob=0.9,
              yolo_loss="YOLOv3Loss",
              nms=MultiClassNMS(
                  score_threshold=0.01,
                  nms_top_k=1000,
                  keep_top_k=100,
                  nms_threshold=0.45,
                  background_label=-1).__dict__,
              weight_prefix_name=''):
     self.norm_decay = norm_decay
     self.num_classes = num_classes
     self.anchor_masks = anchor_masks
     self._parse_anchors(anchors)
     self.yolo_loss = yolo_loss
     self.nms = nms
     self.prefix_name = weight_prefix_name
     self.drop_block = drop_block
     self.block_size = block_size
     self.keep_prob = keep_prob
     if isinstance(nms, dict):
         self.nms = MultiClassNMS(**nms)
예제 #4
0
 def __init__(self,
              norm_decay=0.,
              num_classes=80,
              ignore_thresh=0.7,
              label_smooth=True,
              anchors=[[10, 13], [16, 30], [33, 23], [30, 61], [62, 45],
                       [59, 119], [116, 90], [156, 198], [373, 326]],
              anchor_masks=[[6, 7, 8], [3, 4, 5], [0, 1, 2]],
              nms=MultiClassNMS(
                  score_threshold=0.01,
                  nms_top_k=1000,
                  keep_top_k=100,
                  nms_threshold=0.45,
                  background_label=-1).__dict__,
              weight_prefix_name=''):
     self.norm_decay = norm_decay
     self.num_classes = num_classes
     self.ignore_thresh = ignore_thresh
     self.label_smooth = label_smooth
     self.anchor_masks = anchor_masks
     self._parse_anchors(anchors)
     self.nms = nms
     self.prefix_name = weight_prefix_name
     if isinstance(nms, dict):
         self.nms = MultiClassNMS(**nms)
예제 #5
0
 def __init__(self,
              head,
              box_coder=BoxCoder().__dict__,
              nms=MultiClassNMS().__dict__,
              num_classes=81):
     super(BBoxHead, self).__init__()
     self.head = head
     self.num_classes = num_classes
     self.box_coder = box_coder
     self.nms = nms
     if isinstance(box_coder, dict):
         self.box_coder = BoxCoder(**box_coder)
     if isinstance(nms, dict):
         self.nms = MultiClassNMS(**nms)
     self.head_feat = None
예제 #6
0
 def __init__(self,
              anchors=[[12, 16], [19, 36], [40, 28], [36, 75], [76, 55],
                       [72, 146], [142, 110], [192, 243], [459, 401]],
              anchor_masks=[[0, 1, 2], [3, 4, 5], [6, 7, 8]],
              nms=MultiClassNMS(
                  score_threshold=0.01,
                  nms_top_k=-1,
                  keep_top_k=-1,
                  nms_threshold=0.45,
                  background_label=-1).__dict__,
              spp_stage=5,
              num_classes=80,
              weight_prefix_name='',
              downsample=[8, 16, 32],
              scale_x_y=1.0,
              yolo_loss="YOLOv3Loss",
              iou_aware=False,
              iou_aware_factor=0.4,
              clip_bbox=False):
     super(YOLOv4Head, self).__init__(
         anchors=anchors,
         anchor_masks=anchor_masks,
         nms=nms,
         num_classes=num_classes,
         weight_prefix_name=weight_prefix_name,
         downsample=downsample,
         scale_x_y=scale_x_y,
         yolo_loss=yolo_loss,
         iou_aware=iou_aware,
         iou_aware_factor=iou_aware_factor,
         clip_bbox=clip_bbox)
     self.spp_stage = spp_stage
예제 #7
0
 def __init__(
     self,
     head,
     nms=MultiClassNMS().__dict__,
     bbox_loss=SmoothL1Loss().__dict__,
     num_classes=81,
 ):
     super(CascadeBBoxHead, self).__init__()
     self.head = head
     self.nms = nms
     self.bbox_loss = bbox_loss
     self.num_classes = num_classes
     if isinstance(nms, dict):
         self.nms = MultiClassNMS(**nms)
     if isinstance(bbox_loss, dict):
         self.bbox_loss = SmoothL1Loss(**bbox_loss)
예제 #8
0
 def __init__(self,
              conv_block_num=2,
              norm_decay=0.,
              num_classes=80,
              anchors=[[10, 13], [16, 30], [33, 23], [30, 61], [62, 45],
                       [59, 119], [116, 90], [156, 198], [373, 326]],
              anchor_masks=[[6, 7, 8], [3, 4, 5], [0, 1, 2]],
              drop_block=False,
              coord_conv=False,
              iou_aware=False,
              iou_aware_factor=0.4,
              block_size=3,
              keep_prob=0.9,
              yolo_loss="YOLOv3Loss",
              spp=False,
              nms=MultiClassNMS(
                  score_threshold=0.01,
                  nms_top_k=1000,
                  keep_top_k=100,
                  nms_threshold=0.45,
                  background_label=-1).__dict__,
              weight_prefix_name='',
              downsample=[32, 16, 8],
              scale_x_y=1.0,
              clip_bbox=True):
     check_version("1.8.4")
     self.conv_block_num = conv_block_num
     self.norm_decay = norm_decay
     self.num_classes = num_classes
     self.anchor_masks = anchor_masks
     self._parse_anchors(anchors)
     self.yolo_loss = yolo_loss
     self.nms = nms
     self.prefix_name = weight_prefix_name
     self.drop_block = drop_block
     self.iou_aware = iou_aware
     self.coord_conv = coord_conv
     self.iou_aware_factor = iou_aware_factor
     self.block_size = block_size
     self.keep_prob = keep_prob
     self.use_spp = spp
     if isinstance(nms, dict):
         self.nms = MultiClassNMS(**nms)
     self.downsample = downsample
     self.scale_x_y = scale_x_y
     self.clip_bbox = clip_bbox
예제 #9
0
    def __init__(self,
                 head,
                 nms=MultiClassNMS().__dict__,
                 bbox_loss=SmoothL1Loss().__dict__,
                 num_classes=81,
                 lr_ratio=2.0):
        super(HTCBBoxHead, self).__init__()
        self.head = head
        self.nms = nms
        self.bbox_loss = bbox_loss
        self.num_classes = num_classes
        self.lr_ratio = lr_ratio

        if isinstance(nms, dict):
            self.nms = MultiClassNMS(**nms)
        if isinstance(bbox_loss, dict):
            self.bbox_loss = SmoothL1Loss(**bbox_loss)
예제 #10
0
 def __init__(self,
              conv_block_num=3,
              norm_decay=0.,
              num_classes=80,
              anchors=[[10, 13], [16, 30], [33, 23], [30, 61], [62, 45],
                       [59, 119], [116, 90], [156, 198], [373, 326]],
              anchor_masks=[[6, 7, 8], [3, 4, 5], [0, 1, 2]],
              drop_block=False,
              iou_aware=False,
              iou_aware_factor=0.4,
              block_size=3,
              keep_prob=0.9,
              yolo_loss="YOLOv3Loss",
              spp=False,
              nms=MultiClassNMS(score_threshold=0.01,
                                nms_top_k=1000,
                                keep_top_k=100,
                                nms_threshold=0.45,
                                background_label=-1).__dict__,
              weight_prefix_name='',
              downsample=[32, 16, 8],
              scale_x_y=1.0,
              clip_bbox=True,
              act='mish'):
     super(YOLOv3PANHead,
           self).__init__(conv_block_num=conv_block_num,
                          norm_decay=norm_decay,
                          num_classes=num_classes,
                          anchors=anchors,
                          anchor_masks=anchor_masks,
                          drop_block=drop_block,
                          iou_aware=iou_aware,
                          iou_aware_factor=iou_aware_factor,
                          block_size=block_size,
                          keep_prob=keep_prob,
                          yolo_loss=yolo_loss,
                          spp=spp,
                          nms=nms,
                          weight_prefix_name=weight_prefix_name,
                          downsample=downsample,
                          scale_x_y=scale_x_y,
                          clip_bbox=clip_bbox)
     self.act = act
예제 #11
0
 def __init__(self,
              norm_decay=0.,
              num_classes=80,
              anchors=[[10, 13], [16, 30], [33, 23], [30, 61], [62, 45],
                       [59, 119], [116, 90], [156, 198], [373, 326]],
              anchor_masks=[[6, 7, 8], [3, 4, 5], [0, 1, 2]],
              detection_block_channels=[128, 96],
              drop_block=False,
              block_size=3,
              keep_prob=0.9,
              yolo_loss="YOLOv3Loss",
              spp=False,
              nms=MultiClassNMS(score_threshold=0.01,
                                nms_top_k=1000,
                                keep_top_k=100,
                                nms_threshold=0.45,
                                background_label=-1).__dict__,
              weight_prefix_name='',
              downsample=[32, 16, 8],
              scale_x_y=1.0,
              clip_bbox=True):
     super(PPYOLOTinyHead,
           self).__init__(norm_decay=norm_decay,
                          num_classes=num_classes,
                          anchors=anchors,
                          anchor_masks=anchor_masks,
                          drop_block=drop_block,
                          block_size=block_size,
                          keep_prob=0.9,
                          spp=spp,
                          yolo_loss=yolo_loss,
                          nms=nms,
                          weight_prefix_name=weight_prefix_name,
                          downsample=downsample,
                          scale_x_y=scale_x_y,
                          clip_bbox=clip_bbox)
     self.detection_block_channels = detection_block_channels