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 |
|---|---|---|---|---|---|---|
CRB-active-3Ddet | CRB-active-3Ddet-main/tools/train_utils/train_st_utils.py | import torch
import os
import glob
import tqdm
from torch.nn.utils import clip_grad_norm_
from pcdet.utils import common_utils
from pcdet.utils import self_training_utils
from pcdet.config import cfg
from .train_utils import save_checkpoint, checkpoint_state
def train_one_epoch_st(model, optimizer, source_reader, tar... | 8,363 | 45.466667 | 108 | py |
CRB-active-3Ddet | CRB-active-3Ddet-main/tools/train_utils/train_utils.py | import glob
import os
import torch
import tqdm
import time
from torch.nn.utils import clip_grad_norm_
from pcdet.datasets import build_active_dataloader
from pcdet.utils import common_utils, commu_utils
import pickle
def train_one_epoch(model, optimizer, train_loader, model_func, lr_scheduler, accumulated_iter, optim... | 9,878 | 38.834677 | 153 | py |
CRB-active-3Ddet | CRB-active-3Ddet-main/tools/train_utils/train_active_utils.py | import torch
import os
import glob
import tqdm
import torch.nn as nn
from torch.nn.utils import clip_grad_norm_
from pcdet.utils import common_utils
from pcdet.utils import self_training_utils
from pcdet.utils import active_training_utils
from pcdet.config import cfg
from .train_utils import save_checkpoint, checkpoint... | 19,002 | 49.272487 | 224 | py |
CRB-active-3Ddet | CRB-active-3Ddet-main/tools/train_utils/optimization/fastai_optim.py | # This file is modified from https://github.com/traveller59/second.pytorch
try:
from collections.abc import Iterable
except:
from collections import Iterable
import torch
from torch import nn
from torch._utils import _unflatten_dense_tensors
from torch.nn.utils import parameters_to_vector
bn_types = (nn.Batc... | 10,535 | 38.758491 | 117 | py |
CRB-active-3Ddet | CRB-active-3Ddet-main/tools/train_utils/optimization/learning_schedules_fastai.py | # This file is modified from https://github.com/traveller59/second.pytorch
import math
from functools import partial
import numpy as np
import torch.optim.lr_scheduler as lr_sched
from .fastai_optim import OptimWrapper
class LRSchedulerStep(object):
def __init__(self, fai_optimizer: OptimWrapper, total_step, l... | 4,169 | 35.26087 | 118 | py |
CRB-active-3Ddet | CRB-active-3Ddet-main/tools/train_utils/optimization/__init__.py | from functools import partial
import torch.nn as nn
import torch.optim as optim
import torch.optim.lr_scheduler as lr_sched
from .fastai_optim import OptimWrapper
from .learning_schedules_fastai import CosineWarmupLR, OneCycle
def build_optimizer(model, optim_cfg):
if optim_cfg.get('LOSS_NET_SKIP', False) and ... | 2,868 | 38.847222 | 139 | py |
CRB-active-3Ddet | CRB-active-3Ddet-main/tools/visual_utils/open3d_vis_utils.py | """
Open3d visualization tool box
Written by Jihan YANG
All rights preserved from 2021 - present.
"""
import open3d
import torch
import matplotlib
import numpy as np
box_colormap = [
[1, 1, 1],
[0, 1, 0],
[0, 1, 1],
[1, 1, 0],
]
def get_coor_colors(obj_labels):
"""
Args:
obj_labels: 1... | 3,413 | 28.179487 | 126 | py |
CRB-active-3Ddet | CRB-active-3Ddet-main/tools/visual_utils/visualize_utils.py | import mayavi.mlab as mlab
import numpy as np
import torch
box_colormap = [
[1, 1, 1],
[0, 1, 0],
[0, 1, 1],
[1, 1, 0],
]
def check_numpy_to_torch(x):
if isinstance(x, np.ndarray):
return torch.from_numpy(x).float(), True
return x, False
def rotate_points_along_z(points, angle):
... | 8,540 | 38.541667 | 121 | py |
CRB-active-3Ddet | CRB-active-3Ddet-main/tools/backups/test_backup.py | import _init_path
import argparse
import datetime
import glob
import os
import re
import time
from pathlib import Path
import numpy as np
import torch
from tensorboardX import SummaryWriter
from eval_utils import eval_utils
from pcdet.config import cfg, cfg_from_list, cfg_from_yaml_file, log_config_to_file
from pcdet... | 8,549 | 40.707317 | 120 | py |
CRB-active-3Ddet | CRB-active-3Ddet-main/pcdet/models/__init__.py | from collections import namedtuple
import numpy as np
import torch
from .detectors import build_detector
try:
import kornia
except:
pass
# print('Warning: kornia is not installed. This package is only required by CaDDN')
def build_network(model_cfg, num_class, dataset):
model = build_detector(
... | 1,448 | 26.339623 | 87 | py |
CRB-active-3Ddet | CRB-active-3Ddet-main/pcdet/models/detectors/detector3d_template.py | import os
import torch
import torch.nn as nn
from ...ops.iou3d_nms import iou3d_nms_utils
from ...utils.spconv_utils import find_all_spconv_keys
from .. import backbones_2d, backbones_3d, dense_heads, roi_heads
from ..backbones_2d import map_to_bev
from ..backbones_3d import pfe, vfe
from ..model_utils import model_n... | 26,062 | 47.534451 | 182 | py |
CRB-active-3Ddet | CRB-active-3Ddet-main/pcdet/models/detectors/second_net_iou.py | import torch
from .detector3d_template import Detector3DTemplate
from ..model_utils.model_nms_utils import class_agnostic_nms
from ...ops.roiaware_pool3d import roiaware_pool3d_utils
class SECONDNetIoU(Detector3DTemplate):
def __init__(self, model_cfg, num_class, dataset):
super().__init__(model_cfg=model... | 7,499 | 41.134831 | 127 | py |
CRB-active-3Ddet | CRB-active-3Ddet-main/pcdet/models/backbones_3d/spconv_unet.py | from functools import partial
import torch
import torch.nn as nn
from ...utils.spconv_utils import replace_feature, spconv
from ...utils import common_utils
from .spconv_backbone import post_act_block
class SparseBasicBlock(spconv.SparseModule):
expansion = 1
def __init__(self, inplanes, planes, stride=1, ... | 8,602 | 39.389671 | 117 | py |
CRB-active-3Ddet | CRB-active-3Ddet-main/pcdet/models/backbones_3d/spconv_backbone.py | from functools import partial
import torch.nn as nn
from ...utils.spconv_utils import replace_feature, spconv
def post_act_block(in_channels, out_channels, kernel_size, indice_key=None, stride=1, padding=0,
conv_type='subm', norm_fn=None):
if conv_type == 'subm':
conv = spconv.SubMCo... | 10,242 | 33.840136 | 118 | py |
CRB-active-3Ddet | CRB-active-3Ddet-main/pcdet/models/backbones_3d/pointnet2_backbone.py | import torch
import torch.nn as nn
from ...ops.pointnet2.pointnet2_batch import pointnet2_modules
from ...ops.pointnet2.pointnet2_stack import pointnet2_modules as pointnet2_modules_stack
from ...ops.pointnet2.pointnet2_stack import pointnet2_utils as pointnet2_utils_stack
class PointNet2MSG(nn.Module):
def __in... | 8,540 | 40.26087 | 132 | py |
CRB-active-3Ddet | CRB-active-3Ddet-main/pcdet/models/backbones_3d/pfe/voxel_set_abstraction.py | import math
import numpy as np
import torch
import torch.nn as nn
from ....ops.pointnet2.pointnet2_stack import pointnet2_modules as pointnet2_stack_modules
from ....ops.pointnet2.pointnet2_stack import pointnet2_utils as pointnet2_stack_utils
from ....utils import common_utils
def bilinear_interpolate_torch(im, x, ... | 16,404 | 38.817961 | 127 | py |
CRB-active-3Ddet | CRB-active-3Ddet-main/pcdet/models/backbones_3d/vfe/vfe_template.py | import torch.nn as nn
class VFETemplate(nn.Module):
def __init__(self, model_cfg, **kwargs):
super().__init__()
self.model_cfg = model_cfg
def get_output_feature_dim(self):
raise NotImplementedError
def forward(self, **kwargs):
"""
Args:
**kwargs:
... | 470 | 19.478261 | 45 | py |
CRB-active-3Ddet | CRB-active-3Ddet-main/pcdet/models/backbones_3d/vfe/dynamic_mean_vfe.py | import torch
from .vfe_template import VFETemplate
try:
import torch_scatter
except Exception as e:
# Incase someone doesn't want to use dynamic pillar vfe and hasn't installed torch_scatter
pass
from .vfe_template import VFETemplate
class DynamicMeanVFE(VFETemplate):
def __init__(self, model_cfg, ... | 2,980 | 37.714286 | 106 | py |
CRB-active-3Ddet | CRB-active-3Ddet-main/pcdet/models/backbones_3d/vfe/mean_vfe.py | import torch
from .vfe_template import VFETemplate
class MeanVFE(VFETemplate):
def __init__(self, model_cfg, num_point_features, **kwargs):
super().__init__(model_cfg=model_cfg)
self.num_point_features = num_point_features
def get_output_feature_dim(self):
return self.num_point_featu... | 1,038 | 31.46875 | 99 | py |
CRB-active-3Ddet | CRB-active-3Ddet-main/pcdet/models/backbones_3d/vfe/dynamic_pillar_vfe.py | import torch
import torch.nn as nn
import torch.nn.functional as F
try:
import torch_scatter
except Exception as e:
# Incase someone doesn't want to use dynamic pillar vfe and hasn't installed torch_scatter
pass
from .vfe_template import VFETemplate
class PFNLayerV2(nn.Module):
def __init__(self,
... | 5,614 | 38.265734 | 118 | py |
CRB-active-3Ddet | CRB-active-3Ddet-main/pcdet/models/backbones_3d/vfe/pillar_vfe.py | import torch
import torch.nn as nn
import torch.nn.functional as F
from .vfe_template import VFETemplate
class PFNLayer(nn.Module):
def __init__(self,
in_channels,
out_channels,
use_norm=True,
last_layer=False):
super().__init__()
... | 5,099 | 40.129032 | 137 | py |
CRB-active-3Ddet | CRB-active-3Ddet-main/pcdet/models/backbones_3d/vfe/image_vfe.py | import torch
from .vfe_template import VFETemplate
from .image_vfe_modules import ffn, f2v
class ImageVFE(VFETemplate):
def __init__(self, model_cfg, grid_size, point_cloud_range, depth_downsample_factor, **kwargs):
super().__init__(model_cfg=model_cfg)
self.grid_size = grid_size
self.pc_... | 2,526 | 28.383721 | 99 | py |
CRB-active-3Ddet | CRB-active-3Ddet-main/pcdet/models/backbones_3d/vfe/image_vfe_modules/ffn/depth_ffn.py | import torch.nn as nn
import torch.nn.functional as F
from . import ddn, ddn_loss
from pcdet.models.model_utils.basic_block_2d import BasicBlock2D
class DepthFFN(nn.Module):
def __init__(self, model_cfg, downsample_factor):
"""
Initialize frustum feature network via depth distribution estimation... | 3,778 | 35.336538 | 96 | py |
CRB-active-3Ddet | CRB-active-3Ddet-main/pcdet/models/backbones_3d/vfe/image_vfe_modules/ffn/ddn/ddn_deeplabv3.py | from .ddn_template import DDNTemplate
try:
import torchvision
except:
pass
class DDNDeepLabV3(DDNTemplate):
def __init__(self, backbone_name, **kwargs):
"""
Initializes DDNDeepLabV3 model
Args:
backbone_name: string, ResNet Backbone Name [ResNet50/ResNet101]
"... | 674 | 26 | 77 | py |
CRB-active-3Ddet | CRB-active-3Ddet-main/pcdet/models/backbones_3d/vfe/image_vfe_modules/ffn/ddn/ddn_template.py | from collections import OrderedDict
from pathlib import Path
from torch import hub
import torch
import torch.nn as nn
import torch.nn.functional as F
try:
from kornia.enhance.normalize import normalize
except:
pass
# print('Warning: kornia is not installed. This package is only required by CaDDN')
c... | 5,941 | 35.453988 | 106 | py |
CRB-active-3Ddet | CRB-active-3Ddet-main/pcdet/models/backbones_3d/vfe/image_vfe_modules/ffn/ddn_loss/balancer.py | import torch
import torch.nn as nn
from pcdet.utils import loss_utils
class Balancer(nn.Module):
def __init__(self, fg_weight, bg_weight, downsample_factor=1):
"""
Initialize fixed foreground/background loss balancer
Args:
fg_weight: float, Foreground loss weight
b... | 1,806 | 34.431373 | 102 | py |
CRB-active-3Ddet | CRB-active-3Ddet-main/pcdet/models/backbones_3d/vfe/image_vfe_modules/ffn/ddn_loss/ddn_loss.py | import torch
import torch.nn as nn
from .balancer import Balancer
from pcdet.utils import transform_utils
try:
from kornia.losses.focal import FocalLoss
except:
pass
# print('Warning: kornia is not installed. This package is only required by CaDDN')
class DDNLoss(nn.Module):
def __init__(self... | 2,428 | 30.960526 | 97 | py |
CRB-active-3Ddet | CRB-active-3Ddet-main/pcdet/models/backbones_3d/vfe/image_vfe_modules/f2v/frustum_to_voxel.py | import torch
import torch.nn as nn
from .frustum_grid_generator import FrustumGridGenerator
from .sampler import Sampler
class FrustumToVoxel(nn.Module):
def __init__(self, model_cfg, grid_size, pc_range, disc_cfg):
"""
Initializes module to transform frustum features to voxel features via 3D tr... | 2,338 | 41.527273 | 109 | py |
CRB-active-3Ddet | CRB-active-3Ddet-main/pcdet/models/backbones_3d/vfe/image_vfe_modules/f2v/frustum_grid_generator.py | import torch
import torch.nn as nn
try:
from kornia.utils.grid import create_meshgrid3d
from kornia.geometry.linalg import transform_points
except Exception as e:
# Note: Kornia team will fix this import issue to try to allow the usage of lower torch versions.
# print('Warning: kornia is not installed ... | 6,249 | 41.808219 | 201 | py |
CRB-active-3Ddet | CRB-active-3Ddet-main/pcdet/models/backbones_3d/vfe/image_vfe_modules/f2v/sampler.py | import torch
import torch.nn as nn
import torch.nn.functional as F
class Sampler(nn.Module):
def __init__(self, mode="bilinear", padding_mode="zeros"):
"""
Initializes module
Args:
mode: string, Sampling mode [bilinear/nearest]
padding_mode: string, Padding mode fo... | 980 | 30.645161 | 111 | py |
CRB-active-3Ddet | CRB-active-3Ddet-main/pcdet/models/dense_heads/anchor_head_single.py | import numpy as np
import torch.nn as nn
from .anchor_head_template import AnchorHeadTemplate
class AnchorHeadSingle(AnchorHeadTemplate):
def __init__(self, model_cfg, input_channels, num_class, class_names, grid_size, point_cloud_range,
predict_boxes_when_training=True, **kwargs):
super... | 2,975 | 37.649351 | 136 | py |
CRB-active-3Ddet | CRB-active-3Ddet-main/pcdet/models/dense_heads/point_head_template.py | import torch
import torch.nn as nn
import torch.nn.functional as F
from ...ops.roiaware_pool3d import roiaware_pool3d_utils
from ...utils import common_utils, loss_utils
class PointHeadTemplate(nn.Module):
def __init__(self, model_cfg, num_class):
super().__init__()
self.model_cfg = model_cfg
... | 9,955 | 45.523364 | 119 | py |
CRB-active-3Ddet | CRB-active-3Ddet-main/pcdet/models/dense_heads/anchor_head_template.py | import numpy as np
import torch
import torch.nn as nn
from ...utils import box_coder_utils, common_utils, loss_utils
from .target_assigner.anchor_generator import AnchorGenerator
from .target_assigner.atss_target_assigner import ATSSTargetAssigner
from .target_assigner.axis_aligned_target_assigner import AxisAlignedTa... | 13,005 | 44.00346 | 118 | py |
CRB-active-3Ddet | CRB-active-3Ddet-main/pcdet/models/dense_heads/anchor_head_multi.py | import numpy as np
import torch
import torch.nn as nn
from ..backbones_2d import BaseBEVBackbone
from .anchor_head_template import AnchorHeadTemplate
class SingleHead(BaseBEVBackbone):
def __init__(self, model_cfg, input_channels, num_class, num_anchors_per_location, code_size, rpn_head_cfg=None,
... | 17,041 | 44.566845 | 117 | py |
CRB-active-3Ddet | CRB-active-3Ddet-main/pcdet/models/dense_heads/center_head.py | import copy
import numpy as np
import torch
import torch.nn as nn
from torch.nn.init import kaiming_normal_
from ..model_utils import model_nms_utils
from ..model_utils import centernet_utils
from ...utils import loss_utils
class SeparateHead(nn.Module):
def __init__(self, input_channels, sep_head_dict, init_bias... | 16,051 | 44.089888 | 125 | py |
CRB-active-3Ddet | CRB-active-3Ddet-main/pcdet/models/dense_heads/point_head_box.py | import torch
from ...utils import box_coder_utils, box_utils
from .point_head_template import PointHeadTemplate
class PointHeadBox(PointHeadTemplate):
"""
A simple point-based segmentation head, which are used for PointRCNN.
Reference Paper: https://arxiv.org/abs/1812.04244
PointRCNN: 3D Object Propo... | 4,930 | 41.508621 | 106 | py |
CRB-active-3Ddet | CRB-active-3Ddet-main/pcdet/models/dense_heads/point_head_simple.py | import torch
from ...utils import box_utils
from .point_head_template import PointHeadTemplate
class PointHeadSimple(PointHeadTemplate):
"""
A simple point-based segmentation head, which are used for PV-RCNN keypoint segmentaion.
Reference Paper: https://arxiv.org/abs/1912.13192
PV-RCNN: Point-Voxel ... | 3,594 | 38.076087 | 106 | py |
CRB-active-3Ddet | CRB-active-3Ddet-main/pcdet/models/dense_heads/point_intra_part_head.py | import torch
from ...utils import box_coder_utils, box_utils
from .point_head_template import PointHeadTemplate
class PointIntraPartOffsetHead(PointHeadTemplate):
"""
Point-based head for predicting the intra-object part locations.
Reference Paper: https://arxiv.org/abs/1907.03670
From Points to Part... | 5,568 | 42.507813 | 107 | py |
CRB-active-3Ddet | CRB-active-3Ddet-main/pcdet/models/dense_heads/target_assigner/anchor_generator.py | import torch
class AnchorGenerator(object):
def __init__(self, anchor_range, anchor_generator_config):
super().__init__()
self.anchor_generator_cfg = anchor_generator_config
self.anchor_range = anchor_range
self.anchor_sizes = [config['anchor_sizes'] for config in anchor_generator_... | 3,990 | 48.8875 | 122 | py |
CRB-active-3Ddet | CRB-active-3Ddet-main/pcdet/models/dense_heads/target_assigner/axis_aligned_target_assigner.py | import numpy as np
import torch
from ....ops.iou3d_nms import iou3d_nms_utils
from ....utils import box_utils
class AxisAlignedTargetAssigner(object):
def __init__(self, model_cfg, class_names, box_coder, match_height=False):
super().__init__()
anchor_generator_cfg = model_cfg.ANCHOR_GENERATOR_C... | 10,042 | 46.597156 | 122 | py |
CRB-active-3Ddet | CRB-active-3Ddet-main/pcdet/models/dense_heads/target_assigner/atss_target_assigner.py | import torch
from ....ops.iou3d_nms import iou3d_nms_utils
from ....utils import common_utils
class ATSSTargetAssigner(object):
"""
Reference: https://arxiv.org/abs/1912.02424
"""
def __init__(self, topk, box_coder, match_height=False):
self.topk = topk
self.box_coder = box_coder
... | 6,050 | 41.612676 | 117 | py |
CRB-active-3Ddet | CRB-active-3Ddet-main/pcdet/models/roi_heads/roi_head_template.py | import numpy as np
import torch
import torch.nn as nn
import torch.nn.functional as F
from pcdet.config import cfg
from ...utils import box_coder_utils, common_utils, loss_utils
from ..model_utils.model_nms_utils import class_agnostic_nms
from .target_assigner.proposal_target_layer import ProposalTargetLayer
class Ro... | 16,806 | 45.173077 | 138 | py |
CRB-active-3Ddet | CRB-active-3Ddet-main/pcdet/models/roi_heads/voxelrcnn_head.py | import torch
import torch.nn as nn
from ...ops.pointnet2.pointnet2_stack import voxel_pool_modules as voxelpool_stack_modules
from ...utils import common_utils
from .roi_head_template import RoIHeadTemplate
class VoxelRCNNHead(RoIHeadTemplate):
def __init__(self, backbone_channels, model_cfg, point_cloud_range, v... | 11,993 | 44.604563 | 116 | py |
CRB-active-3Ddet | CRB-active-3Ddet-main/pcdet/models/roi_heads/loss_net.py | import torch.nn as nn
import torch
class LossNet(nn.Module):
def __init__(self, model_cfg, **kwargs):
"""
Initializes convolutional block
Args:
in_channels: int, Number of input channels
out_channels: int, Number of output channels
**kwargs: Dict, Extra ... | 2,413 | 32.527778 | 106 | py |
CRB-active-3Ddet | CRB-active-3Ddet-main/pcdet/models/roi_heads/partA2_head.py | import numpy as np
import torch
import torch.nn as nn
from ...ops.roiaware_pool3d import roiaware_pool3d_utils
from ...utils.spconv_utils import spconv
from .roi_head_template import RoIHeadTemplate
class PartA2FCHead(RoIHeadTemplate):
def __init__(self, input_channels, model_cfg, num_class=1, **kwargs):
... | 10,089 | 43.844444 | 120 | py |
CRB-active-3Ddet | CRB-active-3Ddet-main/pcdet/models/roi_heads/pvrcnn_head.py | import torch.nn as nn
from ...ops.pointnet2.pointnet2_stack import pointnet2_modules as pointnet2_stack_modules
from ...utils import common_utils
from .roi_head_template import RoIHeadTemplate
from .loss_net import LossNet
import torch
class PVRCNNHead(RoIHeadTemplate):
def __init__(self, input_channels, model_cf... | 10,603 | 42.63786 | 136 | py |
CRB-active-3Ddet | CRB-active-3Ddet-main/pcdet/models/roi_heads/second_head.py | import torch
import torch.nn as nn
from .roi_head_template import RoIHeadTemplate
from ...utils import common_utils, loss_utils
class SECONDHead(RoIHeadTemplate):
def __init__(self, input_channels, model_cfg, num_class=1, **kwargs):
super().__init__(num_class=num_class, model_cfg=model_cfg)
self.m... | 7,527 | 41.055866 | 120 | py |
CRB-active-3Ddet | CRB-active-3Ddet-main/pcdet/models/roi_heads/pointrcnn_head.py | import torch
import torch.nn as nn
from ...ops.pointnet2.pointnet2_batch import pointnet2_modules
from ...ops.roipoint_pool3d import roipoint_pool3d_utils
from ...utils import common_utils
from .roi_head_template import RoIHeadTemplate
class PointRCNNHead(RoIHeadTemplate):
def __init__(self, input_channels, mode... | 7,835 | 42.533333 | 116 | py |
CRB-active-3Ddet | CRB-active-3Ddet-main/pcdet/models/roi_heads/target_assigner/proposal_target_layer.py | import numpy as np
import torch
import torch.nn as nn
from ....ops.iou3d_nms import iou3d_nms_utils
class ProposalTargetLayer(nn.Module):
def __init__(self, roi_sampler_cfg):
super().__init__()
self.roi_sampler_cfg = roi_sampler_cfg
def forward(self, batch_dict):
"""
Args:
... | 9,946 | 42.436681 | 117 | py |
CRB-active-3Ddet | CRB-active-3Ddet-main/pcdet/models/model_utils/centernet_utils.py | # This file is modified from https://github.com/tianweiy/CenterPoint
import torch
import torch.nn.functional as F
import numpy as np
import numba
def gaussian_radius(height, width, min_overlap=0.5):
"""
Args:
height: (N)
width: (N)
min_overlap:
Returns:
"""
a1 = 1
b1 =... | 7,235 | 32.345622 | 111 | py |
CRB-active-3Ddet | CRB-active-3Ddet-main/pcdet/models/model_utils/model_nms_utils.py | import torch
from ...ops.iou3d_nms import iou3d_nms_utils
def class_agnostic_nms(box_scores, box_preds, nms_config, score_thresh=None):
src_box_scores = box_scores
if score_thresh is not None:
scores_mask = (box_scores >= score_thresh)
box_scores = box_scores[scores_mask]
box_preds = ... | 2,457 | 35.686567 | 116 | py |
CRB-active-3Ddet | CRB-active-3Ddet-main/pcdet/models/model_utils/basic_block_2d.py | import torch.nn as nn
class BasicBlock2D(nn.Module):
def __init__(self, in_channels, out_channels, **kwargs):
"""
Initializes convolutional block
Args:
in_channels: int, Number of input channels
out_channels: int, Number of output channels
**kwargs: Dic... | 1,038 | 28.685714 | 60 | py |
CRB-active-3Ddet | CRB-active-3Ddet-main/pcdet/models/backbones_2d/base_bev_backbone.py | import numpy as np
import torch
import torch.nn as nn
class BaseBEVBackbone(nn.Module):
def __init__(self, model_cfg, input_channels):
super().__init__()
self.model_cfg = model_cfg
if self.model_cfg.get('LAYER_NUMS', None) is not None:
assert len(self.model_cfg.LAYER_NUMS) == ... | 4,318 | 37.221239 | 121 | py |
CRB-active-3Ddet | CRB-active-3Ddet-main/pcdet/models/backbones_2d/map_to_bev/conv2d_collapse.py | import torch
import torch.nn as nn
from pcdet.models.model_utils.basic_block_2d import BasicBlock2D
class Conv2DCollapse(nn.Module):
def __init__(self, model_cfg, grid_size):
"""
Initializes 2D convolution collapse module
Args:
model_cfg: EasyDict, Model configuration
... | 1,451 | 36.230769 | 106 | py |
CRB-active-3Ddet | CRB-active-3Ddet-main/pcdet/models/backbones_2d/map_to_bev/pointpillar_scatter.py | import torch
import torch.nn as nn
class PointPillarScatter(nn.Module):
def __init__(self, model_cfg, grid_size, **kwargs):
super().__init__()
self.model_cfg = model_cfg
self.num_bev_features = self.model_cfg.NUM_BEV_FEATURES
self.nx, self.ny, self.nz = grid_size
assert se... | 1,545 | 39.684211 | 123 | py |
CRB-active-3Ddet | CRB-active-3Ddet-main/pcdet/models/backbones_2d/map_to_bev/height_compression.py | import torch.nn as nn
class HeightCompression(nn.Module):
def __init__(self, model_cfg, **kwargs):
super().__init__()
self.model_cfg = model_cfg
self.num_bev_features = self.model_cfg.NUM_BEV_FEATURES
def forward(self, batch_dict):
"""
Args:
batch_dict:
... | 870 | 31.259259 | 90 | py |
CRB-active-3Ddet | CRB-active-3Ddet-main/pcdet/datasets/dataset.py | from collections import defaultdict
from pathlib import Path
import numpy as np
import torch.utils.data as torch_data
from ..utils import common_utils
from .augmentor.data_augmentor import DataAugmentor
from .processor.data_processor import DataProcessor
from .processor.point_feature_encoder import PointFeatureEncode... | 9,308 | 39.473913 | 118 | py |
CRB-active-3Ddet | CRB-active-3Ddet-main/pcdet/datasets/__init__.py | import torch
# print(torch.__version__)
from torch.utils.data import DataLoader
from torch.utils.data import DistributedSampler as _DistributedSampler
from pcdet.utils import common_utils
from .dataset import DatasetTemplate
from .kitti.kitti_dataset import KittiDataset
from .nuscenes.nuscenes_dataset import NuScenes... | 6,957 | 37.230769 | 107 | py |
CRB-active-3Ddet | CRB-active-3Ddet-main/pcdet/datasets/waymo/waymo_dataset.py | # OpenPCDet PyTorch Dataloader and Evaluation Tools for Waymo Open Dataset
# Reference https://github.com/open-mmlab/OpenPCDet
# Written by Shaoshuai Shi, Chaoxu Guo
# All Rights Reserved 2019-2020.
import os
import pickle
import copy
import numpy as np
import torch
import multiprocessing
import SharedArray
import tor... | 20,694 | 42.114583 | 131 | py |
CRB-active-3Ddet | CRB-active-3Ddet-main/pcdet/datasets/lyft/lyft_dataset.py | import copy
import pickle
from pathlib import Path
import numpy as np
from tqdm import tqdm
from ...ops.roiaware_pool3d import roiaware_pool3d_utils
from ...utils import common_utils, box_utils
from ..dataset import DatasetTemplate
class LyftDataset(DatasetTemplate):
def __init__(self, dataset_cfg, class_names,... | 14,392 | 40.598266 | 146 | py |
CRB-active-3Ddet | CRB-active-3Ddet-main/pcdet/datasets/nuscenes/nuscenes_utils.py | """
The NuScenes data pre-processing and evaluation is modified from
https://github.com/traveller59/second.pytorch and https://github.com/poodarchu/Det3D
"""
import operator
from functools import reduce
from pathlib import Path
import numpy as np
import tqdm
from nuscenes.utils.data_classes import Box
from nuscenes.u... | 18,474 | 35.876248 | 111 | py |
CRB-active-3Ddet | CRB-active-3Ddet-main/pcdet/datasets/nuscenes/nuscenes_dataset.py | import copy
import pickle
from pathlib import Path
import numpy as np
from tqdm import tqdm
from ...ops.roiaware_pool3d import roiaware_pool3d_utils
from ...utils import common_utils
from ..dataset import DatasetTemplate
class NuScenesDataset(DatasetTemplate):
def __init__(self, dataset_cfg, class_names, traini... | 15,327 | 39.874667 | 120 | py |
CRB-active-3Ddet | CRB-active-3Ddet-main/pcdet/datasets/pandaset/pandaset_dataset.py | """
Dataset from Pandaset (Hesai)
"""
import pickle
import os
try:
import pandas as pd
import pandaset as ps
except:
pass
import numpy as np
from ..dataset import DatasetTemplate
from ...ops.roiaware_pool3d import roiaware_pool3d_utils
import torch
def pose_dict_to_numpy(pose):
"""
Con... | 19,065 | 37.910204 | 157 | py |
CRB-active-3Ddet | CRB-active-3Ddet-main/pcdet/datasets/kitti/kitti_dataset.py | import copy
import pickle
import numpy as np
from skimage import io
from . import kitti_utils
from ...ops.roiaware_pool3d import roiaware_pool3d_utils
from ...utils import box_utils, calibration_kitti, common_utils, object3d_kitti
from ..dataset import DatasetTemplate
class KittiDataset(DatasetTemplate):
def __... | 20,757 | 41.711934 | 154 | py |
CRB-active-3Ddet | CRB-active-3Ddet-main/pcdet/query_strategies/bald_sampling.py |
import torch
from .strategy import Strategy
from pcdet.models import load_data_to_gpu
import torch.nn.functional as F
import tqdm
class BALDSampling(Strategy):
def __init__(self, model, labelled_loader, unlabelled_loader, rank, active_label_dir, cfg):
super(BALDSampling, self).__init__(model, labelled_loa... | 2,763 | 37.929577 | 114 | py |
CRB-active-3Ddet | CRB-active-3Ddet-main/pcdet/query_strategies/crb_sampling.py |
import torch
from .strategy import Strategy
from pcdet.models import load_data_to_gpu
from pcdet.datasets import build_active_dataloader
import torch.nn.functional as F
from torch.distributions import Categorical
import tqdm
import numpy as np
import wandb
import time
import scipy
from sklearn.cluster import kmeans_pl... | 16,078 | 45.877551 | 168 | py |
CRB-active-3Ddet | CRB-active-3Ddet-main/pcdet/query_strategies/montecarlo_sampling.py |
import torch
from .strategy import Strategy
from pcdet.models import load_data_to_gpu
import torch.nn.functional as F
import tqdm
def enable_dropout(model):
""" Function to enable the dropout layers during test-time """
i = 0
for m in model.modules():
if m.__class__.__name__.startswith('Dropout'):... | 3,072 | 36.938272 | 120 | py |
CRB-active-3Ddet | CRB-active-3Ddet-main/pcdet/query_strategies/badge_sampling.py |
import itertools
import torch
from .strategy import Strategy
from pcdet.models import load_data_to_gpu
import torch.nn.functional as F
import tqdm
from sklearn.cluster import kmeans_plusplus
import time
import pickle
import os
from torch.utils.data import DataLoader
import itertools
from collections import Counter
imp... | 9,089 | 43.558824 | 158 | py |
CRB-active-3Ddet | CRB-active-3Ddet-main/pcdet/query_strategies/entropy_sampling.py |
import torch
from .strategy import Strategy
from pcdet.models import load_data_to_gpu
import torch.nn.functional as F
import tqdm
class EntropySampling(Strategy):
def __init__(self, model, labelled_loader, unlabelled_loader, rank, active_label_dir, cfg):
super(EntropySampling, self).__init__(model, labell... | 2,721 | 37.885714 | 117 | py |
CRB-active-3Ddet | CRB-active-3Ddet-main/pcdet/query_strategies/strategy.py | import os
import pickle
import wandb
import torch
class Strategy:
def __init__(self, model, labelled_loader, unlabelled_loader, rank, active_label_dir, cfg):
self.cfg = cfg
self.active_label_dir = active_label_dir
self.rank = rank
self.model = model
self.labelled_loa... | 3,874 | 45.130952 | 163 | py |
CRB-active-3Ddet | CRB-active-3Ddet-main/pcdet/query_strategies/llal_sampling.py |
import torch
from .strategy import Strategy
from pcdet.models import load_data_to_gpu
import torch.nn.functional as F
import tqdm
class LLALSampling(Strategy):
def __init__(self, model, labelled_loader, unlabelled_loader, rank, active_label_dir, cfg):
super(LLALSampling, self).__init__(model, labelled_loa... | 2,318 | 36.403226 | 114 | py |
CRB-active-3Ddet | CRB-active-3Ddet-main/pcdet/query_strategies/confidence_sampling.py |
import torch
from .strategy import Strategy
from pcdet.models import load_data_to_gpu
import torch.nn.functional as F
import tqdm
class ConfidenceSampling(Strategy):
def __init__(self, model, labelled_loader, unlabelled_loader, rank, active_label_dir, cfg):
super(ConfidenceSampling, self).__init__(model, ... | 2,726 | 37.957143 | 120 | py |
CRB-active-3Ddet | CRB-active-3Ddet-main/pcdet/query_strategies/random_sampling.py | import random
from .strategy import Strategy
import tqdm
import torch
from pcdet.models import load_data_to_gpu
class RandomSampling(Strategy):
def __init__(self, model, labelled_loader, unlabelled_loader, rank, active_label_dir, cfg):
super(RandomSampling, self).__init__(model, labelled_loader, unlabelle... | 2,186 | 39.5 | 116 | py |
CRB-active-3Ddet | CRB-active-3Ddet-main/pcdet/query_strategies/coreset_sampling.py |
import torch
from .strategy import Strategy
from pcdet.models import load_data_to_gpu
import torch.nn.functional as F
import tqdm
class CoresetSampling(Strategy):
def __init__(self, model, labelled_loader, unlabelled_loader, rank, active_label_dir, cfg):
super(CoresetSampling, self).__init__(model, labell... | 5,359 | 39.300752 | 149 | py |
CRB-active-3Ddet | CRB-active-3Ddet-main/pcdet/utils/active_training_utils.py | from itertools import accumulate
import torch
import os
import glob
import tqdm
import numpy as np
import torch.distributed as dist
from pcdet.config import cfg
from pcdet.models import load_data_to_gpu
from pcdet.utils import common_utils, commu_utils, memory_ensemble_utils
import pickle as pkl
import re
from pcdet.da... | 12,565 | 37.546012 | 115 | py |
CRB-active-3Ddet | CRB-active-3Ddet-main/pcdet/utils/box_utils.py | import numpy as np
import scipy
import torch
import copy
from scipy.spatial import Delaunay
from ..ops.roiaware_pool3d import roiaware_pool3d_utils
from . import common_utils
def in_hull(p, hull):
"""
:param p: (N, K) test points
:param hull: (M, K) M corners of a box
:return (N) bool
"""
try... | 10,569 | 34.351171 | 118 | py |
CRB-active-3Ddet | CRB-active-3Ddet-main/pcdet/utils/loss_utils.py | import numpy as np
import torch
import torch.nn as nn
import torch.nn.functional as F
from . import box_utils
class SigmoidFocalClassificationLoss(nn.Module):
"""
Sigmoid focal cross entropy loss.
"""
def __init__(self, gamma: float = 2.0, alpha: float = 0.25):
"""
Args:
... | 12,608 | 31.665803 | 102 | py |
CRB-active-3Ddet | CRB-active-3Ddet-main/pcdet/utils/box_coder_utils.py | import numpy as np
import torch
class ResidualCoder(object):
def __init__(self, code_size=7, encode_angle_by_sincos=False, **kwargs):
super().__init__()
self.code_size = code_size
self.encode_angle_by_sincos = encode_angle_by_sincos
if self.encode_angle_by_sincos:
self.... | 7,601 | 33.089686 | 105 | py |
CRB-active-3Ddet | CRB-active-3Ddet-main/pcdet/utils/common_utils.py | import logging
import os
import pickle
import random
import shutil
import subprocess
import SharedArray
import numpy as np
import torch
import torch.distributed as dist
import torch.multiprocessing as mp
def check_numpy_to_torch(x):
if isinstance(x, np.ndarray):
return torch.from_numpy(x).float(), True
... | 7,799 | 28.323308 | 97 | py |
CRB-active-3Ddet | CRB-active-3Ddet-main/pcdet/utils/transform_utils.py | import math
import torch
try:
from kornia.geometry.conversions import (
convert_points_to_homogeneous,
convert_points_from_homogeneous,
)
except:
pass
# print('Warning: kornia is not installed. This package is only required by CaDDN')
def project_to_image(project, points):
"""
... | 3,092 | 32.619565 | 104 | py |
CRB-active-3Ddet | CRB-active-3Ddet-main/pcdet/utils/self_training_utils.py | import torch
import os
import glob
import tqdm
import numpy as np
import torch.distributed as dist
from pcdet.config import cfg
from pcdet.models import load_data_to_gpu
from pcdet.utils import common_utils, commu_utils, memory_ensemble_utils
import pickle as pkl
import re
PSEUDO_LABELS = {}
NEW_PSEUDO_LABELS = {}
d... | 8,550 | 35.080169 | 95 | py |
CRB-active-3Ddet | CRB-active-3Ddet-main/pcdet/utils/spconv_utils.py | from typing import Set
try:
import spconv.pytorch as spconv
except:
import spconv as spconv
import torch.nn as nn
def find_all_spconv_keys(model: nn.Module, prefix="") -> Set[str]:
"""
Finds all spconv keys that need to have weight's transposed
"""
found_keys: Set[str] = set()
for name, ... | 896 | 24.628571 | 73 | py |
CRB-active-3Ddet | CRB-active-3Ddet-main/pcdet/utils/memory_ensemble_utils.py | import torch
import numpy as np
from scipy.optimize import linear_sum_assignment
from pcdet.utils import common_utils
from pcdet.ops.iou3d_nms import iou3d_nms_utils
from pcdet.models.model_utils.model_nms_utils import class_agnostic_nms
def consistency_ensemble(gt_infos_a, gt_infos_b, memory_ensemble_cfg):
"""
... | 14,715 | 41.90379 | 117 | py |
CRB-active-3Ddet | CRB-active-3Ddet-main/pcdet/utils/commu_utils.py | """
This file contains primitives for multi-gpu communication.
This is useful when doing distributed training.
deeply borrow from maskrcnn-benchmark and ST3D
"""
import pickle
import time
import torch
import torch.distributed as dist
def get_world_size():
if not dist.is_available():
return 1
if not... | 5,253 | 27.710383 | 89 | py |
CRB-active-3Ddet | CRB-active-3Ddet-main/pcdet/ops/roipoint_pool3d/roipoint_pool3d_utils.py | import torch
import torch.nn as nn
from torch.autograd import Function
from ...utils import box_utils
from . import roipoint_pool3d_cuda
class RoIPointPool3d(nn.Module):
def __init__(self, num_sampled_points=512, pool_extra_width=1.0):
super().__init__()
self.num_sampled_points = num_sampled_poin... | 2,226 | 31.75 | 112 | py |
CRB-active-3Ddet | CRB-active-3Ddet-main/pcdet/ops/pointnet2/pointnet2_stack/voxel_query_utils.py | import torch
from torch.autograd import Variable
from torch.autograd import Function
import torch.nn as nn
from typing import List
from . import pointnet2_stack_cuda as pointnet2
from . import pointnet2_utils
class VoxelQuery(Function):
@staticmethod
def forward(ctx, max_range: int, radius: float, nsample: i... | 4,148 | 40.079208 | 134 | py |
CRB-active-3Ddet | CRB-active-3Ddet-main/pcdet/ops/pointnet2/pointnet2_stack/pointnet2_utils.py | import torch
import torch.nn as nn
from torch.autograd import Function, Variable
from . import pointnet2_stack_cuda as pointnet2
class BallQuery(Function):
@staticmethod
def forward(ctx, radius: float, nsample: int, xyz: torch.Tensor, xyz_batch_cnt: torch.Tensor,
new_xyz: torch.Tensor, new_x... | 17,903 | 38.523179 | 127 | py |
CRB-active-3Ddet | CRB-active-3Ddet-main/pcdet/ops/pointnet2/pointnet2_stack/voxel_pool_modules.py | import torch
import torch.nn as nn
import torch.nn.functional as F
from . import voxel_query_utils
from typing import List
class NeighborVoxelSAModuleMSG(nn.Module):
def __init__(self, *, query_ranges: List[List[int]], radii: List[float],
nsamples: List[int], mlps: List[List[int]], use_... | 5,672 | 41.977273 | 108 | py |
CRB-active-3Ddet | CRB-active-3Ddet-main/pcdet/ops/pointnet2/pointnet2_stack/pointnet2_modules.py | from typing import List
import torch
import torch.nn as nn
import torch.nn.functional as F
from . import pointnet2_utils
def build_local_aggregation_module(input_channels, config):
local_aggregation_name = config.get('NAME', 'StackSAModuleMSG')
if local_aggregation_name == 'StackSAModuleMSG':
mlps ... | 21,385 | 44.40552 | 132 | py |
CRB-active-3Ddet | CRB-active-3Ddet-main/pcdet/ops/pointnet2/pointnet2_batch/pointnet2_utils.py | from typing import Tuple
import torch
import torch.nn as nn
from torch.autograd import Function, Variable
from . import pointnet2_batch_cuda as pointnet2
class FarthestPointSampling(Function):
@staticmethod
def forward(ctx, xyz: torch.Tensor, npoint: int) -> torch.Tensor:
"""
Uses iterative ... | 9,717 | 32.395189 | 118 | py |
CRB-active-3Ddet | CRB-active-3Ddet-main/pcdet/ops/pointnet2/pointnet2_batch/pointnet2_modules.py | from typing import List
import torch
import torch.nn as nn
import torch.nn.functional as F
from . import pointnet2_utils
class _PointnetSAModuleBase(nn.Module):
def __init__(self):
super().__init__()
self.npoint = None
self.groupers = None
self.mlps = None
self.pool_meth... | 6,631 | 36.897143 | 119 | py |
CRB-active-3Ddet | CRB-active-3Ddet-main/pcdet/ops/iou3d_nms/iou3d_nms_utils.py | """
3D IoU Calculation and Rotated NMS
Written by Shaoshuai Shi
All Rights Reserved 2019-2020.
"""
import torch
from ...utils import common_utils
from . import iou3d_nms_cuda
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, ... | 3,673 | 30.401709 | 109 | py |
CRB-active-3Ddet | CRB-active-3Ddet-main/pcdet/ops/roiaware_pool3d/roiaware_pool3d_utils.py | import torch
import torch.nn as nn
from torch.autograd import Function
from ...utils import common_utils
from . import roiaware_pool3d_cuda
def points_in_boxes_cpu(points, boxes):
"""
Args:
points: (num_points, 3)
boxes: [x, y, z, dx, dy, dz, heading], (x, y, z) is the box center, each box DO... | 4,075 | 35.392857 | 120 | py |
hyperparam-sensitivity | hyperparam-sensitivity-main/models/estimators_tf/_two_head.py | import os
import numpy as np
import tensorflow as tf
from tensorflow import keras
from tensorflow.keras import layers
from sklearn.model_selection import ParameterGrid
from ._common import get_params
from helpers.utils import get_params_df
def _get_ct_data(t, y):
y_c = np.zeros_like(y)
w_c = np.zeros_like(y)
... | 7,579 | 39.972973 | 259 | py |
hyperparam-sensitivity | hyperparam-sensitivity-main/models/estimators_tf/_mlp.py | import numpy as np
import tensorflow as tf
from tensorflow import keras
from tensorflow.keras import layers
class MLP():
def __init__(self, input_size, n_layers, n_units, learning_rate, activation, dropout, l2, out_layer, batch_size, epochs, epochs_are_steps=False):
self.input_size = input_size
sel... | 3,944 | 37.676471 | 149 | py |
tps-torch | tps-torch-main/setup.py | from setuptools import setup, find_packages
import os
"""
def copy_dir(dir_path):
base_dir = os.path.join('tpstorch/', dir_path)
for (dirpath, dirnames, files) in os.walk(base_dir):
for f in files:
if "git" in f:
continue
else:
yield os.path.join(d... | 1,164 | 36.580645 | 73 | py |
tps-torch | tps-torch-main/dimer_solv/fts_test/dimer_fts.py | import scipy.spatial
import sys
sys.path.insert(0,'/global/home/users/muhammad_hasyim/tps-torch/build/')
#Import necessarry tools from torch
import torch
import torch.distributed as dist
import torch.nn as nn
#Import necessarry tools from tpstorch
from tpstorch.examples.dimer_solv_ml import MyMLFTSSampler
from tpstor... | 8,078 | 34.906667 | 122 | py |
tps-torch | tps-torch-main/dimer_solv/fts_test/fts_simulation.py | #import sys
#sys.path.insert(0,"/global/home/users/muhammad_hasyim/tps-torch/build")
#Import necessarry tools from torch
import tpstorch
import torch
import torch.distributed as dist
import torch.nn as nn
import scipy.spatial
#Import necessarry tools from tpstorch
#from mb_fts import MullerBrown as MullerBrownFTS#, ... | 6,357 | 36.621302 | 208 | py |
tps-torch | tps-torch-main/dimer_solv/fts_test/dimer_fts_nosolv.py | import sys
sys.path.insert(0,'/global/home/users/muhammad_hasyim/tps-torch/build/')
import scipy.spatial
#Import necessarry tools from torch
import torch
import torch.distributed as dist
import torch.nn as nn
#Import necessarry tools from tpstorch
from tpstorch.examples.dimer_solv_ml import MyMLFTSSampler
from tpsto... | 8,260 | 35.074236 | 122 | py |
tps-torch | tps-torch-main/dimer_solv/fts_test/fts_simulation_nosolv.py | #import sys
#sys.path.insert(0,"/global/home/users/muhammad_hasyim/tps-torch/build")
#Import necessarry tools from torch
import tpstorch
import torch
import torch.distributed as dist
import torch.nn as nn
import scipy.spatial
#Import necessarry tools from tpstorch
#from mb_fts import MullerBrown as MullerBrownFTS#, ... | 6,405 | 36.905325 | 209 | py |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.