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
qlib
qlib-main/qlib/contrib/model/tcn.py
# MIT License # Copyright (c) 2018 CMU Locus Lab import torch.nn as nn from torch.nn.utils import weight_norm class Chomp1d(nn.Module): def __init__(self, chomp_size): super(Chomp1d, self).__init__() self.chomp_size = chomp_size def forward(self, x): return x[:, :, : -self.chomp_size]...
2,606
32.857143
114
py
qlib
qlib-main/qlib/contrib/model/pytorch_tcts.py
# Copyright (c) Microsoft Corporation. # Licensed under the MIT License. from __future__ import division from __future__ import print_function import numpy as np import pandas as pd import copy import random from ...utils import get_or_create_path from ...log import get_module_logger import torch import torch.nn as...
14,289
32.623529
116
py
qlib
qlib-main/qlib/rl/trainer/callbacks.py
# Copyright (c) Microsoft Corporation. # Licensed under the MIT License. """Callbacks to insert customized recipes during the training. Mimicks the hooks of Keras / PyTorch-Lightning, but tailored for the context of RL. """ from __future__ import annotations import copy import os import shutil import time from datet...
11,576
38.64726
130
py
qlib
qlib-main/qlib/rl/trainer/trainer.py
# Copyright (c) Microsoft Corporation. # Licensed under the MIT License. from __future__ import annotations import collections import copy from contextlib import AbstractContextManager, contextmanager from datetime import datetime from pathlib import Path from typing import Any, Dict, Iterable, List, OrderedDict, Seq...
13,476
36.856742
127
py
qlib
qlib-main/qlib/rl/order_execution/network.py
# Copyright (c) Microsoft Corporation. # Licensed under the MIT License. from __future__ import annotations from typing import List, Tuple, cast import torch import torch.nn as nn from tianshou.data import Batch from qlib.typehint import Literal from .interpreter import FullHistoryObs __all__ = ["Recurrent"] cl...
4,830
33.262411
119
py
qlib
qlib-main/qlib/rl/order_execution/strategy.py
# Copyright (c) Microsoft Corporation. # Licensed under the MIT License. from __future__ import annotations import collections from types import GeneratorType from typing import Any, Callable, cast, Dict, Generator, List, Optional, Tuple, Union import warnings import numpy as np import pandas as pd import torch from...
21,177
37.365942
117
py
qlib
qlib-main/qlib/rl/order_execution/policy.py
# Copyright (c) Microsoft Corporation. # Licensed under the MIT License. from __future__ import annotations from pathlib import Path from typing import Any, Dict, Generator, Iterable, Optional, OrderedDict, Tuple, cast import gym import numpy as np import torch import torch.nn as nn from gym.spaces import Discrete f...
7,008
28.44958
114
py
qlib
qlib-main/qlib/rl/utils/data_queue.py
# Copyright (c) Microsoft Corporation. # Licensed under the MIT License. from __future__ import annotations import multiprocessing from multiprocessing.sharedctypes import Synchronized import os import threading import time import warnings from queue import Empty from typing import Any, Generator, Generic, Sequence, ...
6,597
33.910053
112
py
qlib
qlib-main/qlib/rl/contrib/train_onpolicy.py
# Copyright (c) Microsoft Corporation. # Licensed under the MIT License. from __future__ import annotations import argparse import os import random import sys import warnings from pathlib import Path from typing import cast, List, Optional import numpy as np import pandas as pd import torch import yaml from qlib.back...
10,105
36.568773
115
py
qlib
qlib-main/qlib/rl/contrib/backtest.py
# Copyright (c) Microsoft Corporation. # Licensed under the MIT License. from __future__ import annotations import argparse import copy import os import pickle from collections import defaultdict from pathlib import Path from typing import Dict, List, Optional, Tuple, Union, cast import numpy as np import pandas as p...
13,230
33.366234
120
py
qlib
qlib-main/tests/rl/test_trainer.py
import os import random import sys from pathlib import Path import pytest import torch import torch.nn as nn from gym import spaces from tianshou.policy import PPOPolicy from qlib.config import C from qlib.log import set_log_with_config from qlib.rl.interpreter import StateInterpreter, ActionInterpreter from qlib.rl...
6,245
29.768473
115
py
qlib
qlib-main/tests/rl/test_saoe_simple.py
# Copyright (c) Microsoft Corporation. # Licensed under the MIT License. import sys from functools import partial from pathlib import Path from typing import NamedTuple import numpy as np import pandas as pd import pytest import torch from tianshou.data import Batch from qlib.backtest import Order from qlib.config i...
13,012
38.433333
118
py
qlib
qlib-main/tests/rl/test_finite_env.py
# Copyright (c) Microsoft Corporation. # Licensed under the MIT License. from collections import Counter import gym import numpy as np from tianshou.data import Batch, Collector from tianshou.policy import BasePolicy from torch.utils.data import DataLoader, Dataset, DistributedSampler from qlib.rl.utils.finite_env im...
7,864
30.46
120
py
qlib
qlib-main/tests/rl/test_data_queue.py
# Copyright (c) Microsoft Corporation. # Licensed under the MIT License. import multiprocessing import time import numpy as np import pandas as pd from torch.utils.data import Dataset, DataLoader from qlib.rl.utils.data_queue import DataQueue class DummyDataset(Dataset): def __init__(self, length): sel...
2,395
25.921348
124
py
qlib
qlib-main/tests/rl/test_logger.py
# Copyright (c) Microsoft Corporation. # Licensed under the MIT License. from random import randint, choice from pathlib import Path import re from typing import Any, Tuple import gym import numpy as np import pandas as pd from gym import spaces from tianshou.data import Collector, Batch from tianshou.policy import ...
5,278
31.386503
98
py
qlib
qlib-main/tests/data_mid_layer_tests/test_dataset.py
# Copyright (c) Microsoft Corporation. # Licensed under the MIT License. import unittest import pytest import sys from qlib.tests import TestAutoData from qlib.data.dataset import TSDatasetH import numpy as np import time from qlib.data.dataset.handler import DataHandlerLP class TestDataset(TestAutoData): @pytes...
3,726
33.509259
117
py
qlib
qlib-main/docs/conf.py
# Copyright (c) Microsoft Corporation. # Licensed under the MIT License. # QLib documentation build configuration file, created by # sphinx-quickstart on Wed Sep 27 15:16:05 2017. # # This file is execfile()d with the current directory set to its # containing dir. # # Note that not all possible configuration values a...
6,728
27.75641
79
py
iffDetector
iffDetector-master/configs/fovea_r50_fpn_4gpu_1x.py
# model settings model = dict( type='FOVEA', pretrained='torchvision://resnet50', backbone=dict( type='ResNet', depth=50, num_stages=4, out_indices=(0, 1, 2, 3), frozen_stages=1, style='pytorch'), neck=dict( type='FPN', in_channels=[256, 51...
3,730
29.333333
78
py
iffDetector
iffDetector-master/iff-heads/FoveaBox/fovea_head.py
import torch import torch.nn as nn from mmcv.cnn import normal_init from mmdet.core import multi_apply, multiclass_nms from mmdet.ops import DeformConv from ..builder import build_loss from ..registry import HEADS from ..utils import ConvModule, bias_init_with_prob INF = 1e8 class FeatureAlign(nn.Module): def ...
17,249
40.566265
91
py
iffDetector
iffDetector-master/iff-heads/YOLOv2/darknet.py
import torch import numpy as np import torch.nn as nn import torch.nn.functional as F import utils.network as net_utils import cfgs.config as cfg from layers.reorg.reorg_layer import ReorgLayer from utils.cython_bbox import bbox_ious, anchor_intersections from utils.cython_yolo import yolo_to_bbox from functools impor...
12,617
39.184713
125
py
iffDetector
iffDetector-master/iff-heads/FreeAnchor-ResNeXt101/retinanet.py
import numpy as np import torch from torch import nn from maskrcnn_benchmark.modeling.box_coder import BoxCoder from .retinanet_loss import make_retinanet_loss_evaluator from .free_anchor_loss import make_free_anchor_loss_evaluator from .anchor_generator import make_anchor_generator_retinanet from .retinanet_infer imp...
6,248
35.331395
156
py
fcaf3d
fcaf3d-master/setup.py
from setuptools import find_packages, setup import os import torch from torch.utils.cpp_extension import (BuildExtension, CppExtension, CUDAExtension) def readme(): with open('README.md', encoding='utf-8') as f: content = f.read() return content version_file =...
10,179
36.843866
125
py
fcaf3d
fcaf3d-master/tools/test.py
import argparse import mmcv import os import torch import warnings from mmcv import Config, DictAction from mmcv.cnn import fuse_conv_bn from mmcv.parallel import MMDataParallel, MMDistributedDataParallel from mmcv.runner import (get_dist_info, init_dist, load_checkpoint, wrap_fp16_model) from...
8,412
38.130233
98
py
fcaf3d
fcaf3d-master/tools/test5x5.py
import os import torch import argparse import numpy as np from collections import defaultdict from mmcv import Config from mmcv.runner import load_checkpoint, init_dist, get_dist_info from mmcv.parallel import MMDistributedDataParallel from mmdet.apis import set_random_seed, multi_gpu_test from mmdet3d.models import bu...
2,390
35.227273
100
py
fcaf3d
fcaf3d-master/tools/train.py
from __future__ import division import argparse import copy import mmcv import os import time import torch import warnings from mmcv import Config, DictAction from mmcv.runner import get_dist_info, init_dist from os import path as osp from mmdet import __version__ as mmdet_version from mmdet3d import __version__ as m...
8,411
36.553571
125
py
fcaf3d
fcaf3d-master/tools/data_converter/create_gt_database.py
import mmcv import numpy as np import pickle from mmcv import track_iter_progress from mmcv.ops import roi_align from os import path as osp from pycocotools import mask as maskUtils from pycocotools.coco import COCO from mmdet3d.core.bbox import box_np_ops as box_np_ops from mmdet3d.datasets import build_dataset from ...
12,606
36.298817
79
py
fcaf3d
fcaf3d-master/tools/misc/fuse_conv_bn.py
import argparse import torch from mmcv.runner import save_checkpoint from torch import nn as nn from mmdet.apis import init_model def fuse_conv_bn(conv, bn): """During inference, the functionary of batch norm layers is turned off but only the mean and var alone channels are used, which exposes the chance to ...
2,192
31.731343
79
py
fcaf3d
fcaf3d-master/tools/model_converters/publish_model.py
import argparse import subprocess import torch def parse_args(): parser = argparse.ArgumentParser( description='Process a checkpoint to be published') parser.add_argument('in_file', help='input checkpoint filename') parser.add_argument('out_file', help='output checkpoint filename') args = pars...
1,027
28.371429
77
py
fcaf3d
fcaf3d-master/tools/model_converters/regnet2mmdet.py
import argparse import torch from collections import OrderedDict def convert_stem(model_key, model_weight, state_dict, converted_names): new_key = model_key.replace('stem.conv', 'conv1') new_key = new_key.replace('stem.bn', 'bn1') state_dict[new_key] = model_weight converted_names.add(model_key) p...
3,014
32.876404
77
py
fcaf3d
fcaf3d-master/tools/model_converters/convert_votenet_checkpoints.py
import argparse import tempfile import torch from mmcv import Config from mmcv.runner import load_state_dict from mmdet3d.models import build_detector def parse_args(): parser = argparse.ArgumentParser( description='MMDet3D upgrade model version(before v0.6.0) of VoteNet') parser.add_argument('checkp...
5,042
32.177632
79
py
fcaf3d
fcaf3d-master/tools/analysis_tools/benchmark.py
import argparse import time import torch from mmcv import Config from mmcv.parallel import MMDataParallel from mmcv.runner import load_checkpoint from mmdet3d.datasets import build_dataloader, build_dataset from mmdet3d.models import build_detector from mmdet.core import wrap_fp16_model from tools.misc.fuse_conv_bn im...
2,961
29.854167
79
py
fcaf3d
fcaf3d-master/tests/test_runtime/test_config.py
from os.path import dirname, exists, join, relpath def _get_config_directory(): """Find the predefined detector config directory.""" try: # Assume we are running in the source mmdetection3d repo repo_dpath = dirname(dirname(dirname(__file__))) except NameError: # For IPython develo...
10,523
37.269091
79
py
fcaf3d
fcaf3d-master/tests/test_runtime/test_apis.py
import numpy as np import os import pytest import tempfile import torch from mmcv.parallel import MMDataParallel from os.path import dirname, exists, join from mmdet3d.apis import (convert_SyncBN, inference_detector, inference_mono_3d_detector, inference_multi_modali...
15,708
42.515235
79
py
fcaf3d
fcaf3d-master/tests/test_models/test_detectors.py
import copy import numpy as np import pytest import random import torch from os.path import dirname, exists, join from mmdet3d.core.bbox import (CameraInstance3DBoxes, DepthInstance3DBoxes, LiDARInstance3DBoxes) from mmdet3d.models.builder import build_detector def _setup_seed(seed): ...
17,900
37.006369
79
py
fcaf3d
fcaf3d-master/tests/test_models/test_forward.py
"""Test model forward process. CommandLine: pytest tests/test_models/test_forward.py xdoctest tests/test_models/test_forward.py zero """ import copy import numpy as np import torch from os.path import dirname, exists, join def _get_config_directory(): """Find the predefined detector config directory.""" ...
6,164
28.639423
78
py
fcaf3d
fcaf3d-master/tests/test_models/test_backbones.py
import numpy as np import pytest import torch from mmdet3d.models import build_backbone def test_pointnet2_sa_ssg(): if not torch.cuda.is_available(): pytest.skip() cfg = dict( type='PointNet2SASSG', in_channels=6, num_points=(32, 16), radius=(0.8, 1.2), num_s...
12,119
39.535117
79
py
fcaf3d
fcaf3d-master/tests/test_models/test_segmentors.py
import copy import numpy as np import pytest import torch from os.path import dirname, exists, join from mmdet3d.models.builder import build_segmentor from mmdet.apis import set_random_seed def _get_config_directory(): """Find the predefined detector config directory.""" try: # Assume we are running ...
6,083
36.555556
79
py
fcaf3d
fcaf3d-master/tests/test_models/test_voxel_encoder/test_voxelize.py
import numpy as np import pytest import torch from mmdet3d.core.voxel.voxel_generator import VoxelGenerator from mmdet3d.datasets.pipelines import LoadPointsFromFile from mmdet3d.ops.voxel.voxelize import Voxelization def _get_voxel_points_indices(points, coors, voxel): result_form = np.equal(coors, voxel) r...
3,612
42.011905
78
py
fcaf3d
fcaf3d-master/tests/test_models/test_voxel_encoder/test_dynamic_scatter.py
import pytest import torch from torch.autograd import gradcheck from mmdet3d.ops import DynamicScatter def test_dynamic_scatter(): if not torch.cuda.is_available(): pytest.skip('test requires GPU and torch+cuda') feats = torch.rand( size=(200000, 3), dtype=torch.float32, device='cuda') * 100...
3,809
39.531915
78
py
fcaf3d
fcaf3d-master/tests/test_models/test_voxel_encoder/test_voxel_encoders.py
import torch from mmdet3d.models.builder import build_voxel_encoder def test_pillar_feature_net(): pillar_feature_net_cfg = dict( type='PillarFeatureNet', in_channels=5, feat_channels=[64], with_distance=False, voxel_size=(0.2, 0.2, 8), point_cloud_range=(-51.2, -5...
1,098
31.323529
68
py
fcaf3d
fcaf3d-master/tests/test_models/test_fusion/test_point_fusion.py
"""Tests the core function of point fusion. CommandLine: pytest tests/test_models/test_fusion/test_point_fusion.py """ import torch from mmdet3d.models.fusion_layers import PointFusion def test_sample_single(): # this function makes sure the rewriting of 3d coords transformation # in point fusion does ...
2,075
33.032787
75
py
fcaf3d
fcaf3d-master/tests/test_models/test_fusion/test_vote_fusion.py
"""Tests the core function of vote fusion. CommandLine: pytest tests/test_models/test_fusion/test_vote_fusion.py """ import torch from mmdet3d.models.fusion_layers import VoteFusion def test_vote_fusion(): img_meta = { 'ori_shape': (530, 730, 3), 'img_shape': (600, 826, 3), 'pad_sha...
14,784
44.916149
78
py
fcaf3d
fcaf3d-master/tests/test_models/test_fusion/test_fusion_coord_trans.py
"""Tests coords transformation in fusion modules. CommandLine: pytest tests/test_models/test_fusion/test_fusion_coord_trans.py """ import torch from mmdet3d.models.fusion_layers import apply_3d_transformation def test_coords_transformation(): """Test the transformation of 3d coords.""" # H+R+S+T, not ...
4,910
34.846715
76
py
fcaf3d
fcaf3d-master/tests/test_models/test_common_modules/test_roiaware_pool3d.py
import pytest import torch from mmdet3d.ops.roiaware_pool3d import (RoIAwarePool3d, points_in_boxes_batch, points_in_boxes_cpu, points_in_boxes_gpu) def test_RoIAwarePool3d(): # RoIAwarePool3d only support gpu version currently. ...
5,750
43.581395
79
py
fcaf3d
fcaf3d-master/tests/test_models/test_common_modules/test_vote_module.py
import torch def test_vote_module(): from mmdet3d.models.model_utils import VoteModule vote_loss = dict( type='ChamferDistance', mode='l1', reduction='none', loss_dst_weight=10.0) self = VoteModule(vote_per_seed=3, in_channels=8, vote_loss=vote_loss) seed_xyz = torch....
1,332
33.179487
77
py
fcaf3d
fcaf3d-master/tests/test_models/test_common_modules/test_paconv_modules.py
import numpy as np import pytest import torch def test_paconv_sa_module_msg(): if not torch.cuda.is_available(): pytest.skip() from mmdet3d.ops import PAConvSAModuleMSG # paconv_num_kernels should have same length as mlp_channels with pytest.raises(AssertionError): self = PAConvSAModu...
10,333
34.14966
74
py
fcaf3d
fcaf3d-master/tests/test_models/test_common_modules/test_pointnet_ops.py
import pytest import torch from mmdet3d.ops import (ball_query, furthest_point_sample, furthest_point_sample_with_dist, gather_points, grouping_operation, knn, three_interpolate, three_nn) def test_fps(): if not torch.cuda.is_available(): pytest.skip() ...
20,601
49.869136
79
py
fcaf3d
fcaf3d-master/tests/test_models/test_common_modules/test_middle_encoders.py
import pytest import torch from mmdet3d.models.builder import build_middle_encoder def test_sparse_encoder(): if not torch.cuda.is_available(): pytest.skip('test requires GPU and torch+cuda') sparse_encoder_cfg = dict( type='SparseEncoder', in_channels=5, sparse_shape=[40, 102...
988
35.62963
76
py
fcaf3d
fcaf3d-master/tests/test_models/test_common_modules/test_paconv_ops.py
import pytest import torch from mmdet3d.ops import PAConv, PAConvCUDA, assign_score_withk def test_paconv_assign_scores(): if not torch.cuda.is_available(): pytest.skip() scores = torch.tensor([[[[0.06947571, 0.6065746], [0.28462553, 0.8378516], [0.7595994, 0.97220325], [...
12,625
54.867257
79
py
fcaf3d
fcaf3d-master/tests/test_models/test_common_modules/test_pointnet_modules.py
import numpy as np import pytest import torch def test_pointnet_sa_module_msg(): if not torch.cuda.is_available(): pytest.skip() from mmdet3d.ops import PointSAModuleMSG self = PointSAModuleMSG( num_point=16, radii=[0.2, 0.4], sample_nums=[4, 8], mlp_channels=[[12,...
7,077
31.172727
74
py
fcaf3d
fcaf3d-master/tests/test_models/test_common_modules/test_sparse_unet.py
import torch from mmdet3d.ops import SparseBasicBlock from mmdet3d.ops import spconv as spconv def test_SparseUNet(): from mmdet3d.models.middle_encoders.sparse_unet import SparseUNet self = SparseUNet(in_channels=4, sparse_shape=[41, 1600, 1408]) # test encoder layers assert len(self.encoder_layers...
5,796
41.313869
79
py
fcaf3d
fcaf3d-master/tests/test_models/test_heads/test_roi_extractors.py
import pytest import torch from mmdet3d.models.roi_heads.roi_extractors import Single3DRoIAwareExtractor def test_single_roiaware_extractor(): if not torch.cuda.is_available(): pytest.skip('test requires GPU and torch+cuda') roi_layer_cfg = dict( type='RoIAwarePool3d', out_size=4, max_pts_pe...
1,265
39.83871
79
py
fcaf3d
fcaf3d-master/tests/test_models/test_heads/test_semantic_heads.py
import pytest import torch from mmdet3d.core.bbox import LiDARInstance3DBoxes def test_PointwiseSemanticHead(): # PointwiseSemanticHead only support gpu version currently. if not torch.cuda.is_available(): pytest.skip('test requires GPU and torch+cuda') from mmdet3d.models.builder import build_he...
2,989
35.463415
79
py
fcaf3d
fcaf3d-master/tests/test_models/test_heads/test_heads.py
import copy import numpy as np import pytest import random import torch from os.path import dirname, exists, join from mmdet3d.core.bbox import (Box3DMode, CameraInstance3DBoxes, DepthInstance3DBoxes, LiDARInstance3DBoxes) from mmdet3d.models.builder import build_head from mmdet.apis imp...
47,229
37.586601
79
py
fcaf3d
fcaf3d-master/tests/test_models/test_heads/test_pointnet2_decode_head.py
import numpy as np import pytest import torch from mmcv.cnn.bricks import ConvModule from mmdet3d.models.builder import build_head def test_pn2_decode_head_loss(): if not torch.cuda.is_available(): pytest.skip('test requires GPU and torch+cuda') pn2_decode_head_cfg = dict( type='PointNet2Head...
2,954
34.60241
71
py
fcaf3d
fcaf3d-master/tests/test_models/test_heads/test_parta2_bbox_head.py
import pytest import torch from mmcv import Config from torch.nn import BatchNorm1d, ReLU from mmdet3d.core.bbox import Box3DMode, LiDARInstance3DBoxes from mmdet3d.core.bbox.samplers import IoUNegPiecewiseSampler from mmdet3d.models import PartA2BboxHead from mmdet3d.ops import make_sparse_convmodule from mmdet3d.ops...
20,566
40.633603
79
py
fcaf3d
fcaf3d-master/tests/test_models/test_necks/test_necks.py
import pytest import torch from mmdet3d.models.builder import build_backbone, build_neck def test_centerpoint_fpn(): second_cfg = dict( type='SECOND', in_channels=64, out_channels=[64, 128, 256], layer_nums=[3, 5, 5], layer_strides=[2, 2, 2], norm_cfg=dict(type='B...
1,786
29.288136
72
py
fcaf3d
fcaf3d-master/tests/test_data/test_datasets/test_dataset_wrappers.py
import numpy as np import torch from mmdet3d.datasets.builder import build_dataset def test_getitem(): np.random.seed(1) torch.manual_seed(1) point_cloud_range = [-50, -50, -5, 50, 50, 3] file_client_args = dict(backend='disk') class_names = [ 'car', 'truck', 'trailer', 'bus', 'constructi...
2,843
35
78
py
fcaf3d
fcaf3d-master/tests/test_data/test_datasets/test_kitti_mono_dataset.py
import mmcv import numpy as np import pytest import torch from mmdet3d.datasets import KittiMonoDataset def test_getitem(): np.random.seed(0) class_names = ['Pedestrian', 'Cyclist', 'Car'] img_norm_cfg = dict( mean=[103.530, 116.280, 123.675], std=[1.0, 1.0, 1.0], to_rgb=False) pipeline = [ ...
8,686
39.404651
79
py
fcaf3d
fcaf3d-master/tests/test_data/test_datasets/test_kitti_dataset.py
import numpy as np import os import pytest import tempfile import torch from mmdet3d.core.bbox import LiDARInstance3DBoxes from mmdet3d.datasets import KittiDataset def _generate_kitti_dataset_config(): data_root = 'tests/data/kitti' ann_file = 'tests/data/kitti/kitti_infos_train.pkl' classes = ['Pedestr...
18,631
40.775785
79
py
fcaf3d
fcaf3d-master/tests/test_data/test_datasets/test_scannet_dataset.py
import copy import numpy as np import pytest import torch from mmdet3d.datasets import ScanNetDataset, ScanNetSegDataset def test_getitem(): np.random.seed(0) root_path = './tests/data/scannet/' ann_file = './tests/data/scannet/scannet_infos.pkl' class_names = ('cabinet', 'bed', 'chair', 'sofa', 'tab...
27,013
38.551977
79
py
fcaf3d
fcaf3d-master/tests/test_data/test_datasets/test_nuscenes_mono_dataset.py
import mmcv import numpy as np import pytest import tempfile import torch from os import path as osp from mmdet3d.datasets import NuScenesMonoDataset def test_getitem(): np.random.seed(0) class_names = [ 'car', 'truck', 'trailer', 'bus', 'construction_vehicle', 'bicycle', 'motorcycle', 'pedes...
7,552
38.134715
79
py
fcaf3d
fcaf3d-master/tests/test_data/test_datasets/test_waymo_dataset.py
import numpy as np import pytest import tempfile import torch from mmdet3d.datasets import WaymoDataset def _generate_waymo_train_dataset_config(): data_root = 'tests/data/waymo/kitti_format/' ann_file = 'tests/data/waymo/kitti_format/waymo_infos_train.pkl' classes = ['Car', 'Pedestrian', 'Cyclist'] ...
10,777
40.137405
79
py
fcaf3d
fcaf3d-master/tests/test_data/test_datasets/test_s3dis_dataset.py
import numpy as np import pytest import torch from mmdet3d.datasets import S3DISSegDataset def test_seg_getitem(): np.random.seed(0) root_path = './tests/data/s3dis/' ann_file = './tests/data/s3dis/s3dis_infos.pkl' class_names = ('ceiling', 'floor', 'wall', 'beam', 'column', 'window', ...
10,942
37.12892
79
py
fcaf3d
fcaf3d-master/tests/test_data/test_datasets/test_sunrgbd_dataset.py
import numpy as np import pytest import torch from mmdet3d.datasets import SUNRGBDDataset def _generate_sunrgbd_dataset_config(): root_path = './tests/data/sunrgbd' ann_file = './tests/data/sunrgbd/sunrgbd_infos.pkl' class_names = ('bed', 'table', 'sofa', 'chair', 'toilet', 'desk', 'dr...
13,254
40.551724
79
py
fcaf3d
fcaf3d-master/tests/test_data/test_datasets/test_nuscene_dataset.py
import numpy as np import tempfile import torch from mmdet3d.datasets import NuScenesDataset def test_getitem(): np.random.seed(0) point_cloud_range = [-50, -50, -5, 50, 50, 3] file_client_args = dict(backend='disk') class_names = [ 'car', 'truck', 'trailer', 'bus', 'construction_vehicle', 'b...
4,260
35.732759
78
py
fcaf3d
fcaf3d-master/tests/test_data/test_datasets/test_lyft_dataset.py
import mmcv import numpy as np import tempfile import torch from mmdet3d.datasets import LyftDataset def test_getitem(): np.random.seed(0) torch.manual_seed(0) root_path = './tests/data/lyft' ann_file = './tests/data/lyft/lyft_infos.pkl' class_names = ('car', 'truck', 'bus', 'emergency_vehicle', ...
7,542
43.633136
79
py
fcaf3d
fcaf3d-master/tests/test_data/test_pipelines/test_outdoor_pipeline.py
import numpy as np import torch from mmdet3d.core.bbox import LiDARInstance3DBoxes from mmdet3d.datasets.pipelines import Compose def test_outdoor_aug_pipeline(): point_cloud_range = [0, -40, -3, 70.4, 40, 1] class_names = ['Car'] np.random.seed(0) train_pipeline = [ dict( type='...
10,195
39.621514
79
py
fcaf3d
fcaf3d-master/tests/test_data/test_pipelines/test_indoor_pipeline.py
import mmcv import numpy as np import torch from os import path as osp from mmdet3d.core.bbox import DepthInstance3DBoxes from mmdet3d.datasets.pipelines import Compose def test_scannet_pipeline(): class_names = ('cabinet', 'bed', 'chair', 'sofa', 'table', 'door', 'window', 'bookshelf', 'pictu...
12,886
38.530675
79
py
fcaf3d
fcaf3d-master/tests/test_data/test_pipelines/test_augmentations/test_transforms_3d.py
import mmcv import numpy as np import pytest import torch from mmdet3d.core import (Box3DMode, CameraInstance3DBoxes, DepthInstance3DBoxes, LiDARInstance3DBoxes) from mmdet3d.core.points import DepthPoints, LiDARPoints from mmdet3d.datasets import (BackgroundPointsFilter, GlobalAlignment, ...
29,545
40.731638
79
py
fcaf3d
fcaf3d-master/tests/test_data/test_pipelines/test_augmentations/test_test_augment_utils.py
import numpy as np import torch from mmdet3d.core.points import DepthPoints from mmdet3d.datasets.pipelines import MultiScaleFlipAug3D def test_multi_scale_flip_aug_3D(): np.random.seed(0) transforms = [{ 'type': 'GlobalRotScaleTrans', 'rot_range': [-0.1, 0.1], 'scale_ratio_range': [0...
2,227
34.935484
79
py
fcaf3d
fcaf3d-master/tests/test_data/test_pipelines/test_loadings/test_load_images_from_multi_views.py
import numpy as np import torch from mmcv.parallel import DataContainer from mmdet3d.datasets.pipelines import (DefaultFormatBundle, LoadMultiViewImageFromFiles) def test_load_multi_view_image_from_files(): multi_view_img_loader = LoadMultiViewImageFromFiles(to_float32=Tru...
1,720
36.413043
79
py
fcaf3d
fcaf3d-master/tests/test_utils/test_assigners.py
"""Tests the Assigner objects. CommandLine: pytest tests/test_utils/test_assigner.py xdoctest tests/test_utils/test_assigner.py zero """ import torch from mmdet3d.core.bbox.assigners import MaxIoUAssigner def test_max_iou_assigner(): self = MaxIoUAssigner( pos_iou_thr=0.5, neg_iou_thr=0....
4,253
27.36
77
py
fcaf3d
fcaf3d-master/tests/test_utils/test_samplers.py
import pytest import torch from mmdet3d.core.bbox.assigners import MaxIoUAssigner from mmdet3d.core.bbox.samplers import IoUNegPiecewiseSampler def test_iou_piecewise_sampler(): if not torch.cuda.is_available(): pytest.skip() assigner = MaxIoUAssigner( pos_iou_thr=0.55, neg_iou_thr=0....
1,684
37.295455
79
py
fcaf3d
fcaf3d-master/tests/test_utils/test_nms.py
import numpy as np import torch def test_aligned_3d_nms(): from mmdet3d.core.post_processing import aligned_3d_nms boxes = torch.tensor([[1.2261, 0.6679, -1.2678, 2.6547, 1.0428, 0.1000], [5.0919, 0.6512, 0.7238, 5.4821, 1.2451, 2.1095], [6.8392, -1.2205, 0...
4,029
52.733333
79
py
fcaf3d
fcaf3d-master/tests/test_utils/test_bbox_coders.py
import torch from mmdet3d.core.bbox import DepthInstance3DBoxes, LiDARInstance3DBoxes from mmdet.core import build_bbox_coder def test_partial_bin_based_box_coder(): box_coder_cfg = dict( type='PartialBinBasedBBoxCoder', num_sizes=10, num_dir_bins=12, with_rot=True, mean_s...
17,284
47.827684
79
py
fcaf3d
fcaf3d-master/tests/test_utils/test_points.py
import numpy as np import pytest import torch from mmdet3d.core.points import (BasePoints, CameraPoints, DepthPoints, LiDARPoints) def test_base_points(): # test empty initialization empty_boxes = [] points = BasePoints(empty_boxes) assert points.tensor.shape[0] == 0 ...
50,298
45.230699
79
py
fcaf3d
fcaf3d-master/tests/test_utils/test_coord_3d_mode.py
import numpy as np import torch from mmdet3d.core.bbox import (CameraInstance3DBoxes, Coord3DMode, DepthInstance3DBoxes, LiDARInstance3DBoxes) from mmdet3d.core.points import CameraPoints, DepthPoints, LiDARPoints def test_points_conversion(): """Test the conversion of points betwe...
15,932
49.580952
79
py
fcaf3d
fcaf3d-master/tests/test_utils/test_box3d.py
import numpy as np import pytest import torch import unittest from mmdet3d.core.bbox import (BaseInstance3DBoxes, Box3DMode, CameraInstance3DBoxes, DepthInstance3DBoxes, LiDARInstance3DBoxes, bbox3d2roi, bbox3d_mapping_back) f...
64,120
47.356712
79
py
fcaf3d
fcaf3d-master/tests/test_utils/test_merge_augs.py
import mmcv import pytest import torch from mmdet3d.core import merge_aug_bboxes_3d from mmdet3d.core.bbox import DepthInstance3DBoxes def test_merge_aug_bboxes_3d(): if not torch.cuda.is_available(): pytest.skip('test requires GPU and torch+cuda') img_meta_0 = dict( pcd_horizontal_flip=False...
2,555
40.225806
78
py
fcaf3d
fcaf3d-master/tests/test_utils/test_anchors.py
""" CommandLine: pytest tests/test_utils/test_anchor.py xdoctest tests/test_utils/test_anchor.py zero """ import torch from mmdet3d.core.anchor import build_anchor_generator def test_anchor_3d_range_generator(): if torch.cuda.is_available(): device = 'cuda' else: device = 'cpu' a...
9,299
37.912134
79
py
fcaf3d
fcaf3d-master/tests/test_utils/test_utils.py
import torch from mmdet3d.core import draw_heatmap_gaussian def test_gaussian(): heatmap = torch.zeros((128, 128)) ct_int = torch.tensor([64, 64], dtype=torch.int32) radius = 2 draw_heatmap_gaussian(heatmap, ct_int, radius) assert torch.isclose(torch.sum(heatmap), torch.tensor(4.3505), atol=1e-3)...
321
25.833333
77
py
fcaf3d
fcaf3d-master/tests/test_metrics/test_kitti_eval.py
import numpy as np import pytest import torch from mmdet3d.core.evaluation.kitti_utils.eval import (do_eval, eval_class, kitti_eval) def test_do_eval(): if not torch.cuda.is_available(): pytest.skip('test requires GPU and CUDA') gt_name = np.array...
12,008
48.419753
79
py
fcaf3d
fcaf3d-master/tests/test_metrics/test_losses.py
import pytest import torch def test_chamfer_disrance(): from mmdet3d.models.losses import ChamferDistance, chamfer_distance with pytest.raises(AssertionError): # test invalid mode ChamferDistance(mode='smoothl1') # test invalid type of reduction ChamferDistance(mode='l2', redu...
3,348
45.513889
79
py
fcaf3d
fcaf3d-master/tests/test_metrics/test_seg_eval.py
import numpy as np import pytest import torch from mmdet3d.core.evaluation.seg_eval import seg_eval def test_indoor_eval(): if not torch.cuda.is_available(): pytest.skip() seg_preds = [ torch.Tensor([ 0, 0, 1, 0, 0, 2, 1, 3, 1, 2, 1, 0, 2, 2, 2, 2, 1, 3, 0, 3, 3, 3, 3 ]) ...
1,038
25.641026
79
py
fcaf3d
fcaf3d-master/tests/test_metrics/test_indoor_eval.py
import numpy as np import pytest import torch from mmdet3d.core.evaluation.indoor_eval import average_precision, indoor_eval def test_indoor_eval(): if not torch.cuda.is_available(): pytest.skip() from mmdet3d.core.bbox.structures import Box3DMode, DepthInstance3DBoxes det_infos = [{ 'lab...
6,582
34.015957
79
py
fcaf3d
fcaf3d-master/configs/fcos3d/fcos3d_r101_caffe_fpn_gn-head_dcn_2x8_1x_nus-mono3d_finetune.py
_base_ = './fcos3d_r101_caffe_fpn_gn-head_dcn_2x8_1x_nus-mono3d.py' # model settings model = dict( train_cfg=dict( code_weight=[1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 0.05, 0.05])) # optimizer optimizer = dict(lr=0.001) load_from = 'work_dirs/fcos3d_nus/latest.pth'
274
29.555556
69
py
fcaf3d
fcaf3d-master/configs/imvotenet/imvotenet-v2_stage2_16x8_sunrgbd-3d-10class.py
_base_ = [ '../_base_/datasets/sunrgbd-3d-10class.py', '../_base_/schedules/schedule_3x.py', '../_base_/default_runtime.py', '../_base_/models/imvotenet_image.py' ] class_names = ('bed', 'table', 'sofa', 'chair', 'toilet', 'desk', 'dresser', 'night_stand', 'bookshelf', 'bathtub') # use caff...
8,126
33.004184
225
py
fcaf3d
fcaf3d-master/configs/imvotenet/imvotenet_stage2_16x8_sunrgbd-3d-10class.py
_base_ = [ '../_base_/datasets/sunrgbd-3d-10class.py', '../_base_/schedules/schedule_3x.py', '../_base_/default_runtime.py', '../_base_/models/imvotenet_image.py' ] class_names = ('bed', 'table', 'sofa', 'chair', 'toilet', 'desk', 'dresser', 'night_stand', 'bookshelf', 'bathtub') # use caff...
9,250
34.444444
225
py
fcaf3d
fcaf3d-master/configs/imvotenet/imvotenet_faster_rcnn_r50_fpn_2x4_sunrgbd-3d-10class.py
_base_ = [ '../_base_/datasets/sunrgbd-3d-10class.py', '../_base_/default_runtime.py', '../_base_/models/imvotenet_image.py' ] # use caffe img_norm img_norm_cfg = dict( mean=[103.530, 116.280, 123.675], std=[1.0, 1.0, 1.0], to_rgb=False) train_pipeline = [ dict(type='LoadImageFromFile'), dict(type...
1,986
32.677966
227
py
fcaf3d
fcaf3d-master/configs/nuimages/mask_rcnn_r50_caffe_fpn_1x_nuim.py
_base_ = [ '../_base_/models/mask_rcnn_r50_fpn.py', '../_base_/datasets/nuim_instance.py', '../_base_/schedules/mmdet_schedule_1x.py', '../_base_/default_runtime.py' ] model = dict( pretrained='open-mmlab://detectron2/resnet50_caffe', backbone=dict(norm_cfg=dict(requires_grad=False), style='caffe'),...
1,636
33.829787
78
py
fcaf3d
fcaf3d-master/configs/nuimages/mask_rcnn_r50_caffe_fpn_coco-3x_20e_nuim.py
_base_ = [ '../_base_/models/mask_rcnn_r50_fpn.py', '../_base_/datasets/nuim_instance.py', '../_base_/schedules/mmdet_schedule_1x.py', '../_base_/default_runtime.py' ] model = dict( pretrained='open-mmlab://detectron2/resnet50_caffe', backbone=dict(norm_cfg=dict(requires_grad=False), style='caffe'),...
1,945
35.716981
227
py
fcaf3d
fcaf3d-master/configs/nuimages/mask_rcnn_r50_caffe_fpn_coco-3x_1x_nuim.py
_base_ = [ '../_base_/models/mask_rcnn_r50_fpn.py', '../_base_/datasets/nuim_instance.py', '../_base_/schedules/mmdet_schedule_1x.py', '../_base_/default_runtime.py' ] model = dict( pretrained='open-mmlab://detectron2/resnet50_caffe', backbone=dict(norm_cfg=dict(requires_grad=False), style='caffe'),...
1,866
37.102041
228
py
fcaf3d
fcaf3d-master/configs/nuimages/htc_without_semantic_r50_fpn_1x_nuim.py
_base_ = [ '../_base_/datasets/nuim_instance.py', '../_base_/schedules/mmdet_schedule_1x.py', '../_base_/default_runtime.py' ] # model settings model = dict( type='HybridTaskCascade', pretrained='torchvision://resnet50', backbone=dict( type='ResNet', depth=50, num_stages=4, ...
7,693
33.657658
79
py
fcaf3d
fcaf3d-master/configs/nuimages/mask_rcnn_x101_32x4d_fpn_1x_nuim.py
_base_ = './mask_rcnn_r50_fpn_1x_nuim.py' model = dict( pretrained='open-mmlab://resnext101_32x4d', backbone=dict( type='ResNeXt', depth=101, groups=32, base_width=4, num_stages=4, out_indices=(0, 1, 2, 3), frozen_stages=1, norm_cfg=dict(type='BN',...
368
25.357143
53
py
fcaf3d
fcaf3d-master/configs/nuimages/mask_rcnn_r101_fpn_1x_nuim.py
_base_ = './mask_rcnn_r50_fpn_1x_nuim.py' model = dict(pretrained='torchvision://resnet101', backbone=dict(depth=101))
119
39
76
py
fcaf3d
fcaf3d-master/configs/nuimages/cascade_mask_rcnn_r101_fpn_1x_nuim.py
_base_ = './cascade_mask_rcnn_r50_fpn_1x_nuim.py' model = dict(pretrained='torchvision://resnet101', backbone=dict(depth=101))
127
41.666667
76
py
fcaf3d
fcaf3d-master/configs/nuimages/cascade_mask_rcnn_x101_32x4d_fpn_1x_nuim.py
_base_ = './cascade_mask_rcnn_r50_fpn_1x_nuim.py' model = dict( pretrained='open-mmlab://resnext101_32x4d', backbone=dict( type='ResNeXt', depth=101, groups=32, base_width=4, num_stages=4, out_indices=(0, 1, 2, 3), frozen_stages=1, norm_cfg=dict(ty...
376
25.928571
53
py
fcaf3d
fcaf3d-master/configs/nuimages/htc_x101_64x4d_fpn_dconv_c3-c5_coco-20e_16x1_20e_nuim.py
_base_ = './htc_r50_fpn_1x_nuim.py' model = dict( pretrained='open-mmlab://resnext101_64x4d', backbone=dict( type='ResNeXt', depth=101, groups=64, base_width=4, num_stages=4, out_indices=(0, 1, 2, 3), frozen_stages=1, norm_cfg=dict(type='BN', requi...
859
34.833333
218
py
fcaf3d
fcaf3d-master/configs/regnet/hv_pointpillars_regnet-400mf_fpn_sbn-all_4x8_2x_nus-3d.py
_base_ = [ '../_base_/models/hv_pointpillars_fpn_nus.py', '../_base_/datasets/nus-3d.py', '../_base_/schedules/schedule_2x.py', '../_base_/default_runtime.py', ] # model settings model = dict( type='MVXFasterRCNN', pretrained=dict(pts='open-mmlab://regnetx_400mf'), pts_backbone=dict( ...
752
30.375
79
py