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 |
|---|---|---|---|---|---|---|
RoboBEV | RoboBEV-master/zoo/SOLOFusion/mmdet3d/models/dense_heads/ssd_3d_head.py | # Copyright (c) OpenMMLab. All rights reserved.
import numpy as np
import torch
from mmcv.ops.nms import batched_nms
from mmcv.runner import force_fp32
from torch.nn import functional as F
from mmdet3d.core.bbox.structures import (DepthInstance3DBoxes,
LiDARInstance3DBoxes,
... | 24,910 | 41.95 | 79 | py |
RoboBEV | RoboBEV-master/zoo/SOLOFusion/mmdet3d/models/dense_heads/fcos_mono3d_head.py | # Copyright (c) OpenMMLab. All rights reserved.
import numpy as np
import torch
from mmcv.cnn import Scale
from mmcv.runner import force_fp32
from torch import nn as nn
from mmdet3d.core import box3d_multiclass_nms, limit_period, xywhr2xyxyr
from mmdet.core import multi_apply
from mmdet.models.builder import HEADS, bu... | 42,442 | 43.582983 | 113 | py |
RoboBEV | RoboBEV-master/zoo/SOLOFusion/mmdet3d/models/dense_heads/shape_aware_head.py | # Copyright (c) OpenMMLab. All rights reserved.
import numpy as np
import torch
import warnings
from mmcv.cnn import ConvModule
from mmcv.runner import BaseModule
from torch import nn as nn
from mmdet3d.core import box3d_multiclass_nms, limit_period, xywhr2xyxyr
from mmdet.core import multi_apply
from mmdet.models imp... | 21,176 | 40.200389 | 79 | py |
RoboBEV | RoboBEV-master/zoo/SOLOFusion/mmdet3d/models/dense_heads/centerpoint_head.py | # Copyright (c) OpenMMLab. All rights reserved.
import copy
import torch
from mmcv.cnn import ConvModule, build_conv_layer
from mmcv.runner import BaseModule, force_fp32
from torch import nn
from mmdet3d.core import (circle_nms, draw_heatmap_gaussian, gaussian_radius,
xywhr2xyxyr)
from mmdet3... | 34,782 | 39.1188 | 125 | py |
RoboBEV | RoboBEV-master/zoo/SOLOFusion/mmdet3d/models/dense_heads/free_anchor3d_head.py | # Copyright (c) OpenMMLab. All rights reserved.
import torch
from mmcv.runner import force_fp32
from torch.nn import functional as F
from mmdet3d.core.bbox import bbox_overlaps_nearest_3d
from mmdet.models import HEADS
from .anchor3d_head import Anchor3DHead
from .train_mixins import get_direction_target
@HEADS.regi... | 11,525 | 39.442105 | 118 | py |
RoboBEV | RoboBEV-master/zoo/SOLOFusion/mmdet3d/models/dense_heads/base_conv_bbox_head.py | # Copyright (c) OpenMMLab. All rights reserved.
from mmcv.cnn import ConvModule
from mmcv.cnn.bricks import build_conv_layer
from mmcv.runner import BaseModule
from torch import nn as nn
from mmdet.models.builder import HEADS
@HEADS.register_module()
class BaseConvBboxHead(BaseModule):
r"""More general bbox head... | 4,406 | 32.386364 | 74 | py |
RoboBEV | RoboBEV-master/zoo/SOLOFusion/mmdet3d/models/dense_heads/anchor3d_head.py | # Copyright (c) OpenMMLab. All rights reserved.
import numpy as np
import torch
from mmcv.runner import BaseModule, force_fp32
from torch import nn as nn
from mmdet3d.core import (PseudoSampler, box3d_multiclass_nms, limit_period,
xywhr2xyxyr)
from mmdet.core import (build_assigner, build_bbo... | 21,582 | 40.990272 | 79 | py |
RoboBEV | RoboBEV-master/zoo/SOLOFusion/mmdet3d/models/dense_heads/train_mixins.py | # Copyright (c) OpenMMLab. All rights reserved.
import numpy as np
import torch
from mmdet3d.core import limit_period
from mmdet.core import images_to_levels, multi_apply
class AnchorTrainMixin(object):
"""Mixin class for target assigning of dense heads."""
def anchor_target_3d(self,
... | 16,738 | 47.100575 | 79 | py |
RoboBEV | RoboBEV-master/zoo/SOLOFusion/mmdet3d/models/dense_heads/parta2_rpn_head.py | # Copyright (c) OpenMMLab. All rights reserved.
from __future__ import division
import numpy as np
import torch
from mmcv.runner import force_fp32
from mmdet3d.core import limit_period, xywhr2xyxyr
from mmdet3d.ops.iou3d.iou3d_utils import nms_gpu, nms_normal_gpu
from mmdet.models import HEADS
from .anchor3d_head imp... | 13,852 | 43.117834 | 79 | py |
RoboBEV | RoboBEV-master/zoo/SOLOFusion/mmdet3d/models/dense_heads/groupfree3d_head.py | # Copyright (c) OpenMMLab. All rights reserved.
import copy
import numpy as np
import torch
from mmcv import ConfigDict
from mmcv.cnn import ConvModule, xavier_init
from mmcv.cnn.bricks.transformer import (build_positional_encoding,
build_transformer_layer)
from mmcv.runner impo... | 42,226 | 41.481891 | 79 | py |
RoboBEV | RoboBEV-master/zoo/SOLOFusion/mmdet3d/models/dense_heads/vote_head.py | # Copyright (c) OpenMMLab. All rights reserved.
import numpy as np
import torch
from mmcv.runner import BaseModule, force_fp32
from torch.nn import functional as F
from mmdet3d.core.post_processing import aligned_3d_nms
from mmdet3d.models.builder import build_loss
from mmdet3d.models.losses import chamfer_distance
fr... | 28,350 | 41.697289 | 79 | py |
RoboBEV | RoboBEV-master/zoo/SOLOFusion/mmdet3d/models/utils/embed.py | # Copyright (c) OpenMMLab. All rights reserved.
import torch.nn.functional as F
from mmcv.cnn import build_conv_layer, build_norm_layer
from mmcv.runner.base_module import BaseModule
from torch.nn.modules.utils import _pair as to_2tuple
# Modified from Pytorch-Image-Models
class PatchEmbed(BaseModule):
"""Image t... | 3,590 | 34.554455 | 78 | py |
RoboBEV | RoboBEV-master/zoo/SOLOFusion/mmdet3d/models/utils/mlp.py | # Copyright (c) OpenMMLab. All rights reserved.
from mmcv.cnn import ConvModule
from mmcv.runner import BaseModule
from torch import nn as nn
class MLP(BaseModule):
"""A simple MLP module.
Pass features (B, C, N) through an MLP.
Args:
in_channels (int): Number of channels of input features.
... | 1,675 | 31.230769 | 68 | py |
RoboBEV | RoboBEV-master/zoo/SOLOFusion/mmdet3d/models/utils/clip_sigmoid.py | # Copyright (c) OpenMMLab. All rights reserved.
import torch
def clip_sigmoid(x, eps=1e-4):
"""Sigmoid function for input feature.
Args:
x (torch.Tensor): Input feature map with the shape of [B, N, H, W].
eps (float): Lower bound of the range to be clamped to. Defaults
to 1e-4.
... | 458 | 24.5 | 75 | py |
RoboBEV | RoboBEV-master/zoo/SOLOFusion/mmdet3d/models/roi_heads/part_aggregation_roi_head.py | # Copyright (c) OpenMMLab. All rights reserved.
import warnings
from torch.nn import functional as F
from mmdet3d.core import AssignResult
from mmdet3d.core.bbox import bbox3d2result, bbox3d2roi
from mmdet.core import build_assigner, build_sampler
from mmdet.models import HEADS
from ..builder import build_head, build_... | 13,922 | 41.708589 | 79 | py |
RoboBEV | RoboBEV-master/zoo/SOLOFusion/mmdet3d/models/roi_heads/base_3droi_head.py | # Copyright (c) OpenMMLab. All rights reserved.
from abc import ABCMeta, abstractmethod
from mmcv.runner import BaseModule
class Base3DRoIHead(BaseModule, metaclass=ABCMeta):
"""Base class for 3d RoIHeads."""
def __init__(self,
bbox_head=None,
mask_roi_extractor=None,
... | 2,986 | 29.479592 | 78 | py |
RoboBEV | RoboBEV-master/zoo/SOLOFusion/mmdet3d/models/roi_heads/h3d_roi_head.py | # Copyright (c) OpenMMLab. All rights reserved.
from mmdet3d.core.bbox import bbox3d2result
from mmdet.models import HEADS
from ..builder import build_head
from .base_3droi_head import Base3DRoIHead
@HEADS.register_module()
class H3DRoIHead(Base3DRoIHead):
"""H3D roi head for H3DNet.
Args:
primitive_... | 5,651 | 34.10559 | 78 | py |
RoboBEV | RoboBEV-master/zoo/SOLOFusion/mmdet3d/models/roi_heads/roi_extractors/single_roiaware_extractor.py | # Copyright (c) OpenMMLab. All rights reserved.
import torch
from mmcv.runner import BaseModule
from mmdet3d import ops
from mmdet.models.builder import ROI_EXTRACTORS
@ROI_EXTRACTORS.register_module()
class Single3DRoIAwareExtractor(BaseModule):
"""Point-wise roi-aware Extractor.
Extract Point-wise roi fea... | 1,983 | 35.072727 | 76 | py |
RoboBEV | RoboBEV-master/zoo/SOLOFusion/mmdet3d/models/roi_heads/bbox_heads/parta2_bbox_head.py | # Copyright (c) OpenMMLab. All rights reserved.
import numpy as np
import torch
from mmcv.cnn import ConvModule, normal_init
from mmcv.runner import BaseModule
from torch import nn as nn
from mmdet3d.core.bbox.structures import (LiDARInstance3DBoxes,
rotation_3d_in_axis, xywhr... | 25,032 | 38.988818 | 79 | py |
RoboBEV | RoboBEV-master/zoo/SOLOFusion/mmdet3d/models/roi_heads/bbox_heads/h3d_bbox_head.py | # Copyright (c) OpenMMLab. All rights reserved.
import torch
from mmcv.cnn import ConvModule
from mmcv.runner import BaseModule
from torch import nn as nn
from torch.nn import functional as F
from mmdet3d.core.bbox import DepthInstance3DBoxes
from mmdet3d.core.post_processing import aligned_3d_nms
from mmdet3d.models.... | 40,153 | 42.316073 | 79 | py |
RoboBEV | RoboBEV-master/zoo/SOLOFusion/mmdet3d/models/roi_heads/mask_heads/primitive_head.py | # Copyright (c) OpenMMLab. All rights reserved.
import torch
from mmcv.cnn import ConvModule
from mmcv.runner import BaseModule
from torch import nn as nn
from torch.nn import functional as F
from mmdet3d.models.builder import build_loss
from mmdet3d.models.model_utils import VoteModule
from mmdet3d.ops import build_s... | 42,353 | 42.79938 | 79 | py |
RoboBEV | RoboBEV-master/zoo/SOLOFusion/mmdet3d/models/roi_heads/mask_heads/pointwise_semantic_head.py | # Copyright (c) OpenMMLab. All rights reserved.
import torch
from mmcv.runner import BaseModule
from torch import nn as nn
from torch.nn import functional as F
from mmdet3d.core.bbox.structures import rotation_3d_in_axis
from mmdet3d.models.builder import build_loss
from mmdet.core import multi_apply
from mmdet.models... | 8,114 | 38.779412 | 78 | py |
RoboBEV | RoboBEV-master/zoo/SOLOFusion/mmdet3d/models/segmentors/base.py | # Copyright (c) OpenMMLab. All rights reserved.
import mmcv
import numpy as np
import torch
from mmcv.parallel import DataContainer as DC
from mmcv.runner import auto_fp16
from os import path as osp
from mmdet3d.core import show_seg_result
from mmseg.models.segmentors import BaseSegmentor
class Base3DSegmentor(BaseS... | 5,203 | 39.976378 | 79 | py |
RoboBEV | RoboBEV-master/zoo/SOLOFusion/mmdet3d/models/segmentors/encoder_decoder.py | # Copyright (c) OpenMMLab. All rights reserved.
import numpy as np
import torch
from torch import nn as nn
from torch.nn import functional as F
from mmseg.core import add_prefix
from mmseg.models import SEGMENTORS
from ..builder import build_backbone, build_head, build_loss, build_neck
from .base import Base3DSegmento... | 19,013 | 40.789011 | 79 | py |
RoboBEV | RoboBEV-master/zoo/SOLOFusion/mmdet3d/models/model_utils/vote_module.py | # Copyright (c) OpenMMLab. All rights reserved.
import torch
from mmcv import is_tuple_of
from mmcv.cnn import ConvModule
from torch import nn as nn
from mmdet3d.models.builder import build_loss
class VoteModule(nn.Module):
"""Vote module.
Generate votes from seed point features.
Args:
in_chann... | 7,274 | 38.972527 | 79 | py |
RoboBEV | RoboBEV-master/zoo/SOLOFusion/mmdet3d/models/model_utils/transformer.py | # Copyright (c) OpenMMLab. All rights reserved.
from mmcv.cnn.bricks.registry import ATTENTION
from mmcv.cnn.bricks.transformer import POSITIONAL_ENCODING, MultiheadAttention
from torch import nn as nn
@ATTENTION.register_module()
class GroupFree3DMHA(MultiheadAttention):
"""A warpper for torch.nn.MultiheadAttent... | 5,600 | 39.294964 | 79 | py |
RoboBEV | RoboBEV-master/zoo/SOLOFusion/mmdet3d/models/losses/chamfer_distance.py | # Copyright (c) OpenMMLab. All rights reserved.
import torch
from torch import nn as nn
from torch.nn.functional import l1_loss, mse_loss, smooth_l1_loss
from mmdet.models.builder import LOSSES
def chamfer_distance(src,
dst,
src_weight=1.0,
dst_weight=1.... | 5,544 | 36.466216 | 79 | py |
RoboBEV | RoboBEV-master/zoo/SOLOFusion/mmdet3d/models/losses/paconv_regularization_loss.py | # Copyright (c) OpenMMLab. All rights reserved.
import torch
from torch import nn as nn
from mmdet3d.ops import PAConv, PAConvCUDA
from mmdet.models.builder import LOSSES
from mmdet.models.losses.utils import weight_reduce_loss
def weight_correlation(conv):
"""Calculate correlations between kernel weights in Con... | 4,085 | 36.486239 | 79 | py |
RoboBEV | RoboBEV-master/zoo/SOLOFusion/mmdet3d/models/losses/axis_aligned_iou_loss.py | # Copyright (c) OpenMMLab. All rights reserved.
import torch
from torch import nn as nn
from mmdet.models.builder import LOSSES
from mmdet.models.losses.utils import weighted_loss
from ...core.bbox import AxisAlignedBboxOverlaps3D
@weighted_loss
def axis_aligned_iou_loss(pred, target):
"""Calculate the IoU loss ... | 2,808 | 34.1125 | 78 | py |
RoboBEV | RoboBEV-master/zoo/SOLOFusion/mmdet3d/models/backbones/multi_backbone.py | # Copyright (c) OpenMMLab. All rights reserved.
import copy
import torch
import warnings
from mmcv.cnn import ConvModule
from mmcv.runner import BaseModule, auto_fp16
from torch import nn as nn
from mmdet.models import BACKBONES, build_backbone
@BACKBONES.register_module()
class MultiBackbone(BaseModule):
"""Mul... | 4,709 | 36.086614 | 76 | py |
RoboBEV | RoboBEV-master/zoo/SOLOFusion/mmdet3d/models/backbones/second.py | # Copyright (c) OpenMMLab. All rights reserved.
import warnings
from mmcv.cnn import build_conv_layer, build_norm_layer
from mmcv.runner import BaseModule
from torch import nn as nn
from mmdet.models import BACKBONES
@BACKBONES.register_module()
class SECOND(BaseModule):
"""Backbone network for SECOND/PointPilla... | 3,247 | 34.692308 | 79 | py |
RoboBEV | RoboBEV-master/zoo/SOLOFusion/mmdet3d/models/backbones/swin.py | # Copyright (c) OpenMMLab. All rights reserved.
import warnings
from copy import deepcopy
import torch
import torch.nn as nn
import torch.nn.functional as F
from mmcv.cnn import build_norm_layer, trunc_normal_init
from mmcv.cnn.bricks.transformer import FFN, build_dropout
from mmcv.cnn.utils.weight_init import constan... | 31,650 | 37.45808 | 79 | py |
RoboBEV | RoboBEV-master/zoo/SOLOFusion/mmdet3d/models/backbones/resnet.py | # Copyright (c) Phigent Robotics. All rights reserved.
from torch import nn
from mmdet.models.backbones.resnet import Bottleneck, BasicBlock
import torch.utils.checkpoint as checkpoint
from mmdet.models import BACKBONES
from mmcv.cnn.bricks.registry import NORM_LAYERS
@NORM_LAYERS.register_module()
class IdentityN... | 2,990 | 38.88 | 114 | py |
RoboBEV | RoboBEV-master/zoo/SOLOFusion/mmdet3d/models/backbones/base_pointnet.py | # Copyright (c) OpenMMLab. All rights reserved.
import warnings
from abc import ABCMeta
from mmcv.runner import BaseModule
class BasePointNet(BaseModule, metaclass=ABCMeta):
"""Base class for PointNet."""
def __init__(self, init_cfg=None, pretrained=None):
super(BasePointNet, self).__init__(init_cfg)... | 1,335 | 33.25641 | 76 | py |
RoboBEV | RoboBEV-master/zoo/SOLOFusion/mmdet3d/models/backbones/nostem_regnet.py | # Copyright (c) OpenMMLab. All rights reserved.
from mmdet.models.backbones import RegNet
from ..builder import BACKBONES
@BACKBONES.register_module()
class NoStemRegNet(RegNet):
"""RegNet backbone without Stem for 3D detection.
More details can be found in `paper <https://arxiv.org/abs/2003.13678>`_ .
... | 3,351 | 38.435294 | 79 | py |
RoboBEV | RoboBEV-master/zoo/SOLOFusion/mmdet3d/models/backbones/convnext.py | # Copyright (c) OpenMMLab. All rights reserved.
from functools import partial
from itertools import chain
from typing import Sequence
import torch
import torch.nn as nn
import torch.nn.functional as F
from mmcv.cnn.bricks import (NORM_LAYERS, DropPath, build_activation_layer,
build_norm_la... | 12,997 | 35.82153 | 94 | py |
RoboBEV | RoboBEV-master/zoo/SOLOFusion/mmdet3d/models/backbones/pointnet2_sa_msg.py | # Copyright (c) OpenMMLab. All rights reserved.
import torch
from mmcv.cnn import ConvModule
from mmcv.runner import auto_fp16
from torch import nn as nn
from mmdet3d.ops import build_sa_module
from mmdet.models import BACKBONES
from .base_pointnet import BasePointNet
@BACKBONES.register_module()
class PointNet2SAMS... | 7,138 | 40.505814 | 79 | py |
RoboBEV | RoboBEV-master/zoo/SOLOFusion/mmdet3d/models/backbones/pointnet2_sa_ssg.py | # Copyright (c) OpenMMLab. All rights reserved.
import torch
from mmcv.runner import auto_fp16
from torch import nn as nn
from mmdet3d.ops import PointFPModule, build_sa_module
from mmdet.models import BACKBONES
from .base_pointnet import BasePointNet
@BACKBONES.register_module()
class PointNet2SASSG(BasePointNet):
... | 5,561 | 37.625 | 79 | py |
RoboBEV | RoboBEV-master/zoo/SOLOFusion/mmdet3d/datasets/custom_3d.py | # Copyright (c) OpenMMLab. All rights reserved.
import mmcv
import numpy as np
import tempfile
import warnings
from os import path as osp
from torch.utils.data import Dataset
from mmdet.datasets import DATASETS
from ..core.bbox import get_box_type
from .pipelines import Compose
from .utils import extract_result_dict, ... | 13,346 | 34.975741 | 79 | py |
RoboBEV | RoboBEV-master/zoo/SOLOFusion/mmdet3d/datasets/nuscenes_dataset.py | # Copyright (c) OpenMMLab. All rights reserved.
import mmcv
import torch
import math
import numpy as np
import pyquaternion
import tempfile
from nuscenes.utils.data_classes import Box as NuScenesBox
from os import path as osp
import copy
from collections import defaultdict
from mmdet.datasets import DATASETS
from ..co... | 34,666 | 41.276829 | 154 | py |
RoboBEV | RoboBEV-master/zoo/SOLOFusion/mmdet3d/datasets/utils.py | # Copyright (c) OpenMMLab. All rights reserved.
import mmcv
# yapf: disable
from mmdet3d.datasets.pipelines import (Collect3D, DefaultFormatBundle3D,
LoadAnnotations3D,
LoadImageFromFileMono3D,
LoadM... | 5,763 | 39.879433 | 78 | py |
RoboBEV | RoboBEV-master/zoo/SOLOFusion/mmdet3d/datasets/waymo_dataset.py | # Copyright (c) OpenMMLab. All rights reserved.
import mmcv
import numpy as np
import os
import tempfile
import torch
from mmcv.utils import print_log
from os import path as osp
from mmdet.datasets import DATASETS
from ..core.bbox import Box3DMode, points_cam2img
from .kitti_dataset import KittiDataset
@DATASETS.reg... | 23,094 | 41.221207 | 81 | py |
RoboBEV | RoboBEV-master/zoo/SOLOFusion/mmdet3d/datasets/nuscenes_mono_dataset.py | # Copyright (c) OpenMMLab. All rights reserved.
import copy
import mmcv
import numpy as np
import pyquaternion
import tempfile
import torch
import warnings
from nuscenes.utils.data_classes import Box as NuScenesBox
from os import path as osp
from mmdet3d.core import bbox3d2result, box3d_multiclass_nms, xywhr2xyxyr
fro... | 32,384 | 39.787154 | 154 | py |
RoboBEV | RoboBEV-master/zoo/SOLOFusion/mmdet3d/datasets/kitti_dataset.py | # Copyright (c) OpenMMLab. All rights reserved.
import copy
import mmcv
import numpy as np
import os
import tempfile
import torch
from mmcv.utils import print_log
from os import path as osp
from mmdet.datasets import DATASETS
from ..core import show_multi_modality_result, show_result
from ..core.bbox import (Box3DMode... | 30,997 | 40.552279 | 79 | py |
RoboBEV | RoboBEV-master/zoo/SOLOFusion/mmdet3d/datasets/lyft_dataset.py | # Copyright (c) OpenMMLab. All rights reserved.
import mmcv
import numpy as np
import os
import pandas as pd
import tempfile
from lyft_dataset_sdk.lyftdataset import LyftDataset as Lyft
from lyft_dataset_sdk.utils.data_classes import Box as LyftBox
from os import path as osp
from pyquaternion import Quaternion
from mm... | 22,029 | 38.40966 | 82 | py |
RoboBEV | RoboBEV-master/zoo/SOLOFusion/mmdet3d/datasets/kitti_mono_dataset.py | # Copyright (c) OpenMMLab. All rights reserved.
import copy
import mmcv
import numpy as np
import tempfile
import torch
from mmcv.utils import print_log
from os import path as osp
from mmdet.datasets import DATASETS
from ..core.bbox import Box3DMode, CameraInstance3DBoxes, points_cam2img
from .nuscenes_mono_dataset im... | 23,163 | 40.290553 | 79 | py |
RoboBEV | RoboBEV-master/zoo/SOLOFusion/mmdet3d/datasets/builder.py | # Copyright (c) OpenMMLab. All rights reserved.
import platform
from functools import partial
from mmcv.utils import Registry, build_from_cfg
from mmcv.parallel import collate
from mmcv.runner import get_dist_info
from mmdet.datasets import DATASETS
from mmdet.datasets.builder import _concat_dataset, worker_init_fn
f... | 5,374 | 38.233577 | 133 | py |
RoboBEV | RoboBEV-master/zoo/SOLOFusion/mmdet3d/datasets/custom_3d_seg.py | # Copyright (c) OpenMMLab. All rights reserved.
import mmcv
import numpy as np
import tempfile
import warnings
from os import path as osp
from torch.utils.data import Dataset
from mmdet.datasets import DATASETS
from mmseg.datasets import DATASETS as SEG_DATASETS
from .pipelines import Compose
from .utils import extrac... | 16,362 | 35.281596 | 79 | py |
RoboBEV | RoboBEV-master/zoo/SOLOFusion/mmdet3d/datasets/samplers/infinite_group_each_sample_in_batch_sampler.py | import itertools
import copy
import numpy as np
import torch
import torch.distributed as dist
from mmcv.runner import get_dist_info
from torch.utils.data.sampler import Sampler
# https://github.com/open-mmlab/mmdetection/blob/3b72b12fe9b14de906d1363982b9fba05e7d47c1/mmdet/core/utils/dist_utils.py#L157
def sync_random... | 4,903 | 37.3125 | 125 | py |
RoboBEV | RoboBEV-master/zoo/SOLOFusion/mmdet3d/datasets/pipelines/loading.py | # Copyright (c) OpenMMLab. All rights reserved.
import torch
import torchvision
from PIL import Image
import mmcv
import numpy as np
from pyquaternion import Quaternion
from mmdet3d.core.points import BasePoints, get_points_type
from mmdet.datasets.builder import PIPELINES
from mmdet.datasets.pipelines import LoadAnno... | 39,141 | 39.772917 | 118 | py |
RoboBEV | RoboBEV-master/zoo/SOLOFusion/mmdet3d/datasets/pipelines/transforms_3d.py | # Copyright (c) OpenMMLab. All rights reserved.
import torch
import numpy as np
import warnings
from mmcv import is_tuple_of
from mmcv.utils import build_from_cfg
from mmdet3d.core import VoxelGenerator
from mmdet3d.core.bbox import (CameraInstance3DBoxes, DepthInstance3DBoxes,
LiDARInst... | 58,382 | 38.716327 | 98 | py |
RoboBEV | RoboBEV-master/zoo/SOLOFusion/mmdet3d/datasets/pipelines/custom_loading.py | # Copyright (c) OpenMMLab. All rights reserved.
import os
import torch
import torchvision
from PIL import Image
import mmcv
import numpy as np
from pyquaternion import Quaternion
from mmdet3d.core.points import BasePoints, get_points_type
from mmdet.datasets.builder import PIPELINES
from mmdet.datasets.pipelines impor... | 13,892 | 47.072664 | 118 | py |
RoboBEV | RoboBEV-master/zoo/SOLOFusion/mmdet3d/utils/warmup_fp16_optimizer.py | import copy
import logging
from collections import defaultdict
from itertools import chain
from typing import Optional, Union
import torch.nn as nn
from torch import Tensor
from torch.nn.utils import clip_grad
from torch.cuda.amp import GradScaler
from mmcv.utils import TORCH_VERSION, _BatchNorm, digit_version
from m... | 6,061 | 44.238806 | 104 | py |
RoboBEV | RoboBEV-master/zoo/SOLOFusion/mmdet3d/ops/norm.py | import torch
from mmcv.cnn import NORM_LAYERS
from mmcv.runner import force_fp32
from torch import distributed as dist
from torch import nn as nn
from torch.autograd.function import Function
class AllReduce(Function):
@staticmethod
def forward(ctx, input):
input_list = [
torch.zeros_like(... | 5,015 | 36.432836 | 78 | py |
RoboBEV | RoboBEV-master/zoo/SOLOFusion/mmdet3d/ops/sparse_block.py | # Copyright (c) OpenMMLab. All rights reserved.
from mmcv.cnn import build_conv_layer, build_norm_layer
from torch import nn
from mmdet3d.ops import spconv
from mmdet.models.backbones.resnet import BasicBlock, Bottleneck
class SparseBottleneck(Bottleneck, spconv.SparseModule):
"""Sparse bottleneck block for Part... | 5,952 | 30.834225 | 77 | py |
RoboBEV | RoboBEV-master/zoo/SOLOFusion/mmdet3d/ops/pointnet_modules/point_sa_module.py | # Copyright (c) OpenMMLab. All rights reserved.
import torch
from mmcv.cnn import ConvModule
from torch import nn as nn
from torch.nn import functional as F
from mmdet3d.ops import (GroupAll, PAConv, Points_Sampler, QueryAndGroup,
gather_points)
from .builder import SA_MODULES
class BasePoin... | 13,315 | 37.822157 | 79 | py |
RoboBEV | RoboBEV-master/zoo/SOLOFusion/mmdet3d/ops/pointnet_modules/point_fp_module.py | # Copyright (c) OpenMMLab. All rights reserved.
import torch
from mmcv.cnn import ConvModule
from mmcv.runner import BaseModule, force_fp32
from torch import nn as nn
from typing import List
from mmdet3d.ops import three_interpolate, three_nn
class PointFPModule(BaseModule):
"""Point feature propagation module u... | 2,811 | 34.15 | 79 | py |
RoboBEV | RoboBEV-master/zoo/SOLOFusion/mmdet3d/ops/pointnet_modules/paconv_sa_module.py | # Copyright (c) OpenMMLab. All rights reserved.
import torch
from torch import nn as nn
from mmdet3d.ops import PAConv, PAConvCUDA
from .builder import SA_MODULES
from .point_sa_module import BasePointSAModule
@SA_MODULES.register_module()
class PAConvSAModuleMSG(BasePointSAModule):
r"""Point set abstraction mod... | 13,102 | 37.312865 | 78 | py |
RoboBEV | RoboBEV-master/zoo/SOLOFusion/mmdet3d/ops/group_points/group_points.py | import torch
from torch import nn as nn
from torch.autograd import Function
from typing import Tuple
from ..ball_query import ball_query
from ..knn import knn
from . import group_points_ext
class QueryAndGroup(nn.Module):
"""Query and Group.
Groups with a ball query of radius
Args:
max_radius (... | 7,898 | 33.49345 | 79 | py |
RoboBEV | RoboBEV-master/zoo/SOLOFusion/mmdet3d/ops/gather_points/gather_points.py | import torch
from torch.autograd import Function
from . import gather_points_ext
class GatherPoints(Function):
"""Gather Points.
Gather points with given index.
"""
@staticmethod
def forward(ctx, features: torch.Tensor,
indices: torch.Tensor) -> torch.Tensor:
"""forward.... | 1,541 | 28.09434 | 74 | py |
RoboBEV | RoboBEV-master/zoo/SOLOFusion/mmdet3d/ops/bev_pool/bev_pool.py | import torch
from . import bev_pool_ext
__all__ = ["bev_pool"]
class QuickCumsum(torch.autograd.Function):
@staticmethod
def forward(ctx, x, geom_feats, ranks):
x = x.cumsum(0)
kept = torch.ones(x.shape[0], device=x.device, dtype=torch.bool)
kept[:-1] = ranks[1:] != ranks[:-1]
... | 2,638 | 25.928571 | 76 | py |
RoboBEV | RoboBEV-master/zoo/SOLOFusion/mmdet3d/ops/voxel/voxelize.py | # Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved
import torch
from torch import nn
from torch.autograd import Function
from torch.nn.modules.utils import _pair
from .voxel_layer import dynamic_voxelize, hard_voxelize
class _Voxelization(Function):
@staticmethod
def forward(ctx,
... | 6,502 | 42.644295 | 79 | py |
RoboBEV | RoboBEV-master/zoo/SOLOFusion/mmdet3d/ops/voxel/scatter_points.py | import torch
from torch import nn
from torch.autograd import Function
from .voxel_layer import (dynamic_point_to_voxel_backward,
dynamic_point_to_voxel_forward)
class _dynamic_scatter(Function):
@staticmethod
def forward(ctx, feats, coors, reduce_type='max'):
"""convert kit... | 4,237 | 38.240741 | 79 | py |
RoboBEV | RoboBEV-master/zoo/SOLOFusion/mmdet3d/ops/knn/knn.py | import torch
from torch.autograd import Function
from . import knn_ext
class KNN(Function):
r"""KNN (CUDA) based on heap data structure.
Modified from `PAConv <https://github.com/CVMI-Lab/PAConv/tree/main/
scene_seg/lib/pointops/src/knnquery_heap>`_.
Find k-nearest points.
"""
@staticmethod... | 2,353 | 31.246575 | 75 | py |
RoboBEV | RoboBEV-master/zoo/SOLOFusion/mmdet3d/ops/furthest_point_sample/utils.py | import torch
def calc_square_dist(point_feat_a, point_feat_b, norm=True):
"""Calculating square distance between a and b.
Args:
point_feat_a (Tensor): (B, N, C) Feature vector of each point.
point_feat_b (Tensor): (B, M, C) Feature vector of each point.
norm (Bool): Whether to normali... | 1,051 | 31.875 | 70 | py |
RoboBEV | RoboBEV-master/zoo/SOLOFusion/mmdet3d/ops/furthest_point_sample/points_sampler.py | import torch
from mmcv.runner import force_fp32
from torch import nn as nn
from typing import List
from .furthest_point_sample import (furthest_point_sample,
furthest_point_sample_with_dist)
from .utils import calc_square_dist
def get_sampler_type(sampler_type):
"""Get the typ... | 5,371 | 32.786164 | 79 | py |
RoboBEV | RoboBEV-master/zoo/SOLOFusion/mmdet3d/ops/furthest_point_sample/furthest_point_sample.py | import torch
from torch.autograd import Function
from . import furthest_point_sample_ext
class FurthestPointSampling(Function):
"""Furthest Point Sampling.
Uses iterative furthest point sampling to select a set of features whose
corresponding points have the furthest distance.
"""
@staticmethod... | 2,381 | 29.151899 | 77 | py |
RoboBEV | RoboBEV-master/zoo/SOLOFusion/mmdet3d/ops/iou3d/iou3d_utils.py | import torch
from . import iou3d_cuda
def boxes_iou_bev(boxes_a, boxes_b):
"""Calculate boxes IoU in the bird view.
Args:
boxes_a (torch.Tensor): Input boxes a with shape (M, 5).
boxes_b (torch.Tensor): Input boxes b with shape (N, 5).
Returns:
ans_iou (torch.Tensor): IoU result... | 2,289 | 30.805556 | 76 | py |
RoboBEV | RoboBEV-master/zoo/SOLOFusion/mmdet3d/ops/interpolate/three_interpolate.py | import torch
from torch.autograd import Function
from typing import Tuple
from . import interpolate_ext
class ThreeInterpolate(Function):
@staticmethod
def forward(ctx, features: torch.Tensor, indices: torch.Tensor,
weight: torch.Tensor) -> torch.Tensor:
"""Performs weighted linear i... | 2,144 | 32.515625 | 74 | py |
RoboBEV | RoboBEV-master/zoo/SOLOFusion/mmdet3d/ops/interpolate/three_nn.py | import torch
from torch.autograd import Function
from typing import Tuple
from . import interpolate_ext
class ThreeNN(Function):
@staticmethod
def forward(ctx, target: torch.Tensor,
source: torch.Tensor) -> Tuple[torch.Tensor, torch.Tensor]:
"""Find the top-3 nearest neighbors of the... | 1,296 | 27.195652 | 77 | py |
RoboBEV | RoboBEV-master/zoo/SOLOFusion/mmdet3d/ops/paconv/utils.py | import torch
def calc_euclidian_dist(xyz1, xyz2):
"""Calculate the Euclidian distance between two sets of points.
Args:
xyz1 (torch.Tensor): (N, 3), the first set of points.
xyz2 (torch.Tensor): (N, 3), the second set of points.
Returns:
torch.Tensor: (N, ), the Euclidian distanc... | 3,677 | 41.275862 | 79 | py |
RoboBEV | RoboBEV-master/zoo/SOLOFusion/mmdet3d/ops/paconv/assign_score.py | from torch.autograd import Function
from . import assign_score_withk_ext
class AssignScoreWithK(Function):
r"""Perform weighted sum to generate output features according to scores.
Modified from `PAConv <https://github.com/CVMI-Lab/PAConv/tree/main/
scene_seg/lib/paconv_lib/src/gpu>`_.
This is a mem... | 4,015 | 38.372549 | 79 | py |
RoboBEV | RoboBEV-master/zoo/SOLOFusion/mmdet3d/ops/paconv/paconv.py | import copy
import torch
from mmcv.cnn import (ConvModule, build_activation_layer, build_norm_layer,
constant_init)
from torch import nn as nn
from torch.nn import functional as F
from .assign_score import assign_score_withk as assign_score_cuda
from .utils import assign_kernel_withoutk, assign_s... | 15,868 | 39.585678 | 79 | py |
RoboBEV | RoboBEV-master/zoo/SOLOFusion/mmdet3d/ops/spconv/structure.py | import numpy as np
import torch
def scatter_nd(indices, updates, shape):
"""pytorch edition of tensorflow scatter_nd.
this function don't contain except handle code. so use this carefully when
indice repeats, don't support repeat add which is supported in tensorflow.
"""
ret = torch.zeros(*shape,... | 2,187 | 30.257143 | 78 | py |
RoboBEV | RoboBEV-master/zoo/SOLOFusion/mmdet3d/ops/spconv/modules.py | # Copyright 2019 Yan Yan
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, soft... | 6,999 | 33.482759 | 79 | py |
RoboBEV | RoboBEV-master/zoo/SOLOFusion/mmdet3d/ops/spconv/functional.py | # Copyright 2019 Yan Yan
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, soft... | 3,699 | 36.373737 | 79 | py |
RoboBEV | RoboBEV-master/zoo/SOLOFusion/mmdet3d/ops/spconv/ops.py | # Copyright 2019 Yan Yan
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, soft... | 7,236 | 38.331522 | 79 | py |
RoboBEV | RoboBEV-master/zoo/SOLOFusion/mmdet3d/ops/spconv/conv.py | # Copyright 2019 Yan Yan
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, soft... | 14,355 | 30.482456 | 79 | py |
RoboBEV | RoboBEV-master/zoo/SOLOFusion/mmdet3d/ops/roiaware_pool3d/roiaware_pool3d.py | import mmcv
import torch
from torch import nn as nn
from torch.autograd import Function
from . import roiaware_pool3d_ext
class RoIAwarePool3d(nn.Module):
def __init__(self, out_size, max_pts_per_voxel=128, mode='max'):
super().__init__()
"""RoIAwarePool3d module
Args:
out_s... | 3,668 | 32.054054 | 78 | py |
RoboBEV | RoboBEV-master/zoo/SOLOFusion/mmdet3d/ops/roiaware_pool3d/points_in_boxes.py | import torch
from . import roiaware_pool3d_ext
def points_in_boxes_gpu(points, boxes):
"""Find points that are in boxes (CUDA)
Args:
points (torch.Tensor): [B, M, 3], [x, y, z] in LiDAR coordinate
boxes (torch.Tensor): [B, T, 7],
num_valid_boxes <= T, [x, y, z, w, l, h, ry] in Li... | 4,690 | 36.830645 | 77 | py |
RoboBEV | RoboBEV-master/zoo/SOLOFusion/mmdet3d/ops/ball_query/ball_query.py | import torch
from torch.autograd import Function
from . import ball_query_ext
class BallQuery(Function):
"""Ball Query.
Find nearby points in spherical space.
"""
@staticmethod
def forward(ctx, min_radius: float, max_radius: float, sample_num: int,
xyz: torch.Tensor, center_xyz:... | 1,463 | 29.5 | 79 | py |
RoboBEV | RoboBEV-master/zoo/PETR/tools/generate_dataset.py | import argparse
import os
import warnings
import time
import numpy as np
import torch
import mmcv
from mmdet3d.datasets import build_dataset, build_dataloader
from mmcv import Config, DictAction
from mmdet3d.datasets import build_dataset
from project.mmdet3d_plugin.corruptions import CORRUPTIONS
SEVERITY = {'2': '... | 5,629 | 35.322581 | 125 | py |
RoboBEV | RoboBEV-master/zoo/PETR/tools/test.py | # Copyright (c) OpenMMLab. All rights reserved.
import argparse
import mmcv
import os
import torch
import warnings
from mmcv import Config, DictAction
from mmcv.cnn import fuse_conv_bn
from mmcv.parallel import MMDataParallel, MMDistributedDataParallel
from mmcv.runner import (get_dist_info, init_dist, load_checkpoint,... | 9,778 | 38.431452 | 79 | py |
RoboBEV | RoboBEV-master/zoo/PETR/tools/robust_test.py | # Copyright (c) OpenMMLab. All rights reserved.
# ---------------------------------------------
# Modified by Shaoyuan Xie
# ---------------------------------------------
import argparse
import mmcv
import os
import torch
import warnings
from mmcv import Config, DictAction
from mmcv.cnn import fuse_conv_bn
from mmcv.p... | 11,750 | 39.944251 | 95 | py |
RoboBEV | RoboBEV-master/zoo/PETR/tools/train.py | # ------------------------------------------------------------------------
# Copyright (c) 2022 megvii-model. All Rights Reserved.
# ------------------------------------------------------------------------
# Modified from DETR3D (https://github.com/WangYueFt/detr3d)
# Copyright (c) 2021 Wang, Yue
# --------------------... | 10,078 | 38.065891 | 125 | py |
RoboBEV | RoboBEV-master/zoo/PETR/tools/data_converter/create_gt_database.py | # Copyright (c) OpenMMLab. All rights reserved.
import mmcv
import numpy as np
import pickle
from mmcv import track_iter_progress
from mmcv.ops import roi_align
from os import path as osp
from pycocotools import mask as maskUtils
from pycocotools.coco import COCO
from mmdet3d.core.bbox import box_np_ops as box_np_ops
... | 12,654 | 36.330383 | 79 | py |
RoboBEV | RoboBEV-master/zoo/PETR/tools/data_converter/nuscenes_converter_seg.py | # ------------------------------------------------------------------------
# Copyright (c) 2022 megvii-model. All Rights Reserved.
# ------------------------------------------------------------------------
# Modified from DETR3D (https://github.com/WangYueFt/detr3d)
# Copyright (c) 2021 Wang, Yue
# --------------------... | 31,114 | 38.738186 | 107 | py |
RoboBEV | RoboBEV-master/zoo/PETR/tools/misc/fuse_conv_bn.py | # Copyright (c) OpenMMLab. All rights reserved.
import argparse
import torch
from mmcv.runner import save_checkpoint
from torch import nn as nn
from mmdet.apis import init_model
def fuse_conv_bn(conv, bn):
"""During inference, the functionary of batch norm layers is turned off but
only the mean and var alone... | 2,240 | 31.955882 | 79 | py |
RoboBEV | RoboBEV-master/zoo/PETR/tools/model_converters/publish_model.py | # Copyright (c) OpenMMLab. All rights reserved.
import argparse
import subprocess
import torch
def parse_args():
parser = argparse.ArgumentParser(
description='Process a checkpoint to be published')
parser.add_argument('in_file', help='input checkpoint filename')
parser.add_argument('out_file', he... | 1,075 | 28.888889 | 77 | py |
RoboBEV | RoboBEV-master/zoo/PETR/tools/model_converters/regnet2mmdet.py | # Copyright (c) OpenMMLab. All rights reserved.
import argparse
import torch
from collections import OrderedDict
def convert_stem(model_key, model_weight, state_dict, converted_names):
new_key = model_key.replace('stem.conv', 'conv1')
new_key = new_key.replace('stem.bn', 'bn1')
state_dict[new_key] = model... | 3,062 | 33.033333 | 77 | py |
RoboBEV | RoboBEV-master/zoo/PETR/tools/model_converters/convert_votenet_checkpoints.py | # Copyright (c) OpenMMLab. All rights reserved.
import argparse
import tempfile
import torch
from mmcv import Config
from mmcv.runner import load_state_dict
from mmdet3d.models import build_detector
def parse_args():
parser = argparse.ArgumentParser(
description='MMDet3D upgrade model version(before v0.6... | 5,090 | 32.27451 | 79 | py |
RoboBEV | RoboBEV-master/zoo/PETR/tools/analysis_tools/benchmark.py | # Copyright (c) OpenMMLab. All rights reserved.
import argparse
import time
import torch
from mmcv import Config
from mmcv.parallel import MMDataParallel
from mmcv.runner import load_checkpoint, wrap_fp16_model
from mmdet3d.datasets import build_dataloader, build_dataset
from mmdet3d.models import build_detector
from ... | 2,987 | 30.125 | 79 | py |
RoboBEV | RoboBEV-master/zoo/PETR/tools/analysis_tools/get_flops.py | # Copyright (c) OpenMMLab. All rights reserved.
import argparse
import torch
from mmcv import Config, DictAction
from mmdet3d.models import build_model
try:
from mmcv.cnn import get_model_complexity_info
except ImportError:
raise ImportError('Please upgrade mmcv to >0.6.2')
def parse_args():
parser = ar... | 3,147 | 31.791667 | 79 | py |
RoboBEV | RoboBEV-master/zoo/PETR/projects/configs/robust_test/petr_r50dcn_gridmask_p4.py | _base_ = [
'/nvme/konglingdong/models/mmdetection3d/configs/_base_/datasets/nus-3d.py',
'/nvme/konglingdong/models/mmdetection3d/configs/_base_/default_runtime.py'
]
backbone_norm_cfg = dict(type='LN', requires_grad=True)
plugin=True
plugin_dir='projects/mmdet3d_plugin/'
# If point cloud range is changed, the ... | 7,819 | 33.449339 | 119 | py |
RoboBEV | RoboBEV-master/zoo/PETR/projects/configs/petr/petr_r50dcn_gridmask_c5.py | _base_ = [
'../../../mmdetection3d/configs/_base_/datasets/nus-3d.py',
'../../../mmdetection3d/configs/_base_/default_runtime.py'
]
backbone_norm_cfg = dict(type='LN', requires_grad=True)
plugin=True
plugin_dir='projects/mmdet3d_plugin/'
# If point cloud range is changed, the models should also change their po... | 8,876 | 32.625 | 119 | py |
RoboBEV | RoboBEV-master/zoo/PETR/projects/configs/petr/petr_r50dcn_gridmask_p4.py | _base_ = [
'../../../mmdetection3d/configs/_base_/datasets/nus-3d.py',
'../../../mmdetection3d/configs/_base_/default_runtime.py'
]
backbone_norm_cfg = dict(type='LN', requires_grad=True)
plugin=True
plugin_dir='projects/mmdet3d_plugin/'
# If point cloud range is changed, the models should also change their po... | 8,136 | 33.922747 | 119 | py |
RoboBEV | RoboBEV-master/zoo/PETR/projects/mmdet3d_plugin/core/bbox/util.py | import torch
from .array_converter import array_converter
@array_converter(apply_to=('points', 'cam2img'))
def points_img2cam(points, cam2img):
"""Project points in image coordinates to camera coordinates.
Args:
points (torch.Tensor): 2.5D points in 2D images, [N, 3],
3 corresponds with x... | 2,697 | 30.011494 | 83 | py |
RoboBEV | RoboBEV-master/zoo/PETR/projects/mmdet3d_plugin/core/bbox/array_converter.py | import functools
import numpy as np
import torch
from inspect import getfullargspec
def array_converter(to_torch=True,
apply_to=tuple(),
template_arg_name_=None,
recover=True):
"""Wrapper function for data-type agnostic processing.
First converts inp... | 13,167 | 39.89441 | 79 | py |
RoboBEV | RoboBEV-master/zoo/PETR/projects/mmdet3d_plugin/core/bbox/assigners/hungarian_assigner_3d.py | # ------------------------------------------------------------------------
# Copyright (c) 2021 megvii-model. All Rights Reserved.
# ------------------------------------------------------------------------
# Modified from DETR3D (https://github.com/WangYueFt/detr3d)
# Copyright (c) 2021 Wang, Yue
# --------------------... | 7,037 | 47.875 | 79 | py |
RoboBEV | RoboBEV-master/zoo/PETR/projects/mmdet3d_plugin/core/bbox/match_costs/match_cost.py | import torch
from mmdet.core.bbox.match_costs.builder import MATCH_COST
from mmdet.core.bbox.iou_calculators import bbox_overlaps
@MATCH_COST.register_module()
class BBox3DL1Cost(object):
"""BBox3DL1Cost.
Args:
weight (int | float, optional): loss_weight
"""
def __init__(self, weight=1.):
... | 909 | 32.703704 | 75 | py |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.