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 |
|---|---|---|---|---|---|---|
fcaf3d | fcaf3d-master/mmdet3d/models/roi_heads/mask_heads/pointwise_semantic_head.py | 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 import HEADS
@HEADS.register_module()
class P... | 8,066 | 38.738916 | 78 | py |
fcaf3d | fcaf3d-master/mmdet3d/models/segmentors/base.py | 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(BaseSegmentor):
"""Base class for 3D segmentors.
... | 4,804 | 41.522124 | 79 | py |
fcaf3d | fcaf3d-master/mmdet3d/models/segmentors/encoder_decoder.py | 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_neck
from .base import Base3DSegmentor
@SEGMENTORS.register_module()
class EncoderDecoder3D(Bas... | 17,508 | 40.392435 | 79 | py |
fcaf3d | fcaf3d-master/mmdet3d/models/model_utils/vote_module.py | 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_channels (int): Number of channels of seed point feat... | 7,226 | 38.928177 | 79 | py |
fcaf3d | fcaf3d-master/mmdet3d/models/model_utils/transformer.py | 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.MultiheadAttention for GroupFree3D.
This module implements... | 5,552 | 39.23913 | 79 | py |
fcaf3d | fcaf3d-master/mmdet3d/models/losses/chamfer_distance.py | 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.0,
criterion_mode='l2',
... | 5,496 | 36.394558 | 79 | py |
fcaf3d | fcaf3d-master/mmdet3d/models/losses/axis_aligned_iou_loss.py | 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 (1-IoU) of two set of axis aligned bounding
... | 2,760 | 33.949367 | 78 | py |
fcaf3d | fcaf3d-master/mmdet3d/models/losses/iou3d_loss.py | import torch
import torch.nn as nn
from mmdet.models.builder import LOSSES
from mmdet.models.losses.utils import weighted_loss
from mmdet3d.ops.rotated_iou import cal_giou_3d, cal_iou_3d
from mmdet3d.core.bbox import AxisAlignedBboxOverlaps3D
@weighted_loss
def iou_3d_loss(pred, target):
return 1 - cal_iou_3d(p... | 2,508 | 29.597561 | 74 | py |
fcaf3d | fcaf3d-master/mmdet3d/models/backbones/multi_backbone.py | 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):
"""MultiBackbone with different configs.
Args:
... | 4,661 | 36 | 76 | py |
fcaf3d | fcaf3d-master/mmdet3d/models/backbones/second.py | 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/PointPillars/PartA2/MVXNet.
Args:
in_channels... | 3,199 | 34.555556 | 79 | py |
fcaf3d | fcaf3d-master/mmdet3d/models/backbones/base_pointnet.py | 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)
self.fp16_enabled = False
asser... | 1,287 | 32.894737 | 76 | py |
fcaf3d | fcaf3d-master/mmdet3d/models/backbones/me_resnet.py | import torch.nn as nn
import MinkowskiEngine as ME
from MinkowskiEngine.modules.resnet_block import BasicBlock, Bottleneck
from mmdet.models import BACKBONES
class ResNetBase(nn.Module):
BLOCK = None
LAYERS = ()
INIT_DIM = 64
PLANES = (64, 128, 256, 512)
def __init__(self, in_channels, n_outs):
... | 3,949 | 30.854839 | 97 | py |
fcaf3d | fcaf3d-master/mmdet3d/models/backbones/nostem_regnet.py | 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>`_ .
Args:
arch (dict): The parameter of RegN... | 3,303 | 38.333333 | 79 | py |
fcaf3d | fcaf3d-master/mmdet3d/models/backbones/pointnet2_sa_msg.py | 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 PointNet2SAMSG(BasePointNet):
"""PointNet2 with Multi-sca... | 7,090 | 40.467836 | 79 | py |
fcaf3d | fcaf3d-master/mmdet3d/models/backbones/pointnet2_sa_ssg.py | 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):
"""PointNet2 with Single-scale grouping.
... | 5,513 | 37.559441 | 79 | py |
fcaf3d | fcaf3d-master/mmdet3d/datasets/custom_3d.py | 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, get_loading_pipeline
@DATASETS.register_module... | 13,298 | 34.943243 | 79 | py |
fcaf3d | fcaf3d-master/mmdet3d/datasets/nuscenes_dataset.py | import mmcv
import numpy as np
import pyquaternion
import tempfile
from nuscenes.utils.data_classes import Box as NuScenesBox
from os import path as osp
from mmdet.datasets import DATASETS
from ..core import show_result
from ..core.bbox import Box3DMode, Coord3DMode, LiDARInstance3DBoxes
from .custom_3d import Custom3... | 25,763 | 38.697997 | 154 | py |
fcaf3d | fcaf3d-master/mmdet3d/datasets/utils.py | import mmcv
# yapf: disable
from mmdet3d.datasets.pipelines import (Collect3D, DefaultFormatBundle3D,
LoadAnnotations3D,
LoadImageFromFileMono3D,
LoadMultiViewImageFromFiles,
... | 5,749 | 40.071429 | 78 | py |
fcaf3d | fcaf3d-master/mmdet3d/datasets/waymo_dataset.py | 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.register_module()
class WaymoDataset(KittiDataset):... | 23,046 | 41.210623 | 81 | py |
fcaf3d | fcaf3d-master/mmdet3d/datasets/nuscenes_mono_dataset.py | 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
from mmdet.datasets import DATASETS, CocoDataset
fr... | 32,480 | 40.11519 | 154 | py |
fcaf3d | fcaf3d-master/mmdet3d/datasets/kitti_dataset.py | 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, CameraInstance3DBoxes, Coord3DMode,
... | 30,949 | 40.543624 | 79 | py |
fcaf3d | fcaf3d-master/mmdet3d/datasets/lyft_dataset.py | 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 mmdet3d.core.evaluation.lyft_eval import lyft_eval... | 21,975 | 38.383513 | 90 | py |
fcaf3d | fcaf3d-master/mmdet3d/datasets/kitti_mono_dataset.py | 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 import NuScenesMonoDataset
@DATASETS.register_mo... | 23,299 | 40.385435 | 79 | py |
fcaf3d | fcaf3d-master/mmdet3d/datasets/builder.py | import platform
from mmcv.utils import Registry, build_from_cfg
from mmdet.datasets import DATASETS
from mmdet.datasets.builder import _concat_dataset
if platform.system() != 'Windows':
# https://github.com/pytorch/pytorch/issues/973
import resource
rlimit = resource.getrlimit(resource.RLIMIT_NOFILE)
... | 1,693 | 39.333333 | 79 | py |
fcaf3d | fcaf3d-master/mmdet3d/datasets/custom_3d_seg.py | 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 extract_result_dict, get_loading_pipeline
@DATASETS.... | 16,314 | 35.255556 | 79 | py |
fcaf3d | fcaf3d-master/mmdet3d/datasets/pipelines/transforms_3d.py | 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 box_np_ops
from mmdet.datasets.builder import PIPELINES
from mmdet.datasets.pipelines import RandomFlip
from ..builder import OBJECTSAMPLERS
from .... | 51,901 | 37.848802 | 79 | py |
fcaf3d | fcaf3d-master/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 |
fcaf3d | fcaf3d-master/mmdet3d/ops/sparse_block.py | 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 PartA^2.
Bottleneck block implemented with subm... | 5,904 | 30.747312 | 77 | py |
fcaf3d | fcaf3d-master/mmdet3d/ops/pointnet_modules/point_sa_module.py | 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 BasePointSAModule(nn.Module):
"""Base module for poi... | 13,267 | 37.795322 | 79 | py |
fcaf3d | fcaf3d-master/mmdet3d/ops/pointnet_modules/point_fp_module.py | 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 used in PointNets.
Propagate the features fr... | 2,763 | 33.987342 | 79 | py |
fcaf3d | fcaf3d-master/mmdet3d/ops/pointnet_modules/paconv_sa_module.py | 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 module with multi-scale grouping (MSG) used in
... | 13,054 | 37.284457 | 78 | py |
fcaf3d | fcaf3d-master/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,831 | 33.350877 | 79 | py |
fcaf3d | fcaf3d-master/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 |
fcaf3d | fcaf3d-master/mmdet3d/ops/rotated_iou/oriented_iou_loss.py | import torch
from .box_intersection_2d import oriented_box_intersection_2d
from .min_enclosing_box import smallest_bounding_box
def box2corners_th(box: torch.Tensor) -> torch.Tensor:
"""convert box coordinate to corners
Args:
box (torch.Tensor): (B, N, 5) with x, y, w, h, alpha
Returns:
... | 9,628 | 36.613281 | 105 | py |
fcaf3d | fcaf3d-master/mmdet3d/ops/rotated_iou/min_enclosing_box.py | '''
find the smallest bounding box which enclosing two rectangles. It can be used to calculate the GIoU or DIoU
loss for rotated object detection.
Observation: a side of a minimum-area enclosing box must be collinear with a side of the convex polygon.
https://en.wikipedia.org/wiki/Minimum_bounding_box_algorithms
Sinc... | 7,534 | 36.118227 | 111 | py |
fcaf3d | fcaf3d-master/mmdet3d/ops/rotated_iou/box_intersection_2d.py | '''
torch implementation of 2d oriented box intersection
author: lanxiao li
2020.8
'''
import torch
from .cuda_op.cuda_ext import sort_v
EPSILON = 1e-8
def box_intersection_th(corners1: torch.Tensor, corners2: torch.Tensor):
"""find intersection points of rectangles
Convention: if two edges are collinear, t... | 7,068 | 37.210811 | 120 | py |
fcaf3d | fcaf3d-master/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,
... | 4,820 | 38.195122 | 79 | py |
fcaf3d | fcaf3d-master/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 |
fcaf3d | fcaf3d-master/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 |
fcaf3d | fcaf3d-master/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 |
fcaf3d | fcaf3d-master/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 |
fcaf3d | fcaf3d-master/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 |
fcaf3d | fcaf3d-master/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 |
fcaf3d | fcaf3d-master/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 |
fcaf3d | fcaf3d-master/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 |
fcaf3d | fcaf3d-master/mmdet3d/ops/pcdet_nms/pcdet_nms_utils.py | """
3D IoU Calculation and Rotated NMS
Written by Shaoshuai Shi
All Rights Reserved 2019-2020.
"""
import torch
from . import pcdet_nms
def boxes_bev_iou_cpu(boxes_a, boxes_b):
"""
Args:
boxes_a: (N, 7) [x, y, z, dx, dy, dz, heading]
boxes_b: (M, 7) [x, y, z, dx, dy, dz, heading]
Returns... | 3,461 | 29.637168 | 109 | py |
fcaf3d | fcaf3d-master/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 |
fcaf3d | fcaf3d-master/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 |
fcaf3d | fcaf3d-master/mmdet3d/ops/paconv/paconv.py | import copy
import torch
from mmcv.cnn import (ConvModule, build_activation_layer, build_norm_layer,
constant_init, xavier_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_witho... | 15,536 | 39.251295 | 112 | py |
fcaf3d | fcaf3d-master/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 |
fcaf3d | fcaf3d-master/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 |
fcaf3d | fcaf3d-master/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 |
fcaf3d | fcaf3d-master/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 |
fcaf3d | fcaf3d-master/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 |
fcaf3d | fcaf3d-master/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 |
fcaf3d | fcaf3d-master/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 |
fcaf3d | fcaf3d-master/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 |
CircleNet | CircleNet-master/src/main.py | from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import _init_paths
import os
import copy
import torch
import numpy as np
import math
import torch.utils.data
from opts import opts
from models.model import create_model, load_model, save_model
# from models.da... | 11,009 | 33.086687 | 97 | py |
CircleNet | CircleNet-master/src/test.py | from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import _init_paths
import os
import json
import cv2
import numpy as np
import time
from progress.bar import Bar
import torch
from external.nms import soft_nms
from opts import opts
from logger import Logger
f... | 4,092 | 31.484127 | 78 | py |
CircleNet | CircleNet-master/src/tools/convert_hourglass_weight.py | from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
MODEL_PATH = '../../models/ExtremeNet_500000.pkl'
OUT_PATH = '../../models/ExtremeNet_500000.pth'
import torch
state_dict = torch.load(MODEL_PATH)
key_map = {'t_heats': 'hm_t', 'l_heats': 'hm_l', 'b_heats': 'h... | 905 | 28.225806 | 69 | py |
CircleNet | CircleNet-master/src/tools/voc_eval_lib/model/config.py | from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import os
import os.path as osp
import numpy as np
# `pip install easydict` if you don't have it
from easydict import EasyDict as edict
__C = edict()
# Consumers can get config by:
# from fast_rcnn_config im... | 11,010 | 27.378866 | 91 | py |
CircleNet | CircleNet-master/src/lib/logger.py | from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
# Code referenced from https://gist.github.com/gyglim/1f8dfb1b5c82627ae3efcfbbadb9f514
import os
import time
import sys
import torch
USE_TENSORBOARD = True
try:
import tensorboardX
print('Using tensorboardX... | 2,227 | 29.944444 | 86 | py |
CircleNet | CircleNet-master/src/lib/detectors/exdet.py | from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import _init_paths
import os
import cv2
import numpy as np
from progress.bar import Bar
import time
import torch
from external.nms import soft_nms
from models.decode import exct_decode, agnex_ct_decode
from ... | 5,097 | 37.330827 | 80 | py |
CircleNet | CircleNet-master/src/lib/detectors/ctdet.py | from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import cv2
import numpy as np
from progress.bar import Bar
import time
import torch
from external.nms import soft_nms
from models.decode import ctdet_decode
from models.utils import flip_tensor
from utils.imag... | 3,518 | 37.25 | 78 | py |
CircleNet | CircleNet-master/src/lib/detectors/ddd.py | from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import cv2
import numpy as np
from progress.bar import Bar
import time
import torch
from external.nms import soft_nms
from models.decode import ddd_decode
from models.utils import flip_tensor
from utils.image ... | 4,046 | 37.179245 | 73 | py |
CircleNet | CircleNet-master/src/lib/detectors/multi_pose.py | from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import cv2
import numpy as np
from progress.bar import Bar
import time
import torch
from external.nms import soft_nms_39
from models.decode import multi_pose_decode
from models.utils import flip_tensor, flip_l... | 3,802 | 37.414141 | 79 | py |
CircleNet | CircleNet-master/src/lib/detectors/base_detector.py | from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import cv2
import numpy as np
from progress.bar import Bar
import time
import torch
from models.model import create_model, load_model
from utils.image import get_affine_transform
from utils.debugger import Deb... | 5,062 | 34.159722 | 78 | py |
CircleNet | CircleNet-master/src/lib/detectors/circledet.py | from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import cv2
import numpy as np
from progress.bar import Bar
import time
import torch
import os
from external.nms import soft_nms
from models.decode import circledet_decode
from models.utils import flip_tensor
f... | 4,224 | 36.389381 | 90 | py |
CircleNet | CircleNet-master/src/lib/models/decode.py | from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import torch
import torch.nn as nn
from .utils import _gather_feat, _tranpose_and_gather_feat
def _nms(heat, kernel=3):
pad = (kernel - 1) // 2
hmax = nn.functional.max_pool2d(
heat, (kernel, ... | 22,809 | 36.827529 | 79 | py |
CircleNet | CircleNet-master/src/lib/models/losses.py | # ------------------------------------------------------------------------------
# Portions of this code are from
# CornerNet (https://github.com/princeton-vl/CornerNet)
# Copyright (c) 2018, University of Michigan
# Licensed under the BSD 3-Clause License
# -------------------------------------------------------------... | 8,818 | 31.069091 | 80 | py |
CircleNet | CircleNet-master/src/lib/models/data_parallel.py | import torch
from torch.nn.modules import Module
from torch.nn.parallel.scatter_gather import gather
from torch.nn.parallel.replicate import replicate
from torch.nn.parallel.parallel_apply import parallel_apply
from .scatter_gather import scatter_kwargs
class _DataParallel(Module):
r"""Implements data parallelis... | 5,176 | 39.445313 | 101 | py |
CircleNet | CircleNet-master/src/lib/models/utils.py | from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import torch
import torch.nn as nn
def _sigmoid(x):
y = torch.clamp(x.sigmoid_(), min=1e-4, max=1-1e-4)
return y
def _gather_feat(feat, ind, mask=None):
dim = feat.size(2)
ind = ind.unsqueeze(2)... | 1,570 | 30.42 | 65 | py |
CircleNet | CircleNet-master/src/lib/models/model.py | from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import torchvision.models as models
import torch
import torch.nn as nn
import os
from .networks.msra_resnet import get_pose_net
from .networks.dlav0 import get_pose_net as get_dlav0
from .networks.pose_dla_dcn... | 3,156 | 32.946237 | 80 | py |
CircleNet | CircleNet-master/src/lib/models/scatter_gather.py | import torch
from torch.autograd import Variable
from torch.nn.parallel._functions import Scatter, Gather
def scatter(inputs, target_gpus, dim=0, chunk_sizes=None):
r"""
Slices variables into approximately equal chunks and
distributes them across given GPUs. Duplicates
references to objects that are n... | 1,535 | 38.384615 | 77 | py |
CircleNet | CircleNet-master/src/lib/models/networks/resnet_dcn.py | # ------------------------------------------------------------------------------
# Copyright (c) Microsoft
# Licensed under the MIT License.
# Written by Bin Xiao (Bin.Xiao@microsoft.com)
# Modified by Dequan Wang and Xingyi Zhou
# ------------------------------------------------------------------------------
from __f... | 10,054 | 33.553265 | 80 | py |
CircleNet | CircleNet-master/src/lib/models/networks/pose_dla_dcn.py | from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import os
import math
import logging
import numpy as np
from os.path import join
import torch
from torch import nn
import torch.nn.functional as F
import torch.utils.model_zoo as model_zoo
from .DCNv2.dcn_v2 ... | 17,594 | 34.617409 | 106 | py |
CircleNet | CircleNet-master/src/lib/models/networks/msra_resnet.py | # ------------------------------------------------------------------------------
# Copyright (c) Microsoft
# Licensed under the MIT License.
# Written by Bin Xiao (Bin.Xiao@microsoft.com)
# Modified by Xingyi Zhou
# ------------------------------------------------------------------------------
from __future__ import a... | 10,167 | 35.185053 | 94 | py |
CircleNet | CircleNet-master/src/lib/models/networks/large_hourglass.py | # ------------------------------------------------------------------------------
# This code is base on
# CornerNet (https://github.com/princeton-vl/CornerNet)
# Copyright (c) 2018, University of Michigan
# Licensed under the BSD 3-Clause License
# ----------------------------------------------------------------------... | 10,065 | 32.003279 | 118 | py |
CircleNet | CircleNet-master/src/lib/models/networks/dlav0.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import math
from os.path import join
import torch
from torch import nn
import torch.utils.model_zoo as model_zoo
import numpy as np
BatchNorm = nn.BatchNorm2d
d... | 22,681 | 34.003086 | 86 | py |
CircleNet | CircleNet-master/src/lib/models/networks/DCNv2/test.py | #!/usr/bin/env python
from __future__ import absolute_import
from __future__ import print_function
from __future__ import division
import time
import torch
import torch.nn as nn
from torch.autograd import gradcheck
from dcn_v2 import DCNv2
from dcn_v2_func import DCNv2Function
from dcn_v2 import DCNv2Pooling
from dcn... | 9,286 | 32.527076 | 112 | py |
CircleNet | CircleNet-master/src/lib/models/networks/DCNv2/dcn_v2_func.py | #!/usr/bin/env python
from __future__ import absolute_import
from __future__ import print_function
from __future__ import division
import torch
from torch.autograd import Function
from ._ext import dcn_v2 as _backend
# from _ext import dcn_v2_double as _backend
class DCNv2Function(Function):
def __init__(self,... | 6,526 | 43.401361 | 101 | py |
CircleNet | CircleNet-master/src/lib/models/networks/DCNv2/dcn_v2.py | #!/usr/bin/env python
from __future__ import absolute_import
from __future__ import print_function
from __future__ import division
import torch
import math
from torch import nn
from torch.nn.modules.utils import _pair
from .dcn_v2_func import DCNv2Function
from .dcn_v2_func import DCNv2PoolingFunction
class DCNv2(nn... | 6,797 | 38.523256 | 113 | py |
CircleNet | CircleNet-master/src/lib/models/networks/DCNv2/build_double.py | import os
import torch
from torch.utils.ffi import create_extension
sources = ['src/dcn_v2_double.c']
headers = ['src/dcn_v2_double.h']
defines = []
with_cuda = False
extra_objects = []
if torch.cuda.is_available():
print('Including CUDA code.')
sources += ['src/dcn_v2_cuda_double.c']
headers += ['src/dc... | 1,205 | 26.409091 | 75 | py |
CircleNet | CircleNet-master/src/lib/models/networks/DCNv2/build.py | import os
import torch
from torch.utils.ffi import create_extension
sources = ['src/dcn_v2.c']
headers = ['src/dcn_v2.h']
defines = []
with_cuda = False
extra_objects = []
if torch.cuda.is_available():
print('Including CUDA code.')
sources += ['src/dcn_v2_cuda.c']
headers += ['src/dcn_v2_cuda.h']
def... | 1,156 | 25.295455 | 75 | py |
CircleNet | CircleNet-master/src/lib/trains/exdet.py | from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import torch
import numpy as np
import cv2
import sys
import time
from utils.debugger import Debugger
from models.data_parallel import DataParallel
from models.losses import FocalLoss, RegL1Loss
from models.dec... | 4,562 | 41.25 | 79 | py |
CircleNet | CircleNet-master/src/lib/trains/ctdet.py | from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import torch
import numpy as np
from models.losses import FocalLoss
from models.losses import RegL1Loss, RegLoss, NormRegL1Loss, RegWeightedL1Loss
from models.decode import ctdet_decode
from models.utils impor... | 5,626 | 40.992537 | 78 | py |
CircleNet | CircleNet-master/src/lib/trains/ddd.py | from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import torch
import numpy as np
from models.losses import FocalLoss, L1Loss, BinRotLoss
from models.decode import ddd_decode
from models.utils import _sigmoid
from utils.debugger import Debugger
from utils.pos... | 6,919 | 43.645161 | 80 | py |
CircleNet | CircleNet-master/src/lib/trains/multi_pose.py | from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import torch
import numpy as np
from models.losses import FocalLoss, RegL1Loss, RegLoss, RegWeightedL1Loss
from models.decode import multi_pose_decode
from models.utils import _sigmoid, flip_tensor, flip_lr_of... | 7,252 | 44.049689 | 82 | py |
CircleNet | CircleNet-master/src/lib/trains/base_trainer.py | from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import time
import torch
from progress.bar import Bar
from models.data_parallel import DataParallel
from utils.utils import AverageMeter
class ModleWithLoss(torch.nn.Module):
def __init__(self, model, loss)... | 4,102 | 30.806202 | 80 | py |
CircleNet | CircleNet-master/src/lib/trains/circledet.py | from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import torch
import numpy as np
from models.losses import FocalLoss, FocalLoss_mask
from models.losses import RegL1Loss, RegLoss, NormRegL1Loss, RegWeightedL1Loss
from models.decode import circledet_decode
fro... | 6,944 | 37.583333 | 83 | py |
CircleNet | CircleNet-master/src/lib/datasets/sample/exdet.py | from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import torch.utils.data as data
# import pycocotools.coco as coco
import numpy as np
import torch
import json
import cv2
import os
from utils.image import flip, color_aug
from utils.image import get_affine_tran... | 5,726 | 40.80292 | 81 | py |
CircleNet | CircleNet-master/src/lib/datasets/sample/ctdet.py | from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import torch.utils.data as data
import numpy as np
import torch
import json
import cv2
import os
from utils.image import flip, color_aug
from utils.image import get_affine_transform, affine_transform
from utils... | 6,110 | 38.173077 | 80 | py |
CircleNet | CircleNet-master/src/lib/datasets/sample/ddd.py | from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import torch.utils.data as data
# import pycocotools.coco as coco
import numpy as np
import torch
import json
import cv2
import os
import math
from utils.image import flip, color_aug
from utils.image import get... | 6,805 | 38.80117 | 90 | py |
CircleNet | CircleNet-master/src/lib/datasets/sample/multi_pose.py | from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import torch.utils.data as data
import numpy as np
import torch
import json
import cv2
import os
from utils.image import flip, color_aug
from utils.image import get_affine_transform, affine_transform
from utils... | 7,913 | 42.01087 | 81 | py |
CircleNet | CircleNet-master/src/lib/datasets/sample/circledet.py | from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import torch.utils.data as data
import numpy as np
import torch
import json
import cv2
import os
from utils.image import flip, color_aug
from utils.image import get_affine_transform, affine_transform
from utils... | 9,580 | 41.582222 | 110 | py |
CircleNet | CircleNet-master/src/lib/datasets/dataset/nucls.py | from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import pycocotools.coco as coco
import datasets.eval_protocals.kidpath_circle as kidpath_circle
from datasets.eval_protocals.circle_eval import CIRCLEeval
from pycocotools.cocoeval import COCOeval
import numpy... | 7,091 | 40.717647 | 115 | py |
CircleNet | CircleNet-master/src/lib/datasets/dataset/kidpath_new.py | from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import pycocotools.coco as coco
import datasets.eval_protocals.kidpath_circle as kidpath_circle
from datasets.eval_protocals.circle_eval import CIRCLEeval
from pycocotools.cocoeval import COCOeval
import numpy... | 6,961 | 39.952941 | 82 | py |
CircleNet | CircleNet-master/src/lib/datasets/dataset/kitti.py | from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import torch.utils.data as data
import pycocotools.coco as coco
import numpy as np
import torch
import json
import cv2
import os
import math
import torch.utils.data as data
class KITTI(data.Dataset):
num_c... | 3,058 | 32.988889 | 79 | py |
CircleNet | CircleNet-master/src/lib/datasets/dataset/kidmouse.py | from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import pycocotools.coco as coco
import datasets.eval_protocals.kidpath_circle as kidpath_circle
from datasets.eval_protocals.circle_eval import CIRCLEeval
from pycocotools.cocoeval import COCOeval
import numpy... | 7,054 | 40.017442 | 83 | py |
CircleNet | CircleNet-master/src/lib/datasets/dataset/coco_hp.py | from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import pycocotools.coco as coco
from pycocotools.cocoeval import COCOeval
import numpy as np
import json
import os
import torch.utils.data as data
class COCOHP(data.Dataset):
num_classes = 1
num_joints = ... | 4,242 | 34.358333 | 77 | py |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.