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 |
|---|---|---|---|---|---|---|
DSLA-DSLA | DSLA-DSLA/mmdet/models/detectors/single_stage_instance_seg.py | # Copyright (c) OpenMMLab. All rights reserved.
import copy
import warnings
import mmcv
import numpy as np
import torch
from mmdet.core.visualization.image import imshow_det_bboxes
from ..builder import DETECTORS, build_backbone, build_head, build_neck
from .base import BaseDetector
INF = 1e8
@DETECTORS.register_m... | 13,785 | 36.873626 | 79 | py |
DSLA-DSLA | DSLA-DSLA/mmdet/models/detectors/cornernet.py | # Copyright (c) OpenMMLab. All rights reserved.
import torch
from mmdet.core import bbox2result, bbox_mapping_back
from ..builder import DETECTORS
from .single_stage import SingleStageDetector
@DETECTORS.register_module()
class CornerNet(SingleStageDetector):
"""CornerNet.
This detector is the implementatio... | 3,668 | 36.438776 | 79 | py |
DSLA-DSLA | DSLA-DSLA/mmdet/models/detectors/lad.py | # Copyright (c) OpenMMLab. All rights reserved.
import torch
import torch.nn as nn
from mmcv.runner import load_checkpoint
from ..builder import DETECTORS, build_backbone, build_head, build_neck
from .kd_one_stage import KnowledgeDistillationSingleStageDetector
@DETECTORS.register_module()
class LAD(KnowledgeDistill... | 3,916 | 41.11828 | 78 | py |
DSLA-DSLA | DSLA-DSLA/mmdet/models/detectors/sparse_rcnn.py | # Copyright (c) OpenMMLab. All rights reserved.
from ..builder import DETECTORS
from .two_stage import TwoStageDetector
@DETECTORS.register_module()
class SparseRCNN(TwoStageDetector):
r"""Implementation of `Sparse R-CNN: End-to-End Object Detection with
Learnable Proposals <https://arxiv.org/abs/2011.12450>`... | 4,406 | 38.348214 | 78 | py |
DSLA-DSLA | DSLA-DSLA/mmdet/models/seg_heads/base_semantic_head.py | # Copyright (c) OpenMMLab. All rights reserved.
from abc import ABCMeta, abstractmethod
import torch.nn.functional as F
from mmcv.runner import BaseModule, force_fp32
from ..builder import build_loss
from ..utils import interpolate_as
class BaseSemanticHead(BaseModule, metaclass=ABCMeta):
"""Base module of Sema... | 2,849 | 31.758621 | 77 | py |
DSLA-DSLA | DSLA-DSLA/mmdet/models/seg_heads/panoptic_fpn_head.py | # Copyright (c) OpenMMLab. All rights reserved.
import warnings
import torch
import torch.nn as nn
from mmcv.runner import ModuleList
from ..builder import HEADS
from ..utils import ConvUpsample
from .base_semantic_head import BaseSemanticHead
@HEADS.register_module()
class PanopticFPNHead(BaseSemanticHead):
""... | 6,675 | 41.794872 | 79 | py |
DSLA-DSLA | DSLA-DSLA/mmdet/models/seg_heads/panoptic_fusion_heads/heuristic_fusion_head.py | # Copyright (c) OpenMMLab. All rights reserved.
import torch
from mmdet.datasets.coco_panoptic import INSTANCE_OFFSET
from mmdet.models.builder import HEADS
from .base_panoptic_fusion_head import BasePanopticFusionHead
@HEADS.register_module()
class HeuristicFusionHead(BasePanopticFusionHead):
"""Fusion Head wit... | 4,474 | 34.23622 | 77 | py |
DSLA-DSLA | DSLA-DSLA/mmdet/models/plugins/dropblock.py | # Copyright (c) OpenMMLab. All rights reserved.
import torch
import torch.nn as nn
import torch.nn.functional as F
from mmcv.cnn import PLUGIN_LAYERS
eps = 1e-6
@PLUGIN_LAYERS.register_module()
class DropBlock(nn.Module):
"""Randomly drop some regions of feature maps.
Please refer to the method proposed in... | 2,925 | 33.023256 | 79 | py |
DSLA-DSLA | DSLA-DSLA/mmdet/models/necks/yolox_pafpn.py | # Copyright (c) OpenMMLab. All rights reserved.
import math
import torch
import torch.nn as nn
from mmcv.cnn import ConvModule, DepthwiseSeparableConvModule
from mmcv.runner import BaseModule
from ..builder import NECKS
from ..utils import CSPLayer
@NECKS.register_module()
class YOLOXPAFPN(BaseModule):
"""Path ... | 5,647 | 34.974522 | 78 | py |
DSLA-DSLA | DSLA-DSLA/mmdet/models/necks/ssd_neck.py | # Copyright (c) OpenMMLab. All rights reserved.
import torch
import torch.nn as nn
from mmcv.cnn import ConvModule, DepthwiseSeparableConvModule
from mmcv.runner import BaseModule
from ..builder import NECKS
@NECKS.register_module()
class SSDNeck(BaseModule):
"""Extra layers of SSD backbone to generate multi-sca... | 4,891 | 36.630769 | 77 | py |
DSLA-DSLA | DSLA-DSLA/mmdet/models/necks/rfp.py | # Copyright (c) OpenMMLab. All rights reserved.
import torch
import torch.nn as nn
import torch.nn.functional as F
from mmcv.cnn import constant_init, xavier_init
from mmcv.runner import BaseModule, ModuleList
from ..builder import NECKS, build_backbone
from .fpn import FPN
class ASPP(BaseModule):
"""ASPP (Atrou... | 5,052 | 36.154412 | 78 | py |
DSLA-DSLA | DSLA-DSLA/mmdet/models/necks/dilated_encoder.py | # Copyright (c) OpenMMLab. All rights reserved.
import torch.nn as nn
from mmcv.cnn import (ConvModule, caffe2_xavier_init, constant_init, is_norm,
normal_init)
from torch.nn import BatchNorm2d
from ..builder import NECKS
class Bottleneck(nn.Module):
"""Bottleneck block for DilatedEncoder u... | 3,868 | 34.495413 | 79 | py |
DSLA-DSLA | DSLA-DSLA/mmdet/models/necks/fpg.py | # Copyright (c) OpenMMLab. All rights reserved.
import torch.nn as nn
import torch.nn.functional as F
from mmcv.cnn import ConvModule
from mmcv.runner import BaseModule
from ..builder import NECKS
class Transition(BaseModule):
"""Base class for transition.
Args:
in_channels (int): Number of input ch... | 16,338 | 39.144963 | 79 | py |
DSLA-DSLA | DSLA-DSLA/mmdet/models/necks/pafpn.py | # Copyright (c) OpenMMLab. All rights reserved.
import torch.nn as nn
import torch.nn.functional as F
from mmcv.cnn import ConvModule
from mmcv.runner import auto_fp16
from ..builder import NECKS
from .fpn import FPN
@NECKS.register_module()
class PAFPN(FPN):
"""Path Aggregation Network for Instance Segmentation... | 6,251 | 38.320755 | 79 | py |
DSLA-DSLA | DSLA-DSLA/mmdet/models/necks/nasfcos_fpn.py | # Copyright (c) OpenMMLab. All rights reserved.
import torch.nn as nn
import torch.nn.functional as F
from mmcv.cnn import ConvModule, caffe2_xavier_init
from mmcv.ops.merge_cells import ConcatCell
from mmcv.runner import BaseModule
from ..builder import NECKS
@NECKS.register_module()
class NASFCOS_FPN(BaseModule):
... | 6,591 | 37.776471 | 79 | py |
DSLA-DSLA | DSLA-DSLA/mmdet/models/necks/fpn_carafe.py | # Copyright (c) OpenMMLab. All rights reserved.
import torch.nn as nn
from mmcv.cnn import ConvModule, build_upsample_layer, xavier_init
from mmcv.ops.carafe import CARAFEPack
from mmcv.runner import BaseModule, ModuleList
from ..builder import NECKS
@NECKS.register_module()
class FPN_CARAFE(BaseModule):
"""FPN_... | 11,100 | 39.221014 | 79 | py |
DSLA-DSLA | DSLA-DSLA/mmdet/models/necks/ct_resnet_neck.py | # Copyright (c) OpenMMLab. All rights reserved.
import math
import torch.nn as nn
from mmcv.cnn import ConvModule
from mmcv.runner import BaseModule, auto_fp16
from mmdet.models.builder import NECKS
@NECKS.register_module()
class CTResNetNeck(BaseModule):
"""The neck used in `CenterNet <https://arxiv.org/abs/19... | 3,642 | 37.347368 | 77 | py |
DSLA-DSLA | DSLA-DSLA/mmdet/models/necks/fpn.py | # Copyright (c) OpenMMLab. All rights reserved.
import torch.nn as nn
import torch.nn.functional as F
from mmcv.cnn import ConvModule
from mmcv.runner import BaseModule, auto_fp16
from ..builder import NECKS
@NECKS.register_module()
class FPN(BaseModule):
r"""Feature Pyramid Network.
This is an implementati... | 8,671 | 41.509804 | 79 | py |
DSLA-DSLA | DSLA-DSLA/mmdet/models/necks/nas_fpn.py | # Copyright (c) OpenMMLab. All rights reserved.
import torch.nn as nn
from mmcv.cnn import ConvModule
from mmcv.ops.merge_cells import GlobalPoolingCell, SumCell
from mmcv.runner import BaseModule, ModuleList
from ..builder import NECKS
@NECKS.register_module()
class NASFPN(BaseModule):
"""NAS-FPN.
Implemen... | 6,577 | 40.371069 | 79 | py |
DSLA-DSLA | DSLA-DSLA/mmdet/models/necks/bfp.py | # Copyright (c) OpenMMLab. All rights reserved.
import torch.nn.functional as F
from mmcv.cnn import ConvModule
from mmcv.cnn.bricks import NonLocal2d
from mmcv.runner import BaseModule
from ..builder import NECKS
@NECKS.register_module()
class BFP(BaseModule):
"""BFP (Balanced Feature Pyramids)
BFP takes m... | 3,777 | 35.679612 | 79 | py |
DSLA-DSLA | DSLA-DSLA/mmdet/models/necks/yolo_neck.py | # Copyright (c) OpenMMLab. All rights reserved.
# Copyright (c) 2019 Western Digital Corporation or its affiliates.
import torch
import torch.nn.functional as F
from mmcv.cnn import ConvModule
from mmcv.runner import BaseModule
from ..builder import NECKS
class DetectionBlock(BaseModule):
"""Detection block in ... | 5,431 | 37.524823 | 77 | py |
DSLA-DSLA | DSLA-DSLA/mmdet/models/necks/channel_mapper.py | # Copyright (c) OpenMMLab. All rights reserved.
import torch.nn as nn
from mmcv.cnn import ConvModule
from mmcv.runner import BaseModule
from ..builder import NECKS
@NECKS.register_module()
class ChannelMapper(BaseModule):
r"""Channel Mapper to reduce/increase channels of backbone features.
This is used to ... | 3,975 | 38.366337 | 77 | py |
DSLA-DSLA | DSLA-DSLA/mmdet/models/necks/hrfpn.py | # Copyright (c) OpenMMLab. All rights reserved.
import torch
import torch.nn as nn
import torch.nn.functional as F
from mmcv.cnn import ConvModule
from mmcv.runner import BaseModule
from torch.utils.checkpoint import checkpoint
from ..builder import NECKS
@NECKS.register_module()
class HRFPN(BaseModule):
"""HRFP... | 3,509 | 33.752475 | 79 | py |
DSLA-DSLA | DSLA-DSLA/mmdet/models/dense_heads/nasfcos_head.py | # Copyright (c) OpenMMLab. All rights reserved.
import copy
import torch.nn as nn
from mmcv.cnn import ConvModule, Scale
from mmdet.models.dense_heads.fcos_head import FCOSHead
from ..builder import HEADS
@HEADS.register_module()
class NASFCOSHead(FCOSHead):
"""Anchor-free head used in `NASFCOS <https://arxiv.o... | 2,908 | 34.91358 | 78 | py |
DSLA-DSLA | DSLA-DSLA/mmdet/models/dense_heads/reppoints_head.py | # Copyright (c) OpenMMLab. All rights reserved.
import numpy as np
import torch
import torch.nn as nn
from mmcv.cnn import ConvModule
from mmcv.ops import DeformConv2d
from mmdet.core import (build_assigner, build_sampler, images_to_levels,
multi_apply, unmap)
from mmdet.core.anchor.point_gener... | 34,936 | 44.669281 | 101 | py |
DSLA-DSLA | DSLA-DSLA/mmdet/models/dense_heads/dsla_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
import numpy
from mmdet.core import distance2bbox, multi_apply, multiclass_nms, reduce_mean, bbox_overlaps
from ..builder import HEADS, build_loss
from .anchor_free_head import ... | 27,448 | 46.001712 | 186 | py |
DSLA-DSLA | DSLA-DSLA/mmdet/models/dense_heads/cascade_rpn_head.py | # Copyright (c) OpenMMLab. All rights reserved.
from __future__ import division
import copy
import warnings
import torch
import torch.nn as nn
from mmcv import ConfigDict
from mmcv.ops import DeformConv2d, batched_nms
from mmcv.runner import BaseModule, ModuleList
from mmdet.core import (RegionAssigner, build_assigne... | 33,996 | 41.390274 | 79 | py |
DSLA-DSLA | DSLA-DSLA/mmdet/models/dense_heads/vfnet_head.py | # Copyright (c) OpenMMLab. All rights reserved.
import warnings
import numpy as np
import torch
import torch.nn as nn
from mmcv.cnn import ConvModule, Scale
from mmcv.ops import DeformConv2d
from mmcv.runner import force_fp32
from mmdet.core import (MlvlPointGenerator, bbox_overlaps, build_assigner,
... | 31,290 | 41.22807 | 79 | py |
DSLA-DSLA | DSLA-DSLA/mmdet/models/dense_heads/centernet_head.py | # Copyright (c) OpenMMLab. All rights reserved.
import torch
import torch.nn as nn
from mmcv.cnn import bias_init_with_prob, normal_init
from mmcv.ops import batched_nms
from mmcv.runner import force_fp32
from mmdet.core import multi_apply
from mmdet.models import HEADS, build_loss
from mmdet.models.utils import gauss... | 18,025 | 42.646489 | 79 | py |
DSLA-DSLA | DSLA-DSLA/mmdet/models/dense_heads/fsaf_head.py | # Copyright (c) OpenMMLab. All rights reserved.
import numpy as np
import torch
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 wei... | 19,337 | 43.557604 | 79 | py |
DSLA-DSLA | DSLA-DSLA/mmdet/models/dense_heads/atss_head.py | # Copyright (c) OpenMMLab. All rights reserved.
import torch
import torch.nn as nn
from mmcv.cnn import ConvModule, Scale
from mmcv.runner import force_fp32
from mmdet.core import (anchor_inside_flags, build_assigner, build_sampler,
images_to_levels, multi_apply, reduce_mean, unmap)
from ..buil... | 20,844 | 41.281947 | 79 | py |
DSLA-DSLA | DSLA-DSLA/mmdet/models/dense_heads/detr_head.py | # Copyright (c) OpenMMLab. All rights reserved.
import torch
import torch.nn as nn
import torch.nn.functional as F
from mmcv.cnn import Conv2d, Linear, build_activation_layer
from mmcv.cnn.bricks.transformer import FFN, build_positional_encoding
from mmcv.runner import force_fp32
from mmdet.core import (bbox_cxcywh_to... | 39,707 | 45.991716 | 79 | py |
DSLA-DSLA | DSLA-DSLA/mmdet/models/dense_heads/rpn_head.py | # Copyright (c) OpenMMLab. All rights reserved.
import copy
import torch
import torch.nn as nn
import torch.nn.functional as F
from mmcv.cnn import ConvModule
from mmcv.ops import batched_nms
from ..builder import HEADS
from .anchor_head import AnchorHead
@HEADS.register_module()
class RPNHead(AnchorHead):
"""R... | 11,201 | 41.112782 | 79 | py |
DSLA-DSLA | DSLA-DSLA/mmdet/models/dense_heads/anchor_head.py | # Copyright (c) OpenMMLab. All rights reserved.
import warnings
import torch
import torch.nn as nn
from mmcv.runner import force_fp32
from mmdet.core import (anchor_inside_flags, build_assigner, build_bbox_coder,
build_prior_generator, build_sampler, images_to_levels,
m... | 24,605 | 44.314917 | 79 | py |
DSLA-DSLA | DSLA-DSLA/mmdet/models/dense_heads/yolox_head.py | # Copyright (c) OpenMMLab. All rights reserved.
import math
import torch
import torch.nn as nn
import torch.nn.functional as F
from mmcv.cnn import (ConvModule, DepthwiseSeparableConvModule,
bias_init_with_prob)
from mmcv.ops.nms import batched_nms
from mmcv.runner import force_fp32
from mmdet.c... | 20,874 | 41.515275 | 79 | py |
DSLA-DSLA | DSLA-DSLA/mmdet/models/dense_heads/retina_head.py | # Copyright (c) OpenMMLab. All rights reserved.
import torch.nn as nn
from mmcv.cnn import ConvModule
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>`_.
... | 4,059 | 34 | 76 | py |
DSLA-DSLA | DSLA-DSLA/mmdet/models/dense_heads/ga_rpn_head.py | # Copyright (c) OpenMMLab. All rights reserved.
import copy
import warnings
import torch
import torch.nn as nn
import torch.nn.functional as F
from mmcv import ConfigDict
from mmcv.ops import nms
from ..builder import HEADS
from .guided_anchor_head import GuidedAnchorHead
@HEADS.register_module()
class GARPNHead(Gu... | 7,052 | 38.623596 | 79 | py |
DSLA-DSLA | DSLA-DSLA/mmdet/models/dense_heads/tood_head.py | # Copyright (c) OpenMMLab. All rights reserved.
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.ops import deform_conv2d
from mmcv.runner import force_fp32
from mmdet.core import (anchor_inside_flags, build_assigner, ... | 33,854 | 43.024707 | 79 | py |
DSLA-DSLA | DSLA-DSLA/mmdet/models/dense_heads/deformable_detr_head.py | # Copyright (c) OpenMMLab. All rights reserved.
import copy
import torch
import torch.nn as nn
import torch.nn.functional as F
from mmcv.cnn import Linear, bias_init_with_prob, constant_init
from mmcv.runner import force_fp32
from mmdet.core import multi_apply
from mmdet.models.utils.transformer import inverse_sigmoi... | 13,728 | 42.037618 | 98 | py |
DSLA-DSLA | DSLA-DSLA/mmdet/models/dense_heads/ga_retina_head.py | # Copyright (c) OpenMMLab. All rights reserved.
import torch.nn as nn
from mmcv.cnn import ConvModule
from mmcv.ops import MaskedConv2d
from ..builder import HEADS
from .guided_anchor_head import FeatureAdaption, GuidedAnchorHead
@HEADS.register_module()
class GARetinaHead(GuidedAnchorHead):
"""Guided-Anchor-bas... | 3,931 | 33.491228 | 77 | py |
DSLA-DSLA | DSLA-DSLA/mmdet/models/dense_heads/ld_head.py | # Copyright (c) OpenMMLab. All rights reserved.
import torch
from mmcv.runner import force_fp32
from mmdet.core import bbox_overlaps, multi_apply, reduce_mean
from ..builder import HEADS, build_loss
from .gfl_head import GFLHead
@HEADS.register_module()
class LDHead(GFLHead):
"""Localization distillation Head. (... | 10,636 | 39.599237 | 79 | py |
DSLA-DSLA | DSLA-DSLA/mmdet/models/dense_heads/ssd_head.py | # Copyright (c) OpenMMLab. All rights reserved.
import warnings
import torch
import torch.nn as nn
import torch.nn.functional as F
from mmcv.cnn import ConvModule, DepthwiseSeparableConvModule
from mmcv.runner import force_fp32
from mmdet.core import (build_assigner, build_bbox_coder,
build_pr... | 14,791 | 40.318436 | 79 | py |
DSLA-DSLA | DSLA-DSLA/mmdet/models/dense_heads/fcos_head.py | # Copyright (c) OpenMMLab. All rights reserved.
import warnings
import torch
import torch.nn as nn
import torch.nn.functional as F
from mmcv.cnn import Scale
from mmcv.runner import force_fp32
from mmdet.core import multi_apply, reduce_mean
from ..builder import HEADS, build_loss
from .anchor_free_head import AnchorF... | 19,528 | 42.015419 | 113 | py |
DSLA-DSLA | DSLA-DSLA/mmdet/models/dense_heads/lad_head.py | # Copyright (c) OpenMMLab. All rights reserved.
import torch
from mmcv.runner import force_fp32
from mmdet.core import bbox_overlaps, multi_apply
from ..builder import HEADS
from .paa_head import PAAHead, levels_to_images
@HEADS.register_module()
class LADHead(PAAHead):
"""Label Assignment Head from the paper: `... | 10,058 | 42.171674 | 79 | py |
DSLA-DSLA | DSLA-DSLA/mmdet/models/dense_heads/yolo_head.py | # Copyright (c) OpenMMLab. All rights reserved.
# 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, bias_init_with_prob, constant_init, is_norm,
normal_init)
from ... | 26,329 | 41.467742 | 106 | py |
DSLA-DSLA | DSLA-DSLA/mmdet/models/dense_heads/centripetal_head.py | # Copyright (c) OpenMMLab. All rights reserved.
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... | 19,811 | 45.28972 | 79 | py |
DSLA-DSLA | DSLA-DSLA/mmdet/models/dense_heads/paa_head.py | # Copyright (c) OpenMMLab. All rights reserved.
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:
... | 34,046 | 43.976222 | 79 | py |
DSLA-DSLA | DSLA-DSLA/mmdet/models/dense_heads/retina_sepbn_head.py | # Copyright (c) OpenMMLab. All rights reserved.
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, ... | 4,566 | 37.378151 | 79 | py |
DSLA-DSLA | DSLA-DSLA/mmdet/models/dense_heads/anchor_free_head.py | # Copyright (c) OpenMMLab. All rights reserved.
import warnings
from abc import abstractmethod
import torch
import torch.nn as nn
from mmcv.cnn import ConvModule
from mmcv.runner import force_fp32
from mmdet.core import build_bbox_coder, multi_apply
from mmdet.core.anchor.point_generator import MlvlPointGenerator
fro... | 13,958 | 38.769231 | 79 | py |
DSLA-DSLA | DSLA-DSLA/mmdet/models/dense_heads/pisa_ssd_head.py | # Copyright (c) OpenMMLab. All rights reserved.
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):
... | 5,598 | 38.70922 | 79 | py |
DSLA-DSLA | DSLA-DSLA/mmdet/models/dense_heads/base_mask_head.py | # Copyright (c) OpenMMLab. All rights reserved.
from abc import ABCMeta, abstractmethod
from mmcv.runner import BaseModule
class BaseMaskHead(BaseModule, metaclass=ABCMeta):
"""Base class for mask heads used in One-Stage Instance Segmentation."""
def __init__(self, init_cfg):
super(BaseMaskHead, sel... | 4,539 | 37.803419 | 79 | py |
DSLA-DSLA | DSLA-DSLA/mmdet/models/dense_heads/solo_head.py | # Copyright (c) OpenMMLab. All rights reserved.
import mmcv
import numpy as np
import torch
import torch.nn as nn
import torch.nn.functional as F
from mmcv.cnn import ConvModule
from mmdet.core import InstanceData, mask_matrix_nms, multi_apply
from mmdet.core.utils import center_of_mass, generate_coordinate
from mmdet... | 47,265 | 39.123939 | 79 | py |
DSLA-DSLA | DSLA-DSLA/mmdet/models/dense_heads/embedding_rpn_head.py | # Copyright (c) OpenMMLab. All rights reserved.
import torch
import torch.nn as nn
from mmcv.runner import BaseModule
from mmdet.models.builder import HEADS
from ...core import bbox_cxcywh_to_xyxy
@HEADS.register_module()
class EmbeddingRPNHead(BaseModule):
"""RPNHead in the `Sparse R-CNN <https://arxiv.org/abs/... | 4,629 | 38.57265 | 78 | py |
DSLA-DSLA | DSLA-DSLA/mmdet/models/dense_heads/autoassign_head.py | # Copyright (c) OpenMMLab. All rights reserved.
import warnings
import torch
import torch.nn as nn
import torch.nn.functional as F
from mmcv.cnn import bias_init_with_prob, normal_init
from mmcv.runner import force_fp32
from mmdet.core import multi_apply
from mmdet.core.anchor.point_generator import MlvlPointGenerato... | 22,895 | 42.611429 | 79 | py |
DSLA-DSLA | DSLA-DSLA/mmdet/models/dense_heads/pisa_retinanet_head.py | # Copyright (c) OpenMMLab. All rights reserved.
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 Retinane... | 6,267 | 39.179487 | 79 | py |
DSLA-DSLA | DSLA-DSLA/mmdet/models/dense_heads/gfl_head.py | # Copyright (c) OpenMMLab. All rights reserved.
import torch
import torch.nn as nn
import torch.nn.functional as F
from mmcv.cnn import ConvModule, Scale
from mmcv.runner import force_fp32
from mmdet.core import (anchor_inside_flags, bbox_overlaps, build_assigner,
build_sampler, images_to_level... | 27,913 | 42.010786 | 79 | py |
DSLA-DSLA | DSLA-DSLA/mmdet/models/dense_heads/corner_head.py | # Copyright (c) OpenMMLab. All rights reserved.
from logging import warning
from math import ceil, log
import torch
import torch.nn as nn
from mmcv.cnn import ConvModule, bias_init_with_prob
from mmcv.ops import CornerPool, batched_nms
from mmcv.runner import BaseModule
from mmdet.core import multi_apply
from ..build... | 48,420 | 43.668819 | 79 | py |
DSLA-DSLA | DSLA-DSLA/mmdet/models/dense_heads/yolact_head.py | # Copyright (c) OpenMMLab. All rights reserved.
import numpy as np
import torch
import torch.nn as nn
import torch.nn.functional as F
from mmcv.cnn import ConvModule
from mmcv.runner import BaseModule, ModuleList, force_fp32
from mmdet.core import build_sampler, fast_nms, images_to_levels, multi_apply
from mmdet.core.... | 43,474 | 41.664377 | 79 | py |
DSLA-DSLA | DSLA-DSLA/mmdet/models/dense_heads/base_dense_head.py | # Copyright (c) OpenMMLab. All rights reserved.
from abc import ABCMeta, abstractmethod
import torch
from mmcv.cnn.utils.weight_init import constant_init
from mmcv.ops import batched_nms
from mmcv.runner import BaseModule, force_fp32
from mmdet.core.utils import filter_scores_and_topk, select_single_mlvl
class Base... | 23,226 | 43.074004 | 106 | py |
DSLA-DSLA | DSLA-DSLA/mmdet/models/dense_heads/free_anchor_retina_head.py | # Copyright (c) OpenMMLab. All rights reserved.
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://... | 11,189 | 40.139706 | 94 | py |
DSLA-DSLA | DSLA-DSLA/mmdet/models/dense_heads/guided_anchor_head.py | # Copyright (c) OpenMMLab. All rights reserved.
import warnings
import torch
import torch.nn as nn
from mmcv.ops import DeformConv2d, MaskedConv2d
from mmcv.runner import BaseModule, force_fp32
from mmdet.core import (anchor_inside_flags, build_assigner, build_bbox_coder,
build_prior_generator... | 37,334 | 41.963176 | 79 | py |
DSLA-DSLA | DSLA-DSLA/mmdet/models/dense_heads/yolof_head.py | # Copyright (c) OpenMMLab. All rights reserved.
import torch
import torch.nn as nn
from mmcv.cnn import (ConvModule, bias_init_with_prob, constant_init, is_norm,
normal_init)
from mmcv.runner import force_fp32
from mmdet.core import anchor_inside_flags, multi_apply, reduce_mean, unmap
from ..buil... | 17,409 | 40.7506 | 79 | py |
DSLA-DSLA | DSLA-DSLA/mmdet/models/dense_heads/sabl_retina_head.py | # Copyright (c) OpenMMLab. All rights reserved.
import warnings
import numpy as np
import torch
import torch.nn as nn
from mmcv.cnn import ConvModule
from mmcv.runner import force_fp32
from mmdet.core import (build_assigner, build_bbox_coder,
build_prior_generator, build_sampler, images_to_lev... | 27,410 | 42.440571 | 79 | py |
DSLA-DSLA | DSLA-DSLA/mmdet/models/dense_heads/fovea_head.py | # Copyright (c) OpenMMLab. All rights reserved.
import warnings
import torch
import torch.nn as nn
from mmcv.cnn import ConvModule
from mmcv.ops import DeformConv2d
from mmcv.runner import BaseModule
from mmdet.core import multi_apply
from mmdet.core.utils import filter_scores_and_topk
from ..builder import HEADS
fro... | 16,364 | 41.396373 | 79 | py |
DSLA-DSLA | DSLA-DSLA/mmdet/models/dense_heads/dense_test_mixins.py | # Copyright (c) OpenMMLab. All rights reserved.
import sys
from inspect import signature
import torch
from mmcv.ops import batched_nms
from mmdet.core import bbox_mapping_back, merge_aug_proposals
if sys.version_info >= (3, 7):
from mmdet.utils.contextmanagers import completed
class BBoxTestMixin(object):
... | 8,421 | 39.68599 | 79 | py |
DSLA-DSLA | DSLA-DSLA/mmdet/models/utils/csp_layer.py | # Copyright (c) OpenMMLab. All rights reserved.
import torch
import torch.nn as nn
from mmcv.cnn import ConvModule, DepthwiseSeparableConvModule
from mmcv.runner import BaseModule
class DarknetBottleneck(BaseModule):
"""The basic bottleneck block used in Darknet.
Each ResBlock consists of two ConvModules and... | 5,079 | 32.642384 | 77 | py |
DSLA-DSLA | DSLA-DSLA/mmdet/models/utils/se_layer.py | # Copyright (c) OpenMMLab. All rights reserved.
import mmcv
import torch.nn as nn
from mmcv.cnn import ConvModule
from mmcv.runner import BaseModule
class SELayer(BaseModule):
"""Squeeze-and-Excitation Module.
Args:
channels (int): The input (and output) channels of the SE layer.
ratio (int):... | 2,175 | 35.881356 | 79 | py |
DSLA-DSLA | DSLA-DSLA/mmdet/models/utils/gaussian_target.py | # Copyright (c) OpenMMLab. All rights reserved.
from math import sqrt
import torch
import torch.nn.functional as F
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... | 8,393 | 30.204461 | 79 | py |
DSLA-DSLA | DSLA-DSLA/mmdet/models/utils/normed_predictor.py | # Copyright (c) OpenMMLab. All rights reserved.
import torch
import torch.nn as nn
import torch.nn.functional as F
from mmcv.cnn import CONV_LAYERS
from .builder import LINEAR_LAYERS
@LINEAR_LAYERS.register_module(name='NormedLinear')
class NormedLinear(nn.Linear):
"""Normalized Linear Layer.
Args:
... | 2,998 | 32.696629 | 77 | py |
DSLA-DSLA | DSLA-DSLA/mmdet/models/utils/ckpt_convert.py | # Copyright (c) OpenMMLab. All rights reserved.
# This script consists of several convert functions which
# can modify the weights of model in original repo to be
# pre-trained weights.
from collections import OrderedDict
import torch
def pvt_convert(ckpt):
new_ckpt = OrderedDict()
# Process the concat bet... | 4,964 | 34.978261 | 79 | py |
DSLA-DSLA | DSLA-DSLA/mmdet/models/utils/conv_upsample.py | # Copyright (c) OpenMMLab. All rights reserved.
import torch.nn.functional as F
from mmcv.cnn import ConvModule
from mmcv.runner import BaseModule, ModuleList
class ConvUpsample(BaseModule):
"""ConvUpsample performs 2x upsampling after Conv.
There are several `ConvModule` layers. In the first few layers, ups... | 2,653 | 38.029412 | 78 | py |
DSLA-DSLA | DSLA-DSLA/mmdet/models/utils/misc.py | # Copyright (c) OpenMMLab. All rights reserved.
from torch.nn import functional as F
def interpolate_as(source, target, mode='bilinear', align_corners=False):
"""Interpolate the `source` to the shape of the `target`.
The `source` must be a Tensor, but the `target` can be a Tensor or a
np.ndarray with the... | 1,655 | 37.511628 | 78 | py |
DSLA-DSLA | DSLA-DSLA/mmdet/models/utils/res_layer.py | # Copyright (c) OpenMMLab. All rights reserved.
from mmcv.cnn import build_conv_layer, build_norm_layer
from mmcv.runner import BaseModule, Sequential
from torch import nn as nn
class ResLayer(Sequential):
"""ResLayer to build ResNet style backbone.
Args:
block (nn.Module): block used to build ResLay... | 6,392 | 32.471204 | 79 | py |
DSLA-DSLA | DSLA-DSLA/mmdet/models/utils/brick_wrappers.py | # Copyright (c) OpenMMLab. All rights reserved.
import torch
import torch.nn as nn
import torch.nn.functional as F
from mmcv.cnn.bricks.wrappers import NewEmptyTensorOp, obsolete_torch_version
if torch.__version__ == 'parrots':
TORCH_VERSION = torch.__version__
else:
# torch.__version__ could be 1.3.1+cu92, we... | 1,856 | 34.711538 | 77 | py |
DSLA-DSLA | DSLA-DSLA/mmdet/models/utils/transformer.py | # Copyright (c) OpenMMLab. All rights reserved.
import math
import warnings
from typing import Sequence
import torch
import torch.nn as nn
import torch.nn.functional as F
from mmcv.cnn import (build_activation_layer, build_conv_layer,
build_norm_layer, xavier_init)
from mmcv.cnn.bricks.registry i... | 45,903 | 38.572414 | 79 | py |
DSLA-DSLA | DSLA-DSLA/mmdet/models/utils/positional_encoding.py | # Copyright (c) OpenMMLab. All rights reserved.
import math
import torch
import torch.nn as nn
from mmcv.cnn.bricks.transformer import POSITIONAL_ENCODING
from mmcv.runner import BaseModule
@POSITIONAL_ENCODING.register_module()
class SinePositionalEncoding(BaseModule):
"""Position encoding with sine and cosine ... | 6,568 | 39.054878 | 79 | py |
DSLA-DSLA | DSLA-DSLA/mmdet/models/utils/inverted_residual.py | # Copyright (c) OpenMMLab. All rights reserved.
import torch.utils.checkpoint as cp
from mmcv.cnn import ConvModule
from mmcv.runner import BaseModule
from .se_layer import SELayer
class InvertedResidual(BaseModule):
"""Inverted Residual Block.
Args:
in_channels (int): The input channels of this Mod... | 4,095 | 31.768 | 78 | py |
DSLA-DSLA | DSLA-DSLA/mmdet/models/utils/builder.py | # Copyright (c) OpenMMLab. All rights reserved.
import torch.nn as nn
from mmcv.utils import Registry, build_from_cfg
TRANSFORMER = Registry('Transformer')
LINEAR_LAYERS = Registry('linear layers')
def build_transformer(cfg, default_args=None):
"""Builder for Transformer."""
return build_from_cfg(cfg, TRANSF... | 1,535 | 31 | 78 | py |
DSLA-DSLA | DSLA-DSLA/mmdet/models/roi_heads/standard_roi_head.py | # Copyright (c) OpenMMLab. All rights reserved.
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()
c... | 17,132 | 42.047739 | 79 | py |
DSLA-DSLA | DSLA-DSLA/mmdet/models/roi_heads/grid_roi_head.py | # Copyright (c) OpenMMLab. All rights reserved.
import numpy as np
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 fo... | 6,961 | 39.71345 | 79 | py |
DSLA-DSLA | DSLA-DSLA/mmdet/models/roi_heads/scnet_roi_head.py | # Copyright (c) OpenMMLab. All rights reserved.
import numpy as np
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 ..uti... | 25,683 | 41.382838 | 79 | py |
DSLA-DSLA | DSLA-DSLA/mmdet/models/roi_heads/sparse_roi_head.py | # Copyright (c) OpenMMLab. All rights reserved.
import numpy as np
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(Ca... | 19,280 | 44.367059 | 79 | py |
DSLA-DSLA | DSLA-DSLA/mmdet/models/roi_heads/cascade_roi_head.py | # Copyright (c) OpenMMLab. All rights reserved.
import numpy as np
import torch
import torch.nn as nn
from mmcv.runner import ModuleList
from mmdet.core import (bbox2result, bbox2roi, bbox_mapping, build_assigner,
build_sampler, merge_aug_bboxes, merge_aug_masks,
multicl... | 27,668 | 42.780063 | 79 | py |
DSLA-DSLA | DSLA-DSLA/mmdet/models/roi_heads/trident_roi_head.py | # Copyright (c) OpenMMLab. All rights reserved.
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.... | 5,321 | 42.983471 | 78 | py |
DSLA-DSLA | DSLA-DSLA/mmdet/models/roi_heads/dynamic_roi_head.py | # Copyright (c) OpenMMLab. All rights reserved.
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):
"""R... | 6,654 | 41.660256 | 79 | py |
DSLA-DSLA | DSLA-DSLA/mmdet/models/roi_heads/point_rend_roi_head.py | # Copyright (c) OpenMMLab. All rights reserved.
# Modified from https://github.com/facebookresearch/detectron2/tree/master/projects/PointRend # noqa
import os
import warnings
import numpy as np
import torch
import torch.nn.functional as F
from mmcv.ops import point_sample, rel_roi_point_to_rel_img_point
from mmdet.c... | 18,743 | 46.573604 | 101 | py |
DSLA-DSLA | DSLA-DSLA/mmdet/models/roi_heads/mask_scoring_roi_head.py | # Copyright (c) OpenMMLab. All rights reserved.
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... | 5,230 | 44.885965 | 79 | py |
DSLA-DSLA | DSLA-DSLA/mmdet/models/roi_heads/htc_roi_head.py | # Copyright (c) OpenMMLab. All rights reserved.
import numpy as np
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 ..uti... | 27,630 | 42.928458 | 79 | py |
DSLA-DSLA | DSLA-DSLA/mmdet/models/roi_heads/test_mixins.py | # Copyright (c) OpenMMLab. All rights reserved.
import sys
import warnings
import numpy as np
import torch
from mmdet.core import (bbox2roi, bbox_mapping, merge_aug_bboxes,
merge_aug_masks, multiclass_nms)
if sys.version_info >= (3, 7):
from mmdet.utils.contextmanagers import completed
... | 13,557 | 42.455128 | 79 | py |
DSLA-DSLA | DSLA-DSLA/mmdet/models/roi_heads/roi_extractors/base_roi_extractor.py | # Copyright (c) OpenMMLab. All rights reserved.
from abc import ABCMeta, abstractmethod
import torch
import torch.nn as nn
from mmcv import ops
from mmcv.runner import BaseModule
class BaseRoIExtractor(BaseModule, metaclass=ABCMeta):
"""Base class for RoI extractor.
Args:
roi_layer (dict): Specify R... | 3,002 | 32.741573 | 78 | py |
DSLA-DSLA | DSLA-DSLA/mmdet/models/roi_heads/roi_extractors/single_level_roi_extractor.py | # Copyright (c) OpenMMLab. All rights reserved.
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 leve... | 4,829 | 40.637931 | 79 | py |
DSLA-DSLA | DSLA-DSLA/mmdet/models/roi_heads/bbox_heads/bbox_head.py | # Copyright (c) OpenMMLab. All rights reserved.
import torch
import torch.nn as nn
import torch.nn.functional as F
from mmcv.runner import BaseModule, 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 HEA... | 25,657 | 42.122689 | 79 | py |
DSLA-DSLA | DSLA-DSLA/mmdet/models/roi_heads/bbox_heads/sabl_head.py | # Copyright (c) OpenMMLab. All rights reserved.
import numpy as np
import torch
import torch.nn as nn
import torch.nn.functional as F
from mmcv.cnn import ConvModule
from mmcv.runner import BaseModule, force_fp32
from mmdet.core import build_bbox_coder, multi_apply, multiclass_nms
from mmdet.models.builder import HEAD... | 25,050 | 41.822222 | 79 | py |
DSLA-DSLA | DSLA-DSLA/mmdet/models/roi_heads/bbox_heads/dii_head.py | # Copyright (c) OpenMMLab. All rights reserved.
import torch
import torch.nn as nn
from mmcv.cnn import (bias_init_with_prob, build_activation_layer,
build_norm_layer)
from mmcv.cnn.bricks.transformer import FFN, MultiheadAttention
from mmcv.runner import auto_fp16, force_fp32
from mmdet.core imp... | 19,199 | 43.964871 | 79 | py |
DSLA-DSLA | DSLA-DSLA/mmdet/models/roi_heads/bbox_heads/convfc_bbox_head.py | # Copyright (c) OpenMMLab. All rights reserved.
import torch.nn as nn
from mmcv.cnn import ConvModule
from mmdet.models.builder import HEADS
from mmdet.models.utils import build_linear_layer
from .bbox_head import BBoxHead
@HEADS.register_module()
class ConvFCBBoxHead(BBoxHead):
r"""More general bbox head, with ... | 8,364 | 35.369565 | 79 | py |
DSLA-DSLA | DSLA-DSLA/mmdet/models/roi_heads/bbox_heads/double_bbox_head.py | # Copyright (c) OpenMMLab. All rights reserved.
import torch.nn as nn
from mmcv.cnn import ConvModule
from mmcv.runner import BaseModule, ModuleList
from mmdet.models.backbones.resnet import Bottleneck
from mmdet.models.builder import HEADS
from .bbox_head import BBoxHead
class BasicResBlock(BaseModule):
"""Basi... | 5,733 | 31.03352 | 79 | py |
DSLA-DSLA | DSLA-DSLA/mmdet/models/roi_heads/shared_heads/res_layer.py | # Copyright (c) OpenMMLab. All rights reserved.
import warnings
import torch.nn as nn
from mmcv.runner import BaseModule, auto_fp16
from mmdet.models.backbones import ResNet
from mmdet.models.builder import SHARED_HEADS
from mmdet.models.utils import ResLayer as _ResLayer
@SHARED_HEADS.register_module()
class ResLa... | 2,587 | 30.950617 | 76 | py |
DSLA-DSLA | DSLA-DSLA/mmdet/models/roi_heads/mask_heads/grid_head.py | # Copyright (c) OpenMMLab. All rights reserved.
import numpy as np
import torch
import torch.nn as nn
import torch.nn.functional as F
from mmcv.cnn import ConvModule
from mmcv.runner import BaseModule
from mmdet.models.builder import HEADS, build_loss
@HEADS.register_module()
class GridHead(BaseModule):
def __i... | 15,579 | 41.802198 | 79 | py |
DSLA-DSLA | DSLA-DSLA/mmdet/models/roi_heads/mask_heads/dynamic_mask_head.py | # Copyright (c) OpenMMLab. All rights reserved.
import torch
import torch.nn as nn
from mmcv.runner import auto_fp16, force_fp32
from mmdet.core import mask_target
from mmdet.models.builder import HEADS
from mmdet.models.dense_heads.atss_head import reduce_mean
from mmdet.models.utils import build_transformer
from .fc... | 5,665 | 37.283784 | 79 | py |
DSLA-DSLA | DSLA-DSLA/mmdet/models/roi_heads/mask_heads/maskiou_head.py | # Copyright (c) OpenMMLab. All rights reserved.
import numpy as np
import torch
import torch.nn as nn
from mmcv.cnn import Conv2d, Linear, MaxPool2d
from mmcv.runner import BaseModule, force_fp32
from torch.nn.modules.utils import _pair
from mmdet.models.builder import HEADS, build_loss
@HEADS.register_module()
clas... | 7,382 | 39.125 | 79 | py |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.