(
self,
num_classes,
in_channels,
# anchor free
feat_channels=256,
stacked_convs=4,
strides=(4, 8, 16, 32, 64),
dcn_on_last_conv=False,
conv_bias='auto',
num_query=100,
num_reg_fcs=2,
transformer=None,
sync_cls_avg_factor=False,
positional_encoding=dict(type='SinePositionalEncoding',
num_feats=128,
normalize=True),
loss_cls=dict(type='CrossEntropyLoss',
bg_cls_weight=0.1,
use_sigmoid=False,
loss_weight=1.0,
class_weight=1.0),
loss_bbox=dict(type='L1Loss', loss_weight=5.0),
loss_iou=dict(type='GIoULoss', loss_weight=2.0),
# anchor free
bbox_coder=dict(type='DistancePointBBoxCoder'),
conv_cfg=None,
norm_cfg=None,
train_cfg=dict(assigner=dict(
type='HungarianAssigner',
# cls_cost=dict(type='ClassificationCost', weight=1.),
# reg_cost=dict(type='BBoxL1Cost', weight=5.0),
# iou_cost=dict(type='IoUCost', iou_mode='giou',
# weight=2.0)
kp3d_cost=dict(
type='Keypoints3DCost', convention='smpl_54', weight=5.0),
kp2d_cost=dict(
type='Keypoints2DCost', convention='smpl_54', weight=5.0),
)),
test_cfg=dict(max_per_img=100),
init_cfg=dict(type='Normal',
layer='Conv2d',
std=0.01,
override=dict(type='Normal',
name='conv_cls',
std=0.01,
bias_prob=0.01)),
**kwargs)
| 75 | _version = 2 |
| 76 | |
| 77 | def __init__( |
| 78 | self, |
| 79 | num_classes, |
| 80 | in_channels, |
| 81 | # anchor free |
| 82 | feat_channels=256, |
| 83 | stacked_convs=4, |
| 84 | strides=(4, 8, 16, 32, 64), |
| 85 | dcn_on_last_conv=False, |
| 86 | conv_bias='auto', |
| 87 | num_query=100, |
| 88 | num_reg_fcs=2, |
| 89 | transformer=None, |
| 90 | sync_cls_avg_factor=False, |
| 91 | positional_encoding=dict(type='SinePositionalEncoding', |
| 92 | num_feats=128, |
| 93 | normalize=True), |
| 94 | loss_cls=dict(type='CrossEntropyLoss', |
| 95 | bg_cls_weight=0.1, |
| 96 | use_sigmoid=False, |
| 97 | loss_weight=1.0, |
| 98 | class_weight=1.0), |
| 99 | loss_bbox=dict(type='L1Loss', loss_weight=5.0), |
| 100 | loss_iou=dict(type='GIoULoss', loss_weight=2.0), |
| 101 | # anchor free |
| 102 | bbox_coder=dict(type='DistancePointBBoxCoder'), |
| 103 | conv_cfg=None, |
| 104 | norm_cfg=None, |
| 105 | train_cfg=dict(assigner=dict( |
| 106 | type='HungarianAssigner', |
| 107 | # cls_cost=dict(type='ClassificationCost', weight=1.), |
| 108 | # reg_cost=dict(type='BBoxL1Cost', weight=5.0), |
| 109 | # iou_cost=dict(type='IoUCost', iou_mode='giou', |
| 110 | # weight=2.0) |
| 111 | kp3d_cost=dict( |
| 112 | type='Keypoints3DCost', convention='smpl_54', weight=5.0), |
| 113 | kp2d_cost=dict( |
| 114 | type='Keypoints2DCost', convention='smpl_54', weight=5.0), |
| 115 | )), |
| 116 | test_cfg=dict(max_per_img=100), |
| 117 | init_cfg=dict(type='Normal', |
| 118 | layer='Conv2d', |
| 119 | std=0.01, |
| 120 | override=dict(type='Normal', |
| 121 | name='conv_cls', |
| 122 | std=0.01, |
| 123 | bias_prob=0.01)), |
| 124 | **kwargs): |
| 125 | # NOTE here use `AnchorFreeHead` instead of `TransformerHead`, |
| 126 | # since it brings inconvenience when the initialization of |
| 127 | # `AnchorFreeHead` is called. |
| 128 | super(DETRHead, self).__init__(init_cfg) |
| 129 | self.bg_cls_weight = 0 |
| 130 | self.sync_cls_avg_factor = sync_cls_avg_factor |
| 131 | class_weight = loss_cls.get('class_weight', None) |
| 132 | if class_weight is not None and (self.__class__ is DETRHead): |
| 133 | assert isinstance(class_weight, float), 'Expected ' \ |
| 134 | 'class_weight to have type float. Found ' \ |
no test coverage detected