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 |
|---|---|---|---|---|---|---|
OpenPCDet | OpenPCDet-master/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 |
OpenPCDet | OpenPCDet-master/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 |
OpenPCDet | OpenPCDet-master/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 |
OpenPCDet | OpenPCDet-master/pcdet/models/dense_heads/target_assigner/hungarian_assigner.py | import torch
from scipy.optimize import linear_sum_assignment
from pcdet.ops.iou3d_nms import iou3d_nms_cuda
def height_overlaps(boxes1, boxes2):
"""
Calculate height overlaps of two boxes.
"""
boxes1_top_height = (boxes1[:,2]+ boxes1[:,5]).view(-1, 1)
boxes1_bottom_height = boxes1[:,2].view(-1, 1... | 4,979 | 37.015267 | 90 | py |
OpenPCDet | OpenPCDet-master/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 ...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 RoIHeadTemplate(nn.Module):
... | 11,557 | 43.114504 | 128 | py |
OpenPCDet | OpenPCDet-master/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 |
OpenPCDet | OpenPCDet-master/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 |
OpenPCDet | OpenPCDet-master/pcdet/models/roi_heads/mppnet_memory_bank_e2e.py | from typing import ValuesView
import torch.nn as nn
import torch
import numpy as np
import copy
import torch.nn.functional as F
from pcdet.ops.iou3d_nms import iou3d_nms_utils
from ...utils import common_utils, loss_utils
from .roi_head_template import RoIHeadTemplate
from ..model_utils.mppnet_utils import build_transf... | 28,217 | 47.567986 | 192 | py |
OpenPCDet | OpenPCDet-master/pcdet/models/roi_heads/mppnet_head.py | from typing import ValuesView
import torch.nn as nn
import torch
import numpy as np
import copy
import torch.nn.functional as F
from pcdet.ops.iou3d_nms import iou3d_nms_utils
from ...utils import common_utils, loss_utils
from .roi_head_template import RoIHeadTemplate
from ..model_utils.mppnet_utils import build_transf... | 47,674 | 47.011078 | 192 | py |
OpenPCDet | OpenPCDet-master/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
class PVRCNNHead(RoIHeadTemplate):
def __init__(self, input_channels, model_cfg, num_class=1, **kwargs):
super()... | 7,452 | 41.346591 | 116 | py |
OpenPCDet | OpenPCDet-master/pcdet/models/roi_heads/second_head.py | from functools import partial
import torch
import torch.nn as nn
import torch.nn.functional as F
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().__... | 7,864 | 40.613757 | 120 | py |
OpenPCDet | OpenPCDet-master/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 |
OpenPCDet | OpenPCDet-master/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:
... | 10,028 | 42.79476 | 117 | py |
OpenPCDet | OpenPCDet-master/pcdet/models/model_utils/transfusion_utils.py | import torch
from torch import nn
import torch.nn.functional as F
def clip_sigmoid(x, eps=1e-4):
y = torch.clamp(x.sigmoid_(), min=eps, max=1 - eps)
return y
class PositionEmbeddingLearned(nn.Module):
"""
Absolute pos embedding, learned.
"""
def __init__(self, input_channel, num_pos_feats=28... | 3,859 | 36.475728 | 95 | py |
OpenPCDet | OpenPCDet-master/pcdet/models/model_utils/dsvt_utils.py | import torch
import torch.nn as nn
import numpy as np
from pcdet.ops.ingroup_inds.ingroup_inds_op import ingroup_inds
get_inner_win_inds_cuda = ingroup_inds
class PositionEmbeddingLearned(nn.Module):
"""
Absolute pos embedding, learned.
"""
def __init__(self, input_channel, num_pos_feats):
s... | 6,206 | 40.38 | 112 | py |
OpenPCDet | OpenPCDet-master/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 =... | 14,764 | 37.251295 | 133 | py |
OpenPCDet | OpenPCDet-master/pcdet/models/model_utils/swin_utils.py | """
Mostly copy-paste from
https://github.com/open-mmlab/mmdetection/blob/ecac3a77becc63f23d9f6980b2a36f86acd00a8a/mmdet/models/layers/transformer/utils.py
"""
import copy
import math
import warnings
import collections.abc
from collections import OrderedDict
from itertools import repeat
from typing import Se... | 23,223 | 34.187879 | 140 | py |
OpenPCDet | OpenPCDet-master/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 = ... | 3,842 | 34.583333 | 116 | py |
OpenPCDet | OpenPCDet-master/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 |
OpenPCDet | OpenPCDet-master/pcdet/models/model_utils/mppnet_utils.py | from os import getgrouplist
import torch.nn as nn
import torch
import numpy as np
import torch.nn.functional as F
from typing import Optional, List
from torch import Tensor
from torch.nn.init import xavier_uniform_, zeros_, kaiming_normal_
class PointNetfeat(nn.Module):
def __init__(self, input_dim, x=1,outchanne... | 16,083 | 37.204276 | 179 | py |
OpenPCDet | OpenPCDet-master/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) == ... | 13,110 | 36.247159 | 121 | py |
OpenPCDet | OpenPCDet-master/pcdet/models/backbones_2d/fuser/convfuser.py | import torch
from torch import nn
class ConvFuser(nn.Module):
def __init__(self,model_cfg) -> None:
super().__init__()
self.model_cfg = model_cfg
in_channel = self.model_cfg.IN_CHANNEL
out_channel = self.model_cfg.OUT_CHANNEL
self.conv = nn.Sequential(
nn.Conv2d... | 1,105 | 32.515152 | 79 | py |
OpenPCDet | OpenPCDet-master/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 |
OpenPCDet | OpenPCDet-master/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... | 3,214 | 43.041096 | 142 | py |
OpenPCDet | OpenPCDet-master/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 |
OpenPCDet | OpenPCDet-master/pcdet/datasets/dataset.py | from collections import defaultdict
from pathlib import Path
import numpy as np
import torch
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 Point... | 13,713 | 41.067485 | 122 | py |
OpenPCDet | OpenPCDet-master/pcdet/datasets/__init__.py | import torch
from functools import partial
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 NuSce... | 2,955 | 34.190476 | 115 | py |
OpenPCDet | OpenPCDet-master/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.
import os
import pickle
import copy
import numpy as np
import torch
import multiprocessing
import SharedArray
import torch.distrib... | 39,287 | 46.449275 | 219 | py |
OpenPCDet | OpenPCDet-master/pcdet/datasets/once/once_dataset.py | import copy
import pickle
import numpy as np
from PIL import Image
import torch
import torch.nn.functional as F
from pathlib import Path
from ..dataset import DatasetTemplate
from ...ops.roiaware_pool3d import roiaware_pool3d_utils
from ...utils import box_utils
from .once_toolkits import Octopus
class ONCEDataset(D... | 17,847 | 39.198198 | 140 | py |
OpenPCDet | OpenPCDet-master/pcdet/datasets/argo2/argo2_dataset.py | import copy
import pickle
import argparse
import os
from os import path as osp
import torch
from av2.utils.io import read_feather
import numpy as np
import multiprocessing as mp
import pickle as pkl
from pathlib import Path
import pandas as pd
from ..dataset import DatasetTemplate
from .argo2_utils.so3 import yaw_to_q... | 21,380 | 38.741636 | 140 | py |
OpenPCDet | OpenPCDet-master/pcdet/datasets/argo2/argo2_utils/so3.py | """SO(3) group transformations."""
import kornia.geometry.conversions as C
import torch
from torch import Tensor
from math import pi as PI
@torch.jit.script
def quat_to_mat(quat_wxyz: Tensor) -> Tensor:
"""Convert scalar first quaternion to rotation matrix.
Args:
quat_wxyz: (...,4) Scalar first quat... | 3,862 | 26.204225 | 99 | py |
OpenPCDet | OpenPCDet-master/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,... | 12,762 | 40.983553 | 146 | py |
OpenPCDet | OpenPCDet-master/pcdet/datasets/processor/data_processor.py | from functools import partial
import numpy as np
from skimage import transform
import torch
import torchvision
from ...utils import box_utils, common_utils
tv = None
try:
import cumm.tensorview as tv
except:
pass
class VoxelGeneratorWrapper():
def __init__(self, vsize_xyz, coors_range_xyz, num_point_fea... | 12,380 | 40.408027 | 113 | py |
OpenPCDet | OpenPCDet-master/pcdet/datasets/augmentor/database_sampler.py | import pickle
import os
import copy
import numpy as np
from skimage import io
import torch
import SharedArray
import torch.distributed as dist
from ...ops.iou3d_nms import iou3d_nms_utils
from ...utils import box_utils, common_utils, calibration_kitti
from pcdet.datasets.kitti.kitti_object_eval_python import kitti_co... | 23,558 | 45.836978 | 139 | py |
OpenPCDet | OpenPCDet-master/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... | 22,208 | 36.706282 | 111 | py |
OpenPCDet | OpenPCDet-master/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
from pyquaternion import Quaternion
from PIL import Image
class NuScenesDataset(DatasetTemplate... | 18,123 | 40.664368 | 120 | py |
OpenPCDet | OpenPCDet-master/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 |
OpenPCDet | OpenPCDet-master/pcdet/datasets/custom/custom_dataset.py | import copy
import pickle
import os
import numpy as np
from ...ops.roiaware_pool3d import roiaware_pool3d_utils
from ...utils import box_utils, common_utils
from ..dataset import DatasetTemplate
class CustomDataset(DatasetTemplate):
def __init__(self, dataset_cfg, class_names, training=True, root_path=None, log... | 11,219 | 38.507042 | 119 | py |
OpenPCDet | OpenPCDet-master/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,454 | 41.175258 | 140 | py |
OpenPCDet | OpenPCDet-master/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... | 15,887 | 35.109091 | 130 | py |
OpenPCDet | OpenPCDet-master/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
from pcdet.ops.iou3d_nms import iou3d_nms_utils
class SigmoidFocalClassificationLoss(nn.Module):
"""
Sigmoid focal cross entropy loss.
"""
def __init__(self, gamma: float = 2.0, alpha: float... | 21,718 | 32.413846 | 125 | py |
OpenPCDet | OpenPCDet-master/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 |
OpenPCDet | OpenPCDet-master/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
... | 8,588 | 28.016892 | 97 | py |
OpenPCDet | OpenPCDet-master/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 |
OpenPCDet | OpenPCDet-master/pcdet/utils/spconv_utils.py | from typing import Set
import spconv
if float(spconv.__version__[2:]) >= 2.2:
spconv.constants.SPCONV_USE_DIRECT_TABLE = False
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]:
"""
Fi... | 1,009 | 24.897436 | 73 | py |
OpenPCDet | OpenPCDet-master/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 |
OpenPCDet | OpenPCDet-master/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 |
OpenPCDet | OpenPCDet-master/pcdet/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 |
OpenPCDet | OpenPCDet-master/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 |
OpenPCDet | OpenPCDet-master/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... | 18,073 | 38.462882 | 127 | py |
OpenPCDet | OpenPCDet-master/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 |
OpenPCDet | OpenPCDet-master/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 |
OpenPCDet | OpenPCDet-master/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 |
OpenPCDet | OpenPCDet-master/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 |
OpenPCDet | OpenPCDet-master/pcdet/ops/ingroup_inds/ingroup_inds_op.py | import torch
try:
from . import ingroup_inds_cuda
# import ingroup_indices
except ImportError:
ingroup_indices = None
print('Can not import ingroup indices')
ingroup_indices = ingroup_inds_cuda
from torch.autograd import Function
class IngroupIndicesFunction(Function):
@staticmethod
def forw... | 632 | 19.419355 | 53 | py |
OpenPCDet | OpenPCDet-master/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, ... | 6,382 | 32.772487 | 109 | py |
OpenPCDet | OpenPCDet-master/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 |
target_identification | target_identification-main/fig01_cifar_vs_mnist/tr_set_analysis.py | __all__ = [
"baselines",
]
import logging
from typing import NoReturn, Optional
from torch import LongTensor, Tensor
from poison import config
import poison.end_to_end
import poison.influence_func
from poison.influence_utils import InfluenceMethod
import poison.learner
import poison.rep_point
import poison.gas_a... | 2,620 | 39.323077 | 93 | py |
target_identification | target_identification-main/fig01_cifar_vs_mnist/poison/rep_point.py | __all__ = [
"calc_representer_vals"
]
import logging
import time
from typing import NoReturn, Optional
import torch
from torch import Tensor
from torch.utils.data import DataLoader
from . import _config as config
from . import dirs
from . import influence_utils
from .influence_utils import InfluenceMethod
from .... | 10,055 | 39.224 | 98 | py |
target_identification | target_identification-main/fig01_cifar_vs_mnist/poison/end_to_end.py | __all__ = [
"check_success",
"run",
]
import dill as pk
import logging
from typing import NoReturn, Optional
import torch
from torch import LongTensor, Tensor
import torchvision.transforms as transforms
import wandb
from . import _config as config
from . import dirs
from .influence_utils import InfluenceMeth... | 3,809 | 36.722772 | 95 | py |
target_identification | target_identification-main/fig01_cifar_vs_mnist/poison/_config.py | __all__ = [
"BATCH_SIZE",
"DAMP",
"DATASET",
"HVP_BATCH_SIZE",
"LEARNING_RATE",
"NUM_EPOCH",
"NUM_FF_LAYERS",
"NUM_SUBEPOCH",
"N_CLASSES", "N_FULL_TR", "N_TRAIN", "N_TEST",
"ORIG_POIS_CLS",
"ORIG_TARG_CLS",
"OTHER_CNT",
"OTHER_DS",
"POIS_CLS",
"QUIET",
"R_... | 10,380 | 28.83046 | 98 | py |
target_identification | target_identification-main/fig01_cifar_vs_mnist/poison/learner.py | __all__ = [
"CombinedLearner",
"create_fit_dataloader",
"filter_ids",
"train_both",
]
from abc import ABC, abstractmethod
import datetime
import dill as pk
import itertools
import logging
import time
from typing import Iterable, NoReturn, Optional, Tuple
import torch
from torch import BoolTensor, Tens... | 13,982 | 39.181034 | 98 | py |
target_identification | target_identification-main/fig01_cifar_vs_mnist/poison/utils.py | __all__ = [
"ClassifierBlock",
"NUM_WORKERS",
"TORCH_DEVICE",
"configure_dataset_args",
"construct_filename",
"get_num_usable_cpus",
"get_proj_name",
"load_module",
"log_seeds",
"save_module",
"set_debug_mode",
"set_random_seeds"
]
import copy
import dataclasses
import l... | 23,802 | 37.578606 | 100 | py |
target_identification | target_identification-main/fig01_cifar_vs_mnist/poison/logger.py | # -*- utf-8 -*-
r"""
logger_utils.py
~~~~~~~~~~~~~~~
Provides utilities to simplify and standardize logging in particular for training for training
with \p torch.
:copyright: (c) 2019 by Author
:license: MIT, see LICENSE for more details.
"""
__all__ = [
"TrainingLogger",
"create_stdo... | 11,321 | 36.243421 | 100 | py |
target_identification | target_identification-main/fig01_cifar_vs_mnist/poison/gas_and_tracin.py | __all__ = [
"calc",
"log_final",
]
import logging
from typing import List, NoReturn, Optional, Tuple, Union
import torch
from torch import LongTensor, Tensor
import torch.autograd
from torch.utils.data import DataLoader
from . import _config as config
from . import influence_utils
from .influence_utils impo... | 7,055 | 41.506024 | 97 | py |
target_identification | target_identification-main/fig01_cifar_vs_mnist/poison/types.py | __all__ = [
"CustomTensorDataset",
"LearnerParams",
"ListOrInt",
"OptInt",
"OptStr",
"OptTensor",
"PathOrStr",
"TensorGroup",
"TorchOrNp"
]
from argparse import Namespace
from enum import Enum
import dataclasses
from pathlib import Path
from typing import Any, Callable, List, NoRetu... | 4,237 | 27.635135 | 79 | py |
target_identification | target_identification-main/fig01_cifar_vs_mnist/poison/generate_results.py | __all__ = [
"calculate_results",
]
from dataclasses import dataclass
import io
import logging
import re
import sys
from typing import ClassVar, List, Tuple
import numpy as np
import pycm
import torch
from torch import Tensor
from torch.utils.data import DataLoader
from . import _config as config
from .learner i... | 5,634 | 32.541667 | 100 | py |
target_identification | target_identification-main/fig01_cifar_vs_mnist/poison/influence_func.py | __all__ = [
"calc",
]
import copy
import json
import logging
from pathlib import Path
import pickle as pk
from typing import NoReturn, Optional, Tuple
import numpy as np
import torch
from torch import Tensor
from torch.utils.data import DataLoader
from . import _config as config
from . import dirs
from . import... | 12,090 | 42.02847 | 98 | py |
target_identification | target_identification-main/fig01_cifar_vs_mnist/poison/datasets/utils.py | __all__ = [
"binarize_labels",
"binom_sample",
"download_file",
"extract_target_example",
"filter_classes",
"get_class_mask",
"populate_main_class",
"prune_datasets",
"shuffle_tensorgroup",
"update_tensorgroup",
]
import logging
from pathlib import Path
import numpy as np
impor... | 8,002 | 33.947598 | 96 | py |
target_identification | target_identification-main/fig01_cifar_vs_mnist/poison/datasets/types.py | __all__ = [
"BaseFFModule",
"LearnerModule",
"NEG_LABEL",
"POS_LABEL",
"PoisonDataset",
"PoisonLearner",
"SmartLinear",
"ViewTo1D",
]
import abc
import collections
import copy
from enum import Enum
import logging
from typing import List, NoReturn, Optional
import torch
from torch impor... | 8,164 | 31.923387 | 93 | py |
target_identification | target_identification-main/fig01_cifar_vs_mnist/poison/datasets/_cifar10_resnet.py | __all__ = [
"ResNet9"
]
import torch
from torch import Tensor
import torch.nn as nn
from .types import PoisonLearner
from .. import _config as config
def conv_block(in_channels, out_channels, pool=False):
layers = [nn.Conv2d(in_channels, out_channels, kernel_size=3, padding=1), # noqa
nn.Batc... | 2,775 | 28.531915 | 99 | py |
target_identification | target_identification-main/fig01_cifar_vs_mnist/poison/datasets/wandb_utils.py | __all__ = [
"upload_data",
]
import logging
import os
from pathlib import Path
from typing import List, NoReturn, Optional
import PIL # noqa
from torch import Tensor
import torchvision
import wandb
from .. import _config as config
from ..types import TensorGroup
from .. import utils as parent_utils
# logging.... | 5,032 | 35.737226 | 92 | py |
target_identification | target_identification-main/fig01_cifar_vs_mnist/poison/datasets/_mnist_cnn.py | __all__ = [
"Model",
]
r""""
Adapted from the Robustness Against Backdoors (RAB) repository.
See: https://github.com/AI-secure/Robustness-Against-Backdoor-Attacks
"""
from torch import Tensor
import torch.nn as nn
import torch.nn.functional as F # noqa
from .types import PoisonLearner
class Model(PoisonLearne... | 2,414 | 30.776316 | 97 | py |
target_identification | target_identification-main/fig01_cifar_vs_mnist/poison/datasets/cifar.py | __all__ = [
"build_model",
"load_data",
]
import dill as pk
from pathlib import Path
from typing import NoReturn, Optional
import torch
from torch import BoolTensor, LongTensor, Tensor
import torch.nn as nn
import torch.nn.functional as F # noqa
# noinspection PyProtectedMember
from torch.utils.data import D... | 6,672 | 33.57513 | 100 | py |
target_identification | target_identification-main/fig01_cifar_vs_mnist/poison/datasets/mnist.py | __all__ = [
"DS_SIZE",
"NORMALIZE_FACTOR",
"build_model",
"load_data",
]
import dill as pk
import logging
from pathlib import Path
import re
from typing import NoReturn, Optional
import torch
from torch import BoolTensor, LongTensor, Tensor
import torch.nn as nn
import torchvision
import torchvision.t... | 5,461 | 32.10303 | 100 | py |
target_identification | target_identification-main/fig01_cifar_vs_mnist/poison/tracin_utils/main.py | __all__ = [
"process_epoch",
]
import logging
import sys
from typing import NoReturn, Optional
import torch
import tqdm
from torch import LongTensor, Tensor
from . import _settings as settings
from . import results
from . import utils
from .. import _config as config
from .. import influence_utils
from ..influen... | 8,735 | 44.978947 | 99 | py |
target_identification | target_identification-main/fig01_cifar_vs_mnist/poison/tracin_utils/utils.py | __all__ = [
"DTYPE",
"TracInTensors",
"compute_grad",
"configure_train_dataloader",
"export_tracin_epoch_inf",
"flatten_grad",
"generate_wandb_results",
"get_gas_log_flds",
"get_tracincp_log_flds",
"get_topk_indices",
"get_tracin_log_flds",
"log_vals_stats",
"sort_ids... | 14,293 | 38.595568 | 100 | py |
target_identification | target_identification-main/fig01_cifar_vs_mnist/poison/tracin_utils/results.py | __all__ = [
"export",
"generate_epoch_stats",
]
from pathlib import Path
from typing import NoReturn, Optional, Tuple, List
import torch
from torch import Tensor
from torch.utils.data import DataLoader
from . import utils
from .. import _config as config
from .. import dirs
from .. import influence_utils
fro... | 8,108 | 43.311475 | 99 | py |
target_identification | target_identification-main/fig01_cifar_vs_mnist/poison/influence_utils/nn_influence_utils.py | # Copyright (c) 2020, salesforce.com, inc.
# All rights reserved.
# SPDX-License-Identifier: BSD-3-Clause
__all__ = [
"InfFuncTensors",
"get_model_params",
"compute_gradients",
"compute_influences",
"get_loss_with_weight_decay",
"get_loss_without_wd",
]
import dataclasses
from typing import Ca... | 16,015 | 41.258575 | 146 | py |
target_identification | target_identification-main/fig01_cifar_vs_mnist/poison/influence_utils/general_utils.py | __all__ = [
"ADV_LABEL",
"CLEAN_LABEL",
"InfluenceMethod",
"MIN_LOSS",
"build_log_start_flds",
"calc_adv_auprc",
"calc_adv_auroc",
"calc_cutoff_detect_rates",
"calc_identified_adv_frac",
"calc_pearsonr",
"calc_spearmanr",
"check_bd_ids_contents",
"check_duplicate_ds_i... | 12,017 | 34.874627 | 99 | py |
target_identification | target_identification-main/fig01_cifar_vs_mnist/poison/losses/_losses.py | __all__ = [
"Loss",
"RiskEstimatorBase",
"TORCH_DEVICE",
"ce_loss",
]
from abc import ABC, abstractmethod
from typing import Callable, Optional
import torch
from torch import Tensor
import torch.nn as nn
from .. import _config as config
TORCH_DEVICE = torch.... | 3,785 | 35.757282 | 94 | py |
MatNet | MatNet-main/FFSP/ffsp_MH_test.py |
"""
The MIT License
Copyright (c) 2021 MatNet
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, d... | 8,576 | 34.7375 | 147 | py |
MatNet | MatNet-main/FFSP/FFSProblemDef.py |
"""
The MIT License
Copyright (c) 2021 MatNet
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, d... | 5,324 | 44.905172 | 117 | py |
MatNet | MatNet-main/FFSP/FFSP_GA/main.py |
"""
The MIT License
Copyright (c) 2021 MatNet
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, d... | 4,597 | 27.7375 | 145 | py |
MatNet | MatNet-main/FFSP/FFSP_GA/GA.py |
"""
The MIT License
Copyright (c) 2021 MatNet
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, d... | 10,364 | 39.968379 | 149 | py |
MatNet | MatNet-main/FFSP/FFSP_GA/FFSPEnv_MH.py |
"""
The MIT License
Copyright (c) 2021 MatNet
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, d... | 17,250 | 41.490148 | 266 | py |
MatNet | MatNet-main/FFSP/FFSP_Greedy/FFSPEnv_Greedy.py |
"""
The MIT License
Copyright (c) 2021 MatNet
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, d... | 19,610 | 40.636943 | 126 | py |
MatNet | MatNet-main/FFSP/FFSP_Greedy/LowerBound.py |
"""
The MIT License
Copyright (c) 2021 MatNet
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, d... | 4,959 | 39.325203 | 132 | py |
MatNet | MatNet-main/FFSP/FFSP_Greedy/GreedyAlgorithm.py |
"""
The MIT License
Copyright (c) 2021 MatNet
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, d... | 7,552 | 35.138756 | 137 | py |
MatNet | MatNet-main/FFSP/FFSP_MatNet/FFSPTester.py |
"""
The MIT License
Copyright (c) 2021 MatNet
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, d... | 6,795 | 37.39548 | 115 | py |
MatNet | MatNet-main/FFSP/FFSP_MatNet/FFSPModel_SUB.py |
"""
The MIT License
Copyright (c) 2021 MatNet
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, d... | 5,732 | 35.75 | 124 | py |
MatNet | MatNet-main/FFSP/FFSP_MatNet/FFSPTrainer.py |
"""
The MIT License
Copyright (c) 2021 MatNet
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, d... | 9,553 | 41.462222 | 120 | py |
MatNet | MatNet-main/FFSP/FFSP_MatNet/FFSPModel.py |
"""
The MIT License
Copyright (c) 2021 MatNet
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, d... | 15,265 | 38.14359 | 123 | py |
MatNet | MatNet-main/FFSP/FFSP_MatNet/FFSPEnv.py |
"""
The MIT License
Copyright (c) 2021 MatNet
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, d... | 18,783 | 41.497738 | 120 | py |
MatNet | MatNet-main/FFSP/FFSP_PSO/main.py |
"""
The MIT License
Copyright (c) 2021 MatNet
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, d... | 4,796 | 28.429448 | 145 | py |
MatNet | MatNet-main/FFSP/FFSP_PSO/FFSPEnv_MH.py |
"""
The MIT License
Copyright (c) 2021 MatNet
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, d... | 17,250 | 41.490148 | 266 | py |
MatNet | MatNet-main/FFSP/FFSP_PSO/PSO.py |
"""
The MIT License
Copyright (c) 2021 MatNet
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, d... | 14,227 | 43.049536 | 153 | py |
MatNet | MatNet-main/ATSP/ATSProblemDef.py |
"""
The MIT License
Copyright (c) 2021 MatNet
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, d... | 2,957 | 29.494845 | 129 | py |
MatNet | MatNet-main/ATSP/ATSP_MatNet/ATSPModel_LIB.py |
"""
The MIT License
Copyright (c) 2021 MatNet
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, d... | 5,777 | 35.802548 | 124 | py |
MatNet | MatNet-main/ATSP/ATSP_MatNet/ATSPModel.py |
"""
The MIT License
Copyright (c) 2021 MatNet
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, d... | 13,531 | 37.11831 | 114 | py |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.