python_code stringlengths 0 4.04M | repo_name stringlengths 7 58 | file_path stringlengths 5 147 |
|---|---|---|
# Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
import models.resunet as resunet
import models.res16unet as res16unet
MODELS = []
def add_models(module):
MODELS.extend([getattr(module, ... | ContrastiveSceneContexts-main | downstream/semseg/models/__init__.py |
# Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
from models.resnet import ResNetBase, get_norm
from models.modules.common import ConvType, NormType, conv, conv_tr
from models.modules.resnet... | ContrastiveSceneContexts-main | downstream/semseg/models/res16unet.py |
# Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
from MinkowskiEngine import MinkowskiNetwork
class Model(MinkowskiNetwork):
"""
Base network for all sparse convnet
By default, all ... | ContrastiveSceneContexts-main | downstream/semseg/models/model.py |
# Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
import torch.nn as nn
from models.common import get_norm
import MinkowskiEngine as ME
import MinkowskiEngine.MinkowskiFunctional as MEF
... | ContrastiveSceneContexts-main | downstream/semseg/models/residual_block.py |
# Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
import MinkowskiEngine as ME
def get_norm(norm_type, num_feats, bn_momentum=0.05, D=-1):
if norm_type == 'BN':
return ME.MinkowskiBa... | ContrastiveSceneContexts-main | downstream/semseg/models/common.py |
# Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
import torch.nn as nn
import MinkowskiEngine as ME
from models.model import Model
from models.modules.common import ConvType, NormType, get... | ContrastiveSceneContexts-main | downstream/semseg/models/resnet.py |
# Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
import torch.nn as nn
from models.modules.common import ConvType, NormType, get_norm, conv
from MinkowskiEngine import MinkowskiReLU
clas... | ContrastiveSceneContexts-main | downstream/semseg/models/modules/resnet_block.py |
# Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
import torch.nn as nn
import MinkowskiEngine as ME
from models.modules.common import ConvType, NormType
from models.modules.resnet_block i... | ContrastiveSceneContexts-main | downstream/semseg/models/modules/senet_block.py |
# Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree. | ContrastiveSceneContexts-main | downstream/semseg/models/modules/__init__.py |
# Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
import collections
from enum import Enum
import torch.nn as nn
import MinkowskiEngine as ME
class NormType(Enum):
BATCH_NORM = 0
INST... | ContrastiveSceneContexts-main | downstream/semseg/models/modules/common.py |
# Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
import os
import torch
import numpy as np
import glob
import time
import argparse
import pykeops
from pykeops.torch import LazyTensor
pykeop... | ContrastiveSceneContexts-main | downstream/semseg/lib/sampling_points.py |
# Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree. | ContrastiveSceneContexts-main | downstream/semseg/lib/__init__.py |
# Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
import matplotlib.pyplot as plt
import matplotlib
import numpy as np
from matplotlib.pyplot import *
from PIL import Image
colors = [ 'xkcd... | ContrastiveSceneContexts-main | downstream/semseg/lib/plot_graph.py |
# Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
import logging
from torch.optim import SGD, Adam
from torch.optim.lr_scheduler import LambdaLR, StepLR
class LambdaStepLR(LambdaLR):
de... | ContrastiveSceneContexts-main | downstream/semseg/lib/solvers.py |
# Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
import logging
import os
import shutil
import tempfile
import warnings
import numpy as np
import torch
import torch.nn as nn
from sklearn.... | ContrastiveSceneContexts-main | downstream/semseg/lib/test.py |
# Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
import numpy as np
import logging
import os
import sys
import torch
import logging
import torch.nn.functional as F
from torch import nn
fro... | ContrastiveSceneContexts-main | downstream/semseg/lib/ddp_trainer.py |
# Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
import numpy as np
import trimesh
# color palette for nyu40 labels
def create_color_palette():
return [
(0, 0, 0),
(174, ... | ContrastiveSceneContexts-main | downstream/semseg/lib/io3d.py |
# Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
#!/usr/bin/env python3
import os
import time
import torch
import signal
import pickle
import threading
import functools
import traceback
imp... | ContrastiveSceneContexts-main | downstream/semseg/lib/distributed.py |
# Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
import os
import numpy as np
from numpy.linalg import matrix_rank, inv
from plyfile import PlyData, PlyElement
import pandas as pd
COLOR_MA... | ContrastiveSceneContexts-main | downstream/semseg/lib/pc_utils.py |
# Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
import json
import logging
import os
import errno
import time
import torch
import numpy as np
from omegaconf import OmegaConf
from lib.pc_ut... | ContrastiveSceneContexts-main | downstream/semseg/lib/utils.py |
# Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
from scipy.sparse import csr_matrix
import torch
class SparseMM(torch.autograd.Function):
"""
Sparse x dense matrix multiplication wit... | ContrastiveSceneContexts-main | downstream/semseg/lib/math_functions.py |
# Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
import torch
import torch.nn as nn
from MinkowskiEngine import MinkowskiGlobalPooling, MinkowskiBroadcastAddition, MinkowskiBroadcastMulti... | ContrastiveSceneContexts-main | downstream/semseg/lib/layers.py |
# Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
import os
import sys
import hydra
import torch
import numpy as np
from lib.ddp_trainer import SegmentationTrainer
from lib.distributed impor... | ContrastiveSceneContexts-main | downstream/insseg/ddp_main.py |
# Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
import random
import logging
import numpy as np
import scipy
import scipy.ndimage
import scipy.interpolate
import torch
# A sparse tensor... | ContrastiveSceneContexts-main | downstream/insseg/datasets/transforms.py |
# Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
#from lib.datasets import synthia
from datasets import stanford
from datasets import scannet
#from lib.datasets import shapenet
DATASETS =... | ContrastiveSceneContexts-main | downstream/insseg/datasets/__init__.py |
# Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
import logging
import unittest
import imageio
import os
import os.path as osp
import pickle
import numpy as np
from collections import defa... | ContrastiveSceneContexts-main | downstream/insseg/datasets/synthia.py |
# Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
from abc import ABC
from pathlib import Path
from collections import defaultdict
import random
import numpy as np
from enum import Enum
im... | ContrastiveSceneContexts-main | downstream/insseg/datasets/dataset.py |
# Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
import logging
import os
import sys
import numpy as np
from collections import defaultdict
from scipy import spatial
import torch
from plyfi... | ContrastiveSceneContexts-main | downstream/insseg/datasets/stanford.py |
# Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
import collections
import numpy as np
import MinkowskiEngine as ME
from scipy.linalg import expm, norm
# Rotation matrix along axis with ... | ContrastiveSceneContexts-main | downstream/insseg/datasets/voxelizer.py |
# Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
import math
import torch
import torch.distributed as dist
from torch.utils.data.sampler import Sampler
class InfSampler(Sampler):
"""Samp... | ContrastiveSceneContexts-main | downstream/insseg/datasets/dataloader.py |
# Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
import logging
import os
import sys
from pathlib import Path
import torch
import numpy as np
from scipy import spatial
from datasets.datas... | ContrastiveSceneContexts-main | downstream/insseg/datasets/scannet.py |
# Evaluates semantic label task
# Input:
# - path to .txt prediction files
# - path to .txt ground truth files
# - output file to write results to
# Note that only the valid classes are used for evaluation,
# i.e., any ground truth label not in the valid label set
# is ignored in the evaluation.
#
# example usage... | ContrastiveSceneContexts-main | downstream/insseg/datasets/evaluation/evaluate_semantic_label.py |
# Evaluates semantic instance task
# Adapted from the CityScapes evaluation: https://github.com/mcordts/cityscapesScripts/tree/master/cityscapesscripts/evaluation
# Input:
# - path to .txt prediction files
# - path to .txt ground truth files
# - output file to write results to
# Each .txt prediction file look lik... | ContrastiveSceneContexts-main | downstream/insseg/datasets/evaluation/evaluate_semantic_instance.py |
import os, sys
import csv
try:
import numpy as np
except:
print("Failed to import numpy package.")
sys.exit(-1)
try:
import imageio
except:
print("Please install the module 'imageio' for image processing, e.g.")
print("pip install imageio")
sys.exit(-1)
# print an error message and quit
def... | ContrastiveSceneContexts-main | downstream/insseg/datasets/evaluation/scannet_benchmark_utils/util.py |
import os, sys
import json
try:
import numpy as np
except:
print("Failed to import numpy package.")
sys.exit(-1)
try:
from plyfile import PlyData, PlyElement
except:
print("Please install the module 'plyfile' for PLY i/o, e.g.")
print("pip install plyfile")
sys.exit(-1)
from . import util... | ContrastiveSceneContexts-main | downstream/insseg/datasets/evaluation/scannet_benchmark_utils/util_3d.py |
# Evaluates semantic label task
# Input:
# - path to .txt prediction files
# - path to .txt ground truth files
# - output file to write results to
# Note that only the valid classes are used for evaluation,
# i.e., any ground truth label not in the valid label set
# is ignored in the evaluation.
#
# example usage... | ContrastiveSceneContexts-main | downstream/insseg/datasets/evaluation/scannet_benchmark_utils/scripts/evaluate_semantic_label.py |
import os, sys
import csv
try:
import numpy as np
except:
print("Failed to import numpy package.")
sys.exit(-1)
try:
import imageio
except:
print("Please install the module 'imageio' for image processing, e.g.")
print("pip install imageio")
sys.exit(-1)
# print an error message and quit
def... | ContrastiveSceneContexts-main | downstream/insseg/datasets/evaluation/scannet_benchmark_utils/scripts/util.py |
import os, sys
import json
try:
import numpy as np
except:
print("Failed to import numpy package.")
sys.exit(-1)
try:
from plyfile import PlyData, PlyElement
except:
print("Please install the module 'plyfile' for PLY i/o, e.g.")
print("pip install plyfile")
sys.exit(-1)
import util
# ma... | ContrastiveSceneContexts-main | downstream/insseg/datasets/evaluation/scannet_benchmark_utils/scripts/util_3d.py |
# Evaluates semantic instance task
# Adapted from the CityScapes evaluation: https://github.com/mcordts/cityscapesScripts/tree/master/cityscapesscripts/evaluation
# Input:
# - path to .txt prediction files
# - path to .txt ground truth files
# - output file to write results to
# Each .txt prediction file look lik... | ContrastiveSceneContexts-main | downstream/insseg/datasets/evaluation/scannet_benchmark_utils/scripts/evaluate_semantic_instance.py |
import random
from torch.nn import Module
from MinkowskiEngine import SparseTensor
class Wrapper(Module):
"""
Wrapper for the segmentation networks.
"""
OUT_PIXEL_DIST = -1
def __init__(self, NetClass, in_nchannel, out_nchannel, config):
super(Wrapper, self).__init__()
self.initialize_filter(NetCl... | ContrastiveSceneContexts-main | downstream/insseg/models/wrapper.py |
from models.resnet import ResNetBase, get_norm
from models.modules.common import ConvType, NormType, conv, conv_tr
from models.modules.resnet_block import BasicBlock, BasicBlockINBN, Bottleneck
import torch.nn as nn
import MinkowskiEngine as ME
from MinkowskiEngine import MinkowskiReLU
import MinkowskiEngine.Minkowsk... | ContrastiveSceneContexts-main | downstream/insseg/models/resunet.py |
# Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
import models.resunet as resunet
import models.res16unet as res16unet
MODELS = []
def add_models(module):
MODELS.extend([getattr(module... | ContrastiveSceneContexts-main | downstream/insseg/models/__init__.py |
from models.resnet import ResNetBase, get_norm
from models.modules.common import ConvType, NormType, conv, conv_tr
from models.modules.resnet_block import BasicBlock, Bottleneck
from MinkowskiEngine import MinkowskiReLU, SparseTensor
import MinkowskiEngine.MinkowskiOps as me
class Res16UNetBase(ResNetBase):
BLOCK ... | ContrastiveSceneContexts-main | downstream/insseg/models/res16unet.py |
from MinkowskiEngine import MinkowskiNetwork
class Model(MinkowskiNetwork):
"""
Base network for all sparse convnet
By default, all networks are segmentation networks.
"""
OUT_PIXEL_DIST = -1
def __init__(self, in_channels, out_channels, config, D, **kwargs):
super(Model, self).__init__(D)
self.... | ContrastiveSceneContexts-main | downstream/insseg/models/model.py |
import torch.nn as nn
from models.common import get_norm
import MinkowskiEngine as ME
import MinkowskiEngine.MinkowskiFunctional as MEF
class BasicBlockBase(nn.Module):
expansion = 1
NORM_TYPE = 'BN'
def __init__(self,
inplanes,
planes,
stride=1,
di... | ContrastiveSceneContexts-main | downstream/insseg/models/residual_block.py |
import MinkowskiEngine as ME
def get_norm(norm_type, num_feats, bn_momentum=0.05, D=-1):
if norm_type == 'BN':
return ME.MinkowskiBatchNorm(num_feats, momentum=bn_momentum)
elif norm_type == 'IN':
return ME.MinkowskiInstanceNorm(num_feats, dimension=D)
else:
raise ValueError(f'Type {norm_type}, not ... | ContrastiveSceneContexts-main | downstream/insseg/models/common.py |
import torch.nn as nn
import MinkowskiEngine as ME
from models.model import Model
from models.modules.common import ConvType, NormType, get_norm, conv, sum_pool
from models.modules.resnet_block import BasicBlock, Bottleneck
class ResNetBase(Model):
BLOCK = None
LAYERS = ()
INIT_DIM = 64
PLANES = (64, 128, 2... | ContrastiveSceneContexts-main | downstream/insseg/models/resnet.py |
# Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
import torch.nn as nn
from models.modules.common import ConvType, NormType, get_norm, conv
from MinkowskiEngine import MinkowskiReLU
class ... | ContrastiveSceneContexts-main | downstream/insseg/models/modules/resnet_block.py |
# Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
import torch.nn as nn
import MinkowskiEngine as ME
from models.modules.common import ConvType, NormType
from models.modules.resnet_block imp... | ContrastiveSceneContexts-main | downstream/insseg/models/modules/senet_block.py |
ContrastiveSceneContexts-main | downstream/insseg/models/modules/__init__.py | |
# Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
import collections
from enum import Enum
import torch.nn as nn
import MinkowskiEngine as ME
class NormType(Enum):
BATCH_NORM = 0
INSTA... | ContrastiveSceneContexts-main | downstream/insseg/models/modules/common.py |
# Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree. | ContrastiveSceneContexts-main | downstream/insseg/lib/__init__.py |
# Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
import logging
from torch.optim import SGD, Adam
from torch.optim.lr_scheduler import LambdaLR, StepLR
class LambdaStepLR(LambdaLR):
d... | ContrastiveSceneContexts-main | downstream/insseg/lib/solvers.py |
# Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
import logging
import os
import shutil
import tempfile
import warnings
import numpy as np
import torch
import torch.nn as nn
from sklearn.m... | ContrastiveSceneContexts-main | downstream/insseg/lib/test.py |
# Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
import numpy as np
import logging
import os
import sys
import torch
import logging
import torch.nn.functional as F
from torch import nn
fro... | ContrastiveSceneContexts-main | downstream/insseg/lib/ddp_trainer.py |
# Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
import numpy as np
import trimesh
# color palette for nyu40 labels
def create_color_palette():
return [
(0, 0, 0),
(174, ... | ContrastiveSceneContexts-main | downstream/insseg/lib/io3d.py |
#!/usr/bin/env python3
# Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
import os
import time
import torch
import signal
import pickle
import threading
import functools
import traceback
imp... | ContrastiveSceneContexts-main | downstream/insseg/lib/distributed.py |
# Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
import os
import numpy as np
from numpy.linalg import matrix_rank, inv
from plyfile import PlyData, PlyElement
import pandas as pd
COLOR_MA... | ContrastiveSceneContexts-main | downstream/insseg/lib/pc_utils.py |
# Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
import json
import logging
import os
import errno
import time
import torch
import numpy as np
from omegaconf import OmegaConf
from lib.pc_ut... | ContrastiveSceneContexts-main | downstream/insseg/lib/utils.py |
# Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
from scipy.sparse import csr_matrix
import torch
class SparseMM(torch.autograd.Function):
"""
Sparse x dense matrix multiplication wit... | ContrastiveSceneContexts-main | downstream/insseg/lib/math_functions.py |
# Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
import torch
import torch.nn as nn
from MinkowskiEngine import MinkowskiGlobalPooling, MinkowskiBroadcastAddition, MinkowskiBroadcastMultip... | ContrastiveSceneContexts-main | downstream/insseg/lib/layers.py |
import os
import torch
import numpy as np
from torch.autograd import Function
import argparse
#from lib.datasets.scannet.datagen.export_ids_per_vertex import read_segmentation, write_triangle_mesh
#from lib.utils.io import read_triangle_mesh, create_color_palette, write_triangle_mesh
#from lib.utils.scannet_benchmark_u... | ContrastiveSceneContexts-main | downstream/insseg/lib/bfs/bfs.py |
'''
PointGroup operations
Written by Li Jiang
'''
| ContrastiveSceneContexts-main | downstream/insseg/lib/bfs/ops/ops.py |
from setuptools import setup
from torch.utils.cpp_extension import BuildExtension, CUDAExtension
setup(
name='PG_OP',
ext_modules=[
CUDAExtension('PG_OP', [
'src/bfs_cluster.cpp',
'src/bfs_cluster_kernel.cu',
])
],
cmdclass={'build_ext': BuildExtension}
)
| ContrastiveSceneContexts-main | downstream/insseg/lib/bfs/ops/setup.py |
# Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
import os
import random
import torch
import hydra
import numpy as np
from lib.ddp_trainer import DetectionTrainer
from lib.distributed import... | ContrastiveSceneContexts-main | downstream/votenet/ddp_main.py |
# Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
import numpy as np
import sys
import os
BASE_DIR = os.path.dirname(os.path.abspath(__file__))
sys.path.append(BASE_DIR)
ROOT_DIR = os.path.di... | ContrastiveSceneContexts-main | downstream/votenet/datasets/sunrgbd/model_util_sunrgbd.py |
# Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
''' Provides Python helper function to read My SUNRGBD dataset.
Author: Charles R. Qi
Date: October, 2017
Updated by Charles R. Qi
Date: De... | ContrastiveSceneContexts-main | downstream/votenet/datasets/sunrgbd/sunrgbd_utils.py |
# Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
''' Helper class and functions for loading SUN RGB-D objects
Author: Charles R. Qi
Date: December, 2018
Note: removed unused code for frust... | ContrastiveSceneContexts-main | downstream/votenet/datasets/sunrgbd/sunrgbd_data.py |
# coding: utf-8
# Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
""" Dataset for 3D object detection on SUN RGB-D (with support of vote supervision).
A sunrgbd oriented bounding box is para... | ContrastiveSceneContexts-main | downstream/votenet/datasets/sunrgbd/sunrgbd_detection_dataset.py |
# Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
""" Utility functions for metric evaluation.
Author: Or Litany and Charles R. Qi
"""
import os
import sys
BASE_DIR = os.path.dirname(os.pat... | ContrastiveSceneContexts-main | downstream/votenet/datasets/evaluation/metric_util.py |
# Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
import math
import os, sys, argparse
import inspect
from copy import deepcopy
from evaluate_object_detection_helper import eval_det
import nu... | ContrastiveSceneContexts-main | downstream/votenet/datasets/evaluation/evaluate_object_detection.py |
import os, sys
import csv
import numpy as np
import imageio
# print an error message and quit
def print_error(message, user_fault=False):
sys.stderr.write('ERROR: ' + str(message) + '\n')
if user_fault:
sys.exit(2)
sys.exit(-1)
# if string s represents an int
def represents_int(s):
try:
... | ContrastiveSceneContexts-main | downstream/votenet/datasets/evaluation/util.py |
import os, sys
import json
import numpy as np
from plyfile import PlyData, PlyElement
import util
# matrix: 4x4 np array
# points Nx3 np array
def transform_points(matrix, points):
assert len(points.shape) == 2 and points.shape[1] == 3
num_points = points.shape[0]
p = np.concatenate([points, np.ones((num_... | ContrastiveSceneContexts-main | downstream/votenet/datasets/evaluation/util_3d.py |
# Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
""" Generic Code for Object Detection Evaluation
Input:
For each class:
For each image:
Predictions: box, score
... | ContrastiveSceneContexts-main | downstream/votenet/datasets/evaluation/evaluate_object_detection_helper.py |
# Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
""" Load Scannet scenes with vertices and ground truth labels
for semantic and instance segmentations
"""
# python imports
import math
impor... | ContrastiveSceneContexts-main | downstream/votenet/datasets/scannet/load_scannet_data.py |
# coding: utf-8
# Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
""" Dataset for object bounding box regression.
An axis aligned bounding box is parameterized by (cx,cy,cz) and (dx,dy,dz)
wh... | ContrastiveSceneContexts-main | downstream/votenet/datasets/scannet/scannet_detection_dataset.py |
# Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
""" Batch mode in loading Scannet scenes with vertices and ground truth labels
for semantic and instance segmentations
Usage example: python... | ContrastiveSceneContexts-main | downstream/votenet/datasets/scannet/batch_load_scannet_data.py |
# Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
import numpy as np
import sys
import os
BASE_DIR = os.path.dirname(os.path.abspath(__file__))
sys.path.append(BASE_DIR)
ROOT_DIR = os.path.di... | ContrastiveSceneContexts-main | downstream/votenet/datasets/scannet/model_util_scannet.py |
# Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
import sys
import os
BASE_DIR = os.path.dirname(__file__)
sys.path.append(BASE_DIR)
import numpy as np
import pc_util
scene_name = 'scanne... | ContrastiveSceneContexts-main | downstream/votenet/datasets/scannet/data_viz.py |
# Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
''' Ref: https://github.com/ScanNet/ScanNet/blob/master/BenchmarkScripts '''
import os
import sys
import json
import csv
try:
import num... | ContrastiveSceneContexts-main | downstream/votenet/datasets/scannet/scannet_utils.py |
# Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
import torch
import torch.nn as nn
import numpy as np
import sys
import os
from lib.utils.nn_distance import nn_distance, huber_loss
FAR_THR... | ContrastiveSceneContexts-main | downstream/votenet/models/loss_helper.py |
# Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
import numpy as np
import torch
import os
import sys
from lib.utils import pc_util
DUMP_CONF_THRESH = 0.5 # Dump boxes with obj prob larger ... | ContrastiveSceneContexts-main | downstream/votenet/models/dump_helper.py |
# Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
import torch
import torch.nn as nn
import numpy as np
import sys
import os
BASE_DIR = os.path.dirname(os.path.abspath(__file__))
ROOT_DIR = o... | ContrastiveSceneContexts-main | downstream/votenet/models/loss_helper_boxnet.py |
# Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
""" Helper functions and class to calculate Average Precisions for 3D object detection.
"""
import os
import sys
import numpy as np
import to... | ContrastiveSceneContexts-main | downstream/votenet/models/ap_helper.py |
# Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
''' Voting module: generate votes from XYZ and features of seed points.
Date: July, 2019
Author: Charles R. Qi and Or Litany
'''
import tor... | ContrastiveSceneContexts-main | downstream/votenet/models/voting_module.py |
# Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
import torch
import torch.nn as nn
import torch.nn.functional as F
import numpy as np
import os
import sys
BASE_DIR = os.path.dirname(os.path... | ContrastiveSceneContexts-main | downstream/votenet/models/proposal_module.py |
# Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
import torch
import torch.nn as nn
import numpy as np
import sys
import os
BASE_DIR = os.path.dirname(os.path.abspath(__file__))
ROOT_DIR = o... | ContrastiveSceneContexts-main | downstream/votenet/models/boxnet.py |
# Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
import torch
import torch.nn as nn
import torch.nn.functional as F
import numpy as np
import sys
import os
from models.backbone.pointnet2.po... | ContrastiveSceneContexts-main | downstream/votenet/models/backbone_module.py |
# Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
""" Deep hough voting network for 3D object detection in point clouds.
Author: Charles R. Qi and Or Litany
"""
import torch
import torch.nn... | ContrastiveSceneContexts-main | downstream/votenet/models/votenet.py |
# Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
import argparse
import torch
def str2opt(arg):
assert arg in ['SGD', 'Adam']
return arg
def str2scheduler(arg):
assert arg in... | ContrastiveSceneContexts-main | downstream/votenet/models/backbone/sparseconv/config.py |
# coding: utf-8
# Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
import os
import sys
import numpy as np
import torch
from torch.utils.data import Dataset
from torch.utils.data._utils.colla... | ContrastiveSceneContexts-main | downstream/votenet/models/backbone/sparseconv/voxelized_dataset.py |
# Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree. | ContrastiveSceneContexts-main | downstream/votenet/models/backbone/sparseconv/__init__.py |
import collections
import numpy as np
import MinkowskiEngine as ME
from scipy.linalg import expm, norm
# Rotation matrix along axis with angle theta
def M(axis, theta):
return expm(np.cross(np.eye(3), axis / norm(axis) * theta))
class Voxelizer:
def __init__(self,
voxel_size=1,
... | ContrastiveSceneContexts-main | downstream/votenet/models/backbone/sparseconv/voxelizer.py |
# Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
import random
from torch.nn import Module
from MinkowskiEngine import SparseTensor
class Wrapper(Module):
"""
Wrapper for the segmenta... | ContrastiveSceneContexts-main | downstream/votenet/models/backbone/sparseconv/models_sparseconv/wrapper.py |
# Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
from models.backbone.sparseconv.models_sparseconv.resnet import ResNetBase, get_norm
from models.backbone.sparseconv.models_sparseconv.modul... | ContrastiveSceneContexts-main | downstream/votenet/models/backbone/sparseconv/models_sparseconv/resunet.py |
# Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
from models.backbone.sparseconv.models_sparseconv import resunet as resunet
from models.backbone.sparseconv.models_sparseconv import res16u... | ContrastiveSceneContexts-main | downstream/votenet/models/backbone/sparseconv/models_sparseconv/__init__.py |
# Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
from models.backbone.sparseconv.models_sparseconv.resnet import ResNetBase, get_norm
from models.backbone.sparseconv.models_sparseconv.module... | ContrastiveSceneContexts-main | downstream/votenet/models/backbone/sparseconv/models_sparseconv/res16unet.py |
# Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
from MinkowskiEngine import MinkowskiNetwork
class Model(MinkowskiNetwork):
"""
Base network for all sparse convnet
By default, all... | ContrastiveSceneContexts-main | downstream/votenet/models/backbone/sparseconv/models_sparseconv/model.py |
# Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
import torch.nn as nn
import MinkowskiEngine as ME
from models.backbone.sparseconv.models_sparseconv.model import Model
from models.backbon... | ContrastiveSceneContexts-main | downstream/votenet/models/backbone/sparseconv/models_sparseconv/resnet.py |
# Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
import torch
import torch.nn as nn
from torch.autograd import Variable
from MinkowskiEngine import SparseTensor, MinkowskiConvolution, Mink... | ContrastiveSceneContexts-main | downstream/votenet/models/backbone/sparseconv/models_sparseconv/conditional_random_fields.py |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.