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
DiffBEV
DiffBEV-main/configs/_base_/models/gcnet_r50-d8.py
# model settings norm_cfg = dict(type='SyncBN', requires_grad=True) model = dict( type='EncoderDecoder', pretrained='open-mmlab://resnet50_v1c', backbone=dict( type='ResNetV1c', depth=50, num_stages=4, out_indices=(0, 1, 2, 3), dilations=(1, 1, 2, 4), strides=...
1,326
27.234043
74
py
DiffBEV
DiffBEV-main/configs/_base_/models/encnet_r50-d8.py
# model settings norm_cfg = dict(type='SyncBN', requires_grad=True) model = dict( type='EncoderDecoder', pretrained='open-mmlab://resnet50_v1c', backbone=dict( type='ResNetV1c', depth=50, num_stages=4, out_indices=(0, 1, 2, 3), dilations=(1, 1, 2, 4), strides=...
1,435
28.306122
74
py
DiffBEV
DiffBEV-main/configs/_base_/models/danet_r50-d8.py
# model settings norm_cfg = dict(type='SyncBN', requires_grad=True) model = dict( type='EncoderDecoder', pretrained='open-mmlab://resnet50_v1c', backbone=dict( type='ResNetV1c', depth=50, num_stages=4, out_indices=(0, 1, 2, 3), dilations=(1, 1, 2, 4), strides=...
1,261
27.044444
74
py
DiffBEV
DiffBEV-main/configs/_base_/models/dnl_r50-d8.py
# model settings norm_cfg = dict(type='SyncBN', requires_grad=True) model = dict( type='EncoderDecoder', pretrained='open-mmlab://resnet50_v1c', backbone=dict( type='ResNetV1c', depth=50, num_stages=4, out_indices=(0, 1, 2, 3), dilations=(1, 1, 2, 4), strides=...
1,316
27.021277
74
py
DiffBEV
DiffBEV-main/configs/_base_/models/pspnet_r50-d8.py
# model settings norm_cfg = dict(type='SyncBN', requires_grad=True) model = dict( type='EncoderDecoder', pretrained='open-mmlab://resnet50_v1c', backbone=dict( type='ResNetV1c', depth=50, num_stages=4, out_indices=(0, 1, 2, 3), dilations=(1, 1, 2, 4), strides=...
1,271
27.266667
74
py
DiffBEV
DiffBEV-main/configs/_base_/models/upernet_r50.py
# model settings norm_cfg = dict(type='SyncBN', requires_grad=True) model = dict( type='EncoderDecoder', pretrained='open-mmlab://resnet50_v1c', backbone=dict( type='ResNetV1c', depth=50, num_stages=4, out_indices=(0, 1, 2, 3), dilations=(1, 1, 1, 1), strides=...
1,301
27.933333
74
py
DiffBEV
DiffBEV-main/configs/_base_/models/apcnet_r50-d8.py
# model settings norm_cfg = dict(type='SyncBN', requires_grad=True) model = dict( type='EncoderDecoder', pretrained='open-mmlab://resnet50_v1c', backbone=dict( type='ResNetV1c', depth=50, num_stages=4, out_indices=(0, 1, 2, 3), dilations=(1, 1, 2, 4), strides=...
1,302
27.955556
74
py
DiffBEV
DiffBEV-main/configs/_base_/models/psanet_r50-d8.py
# model settings norm_cfg = dict(type='SyncBN', requires_grad=True) model = dict( type='EncoderDecoder', pretrained='open-mmlab://resnet50_v1c', backbone=dict( type='ResNetV1c', depth=50, num_stages=4, out_indices=(0, 1, 2, 3), dilations=(1, 1, 2, 4), strides=...
1,406
27.14
74
py
DiffBEV
DiffBEV-main/configs/_base_/models/fastfcn_r50-d32_jpu_psp.py
# model settings norm_cfg = dict(type='SyncBN', requires_grad=True) model = dict( type='EncoderDecoder', pretrained='open-mmlab://resnet50_v1c', backbone=dict( type='ResNetV1c', depth=50, num_stages=4, dilations=(1, 1, 2, 4), strides=(1, 2, 2, 2), out_indices=...
1,502
26.833333
74
py
DiffBEV
DiffBEV-main/configs/_base_/models/deeplabv3plus_r50-d8.py
# model settings norm_cfg = dict(type='SyncBN', requires_grad=True) model = dict( type='EncoderDecoder', pretrained='open-mmlab://resnet50_v1c', backbone=dict( type='ResNetV1c', depth=50, num_stages=4, out_indices=(0, 1, 2, 3), dilations=(1, 1, 2, 4), strides=...
1,343
27.595745
74
py
DiffBEV
DiffBEV-main/configs/_base_/models/emanet_r50-d8.py
# model settings norm_cfg = dict(type='SyncBN', requires_grad=True) model = dict( type='EncoderDecoder', pretrained='open-mmlab://resnet50_v1c', backbone=dict( type='ResNetV1c', depth=50, num_stages=4, out_indices=(0, 1, 2, 3), dilations=(1, 1, 2, 4), strides=...
1,329
26.708333
74
py
DiffBEV
DiffBEV-main/configs/_base_/models/dmnet_r50-d8.py
# model settings norm_cfg = dict(type='SyncBN', requires_grad=True) model = dict( type='EncoderDecoder', pretrained='open-mmlab://resnet50_v1c', backbone=dict( type='ResNetV1c', depth=50, num_stages=4, out_indices=(0, 1, 2, 3), dilations=(1, 1, 2, 4), strides=...
1,302
27.955556
74
py
DiffBEV
DiffBEV-main/configs/_base_/models/fpn_r50.py
# model settings norm_cfg = dict(type='SyncBN', requires_grad=True) model = dict( type='EncoderDecoder', pretrained='open-mmlab://resnet50_v1c', backbone=dict( type='ResNetV1c', depth=50, num_stages=4, out_indices=(0, 1, 2, 3), dilations=(1, 1, 1, 1), strides=...
1,056
27.567568
74
py
DiffBEV
DiffBEV-main/configs/_base_/models/deeplabv3_r50-d8.py
# model settings norm_cfg = dict(type='SyncBN', requires_grad=True) model = dict( type='EncoderDecoder', pretrained='open-mmlab://resnet50_v1c', backbone=dict( type='ResNetV1c', depth=50, num_stages=4, out_indices=(0, 1, 2, 3), dilations=(1, 1, 2, 4), strides=...
1,273
27.311111
74
py
DiffBEV
DiffBEV-main/configs/_base_/models/bisenetv1_r18-d32.py
# model settings norm_cfg = dict(type='SyncBN', requires_grad=True) model = dict( type='EncoderDecoder', backbone=dict( type='BiSeNetV1', in_channels=3, context_channels=(128, 256, 512), spatial_channels=(64, 64, 64, 128), out_indices=(0, 1, 2), out_channels=256, ...
2,014
28.202899
78
py
DiffBEV
DiffBEV-main/configs/_base_/models/pointrend_r50.py
# model settings norm_cfg = dict(type='SyncBN', requires_grad=True) model = dict( type='CascadeEncoderDecoder', num_stages=2, pretrained='open-mmlab://resnet50_v1c', backbone=dict( type='ResNetV1c', depth=50, num_stages=4, out_indices=(0, 1, 2, 3), dilations=(1, 1...
1,704
28.912281
78
py
DiffBEV
DiffBEV-main/configs/_base_/models/ocrnet_r50-d8.py
# model settings norm_cfg = dict(type='SyncBN', requires_grad=True) model = dict( type='CascadeEncoderDecoder', num_stages=2, pretrained='open-mmlab://resnet50_v1c', backbone=dict( type='ResNetV1c', depth=50, num_stages=4, out_indices=(0, 1, 2, 3), dilations=(1, 1...
1,385
27.875
78
py
DiffBEV
DiffBEV-main/configs/_base_/models/isanet_r50-d8.py
# model settings norm_cfg = dict(type='SyncBN', requires_grad=True) model = dict( type='EncoderDecoder', pretrained='open-mmlab://resnet50_v1c', backbone=dict( type='ResNetV1c', depth=50, num_stages=4, out_indices=(0, 1, 2, 3), dilations=(1, 1, 2, 4), strides=...
1,291
27.086957
74
py
DiffBEV
DiffBEV-main/configs/_base_/models/nonlocal_r50-d8.py
# model settings norm_cfg = dict(type='SyncBN', requires_grad=True) model = dict( type='EncoderDecoder', pretrained='open-mmlab://resnet50_v1c', backbone=dict( type='ResNetV1c', depth=50, num_stages=4, out_indices=(0, 1, 2, 3), dilations=(1, 1, 2, 4), strides=...
1,315
27
74
py
DiffBEV
DiffBEV-main/configs/_base_/models/fcn_r50-d8.py
# model settings norm_cfg = dict(type='SyncBN', requires_grad=True) model = dict( type='EncoderDecoder', pretrained='open-mmlab://resnet50_v1c', backbone=dict( type='ResNetV1c', depth=50, num_stages=4, out_indices=(0, 1, 2, 3), dilations=(1, 1, 2, 4), strides=...
1,285
26.956522
74
py
DiffBEV
DiffBEV-main/docs/conf.py
# Copyright (c) OpenMMLab. All rights reserved. # Configuration file for the Sphinx documentation builder. # # This file only contains a selection of the most common options. For a full # list see the documentation: # https://www.sphinx-doc.org/en/master/usage/configuration.html # -- Path setup -----------------------...
6,019
29.871795
79
py
viser
viser-main/render_vis.py
import sys, os sys.path.append(os.path.dirname(os.path.dirname(sys.path[0]))) os.environ["PYOPENGL_PLATFORM"] = "egl" #opengl seems to only work with TPU sys.path.insert(0,'third_party') import subprocess import imageio import glob import matplotlib.pyplot as plt import numpy as np import torch import cv2 import pdb i...
14,811
46.780645
240
py
viser
viser-main/extract.py
# Copyright 2021 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # https://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writin...
12,708
39.346032
168
py
viser
viser-main/eval_pck.py
import time import sys, os import pdb import torch import torch.nn as nn from torch.autograd import Variable sys.path.insert(0,'third_party') from ext_utils.badja_data import BADJAData from ext_utils.joint_catalog import SMALJointInfo import matplotlib.pyplot as plt import numpy as np import torch import torch.nn.funct...
13,078
52.823045
187
py
viser
viser-main/optimize.py
# Copyright 2021 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # https://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writin...
1,673
26.9
112
py
viser
viser-main/third_party/PerceptualSimilarity/test_network.py
# import sys; sys.path += ['models'] import torch from util import util from models import dist_model as dm #from IPython import embed use_gpu = True # Whether to use GPU spatial = False # Return a spatial map of perceptual distance. # Optional args spatial_shape and spatial_orde...
1,940
38.612245
154
py
viser
viser-main/third_party/PerceptualSimilarity/train.py
import torch.backends.cudnn as cudnn cudnn.benchmark=False import numpy as np import time import os from models import dist_model as dm from data import data_loader as dl import argparse from util.visualizer import Visualizer #from IPython import embed parser = argparse.ArgumentParser() parser.add_argument('--dataset...
4,956
50.103093
269
py
viser
viser-main/third_party/PerceptualSimilarity/perceptual_loss.py
from __future__ import absolute_import from __future__ import division from __future__ import print_function import torch from torch.autograd import Variable from models import dist_model class PerceptualLoss(torch.nn.Module): def __init__(self, model='net-lin', net='vgg', use_gpu=True): # VGG using our perceptua...
2,966
32.337079
125
py
viser
viser-main/third_party/PerceptualSimilarity/models/base_model.py
import os import torch import torch.nn as nn from ..util import util as util from torch.autograd import Variable from pdb import set_trace as st #from IPython import embed class BaseModel(nn.Module): def __init__(self): super(BaseModel, self).__init__() pass; def name(self): re...
1,829
27.59375
78
py
viser
viser-main/third_party/PerceptualSimilarity/models/pretrained_networks.py
from collections import namedtuple import torch from torchvision import models #from IPython import embed class squeezenet(torch.nn.Module): def __init__(self, requires_grad=False, pretrained=True): super(squeezenet, self).__init__() pretrained_features = models.squeezenet1_1(pretrained=pretrained)...
6,560
35.049451
109
py
viser
viser-main/third_party/PerceptualSimilarity/models/networks_basic.py
import torch import torch.nn as nn import torch.nn.init as init from torch.autograd import Variable import numpy as np from pdb import set_trace as st from ..util import util as util from skimage import color #from IPython import embed from . import pretrained_networks as pn # Off-the-shelf deep network class PNet(nn....
9,835
38.187251
122
py
viser
viser-main/third_party/PerceptualSimilarity/models/dist_model.py
import numpy as np import torch from torch import nn import os import os.path as osp from collections import OrderedDict from torch.autograd import Variable import itertools from ..util import util as util from .base_model import BaseModel from . import networks_basic as networks from scipy.ndimage import zoom import f...
12,925
39.905063
229
py
viser
viser-main/third_party/PerceptualSimilarity/util/util.py
from __future__ import print_function import numpy as np from PIL import Image import inspect import re import numpy as np import os import collections import matplotlib.pyplot as plt from scipy.ndimage.interpolation import zoom #from skimage.measure import compare_ssim import torch #from IPython import embed import cv...
14,037
30.057522
153
py
viser
viser-main/third_party/PerceptualSimilarity/data/custom_dataset_data_loader.py
import torch.utils.data from data.base_data_loader import BaseDataLoader import os def CreateDataset(dataroots,dataset_mode='2afc',load_size=64,): dataset = None if dataset_mode=='2afc': # human judgements from dataset.twoafc_dataset import TwoAFCDataset dataset = TwoAFCDataset() elif datas...
1,482
36.075
138
py
viser
viser-main/third_party/PerceptualSimilarity/data/image_folder.py
################################################################################ # Code from # https://github.com/pytorch/vision/blob/master/torchvision/datasets/folder.py # Modified the original code so that it also loads images from the current # directory as well as the subdirectories ###############################...
2,261
30.416667
94
py
viser
viser-main/third_party/PerceptualSimilarity/data/dataset/twoafc_dataset.py
import os.path import torchvision.transforms as transforms from data.dataset.base_dataset import BaseDataset from data.image_folder import make_dataset from PIL import Image import numpy as np import torch # from IPython import embed class TwoAFCDataset(BaseDataset): def initialize(self, dataroots, load_size=64): ...
2,411
35.545455
99
py
viser
viser-main/third_party/PerceptualSimilarity/data/dataset/base_dataset.py
import torch.utils.data as data class BaseDataset(data.Dataset): def __init__(self): super(BaseDataset, self).__init__() def name(self): return 'BaseDataset' def initialize(self): pass
237
17.307692
43
py
viser
viser-main/third_party/PerceptualSimilarity/data/dataset/jnd_dataset.py
import os.path import torchvision.transforms as transforms from data.dataset.base_dataset import BaseDataset from data.image_folder import make_dataset from PIL import Image import numpy as np import torch #from IPython import embed class JNDDataset(BaseDataset): def initialize(self, dataroot, load_size=64): ...
1,793
32.222222
75
py
viser
viser-main/third_party/ext_nnutils/loss_utils.py
# MIT License # # Copyright (c) 2017 Hiroharu Kato # Copyright (c) 2018 Nikos Kolotouros # Copyright (c) 2019 Shichen Liu # # 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 restricti...
5,472
34.538961
113
py
viser
viser-main/third_party/ext_nnutils/net_blocks.py
# MIT License # # Copyright (c) 2018 akanazawa # Copyright (c) 2021 Google LLC # # 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...
16,619
35.28821
145
py
viser
viser-main/third_party/ext_nnutils/conv4d.py
# MIT License # # Copyright (c) 2019 Carnegie Mellon University # Copyright (c) 2021 Google LLC # # 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 limi...
13,409
40.645963
191
py
viser
viser-main/third_party/ext_nnutils/submodule.py
# MIT License # # Copyright (c) 2019 Carnegie Mellon University # Copyright (c) 2021 Google LLC # # 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 limi...
34,937
45.646195
164
py
viser
viser-main/third_party/ext_nnutils/mesh_net.py
# MIT License # # Copyright (c) 2018 akanazawa # Copyright (c) 2021 Google LLC # # 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...
4,448
34.592
119
py
viser
viser-main/third_party/ext_nnutils/train_utils.py
# MIT License # # Copyright (c) 2018 akanazawa # Copyright (c) 2021 Google LLC # # 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...
4,597
32.808824
103
py
viser
viser-main/third_party/ext_nnutils/VCNplus.py
# MIT License # # Copyright (c) 2019 Carnegie Mellon University # Copyright (c) 2021 Google LLC # # 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 limi...
27,220
49.038603
208
py
viser
viser-main/third_party/nerf/train_utils.py
import pdb import torch from .nerf_helpers import get_minibatches, ndc_rays from .nerf_helpers import sample_pdf_2 as sample_pdf from .volume_rendering_utils import volume_render_radiance_field local_chunksize=131072 def run_network(network_fn, pts, viewdirs, chunksize, embed_fn, embeddirs_fn, code=None): pts_fla...
6,093
30.412371
106
py
viser
viser-main/third_party/nerf/nerf_helpers.py
import pdb import math from typing import Optional import torch def img2mse(img_src, img_tgt): return torch.nn.functional.mse_loss(img_src, img_tgt) def mse2psnr(mse): # For numerical stability, avoid a zero mse loss. if mse == 0: mse = 1e-5 return -10.0 * math.log10(mse) def get_minibatc...
17,886
35.0625
105
py
viser
viser-main/third_party/nerf/models.py
import torch import pdb class VeryTinyNeRFModel(torch.nn.Module): r"""Define a "very tiny" NeRF model comprising three fully connected layers. """ def __init__(self, filter_size=128, num_encoding_functions=6, use_viewdirs=True): super(VeryTinyNeRFModel, self).__init__() self.num_encoding_...
18,208
36.621901
122
py
viser
viser-main/third_party/nerf/load_blender.py
import json import os import cv2 import imageio import numpy as np import torch def translate_by_t_along_z(t): tform = np.eye(4).astype(np.float32) tform[2][3] = t return tform def rotate_by_phi_along_x(phi): tform = np.eye(4).astype(np.float32) tform[1, 1] = tform[2, 2] = np.cos(phi) tform...
3,270
26.957265
83
py
viser
viser-main/third_party/nerf/load_llff.py
import os import imageio import numpy as np # Implementation from: # https://github.com/yenchenlin/nerf-pytorch/blob/master/load_llff.py # Slightly modified version of LLFF data loading code # see https://github.com/Fyusion/LLFF for original def _minify(basedir, factors=[], resolutions=[]): needtoload = False ...
10,545
28.707042
88
py
viser
viser-main/third_party/nerf/volume_rendering_utils.py
import torch from .nerf_helpers import cumprod_exclusive def volume_render_radiance_field( radiance_field, depth_values, ray_directions, radiance_field_noise_std=0.0, white_background=False, ): # TESTED one_e_10 = torch.tensor( [1e10], dtype=ray_directions.dtype, device=ray_direct...
1,625
29.111111
87
py
viser
viser-main/third_party/softras/setup.py
from setuptools import setup, find_packages from torch.utils.cpp_extension import BuildExtension, CUDAExtension CUDA_FLAGS = [] ext_modules=[ CUDAExtension('soft_renderer.cuda.load_textures', [ 'soft_renderer/cuda/load_textures_cuda.cpp', 'soft_renderer/cuda/load_textures_cuda_kernel.cu', ...
1,400
34.025
91
py
viser
viser-main/third_party/softras/soft_renderer/renderer.py
import math import torch import torch.nn as nn import torch.nn.functional as F import numpy import soft_renderer as sr class Renderer(nn.Module): def __init__(self, image_size=256, background_color=[0,0,0], near=1, far=100, anti_aliasing=True, fill_back=True, eps=1e-6, camera...
4,366
41.813725
91
py
viser
viser-main/third_party/softras/soft_renderer/losses.py
import torch import torch.nn as nn import numpy as np class LaplacianLoss(nn.Module): def __init__(self, vertex, faces, average=False): super(LaplacianLoss, self).__init__() self.nv = vertex.size(0) self.nf = faces.size(0) self.average = average laplacian = np.zeros([self.n...
3,795
32.298246
113
py
viser
viser-main/third_party/softras/soft_renderer/rasterizer.py
import numpy as np import torch import torch.nn as nn import torch.nn.functional as F import soft_renderer.functional as srf class SoftRasterizer(nn.Module): def __init__(self, image_size=256, background_color=[0, 0, 0], near=1, far=100, anti_aliasing=False, fill_back=False, eps=1e-3, ...
2,336
41.490909
94
py
viser
viser-main/third_party/softras/soft_renderer/transform.py
import math import numpy as np import torch import torch.nn as nn import soft_renderer.functional as srf class Projection(nn.Module): def __init__(self, P, dist_coeffs=None, orig_size=512): super(Projection, self).__init__() self.P = P self.dist_coeffs = dist_coeffs self.orig_siz...
4,016
36.194444
114
py
viser
viser-main/third_party/softras/soft_renderer/lighting.py
import torch import torch.nn as nn import torch.nn.functional as F import numpy as np import soft_renderer.functional as srf class AmbientLighting(nn.Module): def __init__(self, light_intensity=0.5, light_color=(1,1,1)): super(AmbientLighting, self).__init__() self.light_intensity = light_intens...
2,622
38.149254
90
py
viser
viser-main/third_party/softras/soft_renderer/mesh.py
import torch import torch.nn as nn import torch.nn.functional as F import numpy as np import soft_renderer.functional as srf class Mesh(object): ''' A simple class for creating and manipulating trimesh objects ''' def __init__(self, vertices, faces, textures=None, texture_res=1, texture_type='surface...
6,884
37.463687
116
py
viser
viser-main/third_party/softras/soft_renderer/functional/soft_rasterize.py
import torch import torch.nn as nn import torch.nn.functional as F from torch.autograd import Function import numpy as np import soft_renderer.cuda.soft_rasterize as soft_rasterize_cuda class SoftRasterizeFunction(Function): @staticmethod def forward(ctx, face_vertices, textures, image_size=256, ...
5,728
46.347107
136
py
viser
viser-main/third_party/softras/soft_renderer/functional/vertex_normals.py
import torch import torch.nn.functional as F def vertex_normals(vertices, faces): """ :param vertices: [batch size, number of vertices, 3] :param faces: [batch size, number of faces, 3] :return: [batch size, number of vertices, 3] """ assert (vertices.ndimension() == 3) assert (faces.ndimen...
1,543
39.631579
125
py
viser
viser-main/third_party/softras/soft_renderer/functional/voxelization.py
import torch import torch.nn as nn import torch.nn.functional as F from torch.autograd import Function import soft_renderer.cuda.voxelization as voxelization_cuda def voxelize_sub1(faces, size, dim): bs = faces.size(0) nf = faces.size(1) if dim == 0: faces = faces[:, :, :, [2, 1, 0]].contiguous()...
1,694
26.33871
83
py
viser
viser-main/third_party/softras/soft_renderer/functional/ambient_lighting.py
import torch import torch.nn as nn import torch.nn.functional as F import numpy as np def ambient_lighting(light, light_intensity=0.5, light_color=(1,1,1)): device = light.device if isinstance(light_color, tuple) or isinstance(light_color, list): light_color = torch.tensor(light_color, dtype=torch.fl...
625
31.947368
83
py
viser
viser-main/third_party/softras/soft_renderer/functional/save_obj.py
import os import torch from skimage.io import imsave import soft_renderer.cuda.create_texture_image as create_texture_image_cuda def create_texture_image(textures, texture_res=16): num_faces = textures.shape[0] tile_width = int((num_faces - 1.) ** 0.5) + 1 tile_height = int((num_faces - 1.) / tile_width...
4,163
39.038462
99
py
viser
viser-main/third_party/softras/soft_renderer/functional/perspective.py
import math import torch def perspective(vertices, angle=30.): ''' Compute perspective distortion from a given angle ''' if (vertices.ndimension() != 3): raise ValueError('vertices Tensor should have 3 dimensions') device = vertices.device angle = torch.tensor(angle / 180 * math.pi, dt...
600
27.619048
83
py
viser
viser-main/third_party/softras/soft_renderer/functional/directional_lighting.py
import torch import torch.nn as nn import torch.nn.functional as F import numpy as np def directional_lighting(light, normals, light_intensity=0.5, light_color=(1,1,1), light_direction=(0,1,0)): # normals: [nb, :, 3] device = light.device if isinstance(light_color, tuple) or is...
1,210
42.25
91
py
viser
viser-main/third_party/softras/soft_renderer/functional/face_vertices.py
import torch def face_vertices(vertices, faces): """ :param vertices: [batch size, number of vertices, 3] :param faces: [batch size, number of faces, 3] :return: [batch size, number of faces, 3, 3] """ assert (vertices.ndimension() == 3) assert (faces.ndimension() == 3) assert (vertice...
742
31.304348
88
py
viser
viser-main/third_party/softras/soft_renderer/functional/get_points_from_angles.py
import math import torch def get_points_from_angles(distance, elevation, azimuth, degrees=True): if isinstance(distance, float) or isinstance(distance, int): if degrees: elevation = math.radians(elevation) azimuth = math.radians(azimuth) return ( distance * math...
836
33.875
71
py
viser
viser-main/third_party/softras/soft_renderer/functional/load_obj.py
import os import torch import numpy as np from skimage.io import imread import soft_renderer.cuda.load_textures as load_textures_cuda def load_mtl(filename_mtl): ''' load color (Kd) and filename of textures from *.mtl ''' texture_filenames = {} colors = {} material_name = '' with open(fil...
5,923
34.261905
107
py
viser
viser-main/third_party/softras/soft_renderer/functional/look.py
import numpy as np import torch import torch.nn.functional as F def look(vertices, eye, direction=[0, 1, 0], up=None): """ "Look" transformation of vertices. """ if (vertices.ndimension() != 3): raise ValueError('vertices Tensor should have 3 dimensions') device = vertices.device if ...
1,643
30.615385
86
py
viser
viser-main/third_party/softras/soft_renderer/functional/projection.py
import torch def projection(vertices, P, dist_coeffs, orig_size): ''' Calculate projective transformation of vertices given a projection matrix P: 3x4 projection matrix dist_coeffs: vector of distortion coefficients orig_size: original size of image captured by the camera ''' vertices = to...
1,198
37.677419
88
py
viser
viser-main/third_party/softras/soft_renderer/functional/orthogonal.py
import torch def orthogonal(vertices, scale): ''' Compute orthogonal projection from a given angle To find equivalent scale to perspective projection set scale = focal_pixel / object_depth -- to 0~H/W pixel range = 1 / ( object_depth * tan(half_fov_angle) ) -- to -1~1 pixel range ''...
584
33.411765
81
py
viser
viser-main/third_party/softras/soft_renderer/functional/look_at.py
import numpy as np import torch import torch.nn.functional as F def look_at(vertices, eye, at=[0, 0, 0], up=[0, 1, 0]): """ "Look at" transformation of vertices. """ if (vertices.ndimension() != 3): raise ValueError('vertices Tensor should have 3 dimensions') device = vertices.device ...
2,060
31.714286
86
py
viser
viser-main/third_party/ext_utils/quatlib.py
# Copyright (c) 2020, NVIDIA CORPORATION. All rights reserved. # # NVIDIA CORPORATION and its licensors retain all intellectual property # and proprietary rights in and to this software, related documentation # and any modifications thereto. Any use, reproduction, disclosure or # distribution of this software and rel...
1,541
29.235294
141
py
viser
viser-main/third_party/ext_utils/util_rot.py
# MIT License # # Copyright (c) 2019 Yi_Zhou # # 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, pu...
1,577
39.461538
80
py
viser
viser-main/third_party/ext_utils/io.py
# MIT License # # Copyright (c) 2019 Carnegie Mellon University # Copyright (c) 2021 Google LLC # # 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 limi...
1,862
30.05
80
py
viser
viser-main/preprocess/skip_gen.py
from __future__ import print_function import sys sys.path.insert(0,'third_party') import cv2 import pdb import argparse import numpy as np import torch import torch.nn as nn import torch.nn.parallel import torch.backends.cudnn as cudnn import torch.optim as optim import torch.utils.data from torch.autograd import Vari...
7,004
38.576271
108
py
viser
viser-main/preprocess/auto_gen.py
# Copyright 2021 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # https://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writin...
9,175
40.147982
107
py
viser
viser-main/nnutils/loss_utils.py
# Copyright 2021 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # https://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writin...
2,451
33.535211
94
py
viser
viser-main/nnutils/predictor.py
# Copyright 2021 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # https://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writin...
15,868
46.942598
202
py
viser
viser-main/nnutils/net_blocks.py
import torch import torchvision import torch.nn as nn import sys class CodePredictorTex(nn.Module): def __init__(self, nz_feat=100,tex_code_dim=64, shape_code_dim=64): super(CodePredictorTex, self).__init__() self.tex_predictor = nn.Linear(nz_feat, tex_code_dim) self.shape_predictor = nn.Li...
525
29.941176
71
py
viser
viser-main/nnutils/mesh_net.py
# Copyright 2021 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # https://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writin...
54,941
50.061338
207
py
viser
viser-main/nnutils/train_utils.py
# Copyright 2021 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # https://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writin...
32,294
56.980251
249
py
viser
viser-main/nnutils/geom_utils.py
# Copyright 2021 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # https://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writin...
7,548
26.959259
123
py
viser
viser-main/nnutils/cenet.py
from __future__ import print_function import torch import torch.nn as nn import torch.utils.data from torch.autograd import Variable import torch.nn.functional as F import math import numpy as np import pdb import kornia import sys import sys sys.path.insert(0,'third_party') from nerf import (CfgNode, get_embedding_fun...
17,020
39.817746
148
py
viser
viser-main/dataloader/vid.py
# Copyright 2021 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # https://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writin...
7,391
44.073171
196
py
viser
viser-main/dataloader/vidbase.py
# Copyright 2021 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # https://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writin...
11,958
36.725552
103
py
d3rlpy
d3rlpy-master/setup.py
import os from setuptools import find_packages, setup # get __version__ variable here = os.path.abspath(os.path.dirname(__file__)) exec(open(os.path.join(here, "d3rlpy", "_version.py")).read()) if __name__ == "__main__": setup( name="d3rlpy", version=__version__, description="An offline d...
1,825
34.803922
74
py
d3rlpy
d3rlpy-master/tests/test_torch_utility.py
import copy from typing import Any, Dict, Sequence from unittest.mock import Mock import numpy as np import pytest import torch from d3rlpy.dataset import TrajectoryMiniBatch, Transition, TransitionMiniBatch from d3rlpy.torch_utility import ( Swish, TorchMiniBatch, TorchTrajectoryMiniBatch, View, ...
11,876
26.62093
79
py
d3rlpy
d3rlpy-master/tests/dummy_scalers.py
from typing import Any, Sequence import gym import numpy as np import torch from d3rlpy.dataset import ( EpisodeBase, TrajectorySlicerProtocol, TransitionPickerProtocol, ) from d3rlpy.preprocessing import ActionScaler, ObservationScaler, RewardScaler class DummyObservationScaler(ObservationScaler): ...
2,891
23.508475
78
py
d3rlpy
d3rlpy-master/tests/models/test_q_functions.py
from typing import Sequence import pytest from d3rlpy.models.encoders import VectorEncoderFactory from d3rlpy.models.q_functions import ( FQFQFunctionFactory, IQNQFunctionFactory, MeanQFunctionFactory, QRQFunctionFactory, ) from d3rlpy.models.torch import ( ContinuousFQFQFunction, ContinuousIQ...
4,021
31.699187
69
py
d3rlpy
d3rlpy-master/tests/models/test_builders.py
from typing import Sequence import numpy as np import pytest import torch from d3rlpy.models.builders import ( create_categorical_policy, create_conditional_vae, create_continuous_decision_transformer, create_continuous_q_function, create_deterministic_policy, create_deterministic_regressor, ...
15,292
31.959052
79
py
d3rlpy
d3rlpy-master/tests/models/test_encoders.py
# pylint: disable=protected-access from typing import Sequence import pytest from d3rlpy.models.encoders import ( DefaultEncoderFactory, DenseEncoderFactory, PixelEncoderFactory, VectorEncoderFactory, ) from d3rlpy.models.torch.encoders import ( PixelEncoder, PixelEncoderWithAction, Vector...
4,273
30.19708
71
py
d3rlpy
d3rlpy-master/tests/models/test_optimizers.py
import pytest import torch from torch.optim import SGD, Adam, AdamW, RMSprop from d3rlpy.models.optimizers import ( AdamFactory, AdamWFactory, RMSpropFactory, SGDFactory, ) @pytest.mark.parametrize("lr", [1e-4]) @pytest.mark.parametrize("module", [torch.nn.Linear(2, 3)]) def test_sgd_factory(lr: floa...
1,879
27.059701
69
py
d3rlpy
d3rlpy-master/tests/models/torch/test_v_functions.py
import pytest import torch import torch.nn.functional as F from d3rlpy.models.torch.v_functions import ValueFunction from .model_test import DummyEncoder, check_parameter_updates @pytest.mark.parametrize("feature_size", [100]) @pytest.mark.parametrize("batch_size", [32]) def test_value_function(feature_size: int, b...
855
24.176471
68
py
d3rlpy
d3rlpy-master/tests/models/torch/test_q_functions.py
from typing import Sequence import pytest import torch from d3rlpy.models.builders import create_continuous_q_function from d3rlpy.models.encoders import DefaultEncoderFactory, EncoderFactory from d3rlpy.models.q_functions import ( MeanQFunctionFactory, QFunctionFactory, QRQFunctionFactory, ) from d3rlpy....
1,715
30.777778
72
py
d3rlpy
d3rlpy-master/tests/models/torch/test_imitators.py
import pytest import torch import torch.nn.functional as F from d3rlpy.models.torch.imitators import ( ConditionalVAE, DeterministicRegressor, DiscreteImitator, ProbablisticRegressor, ) from .model_test import ( DummyEncoder, DummyEncoderWithAction, check_parameter_updates, ) @pytest.mar...
4,387
29.685315
75
py
d3rlpy
d3rlpy-master/tests/models/torch/test_distributions.py
import math import pytest import torch import torch.nn.functional as F from torch.distributions import Normal from d3rlpy.models.torch.distributions import ( GaussianDistribution, SquashedGaussianDistribution, ) @pytest.mark.parametrize("action_size", [2]) @pytest.mark.parametrize("batch_size", [32]) @pytes...
3,513
31.841121
74
py
d3rlpy
d3rlpy-master/tests/models/torch/test_parameters.py
from typing import Sequence import pytest import torch from d3rlpy.models.torch.parameters import Parameter @pytest.mark.parametrize("shape", [(100,)]) def test_parameter(shape: Sequence[int]) -> None: data = torch.rand(shape) parameter = Parameter(data) assert parameter().shape == shape assert tor...
348
20.8125
52
py
d3rlpy
d3rlpy-master/tests/models/torch/test_encoders.py
# pylint: disable=protected-access from typing import List, Optional, Sequence, Tuple import pytest import torch from d3rlpy.models.torch.encoders import ( PixelEncoder, PixelEncoderWithAction, VectorEncoder, VectorEncoderWithAction, ) from .model_test import check_parameter_updates @pytest.mark.pa...
6,747
30.680751
78
py
d3rlpy
d3rlpy-master/tests/models/torch/test_policies.py
import pytest import torch from d3rlpy.models.torch.distributions import ( GaussianDistribution, SquashedGaussianDistribution, ) from d3rlpy.models.torch.policies import ( CategoricalPolicy, DeterministicPolicy, DeterministicResidualPolicy, NonSquashedNormalPolicy, SquashedNormalPolicy, ) ...
6,449
30.009615
77
py