repo stringlengths 7 90 | file_url stringlengths 81 315 | file_path stringlengths 4 228 | content stringlengths 0 32.8k | language stringclasses 1
value | license stringclasses 7
values | commit_sha stringlengths 40 40 | retrieved_at stringdate 2026-01-04 14:38:15 2026-01-05 02:33:18 | truncated bool 2
classes |
|---|---|---|---|---|---|---|---|---|
open-mmlab/mmdetection | https://github.com/open-mmlab/mmdetection/blob/cfd5d3a985b0249de009b67d04f37263e11cdf3d/mmdet/models/dense_heads/retina_sepbn_head.py | mmdet/models/dense_heads/retina_sepbn_head.py | # Copyright (c) OpenMMLab. All rights reserved.
from typing import Tuple
import torch.nn as nn
from mmcv.cnn import ConvModule
from mmengine.model import bias_init_with_prob, normal_init
from torch import Tensor
from mmdet.registry import MODELS
from mmdet.utils import OptConfigType, OptMultiConfig
from .anchor_head ... | python | Apache-2.0 | cfd5d3a985b0249de009b67d04f37263e11cdf3d | 2026-01-04T14:42:57.197037Z | false |
open-mmlab/mmdetection | https://github.com/open-mmlab/mmdetection/blob/cfd5d3a985b0249de009b67d04f37263e11cdf3d/mmdet/models/dense_heads/base_mask_head.py | mmdet/models/dense_heads/base_mask_head.py | # Copyright (c) OpenMMLab. All rights reserved.
from abc import ABCMeta, abstractmethod
from typing import List, Tuple, Union
from mmengine.model import BaseModule
from torch import Tensor
from mmdet.structures import SampleList
from mmdet.utils import InstanceList, OptInstanceList, OptMultiConfig
from ..utils import... | python | Apache-2.0 | cfd5d3a985b0249de009b67d04f37263e11cdf3d | 2026-01-04T14:42:57.197037Z | false |
open-mmlab/mmdetection | https://github.com/open-mmlab/mmdetection/blob/cfd5d3a985b0249de009b67d04f37263e11cdf3d/mmdet/models/dense_heads/gfl_head.py | mmdet/models/dense_heads/gfl_head.py | # Copyright (c) OpenMMLab. All rights reserved.
from typing import List, Optional, Sequence, Tuple
import torch
import torch.nn as nn
import torch.nn.functional as F
from mmcv.cnn import ConvModule, Scale
from mmengine.config import ConfigDict
from mmengine.structures import InstanceData
from torch import Tensor
from... | python | Apache-2.0 | cfd5d3a985b0249de009b67d04f37263e11cdf3d | 2026-01-04T14:42:57.197037Z | false |
open-mmlab/mmdetection | https://github.com/open-mmlab/mmdetection/blob/cfd5d3a985b0249de009b67d04f37263e11cdf3d/mmdet/models/dense_heads/solo_head.py | mmdet/models/dense_heads/solo_head.py | # Copyright (c) OpenMMLab. All rights reserved.
from typing import List, Optional, Tuple
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 mmengine.structures import InstanceData
from torch import Tensor
from mmdet.models.utils.misc ... | python | Apache-2.0 | cfd5d3a985b0249de009b67d04f37263e11cdf3d | 2026-01-04T14:42:57.197037Z | true |
open-mmlab/mmdetection | https://github.com/open-mmlab/mmdetection/blob/cfd5d3a985b0249de009b67d04f37263e11cdf3d/mmdet/models/dense_heads/nasfcos_head.py | 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 mmdet.registry import MODELS
from mmdet.utils import OptMultiConfig
@MODELS.register_module()
class NASFCOSHead(FCOSHead):
"""Anch... | python | Apache-2.0 | cfd5d3a985b0249de009b67d04f37263e11cdf3d | 2026-01-04T14:42:57.197037Z | false |
open-mmlab/mmdetection | https://github.com/open-mmlab/mmdetection/blob/cfd5d3a985b0249de009b67d04f37263e11cdf3d/mmdet/models/dense_heads/centernet_head.py | mmdet/models/dense_heads/centernet_head.py | # Copyright (c) OpenMMLab. All rights reserved.
from typing import List, Optional, Tuple
import torch
import torch.nn as nn
from mmcv.ops import batched_nms
from mmengine.config import ConfigDict
from mmengine.model import bias_init_with_prob, normal_init
from mmengine.structures import InstanceData
from torch import ... | python | Apache-2.0 | cfd5d3a985b0249de009b67d04f37263e11cdf3d | 2026-01-04T14:42:57.197037Z | false |
open-mmlab/mmdetection | https://github.com/open-mmlab/mmdetection/blob/cfd5d3a985b0249de009b67d04f37263e11cdf3d/mmdet/models/dense_heads/dino_head.py | mmdet/models/dense_heads/dino_head.py | # Copyright (c) OpenMMLab. All rights reserved.
from typing import Dict, List, Tuple
import torch
from mmengine.structures import InstanceData
from torch import Tensor
from mmdet.registry import MODELS
from mmdet.structures import SampleList
from mmdet.structures.bbox import (bbox_cxcywh_to_xyxy, bbox_overlaps,
... | python | Apache-2.0 | cfd5d3a985b0249de009b67d04f37263e11cdf3d | 2026-01-04T14:42:57.197037Z | false |
open-mmlab/mmdetection | https://github.com/open-mmlab/mmdetection/blob/cfd5d3a985b0249de009b67d04f37263e11cdf3d/mmdet/models/dense_heads/corner_head.py | mmdet/models/dense_heads/corner_head.py | # Copyright (c) OpenMMLab. All rights reserved.
from logging import warning
from math import ceil, log
from typing import List, Optional, Sequence, Tuple
import torch
import torch.nn as nn
from mmcv.cnn import ConvModule
from mmcv.ops import CornerPool, batched_nms
from mmengine.config import ConfigDict
from mmengine.... | python | Apache-2.0 | cfd5d3a985b0249de009b67d04f37263e11cdf3d | 2026-01-04T14:42:57.197037Z | true |
open-mmlab/mmdetection | https://github.com/open-mmlab/mmdetection/blob/cfd5d3a985b0249de009b67d04f37263e11cdf3d/mmdet/models/dense_heads/guided_anchor_head.py | mmdet/models/dense_heads/guided_anchor_head.py | # Copyright (c) OpenMMLab. All rights reserved.
from typing import List, Optional, Tuple
import torch
import torch.nn as nn
from mmcv.ops import DeformConv2d, MaskedConv2d
from mmengine.model import BaseModule
from mmengine.structures import InstanceData
from torch import Tensor
from mmdet.registry import MODELS, TAS... | python | Apache-2.0 | cfd5d3a985b0249de009b67d04f37263e11cdf3d | 2026-01-04T14:42:57.197037Z | true |
open-mmlab/mmdetection | https://github.com/open-mmlab/mmdetection/blob/cfd5d3a985b0249de009b67d04f37263e11cdf3d/mmdet/models/dense_heads/yolof_head.py | mmdet/models/dense_heads/yolof_head.py | # Copyright (c) OpenMMLab. All rights reserved.
from typing import List, Optional, Tuple
import torch
import torch.nn as nn
from mmcv.cnn import ConvModule, is_norm
from mmengine.model import bias_init_with_prob, constant_init, normal_init
from mmengine.structures import InstanceData
from torch import Tensor
from mmd... | python | Apache-2.0 | cfd5d3a985b0249de009b67d04f37263e11cdf3d | 2026-01-04T14:42:57.197037Z | false |
open-mmlab/mmdetection | https://github.com/open-mmlab/mmdetection/blob/cfd5d3a985b0249de009b67d04f37263e11cdf3d/mmdet/models/dense_heads/centripetal_head.py | mmdet/models/dense_heads/centripetal_head.py | # Copyright (c) OpenMMLab. All rights reserved.
from typing import List, Optional, Tuple
import torch.nn as nn
from mmcv.cnn import ConvModule
from mmcv.ops import DeformConv2d
from mmengine.model import normal_init
from torch import Tensor
from mmdet.registry import MODELS
from mmdet.utils import (ConfigType, Instan... | python | Apache-2.0 | cfd5d3a985b0249de009b67d04f37263e11cdf3d | 2026-01-04T14:42:57.197037Z | false |
open-mmlab/mmdetection | https://github.com/open-mmlab/mmdetection/blob/cfd5d3a985b0249de009b67d04f37263e11cdf3d/mmdet/models/dense_heads/ld_head.py | mmdet/models/dense_heads/ld_head.py | # Copyright (c) OpenMMLab. All rights reserved.
from typing import List, Tuple
import torch
from torch import Tensor
from mmdet.registry import MODELS
from mmdet.structures import SampleList
from mmdet.structures.bbox import bbox_overlaps
from mmdet.utils import ConfigType, InstanceList, OptInstanceList, reduce_mean
... | python | Apache-2.0 | cfd5d3a985b0249de009b67d04f37263e11cdf3d | 2026-01-04T14:42:57.197037Z | false |
open-mmlab/mmdetection | https://github.com/open-mmlab/mmdetection/blob/cfd5d3a985b0249de009b67d04f37263e11cdf3d/mmdet/models/dense_heads/paa_head.py | mmdet/models/dense_heads/paa_head.py | # Copyright (c) OpenMMLab. All rights reserved.
from typing import List, Optional, Tuple
import numpy as np
import torch
from mmengine.structures import InstanceData
from torch import Tensor
from mmdet.registry import MODELS
from mmdet.structures.bbox import bbox_overlaps
from mmdet.utils import (ConfigType, Instance... | python | Apache-2.0 | cfd5d3a985b0249de009b67d04f37263e11cdf3d | 2026-01-04T14:42:57.197037Z | true |
open-mmlab/mmdetection | https://github.com/open-mmlab/mmdetection/blob/cfd5d3a985b0249de009b67d04f37263e11cdf3d/mmdet/models/dense_heads/rtmdet_ins_head.py | mmdet/models/dense_heads/rtmdet_ins_head.py | # Copyright (c) OpenMMLab. All rights reserved.
import copy
import math
from typing import List, Optional, Tuple
import torch
import torch.nn as nn
import torch.nn.functional as F
from mmcv.cnn import ConvModule, is_norm
from mmcv.ops import batched_nms
from mmengine.model import (BaseModule, bias_init_with_prob, cons... | python | Apache-2.0 | cfd5d3a985b0249de009b67d04f37263e11cdf3d | 2026-01-04T14:42:57.197037Z | true |
open-mmlab/mmdetection | https://github.com/open-mmlab/mmdetection/blob/cfd5d3a985b0249de009b67d04f37263e11cdf3d/mmdet/models/dense_heads/yolox_head.py | mmdet/models/dense_heads/yolox_head.py | # Copyright (c) OpenMMLab. All rights reserved.
import math
from typing import List, Optional, Sequence, Tuple, Union
import torch
import torch.nn as nn
import torch.nn.functional as F
from mmcv.cnn import ConvModule, DepthwiseSeparableConvModule
from mmcv.ops.nms import batched_nms
from mmengine.config import ConfigD... | python | Apache-2.0 | cfd5d3a985b0249de009b67d04f37263e11cdf3d | 2026-01-04T14:42:57.197037Z | false |
open-mmlab/mmdetection | https://github.com/open-mmlab/mmdetection/blob/cfd5d3a985b0249de009b67d04f37263e11cdf3d/mmdet/models/dense_heads/anchor_head.py | mmdet/models/dense_heads/anchor_head.py | # Copyright (c) OpenMMLab. All rights reserved.
import warnings
from typing import List, Optional, Tuple, Union
import torch
import torch.nn as nn
from mmengine.structures import InstanceData
from torch import Tensor
from mmdet.registry import MODELS, TASK_UTILS
from mmdet.structures.bbox import BaseBoxes, cat_boxes,... | python | Apache-2.0 | cfd5d3a985b0249de009b67d04f37263e11cdf3d | 2026-01-04T14:42:57.197037Z | false |
open-mmlab/mmdetection | https://github.com/open-mmlab/mmdetection/blob/cfd5d3a985b0249de009b67d04f37263e11cdf3d/mmdet/models/dense_heads/detr_head.py | mmdet/models/dense_heads/detr_head.py | # Copyright (c) OpenMMLab. All rights reserved.
from typing import Dict, List, Tuple
import torch
import torch.nn as nn
import torch.nn.functional as F
from mmcv.cnn import Linear
from mmcv.cnn.bricks.transformer import FFN
from mmengine.model import BaseModule
from mmengine.structures import InstanceData
from torch i... | python | Apache-2.0 | cfd5d3a985b0249de009b67d04f37263e11cdf3d | 2026-01-04T14:42:57.197037Z | false |
open-mmlab/mmdetection | https://github.com/open-mmlab/mmdetection/blob/cfd5d3a985b0249de009b67d04f37263e11cdf3d/mmdet/models/dense_heads/free_anchor_retina_head.py | mmdet/models/dense_heads/free_anchor_retina_head.py | # Copyright (c) OpenMMLab. All rights reserved.
from typing import List
import torch
import torch.nn.functional as F
from mmengine.structures import InstanceData
from torch import Tensor
from mmdet.registry import MODELS
from mmdet.structures.bbox import bbox_overlaps
from mmdet.utils import InstanceList, OptConfigTy... | python | Apache-2.0 | cfd5d3a985b0249de009b67d04f37263e11cdf3d | 2026-01-04T14:42:57.197037Z | false |
open-mmlab/mmdetection | https://github.com/open-mmlab/mmdetection/blob/cfd5d3a985b0249de009b67d04f37263e11cdf3d/mmdet/models/dense_heads/rtmdet_head.py | mmdet/models/dense_heads/rtmdet_head.py | # Copyright (c) OpenMMLab. All rights reserved.
from typing import List, Optional, Tuple, Union
import torch
import torch.nn as nn
from mmcv.cnn import ConvModule, DepthwiseSeparableConvModule, Scale, is_norm
from mmengine.model import bias_init_with_prob, constant_init, normal_init
from mmengine.structures import Ins... | python | Apache-2.0 | cfd5d3a985b0249de009b67d04f37263e11cdf3d | 2026-01-04T14:42:57.197037Z | false |
open-mmlab/mmdetection | https://github.com/open-mmlab/mmdetection/blob/cfd5d3a985b0249de009b67d04f37263e11cdf3d/mmdet/models/dense_heads/yolact_head.py | mmdet/models/dense_heads/yolact_head.py | # Copyright (c) OpenMMLab. All rights reserved.
import copy
from typing import List, Optional
import numpy as np
import torch
import torch.nn as nn
import torch.nn.functional as F
from mmcv.cnn import ConvModule
from mmengine.model import BaseModule, ModuleList
from mmengine.structures import InstanceData
from torch i... | python | Apache-2.0 | cfd5d3a985b0249de009b67d04f37263e11cdf3d | 2026-01-04T14:42:57.197037Z | true |
open-mmlab/mmdetection | https://github.com/open-mmlab/mmdetection/blob/cfd5d3a985b0249de009b67d04f37263e11cdf3d/mmdet/models/dense_heads/vfnet_head.py | mmdet/models/dense_heads/vfnet_head.py | # Copyright (c) OpenMMLab. All rights reserved.
from typing import List, Tuple, Union
import numpy as np
import torch
import torch.nn as nn
from mmcv.cnn import ConvModule, Scale
from mmcv.ops import DeformConv2d
from torch import Tensor
from mmdet.registry import MODELS, TASK_UTILS
from mmdet.structures.bbox import ... | python | Apache-2.0 | cfd5d3a985b0249de009b67d04f37263e11cdf3d | 2026-01-04T14:42:57.197037Z | false |
open-mmlab/mmdetection | https://github.com/open-mmlab/mmdetection/blob/cfd5d3a985b0249de009b67d04f37263e11cdf3d/mmdet/models/dense_heads/base_dense_head.py | mmdet/models/dense_heads/base_dense_head.py | # Copyright (c) OpenMMLab. All rights reserved.
import copy
from abc import ABCMeta, abstractmethod
from inspect import signature
from typing import List, Optional, Tuple
import torch
from mmcv.ops import batched_nms
from mmengine.config import ConfigDict
from mmengine.model import BaseModule, constant_init
from mmeng... | python | Apache-2.0 | cfd5d3a985b0249de009b67d04f37263e11cdf3d | 2026-01-04T14:42:57.197037Z | false |
open-mmlab/mmdetection | https://github.com/open-mmlab/mmdetection/blob/cfd5d3a985b0249de009b67d04f37263e11cdf3d/mmdet/models/dense_heads/mask2former_head.py | mmdet/models/dense_heads/mask2former_head.py | # Copyright (c) OpenMMLab. All rights reserved.
import copy
from typing import List, Tuple
import torch
import torch.nn as nn
import torch.nn.functional as F
from mmcv.cnn import Conv2d
from mmcv.ops import point_sample
from mmengine.model import ModuleList, caffe2_xavier_init
from mmengine.structures import InstanceD... | python | Apache-2.0 | cfd5d3a985b0249de009b67d04f37263e11cdf3d | 2026-01-04T14:42:57.197037Z | false |
open-mmlab/mmdetection | https://github.com/open-mmlab/mmdetection/blob/cfd5d3a985b0249de009b67d04f37263e11cdf3d/mmdet/models/dense_heads/pisa_ssd_head.py | mmdet/models/dense_heads/pisa_ssd_head.py | # Copyright (c) OpenMMLab. All rights reserved.
from typing import Dict, List, Union
import torch
from torch import Tensor
from mmdet.registry import MODELS
from mmdet.utils import InstanceList, OptInstanceList
from ..losses import CrossEntropyLoss, SmoothL1Loss, carl_loss, isr_p
from ..utils import multi_apply
from ... | python | Apache-2.0 | cfd5d3a985b0249de009b67d04f37263e11cdf3d | 2026-01-04T14:42:57.197037Z | false |
open-mmlab/mmdetection | https://github.com/open-mmlab/mmdetection/blob/cfd5d3a985b0249de009b67d04f37263e11cdf3d/mmdet/models/dense_heads/pisa_retinanet_head.py | mmdet/models/dense_heads/pisa_retinanet_head.py | # Copyright (c) OpenMMLab. All rights reserved.
from typing import List
import torch
from torch import Tensor
from mmdet.registry import MODELS
from mmdet.utils import InstanceList, OptInstanceList
from ..losses import carl_loss, isr_p
from ..utils import images_to_levels
from .retina_head import RetinaHead
@MODELS... | python | Apache-2.0 | cfd5d3a985b0249de009b67d04f37263e11cdf3d | 2026-01-04T14:42:57.197037Z | false |
open-mmlab/mmdetection | https://github.com/open-mmlab/mmdetection/blob/cfd5d3a985b0249de009b67d04f37263e11cdf3d/mmdet/models/dense_heads/atss_head.py | mmdet/models/dense_heads/atss_head.py | # Copyright (c) OpenMMLab. All rights reserved.
from typing import List, Optional, Sequence, Tuple
import torch
import torch.nn as nn
from mmcv.cnn import ConvModule, Scale
from mmengine.structures import InstanceData
from torch import Tensor
from mmdet.registry import MODELS
from mmdet.utils import (ConfigType, Inst... | python | Apache-2.0 | cfd5d3a985b0249de009b67d04f37263e11cdf3d | 2026-01-04T14:42:57.197037Z | false |
open-mmlab/mmdetection | https://github.com/open-mmlab/mmdetection/blob/cfd5d3a985b0249de009b67d04f37263e11cdf3d/mmdet/models/dense_heads/__init__.py | mmdet/models/dense_heads/__init__.py | # Copyright (c) OpenMMLab. All rights reserved.
from .anchor_free_head import AnchorFreeHead
from .anchor_head import AnchorHead
from .atss_head import ATSSHead
from .atss_vlfusion_head import ATSSVLFusionHead
from .autoassign_head import AutoAssignHead
from .boxinst_head import BoxInstBboxHead, BoxInstMaskHead
from .c... | python | Apache-2.0 | cfd5d3a985b0249de009b67d04f37263e11cdf3d | 2026-01-04T14:42:57.197037Z | false |
open-mmlab/mmdetection | https://github.com/open-mmlab/mmdetection/blob/cfd5d3a985b0249de009b67d04f37263e11cdf3d/mmdet/models/dense_heads/ga_retina_head.py | mmdet/models/dense_heads/ga_retina_head.py | # Copyright (c) OpenMMLab. All rights reserved.
from typing import Tuple
import torch.nn as nn
from mmcv.cnn import ConvModule
from mmcv.ops import MaskedConv2d
from torch import Tensor
from mmdet.registry import MODELS
from mmdet.utils import OptConfigType, OptMultiConfig
from .guided_anchor_head import FeatureAdapt... | python | Apache-2.0 | cfd5d3a985b0249de009b67d04f37263e11cdf3d | 2026-01-04T14:42:57.197037Z | false |
open-mmlab/mmdetection | https://github.com/open-mmlab/mmdetection/blob/cfd5d3a985b0249de009b67d04f37263e11cdf3d/mmdet/models/dense_heads/boxinst_head.py | mmdet/models/dense_heads/boxinst_head.py | # Copyright (c) OpenMMLab. All rights reserved.
from typing import List
import torch
import torch.nn.functional as F
from mmengine import MessageHub
from mmengine.structures import InstanceData
from torch import Tensor
from mmdet.registry import MODELS
from mmdet.utils import InstanceList
from ..utils.misc import unf... | python | Apache-2.0 | cfd5d3a985b0249de009b67d04f37263e11cdf3d | 2026-01-04T14:42:57.197037Z | false |
open-mmlab/mmdetection | https://github.com/open-mmlab/mmdetection/blob/cfd5d3a985b0249de009b67d04f37263e11cdf3d/mmdet/models/dense_heads/ddq_detr_head.py | mmdet/models/dense_heads/ddq_detr_head.py | # Copyright (c) OpenMMLab. All rights reserved.
import copy
from typing import Dict, List, Tuple
import torch
from mmengine.model import bias_init_with_prob, constant_init
from torch import Tensor, nn
from mmdet.registry import MODELS
from mmdet.structures import SampleList
from mmdet.structures.bbox import bbox_cxcy... | python | Apache-2.0 | cfd5d3a985b0249de009b67d04f37263e11cdf3d | 2026-01-04T14:42:57.197037Z | false |
open-mmlab/mmdetection | https://github.com/open-mmlab/mmdetection/blob/cfd5d3a985b0249de009b67d04f37263e11cdf3d/mmdet/models/dense_heads/cascade_rpn_head.py | mmdet/models/dense_heads/cascade_rpn_head.py | # Copyright (c) OpenMMLab. All rights reserved.
from __future__ import division
import copy
from typing import Dict, List, Optional, Tuple, Union
import torch
import torch.nn as nn
from mmcv.ops import DeformConv2d
from mmengine.config import ConfigDict
from mmengine.model import BaseModule, ModuleList
from mmengine.s... | python | Apache-2.0 | cfd5d3a985b0249de009b67d04f37263e11cdf3d | 2026-01-04T14:42:57.197037Z | true |
open-mmlab/mmdetection | https://github.com/open-mmlab/mmdetection/blob/cfd5d3a985b0249de009b67d04f37263e11cdf3d/mmdet/models/dense_heads/anchor_free_head.py | mmdet/models/dense_heads/anchor_free_head.py | # Copyright (c) OpenMMLab. All rights reserved.
from abc import abstractmethod
from typing import Any, List, Sequence, Tuple, Union
import torch.nn as nn
from mmcv.cnn import ConvModule
from numpy import ndarray
from torch import Tensor
from mmdet.registry import MODELS, TASK_UTILS
from mmdet.utils import (ConfigType... | python | Apache-2.0 | cfd5d3a985b0249de009b67d04f37263e11cdf3d | 2026-01-04T14:42:57.197037Z | false |
open-mmlab/mmdetection | https://github.com/open-mmlab/mmdetection/blob/cfd5d3a985b0249de009b67d04f37263e11cdf3d/mmdet/models/dense_heads/reppoints_head.py | mmdet/models/dense_heads/reppoints_head.py | # Copyright (c) OpenMMLab. All rights reserved.
from typing import Dict, List, Sequence, Tuple
import numpy as np
import torch
import torch.nn as nn
from mmcv.cnn import ConvModule
from mmcv.ops import DeformConv2d
from mmengine.config import ConfigDict
from mmengine.structures import InstanceData
from torch import Te... | python | Apache-2.0 | cfd5d3a985b0249de009b67d04f37263e11cdf3d | 2026-01-04T14:42:57.197037Z | true |
open-mmlab/mmdetection | https://github.com/open-mmlab/mmdetection/blob/cfd5d3a985b0249de009b67d04f37263e11cdf3d/mmdet/models/dense_heads/retina_head.py | mmdet/models/dense_heads/retina_head.py | # Copyright (c) OpenMMLab. All rights reserved.
import torch.nn as nn
from mmcv.cnn import ConvModule
from mmdet.registry import MODELS
from .anchor_head import AnchorHead
@MODELS.register_module()
class RetinaHead(AnchorHead):
r"""An anchor-based head used in `RetinaNet
<https://arxiv.org/pdf/1708.02002.pdf... | python | Apache-2.0 | cfd5d3a985b0249de009b67d04f37263e11cdf3d | 2026-01-04T14:42:57.197037Z | false |
open-mmlab/mmdetection | https://github.com/open-mmlab/mmdetection/blob/cfd5d3a985b0249de009b67d04f37263e11cdf3d/mmdet/models/dense_heads/rpn_head.py | mmdet/models/dense_heads/rpn_head.py | # Copyright (c) OpenMMLab. All rights reserved.
import copy
from typing import List, Optional, Tuple
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 mmengine.config import ConfigDict
from mmengine.structures import InstanceData
fr... | python | Apache-2.0 | cfd5d3a985b0249de009b67d04f37263e11cdf3d | 2026-01-04T14:42:57.197037Z | false |
open-mmlab/mmdetection | https://github.com/open-mmlab/mmdetection/blob/cfd5d3a985b0249de009b67d04f37263e11cdf3d/mmdet/models/dense_heads/fcos_head.py | mmdet/models/dense_heads/fcos_head.py | # Copyright (c) OpenMMLab. All rights reserved.
from typing import Dict, List, Tuple
import torch
import torch.nn as nn
from mmcv.cnn import Scale
from mmengine.structures import InstanceData
from torch import Tensor
from mmdet.models.layers import NormedConv2d
from mmdet.registry import MODELS
from mmdet.utils impor... | python | Apache-2.0 | cfd5d3a985b0249de009b67d04f37263e11cdf3d | 2026-01-04T14:42:57.197037Z | false |
open-mmlab/mmdetection | https://github.com/open-mmlab/mmdetection/blob/cfd5d3a985b0249de009b67d04f37263e11cdf3d/mmdet/models/dense_heads/maskformer_head.py | mmdet/models/dense_heads/maskformer_head.py | # Copyright (c) OpenMMLab. All rights reserved.
from typing import Dict, List, Optional, Tuple, Union
import torch
import torch.nn as nn
import torch.nn.functional as F
from mmcv.cnn import Conv2d
from mmengine.model import caffe2_xavier_init
from mmengine.structures import InstanceData, PixelData
from torch import Te... | python | Apache-2.0 | cfd5d3a985b0249de009b67d04f37263e11cdf3d | 2026-01-04T14:42:57.197037Z | false |
open-mmlab/mmdetection | https://github.com/open-mmlab/mmdetection/blob/cfd5d3a985b0249de009b67d04f37263e11cdf3d/mmdet/models/dense_heads/condinst_head.py | mmdet/models/dense_heads/condinst_head.py | # Copyright (c) OpenMMLab. All rights reserved.
import copy
from typing import Dict, List, Optional, Tuple
import torch
import torch.nn as nn
import torch.nn.functional as F
from mmcv.cnn import ConvModule, Scale
from mmengine.config import ConfigDict
from mmengine.model import BaseModule, kaiming_init
from mmengine.s... | python | Apache-2.0 | cfd5d3a985b0249de009b67d04f37263e11cdf3d | 2026-01-04T14:42:57.197037Z | true |
open-mmlab/mmdetection | https://github.com/open-mmlab/mmdetection/blob/cfd5d3a985b0249de009b67d04f37263e11cdf3d/mmdet/models/dense_heads/deformable_detr_head.py | mmdet/models/dense_heads/deformable_detr_head.py | # Copyright (c) OpenMMLab. All rights reserved.
import copy
from typing import Dict, List, Tuple
import torch
import torch.nn as nn
from mmcv.cnn import Linear
from mmengine.model import bias_init_with_prob, constant_init
from torch import Tensor
from mmdet.registry import MODELS
from mmdet.structures import SampleLi... | python | Apache-2.0 | cfd5d3a985b0249de009b67d04f37263e11cdf3d | 2026-01-04T14:42:57.197037Z | false |
open-mmlab/mmdetection | https://github.com/open-mmlab/mmdetection/blob/cfd5d3a985b0249de009b67d04f37263e11cdf3d/mmdet/models/dense_heads/lad_head.py | mmdet/models/dense_heads/lad_head.py | # Copyright (c) OpenMMLab. All rights reserved.
from typing import List, Optional
import torch
from torch import Tensor
from mmdet.registry import MODELS
from mmdet.structures import SampleList
from mmdet.structures.bbox import bbox_overlaps
from mmdet.utils import InstanceList, OptInstanceList
from ..utils import le... | python | Apache-2.0 | cfd5d3a985b0249de009b67d04f37263e11cdf3d | 2026-01-04T14:42:57.197037Z | false |
open-mmlab/mmdetection | https://github.com/open-mmlab/mmdetection/blob/cfd5d3a985b0249de009b67d04f37263e11cdf3d/mmdet/models/dense_heads/autoassign_head.py | mmdet/models/dense_heads/autoassign_head.py | # Copyright (c) OpenMMLab. All rights reserved.
from typing import Dict, List, Sequence, Tuple
import torch
import torch.nn as nn
import torch.nn.functional as F
from mmcv.cnn import Scale
from mmengine.model import bias_init_with_prob, normal_init
from mmengine.structures import InstanceData
from torch import Tensor
... | python | Apache-2.0 | cfd5d3a985b0249de009b67d04f37263e11cdf3d | 2026-01-04T14:42:57.197037Z | false |
open-mmlab/mmdetection | https://github.com/open-mmlab/mmdetection/blob/cfd5d3a985b0249de009b67d04f37263e11cdf3d/mmdet/models/losses/accuracy.py | mmdet/models/losses/accuracy.py | # Copyright (c) OpenMMLab. All rights reserved.
import torch.nn as nn
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 ... | python | Apache-2.0 | cfd5d3a985b0249de009b67d04f37263e11cdf3d | 2026-01-04T14:42:57.197037Z | false |
open-mmlab/mmdetection | https://github.com/open-mmlab/mmdetection/blob/cfd5d3a985b0249de009b67d04f37263e11cdf3d/mmdet/models/losses/balanced_l1_loss.py | mmdet/models/losses/balanced_l1_loss.py | # Copyright (c) OpenMMLab. All rights reserved.
import numpy as np
import torch
import torch.nn as nn
from mmdet.registry import MODELS
from .utils import weighted_loss
@weighted_loss
def balanced_l1_loss(pred,
target,
beta=1.0,
alpha=0.5,
... | python | Apache-2.0 | cfd5d3a985b0249de009b67d04f37263e11cdf3d | 2026-01-04T14:42:57.197037Z | false |
open-mmlab/mmdetection | https://github.com/open-mmlab/mmdetection/blob/cfd5d3a985b0249de009b67d04f37263e11cdf3d/mmdet/models/losses/multipos_cross_entropy_loss.py | mmdet/models/losses/multipos_cross_entropy_loss.py | # Copyright (c) OpenMMLab. All rights reserved.
from typing import Optional
import torch
from mmengine.model import BaseModule
from torch import Tensor
from mmdet.registry import MODELS
from .utils import weight_reduce_loss
@MODELS.register_module()
class MultiPosCrossEntropyLoss(BaseModule):
"""multi-positive ... | python | Apache-2.0 | cfd5d3a985b0249de009b67d04f37263e11cdf3d | 2026-01-04T14:42:57.197037Z | false |
open-mmlab/mmdetection | https://github.com/open-mmlab/mmdetection/blob/cfd5d3a985b0249de009b67d04f37263e11cdf3d/mmdet/models/losses/ae_loss.py | mmdet/models/losses/ae_loss.py | # Copyright (c) OpenMMLab. All rights reserved.
import torch
import torch.nn as nn
import torch.nn.functional as F
from mmdet.registry import MODELS
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 pus... | python | Apache-2.0 | cfd5d3a985b0249de009b67d04f37263e11cdf3d | 2026-01-04T14:42:57.197037Z | false |
open-mmlab/mmdetection | https://github.com/open-mmlab/mmdetection/blob/cfd5d3a985b0249de009b67d04f37263e11cdf3d/mmdet/models/losses/seesaw_loss.py | mmdet/models/losses/seesaw_loss.py | # Copyright (c) OpenMMLab. All rights reserved.
from typing import Dict, Optional, Tuple, Union
import torch
import torch.nn as nn
import torch.nn.functional as F
from torch import Tensor
from mmdet.registry import MODELS
from .accuracy import accuracy
from .cross_entropy_loss import cross_entropy
from .utils import ... | python | Apache-2.0 | cfd5d3a985b0249de009b67d04f37263e11cdf3d | 2026-01-04T14:42:57.197037Z | false |
open-mmlab/mmdetection | https://github.com/open-mmlab/mmdetection/blob/cfd5d3a985b0249de009b67d04f37263e11cdf3d/mmdet/models/losses/kd_loss.py | mmdet/models/losses/kd_loss.py | # Copyright (c) OpenMMLab. All rights reserved.
from typing import Optional
import torch.nn as nn
import torch.nn.functional as F
from torch import Tensor
from mmdet.registry import MODELS
from .utils import weighted_loss
@weighted_loss
def knowledge_distillation_kl_div_loss(pred: Tensor,
... | python | Apache-2.0 | cfd5d3a985b0249de009b67d04f37263e11cdf3d | 2026-01-04T14:42:57.197037Z | false |
open-mmlab/mmdetection | https://github.com/open-mmlab/mmdetection/blob/cfd5d3a985b0249de009b67d04f37263e11cdf3d/mmdet/models/losses/l2_loss.py | mmdet/models/losses/l2_loss.py | # Copyright (c) OpenMMLab. All rights reserved.
from typing import Optional, Tuple, Union
import numpy as np
import torch
from mmengine.model import BaseModule
from torch import Tensor
from mmdet.registry import MODELS
from .utils import weighted_loss
@weighted_loss
def l2_loss(pred: Tensor, target: Tensor) -> Tens... | python | Apache-2.0 | cfd5d3a985b0249de009b67d04f37263e11cdf3d | 2026-01-04T14:42:57.197037Z | false |
open-mmlab/mmdetection | https://github.com/open-mmlab/mmdetection/blob/cfd5d3a985b0249de009b67d04f37263e11cdf3d/mmdet/models/losses/varifocal_loss.py | mmdet/models/losses/varifocal_loss.py | # Copyright (c) OpenMMLab. All rights reserved.
from typing import Optional
import torch.nn as nn
import torch.nn.functional as F
from torch import Tensor
from mmdet.registry import MODELS
from .utils import weight_reduce_loss
def varifocal_loss(pred: Tensor,
target: Tensor,
we... | python | Apache-2.0 | cfd5d3a985b0249de009b67d04f37263e11cdf3d | 2026-01-04T14:42:57.197037Z | false |
open-mmlab/mmdetection | https://github.com/open-mmlab/mmdetection/blob/cfd5d3a985b0249de009b67d04f37263e11cdf3d/mmdet/models/losses/ghm_loss.py | mmdet/models/losses/ghm_loss.py | # Copyright (c) OpenMMLab. All rights reserved.
import torch
import torch.nn as nn
import torch.nn.functional as F
from mmdet.registry import MODELS
from .utils import weight_reduce_loss
def _expand_onehot_labels(labels, label_weights, label_channels):
bin_labels = labels.new_full((labels.size(0), label_channels... | python | Apache-2.0 | cfd5d3a985b0249de009b67d04f37263e11cdf3d | 2026-01-04T14:42:57.197037Z | false |
open-mmlab/mmdetection | https://github.com/open-mmlab/mmdetection/blob/cfd5d3a985b0249de009b67d04f37263e11cdf3d/mmdet/models/losses/pisa_loss.py | mmdet/models/losses/pisa_loss.py | # Copyright (c) OpenMMLab. All rights reserved.
from typing import List, Optional, Tuple
import torch
import torch.nn as nn
from torch import Tensor
from mmdet.structures.bbox import bbox_overlaps
from ..task_modules.coders import BaseBBoxCoder
from ..task_modules.samplers import SamplingResult
def isr_p(cls_score:... | python | Apache-2.0 | cfd5d3a985b0249de009b67d04f37263e11cdf3d | 2026-01-04T14:42:57.197037Z | false |
open-mmlab/mmdetection | https://github.com/open-mmlab/mmdetection/blob/cfd5d3a985b0249de009b67d04f37263e11cdf3d/mmdet/models/losses/eqlv2_loss.py | mmdet/models/losses/eqlv2_loss.py | # Copyright (c) OpenMMLab. All rights reserved.
import logging
from functools import partial
from typing import Optional
import torch
import torch.distributed as dist
import torch.nn as nn
import torch.nn.functional as F
from mmengine.logging import print_log
from torch import Tensor
from mmdet.registry import MODELS... | python | Apache-2.0 | cfd5d3a985b0249de009b67d04f37263e11cdf3d | 2026-01-04T14:42:57.197037Z | false |
open-mmlab/mmdetection | https://github.com/open-mmlab/mmdetection/blob/cfd5d3a985b0249de009b67d04f37263e11cdf3d/mmdet/models/losses/mse_loss.py | mmdet/models/losses/mse_loss.py | # Copyright (c) OpenMMLab. All rights reserved.
from typing import Optional
import torch.nn as nn
import torch.nn.functional as F
from torch import Tensor
from mmdet.registry import MODELS
from .utils import weighted_loss
@weighted_loss
def mse_loss(pred: Tensor, target: Tensor) -> Tensor:
"""A Wrapper of MSE l... | python | Apache-2.0 | cfd5d3a985b0249de009b67d04f37263e11cdf3d | 2026-01-04T14:42:57.197037Z | false |
open-mmlab/mmdetection | https://github.com/open-mmlab/mmdetection/blob/cfd5d3a985b0249de009b67d04f37263e11cdf3d/mmdet/models/losses/smooth_l1_loss.py | mmdet/models/losses/smooth_l1_loss.py | # Copyright (c) OpenMMLab. All rights reserved.
from typing import Optional
import torch
import torch.nn as nn
from torch import Tensor
from mmdet.registry import MODELS
from .utils import weighted_loss
@weighted_loss
def smooth_l1_loss(pred: Tensor, target: Tensor, beta: float = 1.0) -> Tensor:
"""Smooth L1 lo... | python | Apache-2.0 | cfd5d3a985b0249de009b67d04f37263e11cdf3d | 2026-01-04T14:42:57.197037Z | false |
open-mmlab/mmdetection | https://github.com/open-mmlab/mmdetection/blob/cfd5d3a985b0249de009b67d04f37263e11cdf3d/mmdet/models/losses/cross_entropy_loss.py | mmdet/models/losses/cross_entropy_loss.py | # Copyright (c) OpenMMLab. All rights reserved.
import warnings
import torch
import torch.nn as nn
import torch.nn.functional as F
from mmdet.registry import MODELS
from .accuracy import accuracy
from .utils import weight_reduce_loss
def cross_entropy(pred,
label,
weight=None,
... | python | Apache-2.0 | cfd5d3a985b0249de009b67d04f37263e11cdf3d | 2026-01-04T14:42:57.197037Z | false |
open-mmlab/mmdetection | https://github.com/open-mmlab/mmdetection/blob/cfd5d3a985b0249de009b67d04f37263e11cdf3d/mmdet/models/losses/gfocal_loss.py | mmdet/models/losses/gfocal_loss.py | # Copyright (c) OpenMMLab. All rights reserved.
from functools import partial
import torch
import torch.nn as nn
import torch.nn.functional as F
from mmdet.models.losses.utils import weighted_loss
from mmdet.registry import MODELS
@weighted_loss
def quality_focal_loss(pred, target, beta=2.0):
r"""Quality Focal ... | python | Apache-2.0 | cfd5d3a985b0249de009b67d04f37263e11cdf3d | 2026-01-04T14:42:57.197037Z | false |
open-mmlab/mmdetection | https://github.com/open-mmlab/mmdetection/blob/cfd5d3a985b0249de009b67d04f37263e11cdf3d/mmdet/models/losses/focal_loss.py | mmdet/models/losses/focal_loss.py | # Copyright (c) OpenMMLab. All rights reserved.
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 mmdet.registry import MODELS
from .accuracy import accuracy
from .utils import weight_reduce_loss
# This method is only for debugging
... | python | Apache-2.0 | cfd5d3a985b0249de009b67d04f37263e11cdf3d | 2026-01-04T14:42:57.197037Z | false |
open-mmlab/mmdetection | https://github.com/open-mmlab/mmdetection/blob/cfd5d3a985b0249de009b67d04f37263e11cdf3d/mmdet/models/losses/gaussian_focal_loss.py | mmdet/models/losses/gaussian_focal_loss.py | # Copyright (c) OpenMMLab. All rights reserved.
from typing import Optional, Union
import torch.nn as nn
from torch import Tensor
from mmdet.registry import MODELS
from .utils import weight_reduce_loss, weighted_loss
@weighted_loss
def gaussian_focal_loss(pred: Tensor,
gaussian_target: Tenso... | python | Apache-2.0 | cfd5d3a985b0249de009b67d04f37263e11cdf3d | 2026-01-04T14:42:57.197037Z | false |
open-mmlab/mmdetection | https://github.com/open-mmlab/mmdetection/blob/cfd5d3a985b0249de009b67d04f37263e11cdf3d/mmdet/models/losses/utils.py | mmdet/models/losses/utils.py | # Copyright (c) OpenMMLab. All rights reserved.
import functools
from typing import Callable, Optional
import torch
import torch.nn.functional as F
from torch import Tensor
def reduce_loss(loss: Tensor, reduction: str) -> Tensor:
"""Reduce loss as specified.
Args:
loss (Tensor): Elementwise loss ten... | python | Apache-2.0 | cfd5d3a985b0249de009b67d04f37263e11cdf3d | 2026-01-04T14:42:57.197037Z | false |
open-mmlab/mmdetection | https://github.com/open-mmlab/mmdetection/blob/cfd5d3a985b0249de009b67d04f37263e11cdf3d/mmdet/models/losses/dice_loss.py | mmdet/models/losses/dice_loss.py | # Copyright (c) OpenMMLab. All rights reserved.
import torch
import torch.nn as nn
from mmdet.registry import MODELS
from .utils import weight_reduce_loss
def dice_loss(pred,
target,
weight=None,
eps=1e-3,
reduction='mean',
naive_dice=False,
... | python | Apache-2.0 | cfd5d3a985b0249de009b67d04f37263e11cdf3d | 2026-01-04T14:42:57.197037Z | false |
open-mmlab/mmdetection | https://github.com/open-mmlab/mmdetection/blob/cfd5d3a985b0249de009b67d04f37263e11cdf3d/mmdet/models/losses/margin_loss.py | mmdet/models/losses/margin_loss.py | # Copyright (c) OpenMMLab. All rights reserved.
from typing import Optional, Tuple, Union
import numpy as np
import torch
from mmengine.model import BaseModule
from torch import Tensor
from mmdet.registry import MODELS
from .mse_loss import mse_loss
@MODELS.register_module()
class MarginL2Loss(BaseModule):
"""L... | python | Apache-2.0 | cfd5d3a985b0249de009b67d04f37263e11cdf3d | 2026-01-04T14:42:57.197037Z | false |
open-mmlab/mmdetection | https://github.com/open-mmlab/mmdetection/blob/cfd5d3a985b0249de009b67d04f37263e11cdf3d/mmdet/models/losses/triplet_loss.py | mmdet/models/losses/triplet_loss.py | # Copyright (c) OpenMMLab. All rights reserved.
import torch
import torch.nn as nn
from mmengine.model import BaseModule
from mmdet.registry import MODELS
@MODELS.register_module()
class TripletLoss(BaseModule):
"""Triplet loss with hard positive/negative mining.
Reference:
Hermans et al. In Defense... | python | Apache-2.0 | cfd5d3a985b0249de009b67d04f37263e11cdf3d | 2026-01-04T14:42:57.197037Z | false |
open-mmlab/mmdetection | https://github.com/open-mmlab/mmdetection/blob/cfd5d3a985b0249de009b67d04f37263e11cdf3d/mmdet/models/losses/__init__.py | mmdet/models/losses/__init__.py | # Copyright (c) OpenMMLab. All rights reserved.
from .accuracy import Accuracy, accuracy
from .ae_loss import AssociativeEmbeddingLoss
from .balanced_l1_loss import BalancedL1Loss, balanced_l1_loss
from .cross_entropy_loss import (CrossEntropyCustomLoss, CrossEntropyLoss,
binary_cross_e... | python | Apache-2.0 | cfd5d3a985b0249de009b67d04f37263e11cdf3d | 2026-01-04T14:42:57.197037Z | false |
open-mmlab/mmdetection | https://github.com/open-mmlab/mmdetection/blob/cfd5d3a985b0249de009b67d04f37263e11cdf3d/mmdet/models/losses/iou_loss.py | mmdet/models/losses/iou_loss.py | # Copyright (c) OpenMMLab. All rights reserved.
import math
import warnings
from typing import Optional
import torch
import torch.nn as nn
from torch import Tensor
from mmdet.registry import MODELS
from mmdet.structures.bbox import bbox_overlaps
from .utils import weighted_loss
@weighted_loss
def iou_loss(pred: Ten... | python | Apache-2.0 | cfd5d3a985b0249de009b67d04f37263e11cdf3d | 2026-01-04T14:42:57.197037Z | false |
open-mmlab/mmdetection | https://github.com/open-mmlab/mmdetection/blob/cfd5d3a985b0249de009b67d04f37263e11cdf3d/mmdet/models/losses/ddq_detr_aux_loss.py | mmdet/models/losses/ddq_detr_aux_loss.py | # Copyright (c) OpenMMLab. All rights reserved.
import torch
import torch.nn as nn
from mmengine.structures import BaseDataElement
from mmdet.models.utils import multi_apply
from mmdet.registry import MODELS, TASK_UTILS
from mmdet.utils import reduce_mean
class DDQAuxLoss(nn.Module):
"""DDQ auxiliary branches lo... | python | Apache-2.0 | cfd5d3a985b0249de009b67d04f37263e11cdf3d | 2026-01-04T14:42:57.197037Z | false |
open-mmlab/mmdetection | https://github.com/open-mmlab/mmdetection/blob/cfd5d3a985b0249de009b67d04f37263e11cdf3d/mmdet/models/utils/image.py | mmdet/models/utils/image.py | # Copyright (c) OpenMMLab. All rights reserved.
from typing import Union
import mmcv
import numpy as np
import torch
from torch import Tensor
def imrenormalize(img: Union[Tensor, np.ndarray], img_norm_cfg: dict,
new_img_norm_cfg: dict) -> Union[Tensor, np.ndarray]:
"""Re-normalize the image.
... | python | Apache-2.0 | cfd5d3a985b0249de009b67d04f37263e11cdf3d | 2026-01-04T14:42:57.197037Z | false |
open-mmlab/mmdetection | https://github.com/open-mmlab/mmdetection/blob/cfd5d3a985b0249de009b67d04f37263e11cdf3d/mmdet/models/utils/panoptic_gt_processing.py | mmdet/models/utils/panoptic_gt_processing.py | # Copyright (c) OpenMMLab. All rights reserved.
from typing import Tuple
import torch
from torch import Tensor
def preprocess_panoptic_gt(gt_labels: Tensor, gt_masks: Tensor,
gt_semantic_seg: Tensor, num_things: int,
num_stuff: int) -> Tuple[Tensor, Tensor]:
... | python | Apache-2.0 | cfd5d3a985b0249de009b67d04f37263e11cdf3d | 2026-01-04T14:42:57.197037Z | false |
open-mmlab/mmdetection | https://github.com/open-mmlab/mmdetection/blob/cfd5d3a985b0249de009b67d04f37263e11cdf3d/mmdet/models/utils/vlfuse_helper.py | mmdet/models/utils/vlfuse_helper.py | # Copyright (c) OpenMMLab. All rights reserved.
# Modified from https://github.com/microsoft/GLIP/blob/main/maskrcnn_benchmark/utils/fuse_helper.py # noqa
# and https://github.com/microsoft/GLIP/blob/main/maskrcnn_benchmark/modeling/rpn/modeling_bert.py # noqa
import math
from typing import Dict, Optional, Tuple
imp... | python | Apache-2.0 | cfd5d3a985b0249de009b67d04f37263e11cdf3d | 2026-01-04T14:42:57.197037Z | false |
open-mmlab/mmdetection | https://github.com/open-mmlab/mmdetection/blob/cfd5d3a985b0249de009b67d04f37263e11cdf3d/mmdet/models/utils/wbf.py | mmdet/models/utils/wbf.py | # Copyright (c) OpenMMLab. All rights reserved.
import warnings
from typing import Tuple
import numpy as np
import torch
from torch import Tensor
# References: https://github.com/ZFTurbo/Weighted-Boxes-Fusion
def weighted_boxes_fusion(
bboxes_list: list,
scores_list: list,
labels_list: list,... | python | Apache-2.0 | cfd5d3a985b0249de009b67d04f37263e11cdf3d | 2026-01-04T14:42:57.197037Z | false |
open-mmlab/mmdetection | https://github.com/open-mmlab/mmdetection/blob/cfd5d3a985b0249de009b67d04f37263e11cdf3d/mmdet/models/utils/gaussian_target.py | 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... | python | Apache-2.0 | cfd5d3a985b0249de009b67d04f37263e11cdf3d | 2026-01-04T14:42:57.197037Z | false |
open-mmlab/mmdetection | https://github.com/open-mmlab/mmdetection/blob/cfd5d3a985b0249de009b67d04f37263e11cdf3d/mmdet/models/utils/make_divisible.py | mmdet/models/utils/make_divisible.py | # Copyright (c) OpenMMLab. All rights reserved.
def make_divisible(value, divisor, min_value=None, min_ratio=0.9):
"""Make divisible function.
This function rounds the channel number to the nearest value that can be
divisible by the divisor. It is taken from the original tf repo. It ensures
that all la... | python | Apache-2.0 | cfd5d3a985b0249de009b67d04f37263e11cdf3d | 2026-01-04T14:42:57.197037Z | false |
open-mmlab/mmdetection | https://github.com/open-mmlab/mmdetection/blob/cfd5d3a985b0249de009b67d04f37263e11cdf3d/mmdet/models/utils/misc.py | mmdet/models/utils/misc.py | # Copyright (c) OpenMMLab. All rights reserved.
from functools import partial
from typing import List, Optional, Sequence, Tuple, Union
import numpy as np
import torch
from mmengine.structures import InstanceData
from mmengine.utils import digit_version
from six.moves import map, zip
from torch import Tensor
from torc... | python | Apache-2.0 | cfd5d3a985b0249de009b67d04f37263e11cdf3d | 2026-01-04T14:42:57.197037Z | false |
open-mmlab/mmdetection | https://github.com/open-mmlab/mmdetection/blob/cfd5d3a985b0249de009b67d04f37263e11cdf3d/mmdet/models/utils/point_sample.py | mmdet/models/utils/point_sample.py | # Copyright (c) OpenMMLab. All rights reserved.
import torch
from mmcv.ops import point_sample
from torch import Tensor
def get_uncertainty(mask_preds: Tensor, labels: Tensor) -> Tensor:
"""Estimate uncertainty based on pred logits.
We estimate uncertainty as L1 distance between 0.0 and the logits
predic... | python | Apache-2.0 | cfd5d3a985b0249de009b67d04f37263e11cdf3d | 2026-01-04T14:42:57.197037Z | false |
open-mmlab/mmdetection | https://github.com/open-mmlab/mmdetection/blob/cfd5d3a985b0249de009b67d04f37263e11cdf3d/mmdet/models/utils/__init__.py | mmdet/models/utils/__init__.py | # Copyright (c) OpenMMLab. All rights reserved.
from .gaussian_target import (gather_feat, gaussian_radius,
gen_gaussian_target, get_local_maximum,
get_topk_from_heatmap, transpose_and_gather_feat)
from .image import imrenormalize
from .make_divisible import m... | python | Apache-2.0 | cfd5d3a985b0249de009b67d04f37263e11cdf3d | 2026-01-04T14:42:57.197037Z | false |
open-mmlab/mmdetection | https://github.com/open-mmlab/mmdetection/blob/cfd5d3a985b0249de009b67d04f37263e11cdf3d/mmdet/models/vis/mask2former_vis.py | mmdet/models/vis/mask2former_vis.py | # Copyright (c) OpenMMLab. All rights reserved.
from typing import Optional, Union
from torch import Tensor
from mmdet.models.mot import BaseMOTModel
from mmdet.registry import MODELS
from mmdet.structures import TrackDataSample, TrackSampleList
from mmdet.utils import OptConfigType, OptMultiConfig
@MODELS.register... | python | Apache-2.0 | cfd5d3a985b0249de009b67d04f37263e11cdf3d | 2026-01-04T14:42:57.197037Z | false |
open-mmlab/mmdetection | https://github.com/open-mmlab/mmdetection/blob/cfd5d3a985b0249de009b67d04f37263e11cdf3d/mmdet/models/vis/__init__.py | mmdet/models/vis/__init__.py | # Copyright (c) OpenMMLab. All rights reserved.
from .mask2former_vis import Mask2FormerVideo
from .masktrack_rcnn import MaskTrackRCNN
__all__ = ['Mask2FormerVideo', 'MaskTrackRCNN']
| python | Apache-2.0 | cfd5d3a985b0249de009b67d04f37263e11cdf3d | 2026-01-04T14:42:57.197037Z | false |
open-mmlab/mmdetection | https://github.com/open-mmlab/mmdetection/blob/cfd5d3a985b0249de009b67d04f37263e11cdf3d/mmdet/models/vis/masktrack_rcnn.py | mmdet/models/vis/masktrack_rcnn.py | # Copyright (c) OpenMMLab. All rights reserved.
from typing import Optional
import torch
from torch import Tensor
from mmdet.models.mot import BaseMOTModel
from mmdet.registry import MODELS
from mmdet.structures import TrackSampleList
from mmdet.utils import OptConfigType, OptMultiConfig
@MODELS.register_module()
c... | python | Apache-2.0 | cfd5d3a985b0249de009b67d04f37263e11cdf3d | 2026-01-04T14:42:57.197037Z | false |
open-mmlab/mmdetection | https://github.com/open-mmlab/mmdetection/blob/cfd5d3a985b0249de009b67d04f37263e11cdf3d/mmdet/models/mot/ocsort.py | mmdet/models/mot/ocsort.py | # Copyright (c) OpenMMLab. All rights reserved.
from typing import Dict, Optional
from torch import Tensor
from mmdet.registry import MODELS
from mmdet.structures import TrackSampleList
from mmdet.utils import OptConfigType, OptMultiConfig
from .base import BaseMOTModel
@MODELS.register_module()
class OCSORT(BaseM... | python | Apache-2.0 | cfd5d3a985b0249de009b67d04f37263e11cdf3d | 2026-01-04T14:42:57.197037Z | false |
open-mmlab/mmdetection | https://github.com/open-mmlab/mmdetection/blob/cfd5d3a985b0249de009b67d04f37263e11cdf3d/mmdet/models/mot/strongsort.py | mmdet/models/mot/strongsort.py | # Copyright (c) OpenMMLab. All rights reserved.
from typing import Optional
import numpy as np
from mmengine.structures import InstanceData
from torch import Tensor
from mmdet.registry import MODELS, TASK_UTILS
from mmdet.structures import TrackSampleList
from mmdet.utils import OptConfigType
from .deep_sort import D... | python | Apache-2.0 | cfd5d3a985b0249de009b67d04f37263e11cdf3d | 2026-01-04T14:42:57.197037Z | false |
open-mmlab/mmdetection | https://github.com/open-mmlab/mmdetection/blob/cfd5d3a985b0249de009b67d04f37263e11cdf3d/mmdet/models/mot/deep_sort.py | mmdet/models/mot/deep_sort.py | # Copyright (c) OpenMMLab. All rights reserved.
from typing import Optional
from torch import Tensor
from mmdet.registry import MODELS
from mmdet.structures import TrackSampleList
from mmdet.utils import OptConfigType
from .base import BaseMOTModel
@MODELS.register_module()
class DeepSORT(BaseMOTModel):
"""Simp... | python | Apache-2.0 | cfd5d3a985b0249de009b67d04f37263e11cdf3d | 2026-01-04T14:42:57.197037Z | false |
open-mmlab/mmdetection | https://github.com/open-mmlab/mmdetection/blob/cfd5d3a985b0249de009b67d04f37263e11cdf3d/mmdet/models/mot/bytetrack.py | mmdet/models/mot/bytetrack.py | # Copyright (c) OpenMMLab. All rights reserved.
from typing import Dict, Optional
from torch import Tensor
from mmdet.registry import MODELS
from mmdet.structures import SampleList, TrackSampleList
from mmdet.utils import OptConfigType, OptMultiConfig
from .base import BaseMOTModel
@MODELS.register_module()
class B... | python | Apache-2.0 | cfd5d3a985b0249de009b67d04f37263e11cdf3d | 2026-01-04T14:42:57.197037Z | false |
open-mmlab/mmdetection | https://github.com/open-mmlab/mmdetection/blob/cfd5d3a985b0249de009b67d04f37263e11cdf3d/mmdet/models/mot/__init__.py | mmdet/models/mot/__init__.py | # Copyright (c) OpenMMLab. All rights reserved.
from .base import BaseMOTModel
from .bytetrack import ByteTrack
from .deep_sort import DeepSORT
from .ocsort import OCSORT
from .qdtrack import QDTrack
from .strongsort import StrongSORT
__all__ = [
'BaseMOTModel', 'ByteTrack', 'QDTrack', 'DeepSORT', 'StrongSORT', 'O... | python | Apache-2.0 | cfd5d3a985b0249de009b67d04f37263e11cdf3d | 2026-01-04T14:42:57.197037Z | false |
open-mmlab/mmdetection | https://github.com/open-mmlab/mmdetection/blob/cfd5d3a985b0249de009b67d04f37263e11cdf3d/mmdet/models/mot/qdtrack.py | mmdet/models/mot/qdtrack.py | # Copyright (c) OpenMMLab. All rights reserved.
from typing import Optional, Union
import torch
from torch import Tensor
from mmdet.registry import MODELS
from mmdet.structures import TrackSampleList
from mmdet.utils import OptConfigType, OptMultiConfig
from .base import BaseMOTModel
@MODELS.register_module()
class... | python | Apache-2.0 | cfd5d3a985b0249de009b67d04f37263e11cdf3d | 2026-01-04T14:42:57.197037Z | false |
open-mmlab/mmdetection | https://github.com/open-mmlab/mmdetection/blob/cfd5d3a985b0249de009b67d04f37263e11cdf3d/mmdet/models/mot/base.py | mmdet/models/mot/base.py | # Copyright (c) OpenMMLab. All rights reserved.
from abc import ABCMeta, abstractmethod
from typing import Dict, List, Tuple, Union
from mmengine.model import BaseModel
from torch import Tensor
from mmdet.registry import MODELS
from mmdet.structures import OptTrackSampleList, TrackSampleList
from mmdet.utils import O... | python | Apache-2.0 | cfd5d3a985b0249de009b67d04f37263e11cdf3d | 2026-01-04T14:42:57.197037Z | false |
open-mmlab/mmdetection | https://github.com/open-mmlab/mmdetection/blob/cfd5d3a985b0249de009b67d04f37263e11cdf3d/mmdet/models/task_modules/__init__.py | mmdet/models/task_modules/__init__.py | # Copyright (c) OpenMMLab. All rights reserved.
from .assigners import * # noqa: F401,F403
from .builder import (ANCHOR_GENERATORS, BBOX_ASSIGNERS, BBOX_CODERS,
BBOX_SAMPLERS, IOU_CALCULATORS, MATCH_COSTS,
PRIOR_GENERATORS, build_anchor_generator, build_assigner,
... | python | Apache-2.0 | cfd5d3a985b0249de009b67d04f37263e11cdf3d | 2026-01-04T14:42:57.197037Z | false |
open-mmlab/mmdetection | https://github.com/open-mmlab/mmdetection/blob/cfd5d3a985b0249de009b67d04f37263e11cdf3d/mmdet/models/task_modules/builder.py | mmdet/models/task_modules/builder.py | # Copyright (c) OpenMMLab. All rights reserved.
import warnings
from mmdet.registry import TASK_UTILS
PRIOR_GENERATORS = TASK_UTILS
ANCHOR_GENERATORS = TASK_UTILS
BBOX_ASSIGNERS = TASK_UTILS
BBOX_SAMPLERS = TASK_UTILS
BBOX_CODERS = TASK_UTILS
MATCH_COSTS = TASK_UTILS
IOU_CALCULATORS = TASK_UTILS
def build_bbox_code... | python | Apache-2.0 | cfd5d3a985b0249de009b67d04f37263e11cdf3d | 2026-01-04T14:42:57.197037Z | false |
open-mmlab/mmdetection | https://github.com/open-mmlab/mmdetection/blob/cfd5d3a985b0249de009b67d04f37263e11cdf3d/mmdet/models/task_modules/tracking/kalman_filter.py | mmdet/models/task_modules/tracking/kalman_filter.py | # Copyright (c) OpenMMLab. All rights reserved.
from typing import Tuple
import numpy as np
import torch
try:
import scipy.linalg
HAS_SCIPY = True
except ImportError:
HAS_SCIPY = False
from mmdet.registry import TASK_UTILS
@TASK_UTILS.register_module()
class KalmanFilter:
"""A simple Kalman filter ... | python | Apache-2.0 | cfd5d3a985b0249de009b67d04f37263e11cdf3d | 2026-01-04T14:42:57.197037Z | false |
open-mmlab/mmdetection | https://github.com/open-mmlab/mmdetection/blob/cfd5d3a985b0249de009b67d04f37263e11cdf3d/mmdet/models/task_modules/tracking/camera_motion_compensation.py | mmdet/models/task_modules/tracking/camera_motion_compensation.py | # Copyright (c) OpenMMLab. All rights reserved.
import cv2
import numpy as np
import torch
from torch import Tensor
from mmdet.registry import TASK_UTILS
from mmdet.structures.bbox import bbox_cxcyah_to_xyxy, bbox_xyxy_to_cxcyah
@TASK_UTILS.register_module()
class CameraMotionCompensation:
"""Camera motion compe... | python | Apache-2.0 | cfd5d3a985b0249de009b67d04f37263e11cdf3d | 2026-01-04T14:42:57.197037Z | false |
open-mmlab/mmdetection | https://github.com/open-mmlab/mmdetection/blob/cfd5d3a985b0249de009b67d04f37263e11cdf3d/mmdet/models/task_modules/tracking/interpolation.py | mmdet/models/task_modules/tracking/interpolation.py | # Copyright (c) OpenMMLab. All rights reserved.
import numpy as np
try:
from sklearn.gaussian_process import GaussianProcessRegressor as GPR
from sklearn.gaussian_process.kernels import RBF
HAS_SKIKIT_LEARN = True
except ImportError:
HAS_SKIKIT_LEARN = False
from mmdet.registry import TASK_UTILS
@TA... | python | Apache-2.0 | cfd5d3a985b0249de009b67d04f37263e11cdf3d | 2026-01-04T14:42:57.197037Z | false |
open-mmlab/mmdetection | https://github.com/open-mmlab/mmdetection/blob/cfd5d3a985b0249de009b67d04f37263e11cdf3d/mmdet/models/task_modules/tracking/similarity.py | mmdet/models/task_modules/tracking/similarity.py | # Copyright (c) OpenMMLab. All rights reserved.
import torch
import torch.nn.functional as F
from torch import Tensor
def embed_similarity(key_embeds: Tensor,
ref_embeds: Tensor,
method: str = 'dot_product',
temperature: int = -1) -> Tensor:
"""Calcul... | python | Apache-2.0 | cfd5d3a985b0249de009b67d04f37263e11cdf3d | 2026-01-04T14:42:57.197037Z | false |
open-mmlab/mmdetection | https://github.com/open-mmlab/mmdetection/blob/cfd5d3a985b0249de009b67d04f37263e11cdf3d/mmdet/models/task_modules/tracking/__init__.py | mmdet/models/task_modules/tracking/__init__.py | # Copyright (c) OpenMMLab. All rights reserved.
from .aflink import AppearanceFreeLink
from .camera_motion_compensation import CameraMotionCompensation
from .interpolation import InterpolateTracklets
from .kalman_filter import KalmanFilter
from .similarity import embed_similarity
__all__ = [
'KalmanFilter', 'Inter... | python | Apache-2.0 | cfd5d3a985b0249de009b67d04f37263e11cdf3d | 2026-01-04T14:42:57.197037Z | false |
open-mmlab/mmdetection | https://github.com/open-mmlab/mmdetection/blob/cfd5d3a985b0249de009b67d04f37263e11cdf3d/mmdet/models/task_modules/tracking/aflink.py | mmdet/models/task_modules/tracking/aflink.py | # Copyright (c) OpenMMLab. All rights reserved.
from collections import defaultdict
from typing import Tuple
import numpy as np
import torch
from mmengine.model import BaseModule
from mmengine.runner.checkpoint import load_checkpoint
from scipy.optimize import linear_sum_assignment
from torch import Tensor, nn
from m... | python | Apache-2.0 | cfd5d3a985b0249de009b67d04f37263e11cdf3d | 2026-01-04T14:42:57.197037Z | false |
open-mmlab/mmdetection | https://github.com/open-mmlab/mmdetection/blob/cfd5d3a985b0249de009b67d04f37263e11cdf3d/mmdet/models/task_modules/assigners/grid_assigner.py | mmdet/models/task_modules/assigners/grid_assigner.py | # Copyright (c) OpenMMLab. All rights reserved.
from typing import Optional, Tuple, Union
import torch
from mmengine.structures import InstanceData
from mmdet.registry import TASK_UTILS
from mmdet.utils import ConfigType
from .assign_result import AssignResult
from .base_assigner import BaseAssigner
@TASK_UTILS.reg... | python | Apache-2.0 | cfd5d3a985b0249de009b67d04f37263e11cdf3d | 2026-01-04T14:42:57.197037Z | false |
open-mmlab/mmdetection | https://github.com/open-mmlab/mmdetection/blob/cfd5d3a985b0249de009b67d04f37263e11cdf3d/mmdet/models/task_modules/assigners/region_assigner.py | mmdet/models/task_modules/assigners/region_assigner.py | # Copyright (c) OpenMMLab. All rights reserved.
from typing import List, Optional, Tuple
import torch
from mmengine.structures import InstanceData
from torch import Tensor
from mmdet.registry import TASK_UTILS
from ..prior_generators import anchor_inside_flags
from .assign_result import AssignResult
from .base_assign... | python | Apache-2.0 | cfd5d3a985b0249de009b67d04f37263e11cdf3d | 2026-01-04T14:42:57.197037Z | false |
open-mmlab/mmdetection | https://github.com/open-mmlab/mmdetection/blob/cfd5d3a985b0249de009b67d04f37263e11cdf3d/mmdet/models/task_modules/assigners/point_assigner.py | mmdet/models/task_modules/assigners/point_assigner.py | # Copyright (c) OpenMMLab. All rights reserved.
from typing import Optional
import torch
from mmengine.structures import InstanceData
from mmdet.registry import TASK_UTILS
from .assign_result import AssignResult
from .base_assigner import BaseAssigner
@TASK_UTILS.register_module()
class PointAssigner(BaseAssigner):... | python | Apache-2.0 | cfd5d3a985b0249de009b67d04f37263e11cdf3d | 2026-01-04T14:42:57.197037Z | false |
open-mmlab/mmdetection | https://github.com/open-mmlab/mmdetection/blob/cfd5d3a985b0249de009b67d04f37263e11cdf3d/mmdet/models/task_modules/assigners/match_cost.py | mmdet/models/task_modules/assigners/match_cost.py | # Copyright (c) OpenMMLab. All rights reserved.
from abc import abstractmethod
from typing import Optional, Union
import torch
import torch.nn.functional as F
from mmengine.structures import InstanceData
from torch import Tensor
from mmdet.registry import TASK_UTILS
from mmdet.structures.bbox import bbox_overlaps, bb... | python | Apache-2.0 | cfd5d3a985b0249de009b67d04f37263e11cdf3d | 2026-01-04T14:42:57.197037Z | false |
open-mmlab/mmdetection | https://github.com/open-mmlab/mmdetection/blob/cfd5d3a985b0249de009b67d04f37263e11cdf3d/mmdet/models/task_modules/assigners/multi_instance_assigner.py | mmdet/models/task_modules/assigners/multi_instance_assigner.py | # Copyright (c) OpenMMLab. All rights reserved.
from typing import Optional
import torch
from mmengine.structures import InstanceData
from mmdet.registry import TASK_UTILS
from .assign_result import AssignResult
from .max_iou_assigner import MaxIoUAssigner
@TASK_UTILS.register_module()
class MultiInstanceAssigner(M... | python | Apache-2.0 | cfd5d3a985b0249de009b67d04f37263e11cdf3d | 2026-01-04T14:42:57.197037Z | false |
open-mmlab/mmdetection | https://github.com/open-mmlab/mmdetection/blob/cfd5d3a985b0249de009b67d04f37263e11cdf3d/mmdet/models/task_modules/assigners/base_assigner.py | mmdet/models/task_modules/assigners/base_assigner.py | # Copyright (c) OpenMMLab. All rights reserved.
from abc import ABCMeta, abstractmethod
from typing import Optional
from mmengine.structures import InstanceData
class BaseAssigner(metaclass=ABCMeta):
"""Base assigner that assigns boxes to ground truth boxes."""
@abstractmethod
def assign(self,
... | python | Apache-2.0 | cfd5d3a985b0249de009b67d04f37263e11cdf3d | 2026-01-04T14:42:57.197037Z | false |
open-mmlab/mmdetection | https://github.com/open-mmlab/mmdetection/blob/cfd5d3a985b0249de009b67d04f37263e11cdf3d/mmdet/models/task_modules/assigners/dynamic_soft_label_assigner.py | mmdet/models/task_modules/assigners/dynamic_soft_label_assigner.py | # Copyright (c) OpenMMLab. All rights reserved.
from typing import Optional, Tuple
import torch
import torch.nn.functional as F
from mmengine.structures import InstanceData
from torch import Tensor
from mmdet.registry import TASK_UTILS
from mmdet.structures.bbox import BaseBoxes
from mmdet.utils import ConfigType
fro... | python | Apache-2.0 | cfd5d3a985b0249de009b67d04f37263e11cdf3d | 2026-01-04T14:42:57.197037Z | false |
open-mmlab/mmdetection | https://github.com/open-mmlab/mmdetection/blob/cfd5d3a985b0249de009b67d04f37263e11cdf3d/mmdet/models/task_modules/assigners/assign_result.py | mmdet/models/task_modules/assigners/assign_result.py | # Copyright (c) OpenMMLab. All rights reserved.
import torch
from torch import Tensor
from mmdet.utils import util_mixins
class AssignResult(util_mixins.NiceRepr):
"""Stores assignments between predicted and truth boxes.
Attributes:
num_gts (int): the number of truth boxes considered when computing ... | python | Apache-2.0 | cfd5d3a985b0249de009b67d04f37263e11cdf3d | 2026-01-04T14:42:57.197037Z | false |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.