repo
stringlengths
1
99
file
stringlengths
13
215
code
stringlengths
12
59.2M
file_length
int64
12
59.2M
avg_line_length
float64
3.82
1.48M
max_line_length
int64
12
2.51M
extension_type
stringclasses
1 value
UniControl
UniControl-main/annotator/uniformer/mmdet_null/models/dense_heads/vfnet_head.py
import numpy as np import torch import torch.nn as nn from mmcv.cnn import ConvModule, Scale, bias_init_with_prob, normal_init from mmcv.ops import DeformConv2d from mmcv.runner import force_fp32 from mmdet.core import (bbox2distance, bbox_overlaps, build_anchor_generator, build_assigner, build...
35,403
43.533333
79
py
UniControl
UniControl-main/annotator/uniformer/mmdet_null/models/dense_heads/fsaf_head.py
import numpy as np import torch from mmcv.cnn import normal_init from mmcv.runner import force_fp32 from mmdet.core import (anchor_inside_flags, images_to_levels, multi_apply, unmap) from ..builder import HEADS from ..losses.accuracy import accuracy from ..losses.utils import weight_reduce_loss...
18,883
43.643026
79
py
UniControl
UniControl-main/annotator/uniformer/mmdet_null/models/dense_heads/atss_head.py
import torch import torch.nn as nn from mmcv.cnn import ConvModule, Scale, bias_init_with_prob, normal_init from mmcv.runner import force_fp32 from mmdet.core import (anchor_inside_flags, build_assigner, build_sampler, images_to_levels, multi_apply, multiclass_nms, reduc...
30,511
43.22029
79
py
UniControl
UniControl-main/annotator/uniformer/mmdet_null/models/dense_heads/rpn_head.py
import copy import warnings import torch import torch.nn as nn import torch.nn.functional as F from mmcv import ConfigDict from mmcv.cnn import normal_init from mmcv.ops import batched_nms from ..builder import HEADS from .anchor_head import AnchorHead from .rpn_test_mixin import RPNTestMixin @HEADS.register_module...
10,616
43.797468
79
py
UniControl
UniControl-main/annotator/uniformer/mmdet_null/models/dense_heads/anchor_head.py
import torch import torch.nn as nn from mmcv.cnn import normal_init from mmcv.runner import force_fp32 from mmdet.core import (anchor_inside_flags, build_anchor_generator, build_assigner, build_bbox_coder, build_sampler, images_to_levels, multi_apply, multiclass_nms, unm...
34,480
44.852394
79
py
UniControl
UniControl-main/annotator/uniformer/mmdet_null/models/dense_heads/retina_head.py
import torch.nn as nn from mmcv.cnn import ConvModule, bias_init_with_prob, normal_init from ..builder import HEADS from .anchor_head import AnchorHead @HEADS.register_module() class RetinaHead(AnchorHead): r"""An anchor-based head used in `RetinaNet <https://arxiv.org/pdf/1708.02002.pdf>`_. The head co...
4,051
34.234783
76
py
UniControl
UniControl-main/annotator/uniformer/mmdet_null/models/dense_heads/ga_rpn_head.py
import copy import warnings import torch import torch.nn as nn import torch.nn.functional as F from mmcv import ConfigDict from mmcv.cnn import normal_init from mmcv.ops import nms from ..builder import HEADS from .guided_anchor_head import GuidedAnchorHead from .rpn_test_mixin import RPNTestMixin @HEADS.register_m...
6,896
39.098837
79
py
UniControl
UniControl-main/annotator/uniformer/mmdet_null/models/dense_heads/ga_retina_head.py
import torch.nn as nn from mmcv.cnn import ConvModule, bias_init_with_prob, normal_init from mmcv.ops import MaskedConv2d from ..builder import HEADS from .guided_anchor_head import FeatureAdaption, GuidedAnchorHead @HEADS.register_module() class GARetinaHead(GuidedAnchorHead): """Guided-Anchor-based RetinaNet h...
3,876
34.245455
78
py
UniControl
UniControl-main/annotator/uniformer/mmdet_null/models/dense_heads/ld_head.py
import torch from mmcv.runner import force_fp32 from mmdet.core import (bbox2distance, bbox_overlaps, distance2bbox, multi_apply, reduce_mean) from ..builder import HEADS, build_loss from .gfl_head import GFLHead @HEADS.register_module() class LDHead(GFLHead): """Localization distillation...
10,641
39.618321
79
py
UniControl
UniControl-main/annotator/uniformer/mmdet_null/models/dense_heads/ssd_head.py
import torch import torch.nn as nn import torch.nn.functional as F from mmcv.cnn import xavier_init from mmcv.runner import force_fp32 from mmdet.core import (build_anchor_generator, build_assigner, build_bbox_coder, build_sampler, multi_apply) from ..builder import HEADS from ..losses import s...
11,038
40.5
79
py
UniControl
UniControl-main/annotator/uniformer/mmdet_null/models/dense_heads/fcos_head.py
import torch import torch.nn as nn import torch.nn.functional as F from mmcv.cnn import Scale, normal_init from mmcv.runner import force_fp32 from mmdet.core import distance2bbox, multi_apply, multiclass_nms, reduce_mean from ..builder import HEADS, build_loss from .anchor_free_head import AnchorFreeHead INF = 1e8 ...
28,339
43.984127
113
py
UniControl
UniControl-main/annotator/uniformer/mmdet_null/models/dense_heads/yolo_head.py
# Copyright (c) 2019 Western Digital Corporation or its affiliates. import warnings import torch import torch.nn as nn import torch.nn.functional as F from mmcv.cnn import ConvModule, normal_init from mmcv.runner import force_fp32 from mmdet.core import (build_anchor_generator, build_assigner, ...
24,983
42.224913
79
py
UniControl
UniControl-main/annotator/uniformer/mmdet_null/models/dense_heads/centripetal_head.py
import torch.nn as nn from mmcv.cnn import ConvModule, normal_init from mmcv.ops import DeformConv2d from mmdet.core import multi_apply from ..builder import HEADS, build_loss from .corner_head import CornerHead @HEADS.register_module() class CentripetalHead(CornerHead): """Head of CentripetalNet: Pursuing High-...
19,469
45.137441
79
py
UniControl
UniControl-main/annotator/uniformer/mmdet_null/models/dense_heads/paa_head.py
import numpy as np import torch from mmcv.runner import force_fp32 from mmdet.core import multi_apply, multiclass_nms from mmdet.core.bbox.iou_calculators import bbox_overlaps from mmdet.models import HEADS from mmdet.models.dense_heads import ATSSHead EPS = 1e-12 try: import sklearn.mixture as skm except ImportE...
29,706
43.206845
79
py
UniControl
UniControl-main/annotator/uniformer/mmdet_null/models/dense_heads/retina_sepbn_head.py
import torch.nn as nn from mmcv.cnn import ConvModule, bias_init_with_prob, normal_init from ..builder import HEADS from .anchor_head import AnchorHead @HEADS.register_module() class RetinaSepBNHead(AnchorHead): """"RetinaHead with separate BN. In RetinaHead, conv/norm layers are shared across different FPN...
4,288
36.622807
79
py
UniControl
UniControl-main/annotator/uniformer/mmdet_null/models/dense_heads/anchor_free_head.py
from abc import abstractmethod import torch import torch.nn as nn from mmcv.cnn import ConvModule, bias_init_with_prob, normal_init from mmcv.runner import force_fp32 from mmdet.core import multi_apply from ..builder import HEADS, build_loss from .base_dense_head import BaseDenseHead from .dense_test_mixins import BB...
13,496
38.580645
79
py
UniControl
UniControl-main/annotator/uniformer/mmdet_null/models/dense_heads/pisa_ssd_head.py
import torch from mmdet.core import multi_apply from ..builder import HEADS from ..losses import CrossEntropyLoss, SmoothL1Loss, carl_loss, isr_p from .ssd_head import SSDHead # TODO: add loss evaluator for SSD @HEADS.register_module() class PISASSDHead(SSDHead): def loss(self, cls_scores, ...
5,551
38.657143
79
py
UniControl
UniControl-main/annotator/uniformer/mmdet_null/models/dense_heads/embedding_rpn_head.py
import torch import torch.nn as nn from mmdet.models.builder import HEADS from ...core import bbox_cxcywh_to_xyxy @HEADS.register_module() class EmbeddingRPNHead(nn.Module): """RPNHead in the `Sparse R-CNN <https://arxiv.org/abs/2011.12450>`_ . Unlike traditional RPNHead, this module does not need FPN input...
3,916
37.782178
78
py
UniControl
UniControl-main/annotator/uniformer/mmdet_null/models/dense_heads/pisa_retinanet_head.py
import torch from mmcv.runner import force_fp32 from mmdet.core import images_to_levels from ..builder import HEADS from ..losses import carl_loss, isr_p from .retina_head import RetinaHead @HEADS.register_module() class PISARetinaHead(RetinaHead): """PISA Retinanet Head. The head owns the same structure wi...
6,220
39.135484
79
py
UniControl
UniControl-main/annotator/uniformer/mmdet_null/models/dense_heads/gfl_head.py
import torch import torch.nn as nn import torch.nn.functional as F from mmcv.cnn import ConvModule, Scale, bias_init_with_prob, normal_init from mmcv.runner import force_fp32 from mmdet.core import (anchor_inside_flags, bbox2distance, bbox_overlaps, build_assigner, build_sampler, distance2bbox,...
28,062
42.307099
79
py
UniControl
UniControl-main/annotator/uniformer/mmdet_null/models/dense_heads/corner_head.py
from logging import warning from math import ceil, log import torch import torch.nn as nn import torch.nn.functional as F from mmcv.cnn import ConvModule, bias_init_with_prob from mmcv.ops import CornerPool, batched_nms from mmdet.core import multi_apply from ..builder import HEADS, build_loss from ..utils import gau...
46,589
42.339535
79
py
UniControl
UniControl-main/annotator/uniformer/mmdet_null/models/dense_heads/yolact_head.py
import numpy as np import torch import torch.nn as nn import torch.nn.functional as F from mmcv.cnn import ConvModule, xavier_init from mmcv.runner import force_fp32 from mmdet.core import build_sampler, fast_nms, images_to_levels, multi_apply from ..builder import HEADS, build_loss from .anchor_head import AnchorHead...
39,679
41.033898
79
py
UniControl
UniControl-main/annotator/uniformer/mmdet_null/models/dense_heads/base_dense_head.py
from abc import ABCMeta, abstractmethod import torch.nn as nn class BaseDenseHead(nn.Module, metaclass=ABCMeta): """Base class for DenseHeads.""" def __init__(self): super(BaseDenseHead, self).__init__() @abstractmethod def loss(self, **kwargs): """Compute losses of the head.""" ...
2,051
33.2
79
py
UniControl
UniControl-main/annotator/uniformer/mmdet_null/models/dense_heads/free_anchor_retina_head.py
import torch import torch.nn.functional as F from mmdet.core import bbox_overlaps from ..builder import HEADS from .retina_head import RetinaHead EPS = 1e-12 @HEADS.register_module() class FreeAnchorRetinaHead(RetinaHead): """FreeAnchor RetinaHead used in https://arxiv.org/abs/1909.02466. Args: num...
11,148
40.140221
94
py
UniControl
UniControl-main/annotator/uniformer/mmdet_null/models/dense_heads/guided_anchor_head.py
import torch import torch.nn as nn from mmcv.cnn import bias_init_with_prob, normal_init from mmcv.ops import DeformConv2d, MaskedConv2d from mmcv.runner import force_fp32 from mmdet.core import (anchor_inside_flags, build_anchor_generator, build_assigner, build_bbox_coder, build_sampler, ...
36,623
41.536585
79
py
UniControl
UniControl-main/annotator/uniformer/mmdet_null/models/dense_heads/sabl_retina_head.py
import numpy as np import torch import torch.nn as nn from mmcv.cnn import ConvModule, bias_init_with_prob, normal_init from mmcv.runner import force_fp32 from mmdet.core import (build_anchor_generator, build_assigner, build_bbox_coder, build_sampler, images_to_levels, m...
27,171
42.684887
79
py
UniControl
UniControl-main/annotator/uniformer/mmdet_null/models/dense_heads/fovea_head.py
import torch import torch.nn as nn from mmcv.cnn import ConvModule, normal_init from mmcv.ops import DeformConv2d from mmdet.core import multi_apply, multiclass_nms from ..builder import HEADS from .anchor_free_head import AnchorFreeHead INF = 1e8 class FeatureAlign(nn.Module): def __init__(self, ...
14,405
41.122807
79
py
UniControl
UniControl-main/annotator/uniformer/mmdet_null/models/dense_heads/dense_test_mixins.py
from inspect import signature import torch from mmdet.core import bbox2result, bbox_mapping_back, multiclass_nms class BBoxTestMixin(object): """Mixin class for test time augmentation of bboxes.""" def merge_aug_bboxes(self, aug_bboxes, aug_scores, img_metas): """Merge augmented detection bboxes an...
4,092
39.524752
79
py
UniControl
UniControl-main/annotator/uniformer/mmdet_null/models/dense_heads/transformer_head.py
import torch import torch.nn as nn import torch.nn.functional as F from mmcv.cnn import Conv2d, Linear, build_activation_layer from mmcv.runner import force_fp32 from mmdet.core import (bbox_cxcywh_to_xyxy, bbox_xyxy_to_cxcywh, build_assigner, build_sampler, multi_apply, ...
30,957
46.264122
79
py
UniControl
UniControl-main/annotator/uniformer/mmdet_null/models/utils/gaussian_target.py
from math import sqrt import torch def gaussian2D(radius, sigma=1, dtype=torch.float32, device='cpu'): """Generate 2D gaussian kernel. Args: radius (int): Radius of gaussian kernel. sigma (int): Sigma of gaussian function. Default: 1. dtype (torch.dtype): Dtype of gaussian tensor. De...
5,784
30.102151
79
py
UniControl
UniControl-main/annotator/uniformer/mmdet_null/models/utils/res_layer.py
from mmcv.cnn import build_conv_layer, build_norm_layer from torch import nn as nn class ResLayer(nn.Sequential): """ResLayer to build ResNet style backbone. Args: block (nn.Module): block used to build ResLayer. inplanes (int): inplanes of block. planes (int): planes of block. ...
6,261
32.308511
79
py
UniControl
UniControl-main/annotator/uniformer/mmdet_null/models/utils/transformer.py
import torch import torch.nn as nn from mmcv.cnn import (Linear, build_activation_layer, build_norm_layer, xavier_init) from .builder import TRANSFORMER class MultiheadAttention(nn.Module): """A warpper for torch.nn.MultiheadAttention. This module implements MultiheadAttention with res...
36,776
41.714286
79
py
UniControl
UniControl-main/annotator/uniformer/mmdet_null/models/utils/positional_encoding.py
import math import torch import torch.nn as nn from mmcv.cnn import uniform_init from .builder import POSITIONAL_ENCODING @POSITIONAL_ENCODING.register_module() class SinePositionalEncoding(nn.Module): """Position encoding with sine and cosine functions. See `End-to-End Object Detection with Transformers ...
5,800
37.417219
79
py
UniControl
UniControl-main/annotator/uniformer/mmdet_null/models/roi_heads/standard_roi_head.py
import torch from mmdet.core import bbox2result, bbox2roi, build_assigner, build_sampler from ..builder import HEADS, build_head, build_roi_extractor from .base_roi_head import BaseRoIHead from .test_mixins import BBoxTestMixin, MaskTestMixin @HEADS.register_module() class StandardRoIHead(BaseRoIHead, BBoxTestMixin,...
12,334
40.672297
79
py
UniControl
UniControl-main/annotator/uniformer/mmdet_null/models/roi_heads/grid_roi_head.py
import torch from mmdet.core import bbox2result, bbox2roi from ..builder import HEADS, build_head, build_roi_extractor from .standard_roi_head import StandardRoIHead @HEADS.register_module() class GridRoIHead(StandardRoIHead): """Grid roi head for Grid R-CNN. https://arxiv.org/abs/1811.12030 """ de...
7,100
39.118644
79
py
UniControl
UniControl-main/annotator/uniformer/mmdet_null/models/roi_heads/scnet_roi_head.py
import torch import torch.nn.functional as F from mmdet.core import (bbox2result, bbox2roi, bbox_mapping, merge_aug_bboxes, merge_aug_masks, multiclass_nms) from ..builder import HEADS, build_head, build_roi_extractor from .cascade_roi_head import CascadeRoIHead @HEADS.register_module() class...
24,292
40.668954
79
py
UniControl
UniControl-main/annotator/uniformer/mmdet_null/models/roi_heads/sparse_roi_head.py
import torch from mmdet.core import bbox2result, bbox2roi, bbox_xyxy_to_cxcywh from mmdet.core.bbox.samplers import PseudoSampler from ..builder import HEADS from .cascade_roi_head import CascadeRoIHead @HEADS.register_module() class SparseRoIHead(CascadeRoIHead): r"""The RoIHead for `Sparse R-CNN: End-to-End Ob...
14,207
44.538462
79
py
UniControl
UniControl-main/annotator/uniformer/mmdet_null/models/roi_heads/cascade_roi_head.py
import torch import torch.nn as nn from mmdet.core import (bbox2result, bbox2roi, bbox_mapping, build_assigner, build_sampler, merge_aug_bboxes, merge_aug_masks, multiclass_nms) from ..builder import HEADS, build_head, build_roi_extractor from .base_roi_head import BaseR...
22,053
42.413386
79
py
UniControl
UniControl-main/annotator/uniformer/mmdet_null/models/roi_heads/trident_roi_head.py
import torch from mmcv.ops import batched_nms from mmdet.core import (bbox2result, bbox2roi, bbox_mapping, merge_aug_bboxes, multiclass_nms) from mmdet.models.roi_heads.standard_roi_head import StandardRoIHead from ..builder import HEADS @HEADS.register_module() class TridentRoIHead(StandardR...
5,273
42.95
78
py
UniControl
UniControl-main/annotator/uniformer/mmdet_null/models/roi_heads/dynamic_roi_head.py
import numpy as np import torch from mmdet.core import bbox2roi from mmdet.models.losses import SmoothL1Loss from ..builder import HEADS from .standard_roi_head import StandardRoIHead EPS = 1e-15 @HEADS.register_module() class DynamicRoIHead(StandardRoIHead): """RoI head for `Dynamic R-CNN <https://arxiv.org/ab...
6,606
41.625806
79
py
UniControl
UniControl-main/annotator/uniformer/mmdet_null/models/roi_heads/point_rend_roi_head.py
# Modified from https://github.com/facebookresearch/detectron2/tree/master/projects/PointRend # noqa import torch import torch.nn.functional as F from mmcv.ops import point_sample, rel_roi_point_to_rel_img_point from mmdet.core import bbox2roi, bbox_mapping, merge_aug_masks from .. import builder from ..builder impo...
10,311
46.086758
101
py
UniControl
UniControl-main/annotator/uniformer/mmdet_null/models/roi_heads/base_roi_head.py
from abc import ABCMeta, abstractmethod import torch.nn as nn from ..builder import build_shared_head class BaseRoIHead(nn.Module, metaclass=ABCMeta): """Base class for RoIHeads.""" def __init__(self, bbox_roi_extractor=None, bbox_head=None, mask_roi_extra...
3,021
28.057692
78
py
UniControl
UniControl-main/annotator/uniformer/mmdet_null/models/roi_heads/mask_scoring_roi_head.py
import torch from mmdet.core import bbox2roi from ..builder import HEADS, build_head from .standard_roi_head import StandardRoIHead @HEADS.register_module() class MaskScoringRoIHead(StandardRoIHead): """Mask Scoring RoIHead for Mask Scoring RCNN. https://arxiv.org/abs/1903.00241 """ def __init__(se...
5,503
43.747967
79
py
UniControl
UniControl-main/annotator/uniformer/mmdet_null/models/roi_heads/htc_roi_head.py
import torch import torch.nn.functional as F from mmdet.core import (bbox2result, bbox2roi, bbox_mapping, merge_aug_bboxes, merge_aug_masks, multiclass_nms) from ..builder import HEADS, build_head, build_roi_extractor from .cascade_roi_head import CascadeRoIHead @HEADS.register_module() class...
25,900
42.9
79
py
UniControl
UniControl-main/annotator/uniformer/mmdet_null/models/roi_heads/test_mixins.py
import logging import sys import torch from mmdet.core import (bbox2roi, bbox_mapping, merge_aug_bboxes, merge_aug_masks, multiclass_nms) logger = logging.getLogger(__name__) if sys.version_info >= (3, 7): from mmdet.utils.contextmanagers import completed class BBoxTestMixin(object): ...
15,155
42.426934
79
py
UniControl
UniControl-main/annotator/uniformer/mmdet_null/models/roi_heads/roi_extractors/base_roi_extractor.py
from abc import ABCMeta, abstractmethod import torch import torch.nn as nn from mmcv import ops class BaseRoIExtractor(nn.Module, metaclass=ABCMeta): """Base class for RoI extractor. Args: roi_layer (dict): Specify RoI layer type and arguments. out_channels (int): Output channels of RoI laye...
2,772
32.011905
78
py
UniControl
UniControl-main/annotator/uniformer/mmdet_null/models/roi_heads/roi_extractors/single_level_roi_extractor.py
import torch from mmcv.runner import force_fp32 from mmdet.models.builder import ROI_EXTRACTORS from .base_roi_extractor import BaseRoIExtractor @ROI_EXTRACTORS.register_module() class SingleRoIExtractor(BaseRoIExtractor): """Extract RoI features from a single level feature map. If there are multiple input ...
4,465
39.972477
79
py
UniControl
UniControl-main/annotator/uniformer/mmdet_null/models/roi_heads/bbox_heads/bbox_head.py
import torch import torch.nn as nn import torch.nn.functional as F from mmcv.runner import auto_fp16, force_fp32 from torch.nn.modules.utils import _pair from mmdet.core import build_bbox_coder, multi_apply, multiclass_nms from mmdet.models.builder import HEADS, build_loss from mmdet.models.losses import accuracy @H...
21,344
43.10124
79
py
UniControl
UniControl-main/annotator/uniformer/mmdet_null/models/roi_heads/bbox_heads/sabl_head.py
import numpy as np import torch import torch.nn as nn import torch.nn.functional as F from mmcv.cnn import ConvModule, kaiming_init, normal_init, xavier_init from mmcv.runner import force_fp32 from mmdet.core import build_bbox_coder, multi_apply, multiclass_nms from mmdet.models.builder import HEADS, build_loss from m...
24,584
41.905759
79
py
UniControl
UniControl-main/annotator/uniformer/mmdet_null/models/roi_heads/bbox_heads/dii_head.py
import torch import torch.nn as nn from mmcv.cnn import (bias_init_with_prob, build_activation_layer, build_norm_layer) from mmcv.runner import auto_fp16, force_fp32 from mmdet.core import multi_apply from mmdet.models.builder import HEADS, build_loss from mmdet.models.dense_heads.atss_head impor...
18,681
43.908654
79
py
UniControl
UniControl-main/annotator/uniformer/mmdet_null/models/roi_heads/bbox_heads/convfc_bbox_head.py
import torch.nn as nn from mmcv.cnn import ConvModule from mmdet.models.builder import HEADS from .bbox_head import BBoxHead @HEADS.register_module() class ConvFCBBoxHead(BBoxHead): r"""More general bbox head, with shared conv and fc layers and two optional separated branches. .. code-block:: none ...
7,436
35.101942
79
py
UniControl
UniControl-main/annotator/uniformer/mmdet_null/models/roi_heads/bbox_heads/double_bbox_head.py
import torch.nn as nn from mmcv.cnn import ConvModule, normal_init, xavier_init from mmdet.models.backbones.resnet import Bottleneck from mmdet.models.builder import HEADS from .bbox_head import BBoxHead class BasicResBlock(nn.Module): """Basic residual block. This block is a little different from the block...
5,380
30.104046
78
py
UniControl
UniControl-main/annotator/uniformer/mmdet_null/models/roi_heads/shared_heads/res_layer.py
import torch.nn as nn from mmcv.cnn import constant_init, kaiming_init from mmcv.runner import auto_fp16, load_checkpoint from mmdet.models.backbones import ResNet from mmdet.models.builder import SHARED_HEADS from mmdet.models.utils import ResLayer as _ResLayer from mmdet.utils import get_root_logger @SHARED_HEADS....
2,454
30.474359
74
py
UniControl
UniControl-main/annotator/uniformer/mmdet_null/models/roi_heads/mask_heads/grid_head.py
import numpy as np import torch import torch.nn as nn import torch.nn.functional as F from mmcv.cnn import ConvModule, kaiming_init, normal_init from mmdet.models.builder import HEADS, build_loss @HEADS.register_module() class GridHead(nn.Module): def __init__(self, grid_points=9, ...
15,432
41.869444
79
py
UniControl
UniControl-main/annotator/uniformer/mmdet_null/models/roi_heads/mask_heads/coarse_mask_head.py
import torch.nn as nn from mmcv.cnn import ConvModule, Linear, constant_init, xavier_init from mmcv.runner import auto_fp16 from mmdet.models.builder import HEADS from .fcn_mask_head import FCNMaskHead @HEADS.register_module() class CoarseMaskHead(FCNMaskHead): """Coarse mask head used in PointRend. Compare...
3,233
34.152174
79
py
UniControl
UniControl-main/annotator/uniformer/mmdet_null/models/roi_heads/mask_heads/maskiou_head.py
import numpy as np import torch import torch.nn as nn from mmcv.cnn import Conv2d, Linear, MaxPool2d, kaiming_init, normal_init from mmcv.runner import force_fp32 from torch.nn.modules.utils import _pair from mmdet.models.builder import HEADS, build_loss @HEADS.register_module() class MaskIoUHead(nn.Module): """...
7,332
38.213904
79
py
UniControl
UniControl-main/annotator/uniformer/mmdet_null/models/roi_heads/mask_heads/feature_relay_head.py
import torch.nn as nn from mmcv.cnn import kaiming_init from mmcv.runner import auto_fp16 from mmdet.models.builder import HEADS @HEADS.register_module() class FeatureRelayHead(nn.Module): """Feature Relay Head used in `SCNet <https://arxiv.org/abs/2012.10150>`_. Args: in_channels (int, optional): n...
1,854
32.125
78
py
UniControl
UniControl-main/annotator/uniformer/mmdet_null/models/roi_heads/mask_heads/global_context_head.py
import torch.nn as nn from mmcv.cnn import ConvModule from mmcv.runner import auto_fp16, force_fp32 from mmdet.models.builder import HEADS from mmdet.models.utils import ResLayer, SimplifiedBasicBlock @HEADS.register_module() class GlobalContextHead(nn.Module): """Global context head used in `SCNet <https://arxi...
3,685
34.786408
79
py
UniControl
UniControl-main/annotator/uniformer/mmdet_null/models/roi_heads/mask_heads/fcn_mask_head.py
import numpy as np import torch import torch.nn as nn import torch.nn.functional as F from mmcv.cnn import Conv2d, ConvModule, build_upsample_layer from mmcv.ops.carafe import CARAFEPack from mmcv.runner import auto_fp16, force_fp32 from torch.nn.modules.utils import _pair from mmdet.core import mask_target from mmdet...
15,621
40.328042
85
py
UniControl
UniControl-main/annotator/uniformer/mmdet_null/models/roi_heads/mask_heads/fused_semantic_head.py
import torch.nn as nn import torch.nn.functional as F from mmcv.cnn import ConvModule, kaiming_init from mmcv.runner import auto_fp16, force_fp32 from mmdet.models.builder import HEADS @HEADS.register_module() class FusedSemanticHead(nn.Module): r"""Multi-level fused semantic segmentation head. .. code-bloc...
3,610
32.435185
79
py
UniControl
UniControl-main/annotator/uniformer/mmdet_null/models/roi_heads/mask_heads/mask_point_head.py
# Modified from https://github.com/facebookresearch/detectron2/tree/master/projects/PointRend/point_head/point_head.py # noqa import torch import torch.nn as nn from mmcv.cnn import ConvModule, normal_init from mmcv.ops import point_sample, rel_roi_point_to_rel_img_point from mmdet.models.builder import HEADS, build...
13,190
42.82392
126
py
UniControl
UniControl-main/annotator/uniformer/mmdet_null/models/losses/ghm_loss.py
import torch import torch.nn as nn import torch.nn.functional as F from ..builder import LOSSES def _expand_onehot_labels(labels, label_weights, label_channels): bin_labels = labels.new_full((labels.size(0), label_channels), 0) inds = torch.nonzero( (labels >= 0) & (labels < label_channels), as_tuple...
6,365
35.797688
79
py
UniControl
UniControl-main/annotator/uniformer/mmdet_null/models/losses/mse_loss.py
import torch.nn as nn import torch.nn.functional as F from ..builder import LOSSES from .utils import weighted_loss @weighted_loss def mse_loss(pred, target): """Warpper of mse loss.""" return F.mse_loss(pred, target, reduction='none') @LOSSES.register_module() class MSELoss(nn.Module): """MSELoss. ...
1,463
28.28
78
py
UniControl
UniControl-main/annotator/uniformer/mmdet_null/models/losses/pisa_loss.py
import mmcv import torch from mmdet.core import bbox_overlaps @mmcv.jit(derivate=True, coderize=True) def isr_p(cls_score, bbox_pred, bbox_targets, rois, sampling_results, loss_cls, bbox_coder, k=2, bias=0, num_class=80): "...
7,168
37.961957
79
py
UniControl
UniControl-main/annotator/uniformer/mmdet_null/models/losses/balanced_l1_loss.py
import mmcv import numpy as np import torch import torch.nn as nn from ..builder import LOSSES from .utils import weighted_loss @mmcv.jit(derivate=True, coderize=True) @weighted_loss def balanced_l1_loss(pred, target, beta=1.0, alpha=0.5, ...
4,168
33.454545
79
py
UniControl
UniControl-main/annotator/uniformer/mmdet_null/models/losses/iou_loss.py
import math import mmcv import torch import torch.nn as nn from mmdet.core import bbox_overlaps from ..builder import LOSSES from .utils import weighted_loss @mmcv.jit(derivate=True, coderize=True) @weighted_loss def iou_loss(pred, target, linear=False, eps=1e-6): """IoU loss. Computing the IoU loss betwee...
14,100
31.267735
79
py
UniControl
UniControl-main/annotator/uniformer/mmdet_null/models/losses/smooth_l1_loss.py
import mmcv import torch import torch.nn as nn from ..builder import LOSSES from .utils import weighted_loss @mmcv.jit(derivate=True, coderize=True) @weighted_loss def smooth_l1_loss(pred, target, beta=1.0): """Smooth L1 loss. Args: pred (torch.Tensor): The prediction. target (torch.Tensor):...
4,515
31.257143
78
py
UniControl
UniControl-main/annotator/uniformer/mmdet_null/models/losses/gfocal_loss.py
import mmcv import torch.nn as nn import torch.nn.functional as F from ..builder import LOSSES from .utils import weighted_loss @mmcv.jit(derivate=True, coderize=True) @weighted_loss def quality_focal_loss(pred, target, beta=2.0): r"""Quality Focal Loss (QFL) is from `Generalized Focal Loss: Learning Qualifi...
7,410
38.21164
79
py
UniControl
UniControl-main/annotator/uniformer/mmdet_null/models/losses/varifocal_loss.py
import mmcv import torch.nn as nn import torch.nn.functional as F from ..builder import LOSSES from .utils import weight_reduce_loss @mmcv.jit(derivate=True, coderize=True) def varifocal_loss(pred, target, weight=None, alpha=0.75, gamma=2.0,...
5,317
38.686567
79
py
UniControl
UniControl-main/annotator/uniformer/mmdet_null/models/losses/utils.py
import functools import mmcv import torch.nn.functional as F def reduce_loss(loss, reduction): """Reduce loss as specified. Args: loss (Tensor): Elementwise loss tensor. reduction (str): Options are "none", "mean" and "sum". Return: Tensor: Reduced loss tensor. """ reduc...
3,055
29.257426
79
py
UniControl
UniControl-main/annotator/uniformer/mmdet_null/models/losses/ae_loss.py
import mmcv import torch import torch.nn as nn import torch.nn.functional as F from ..builder import LOSSES @mmcv.jit(derivate=True, coderize=True) def ae_loss_per_image(tl_preds, br_preds, match): """Associative Embedding Loss in one image. Associative Embedding Loss including two parts: pull loss and push...
3,809
35.990291
143
py
UniControl
UniControl-main/annotator/uniformer/mmdet_null/models/losses/accuracy.py
import mmcv import torch.nn as nn @mmcv.jit(coderize=True) def accuracy(pred, target, topk=1, thresh=None): """Calculate accuracy according to the prediction and target. Args: pred (torch.Tensor): The model prediction, shape (N, num_class) target (torch.Tensor): The target of each prediction,...
2,942
36.253165
79
py
UniControl
UniControl-main/annotator/uniformer/mmdet_null/models/losses/focal_loss.py
import torch import torch.nn as nn import torch.nn.functional as F from mmcv.ops import sigmoid_focal_loss as _sigmoid_focal_loss from ..builder import LOSSES from .utils import weight_reduce_loss # This method is only for debugging def py_sigmoid_focal_loss(pred, target, ...
7,517
40.307692
79
py
UniControl
UniControl-main/annotator/uniformer/mmdet_null/models/losses/cross_entropy_loss.py
import torch import torch.nn as nn import torch.nn.functional as F from ..builder import LOSSES from .utils import weight_reduce_loss def cross_entropy(pred, label, weight=None, reduction='mean', avg_factor=None, class_weight=N...
7,910
35.795349
79
py
UniControl
UniControl-main/annotator/uniformer/mmdet_null/models/losses/gaussian_focal_loss.py
import mmcv import torch.nn as nn from ..builder import LOSSES from .utils import weighted_loss @mmcv.jit(derivate=True, coderize=True) @weighted_loss def gaussian_focal_loss(pred, gaussian_target, alpha=2.0, gamma=4.0): """`Focal Loss <https://arxiv.org/abs/1708.02002>`_ for targets in gaussian distribution...
3,264
34.48913
108
py
UniControl
UniControl-main/annotator/uniformer/mmdet_null/models/losses/kd_loss.py
import mmcv import torch.nn as nn import torch.nn.functional as F from ..builder import LOSSES from .utils import weighted_loss @mmcv.jit(derivate=True, coderize=True) @weighted_loss def knowledge_distillation_kl_div_loss(pred, soft_label, ...
2,864
31.556818
78
py
UniControl
UniControl-main/annotator/uniformer/mmdet_null/models/backbones/hrnet.py
import torch.nn as nn from mmcv.cnn import (build_conv_layer, build_norm_layer, constant_init, kaiming_init) from mmcv.runner import load_checkpoint from torch.nn.modules.batchnorm import _BatchNorm from mmdet.utils import get_root_logger from ..builder import BACKBONES from .resnet import BasicB...
20,358
36.842007
79
py
UniControl
UniControl-main/annotator/uniformer/mmdet_null/models/backbones/regnet.py
import numpy as np import torch.nn as nn from mmcv.cnn import build_conv_layer, build_norm_layer from ..builder import BACKBONES from .resnet import ResNet from .resnext import Bottleneck @BACKBONES.register_module() class RegNet(ResNet): """RegNet backbone. More details can be found in `paper <https://arxi...
12,271
36.644172
79
py
UniControl
UniControl-main/annotator/uniformer/mmdet_null/models/backbones/trident_resnet.py
import torch import torch.nn as nn import torch.nn.functional as F import torch.utils.checkpoint as cp from mmcv.cnn import build_conv_layer, build_norm_layer, kaiming_init from torch.nn.modules.utils import _pair from mmdet.models.backbones.resnet import Bottleneck, ResNet from mmdet.models.builder import BACKBONES ...
10,863
36.078498
79
py
UniControl
UniControl-main/annotator/uniformer/mmdet_null/models/backbones/detectors_resnext.py
import math from mmcv.cnn import build_conv_layer, build_norm_layer from ..builder import BACKBONES from .detectors_resnet import Bottleneck as _Bottleneck from .detectors_resnet import DetectoRS_ResNet class Bottleneck(_Bottleneck): expansion = 4 def __init__(self, inplanes, ...
3,872
30.487805
77
py
UniControl
UniControl-main/annotator/uniformer/mmdet_null/models/backbones/swin_transformer.py
# -------------------------------------------------------- # Swin Transformer # Copyright (c) 2021 Microsoft # Licensed under The MIT License [see LICENSE for details] # Written by Ze Liu, Yutong Lin, Yixuan Wei # -------------------------------------------------------- import torch import torch.nn as nn import torch....
24,552
37.911252
123
py
UniControl
UniControl-main/annotator/uniformer/mmdet_null/models/backbones/resnet.py
import torch.nn as nn import torch.utils.checkpoint as cp from mmcv.cnn import (build_conv_layer, build_norm_layer, build_plugin_layer, constant_init, kaiming_init) from mmcv.runner import load_checkpoint from torch.nn.modules.batchnorm import _BatchNorm from mmdet.utils import get_root_logger fr...
23,377
34.207831
79
py
UniControl
UniControl-main/annotator/uniformer/mmdet_null/models/backbones/detectors_resnet.py
import torch.nn as nn import torch.utils.checkpoint as cp from mmcv.cnn import build_conv_layer, build_norm_layer, constant_init from ..builder import BACKBONES from .resnet import Bottleneck as _Bottleneck from .resnet import ResNet class Bottleneck(_Bottleneck): r"""Bottleneck for the ResNet backbone in `Detec...
10,517
33.372549
78
py
UniControl
UniControl-main/annotator/uniformer/mmdet_null/models/backbones/ssd_vgg.py
import torch import torch.nn as nn import torch.nn.functional as F from mmcv.cnn import VGG, constant_init, kaiming_init, normal_init, xavier_init from mmcv.runner import load_checkpoint from mmdet.utils import get_root_logger from ..builder import BACKBONES @BACKBONES.register_module() class SSDVGG(VGG): """VGG...
5,882
33.605882
79
py
UniControl
UniControl-main/annotator/uniformer/mmdet_null/models/backbones/resnext.py
import math from mmcv.cnn import build_conv_layer, build_norm_layer from ..builder import BACKBONES from ..utils import ResLayer from .resnet import Bottleneck as _Bottleneck from .resnet import ResNet class Bottleneck(_Bottleneck): expansion = 4 def __init__(self, inplanes, ...
5,664
35.785714
79
py
UniControl
UniControl-main/annotator/uniformer/mmdet_null/models/backbones/resnest.py
import math import torch import torch.nn as nn import torch.nn.functional as F import torch.utils.checkpoint as cp from mmcv.cnn import build_conv_layer, build_norm_layer from ..builder import BACKBONES from ..utils import ResLayer from .resnet import Bottleneck as _Bottleneck from .resnet import ResNetV1d class RS...
10,352
31.556604
79
py
UniControl
UniControl-main/annotator/uniformer/mmdet_null/models/backbones/hourglass.py
import torch.nn as nn from mmcv.cnn import ConvModule from ..builder import BACKBONES from ..utils import ResLayer from .resnet import BasicBlock class HourglassModule(nn.Module): """Hourglass Module for HourglassNet backbone. Generate module recursively and use BasicBlock as the base unit. Args: ...
6,452
31.427136
79
py
UniControl
UniControl-main/annotator/uniformer/mmdet_null/models/backbones/res2net.py
import math import torch import torch.nn as nn import torch.utils.checkpoint as cp from mmcv.cnn import (build_conv_layer, build_norm_layer, constant_init, kaiming_init) from mmcv.runner import load_checkpoint from torch.nn.modules.batchnorm import _BatchNorm from mmdet.utils import get_root_log...
12,675
35.011364
79
py
UniControl
UniControl-main/annotator/uniformer/mmdet_null/models/backbones/darknet.py
# Copyright (c) 2019 Western Digital Corporation or its affiliates. import logging import torch.nn as nn from mmcv.cnn import ConvModule, constant_init, kaiming_init from mmcv.runner import load_checkpoint from torch.nn.modules.batchnorm import _BatchNorm from ..builder import BACKBONES class ResBlock(nn.Module): ...
7,574
36.875
79
py
UniControl
UniControl-main/annotator/uniformer/mmdet_null/models/backbones/uniformer.py
# -------------------------------------------------------- # UniFormer # Copyright (c) 2022 SenseTime X-Lab # Licensed under The MIT License [see LICENSE for details] # Written by Kunchang Li # -------------------------------------------------------- from collections import OrderedDict import math from functools impo...
18,436
42.586288
145
py
UniControl
UniControl-main/annotator/uniformer/mmdet_null/datasets/custom.py
import os.path as osp import warnings from collections import OrderedDict import mmcv import numpy as np from mmcv.utils import print_log from torch.utils.data import Dataset from mmdet.core import eval_map, eval_recalls from .builder import DATASETS from .pipelines import Compose @DATASETS.register_module() class ...
11,581
34.746914
79
py
UniControl
UniControl-main/annotator/uniformer/mmdet_null/datasets/dataset_wrappers.py
import bisect import math from collections import defaultdict import numpy as np from mmcv.utils import print_log from torch.utils.data.dataset import ConcatDataset as _ConcatDataset from .builder import DATASETS from .coco import CocoDataset @DATASETS.register_module() class ConcatDataset(_ConcatDataset): """A...
11,088
38.183746
167
py
UniControl
UniControl-main/annotator/uniformer/mmdet_null/datasets/builder.py
import copy import platform import random from functools import partial import numpy as np from annotator.uniformer.mmcv.parallel import collate from annotator.uniformer.mmcv.runner import get_dist_info from annotator.uniformer.mmcv.utils import Registry, build_from_cfg from torch.utils.data import DataLoader from .s...
5,344
36.118056
79
py
UniControl
UniControl-main/annotator/uniformer/mmdet_null/datasets/samplers/group_sampler.py
from __future__ import division import math import numpy as np import torch from mmcv.runner import get_dist_info from torch.utils.data import Sampler class GroupSampler(Sampler): def __init__(self, dataset, samples_per_gpu=1): assert hasattr(dataset, 'flag') self.dataset = dataset self....
5,368
35.033557
78
py
UniControl
UniControl-main/annotator/uniformer/mmdet_null/datasets/samplers/distributed_sampler.py
import math import torch from torch.utils.data import DistributedSampler as _DistributedSampler class DistributedSampler(_DistributedSampler): def __init__(self, dataset, num_replicas=None, rank=None, shuffle=True, seed=0): ...
1,310
31.775
79
py
UniControl
UniControl-main/annotator/uniformer/mmdet_null/datasets/pipelines/formating.py
from collections.abc import Sequence import mmcv import numpy as np import torch from mmcv.parallel import DataContainer as DC from ..builder import PIPELINES def to_tensor(data): """Convert objects of various python types to :obj:`torch.Tensor`. Supported types are: :class:`numpy.ndarray`, :class:`torch.T...
12,037
31.980822
79
py
UniControl
UniControl-main/annotator/uniformer/mmdet_null/utils/contextmanagers.py
import asyncio import contextlib import logging import os import time from typing import List import torch logger = logging.getLogger(__name__) DEBUG_COMPLETED_TIME = bool(os.environ.get('DEBUG_COMPLETED_TIME', False)) @contextlib.asynccontextmanager async def completed(trace_name='', name='', ...
4,077
32.42623
79
py
UniControl
UniControl-main/annotator/uniformer/mmdet_null/utils/profiling.py
import contextlib import sys import time import torch if sys.version_info >= (3, 7): @contextlib.contextmanager def profile_time(trace_name, name, enabled=True, stream=None, end_stream=None): """Print time spent by CP...
1,288
31.225
73
py
UniControl
UniControl-main/annotator/uniformer/configs/_base_/models/ccnet_r50-d8.py
# model settings norm_cfg = dict(type='SyncBN', requires_grad=True) model = dict( type='EncoderDecoder', pretrained='open-mmlab://resnet50_v1c', backbone=dict( type='ResNetV1c', depth=50, num_stages=4, out_indices=(0, 1, 2, 3), dilations=(1, 1, 2, 4), strides=...
1,258
26.977778
74
py
UniControl
UniControl-main/annotator/uniformer/configs/_base_/models/ann_r50-d8.py
# model settings norm_cfg = dict(type='SyncBN', requires_grad=True) model = dict( type='EncoderDecoder', pretrained='open-mmlab://resnet50_v1c', backbone=dict( type='ResNetV1c', depth=50, num_stages=4, out_indices=(0, 1, 2, 3), dilations=(1, 1, 2, 4), strides=...
1,346
27.659574
74
py