repo
stringlengths
2
99
file
stringlengths
13
225
code
stringlengths
0
18.3M
file_length
int64
0
18.3M
avg_line_length
float64
0
1.36M
max_line_length
int64
0
4.26M
extension_type
stringclasses
1 value
XFL
XFL-master/test/algorithm/framework/vertical/test_xgboost.py
# Copyright 2022 The XFL Authors. All rights reserved. # # 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 # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law...
33,748
48.053779
557
py
XFL
XFL-master/test/algorithm/framework/vertical/test_xgb.py
# Copyright 2022 The XFL Authors. All rights reserved. # # 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 # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law...
24,834
36.402108
117
py
XFL
XFL-master/test/algorithm/framework/vertical/test_xgb2.py
# Copyright 2022 The XFL Authors. All rights reserved. # # 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 # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law...
43,089
43.560496
118
py
XFL
XFL-master/test/algorithm/framework/local/test_local_data_statistic.py
# Copyright 2022 The XFL Authors. All rights reserved. # # 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 # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law...
5,100
34.671329
120
py
XFL
XFL-master/test/algorithm/framework/local/test_local_data_split.py
# Copyright 2022 The XFL Authors. All rights reserved. # # 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 # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law...
8,194
45.039326
109
py
XFL
XFL-master/test/algorithm/framework/local/test_local_standard_scaler.py
# Copyright 2022 The XFL Authors. All rights reserved. # # 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 # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable ...
3,677
32.436364
82
py
XFL
XFL-master/test/algorithm/framework/local/test_local_feature_preprocess.py
# Copyright 2022 The XFL Authors. All rights reserved. # # 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 # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable ...
7,597
43.432749
119
py
XFL
XFL-master/test/algorithm/framework/local/test_local_normalization.py
# Copyright 2022 The XFL Authors. All rights reserved. # # 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 # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable ...
6,376
36.075581
108
py
XFL
XFL-master/demo/horizontal/linear_regression/data_preprocess.py
import random import numpy as np import pandas as pd from sklearn.datasets import load_boston bostonDataset = load_boston() features = pd.DataFrame(bostonDataset['data']) features.columns = bostonDataset['feature_names'] label = pd.DataFrame(bostonDataset['target']) data = label.join(features) num = len(data) index ...
746
28.88
70
py
XFL
XFL-master/demo/horizontal/linear_regression/2party/config/__init__.py
0
0
0
py
XFL
XFL-master/demo/horizontal/linear_regression/3party/config/__init__.py
0
0
0
py
XFL
XFL-master/demo/horizontal/nbafl/2party/config/__init__.py
0
0
0
py
XFL
XFL-master/demo/horizontal/nbafl/3party/config/__init__.py
0
0
0
py
XFL
XFL-master/demo/horizontal/chatglm/chatglm-demo/tokenization_chatglm.py
"""Tokenization classes for ChatGLM.""" from typing import List, Optional, Union import os from transformers.tokenization_utils import PreTrainedTokenizer from transformers.utils import logging, PaddingStrategy from transformers.tokenization_utils_base import EncodedInput, BatchEncoding from typing import Dict import ...
17,047
37.396396
119
py
XFL
XFL-master/demo/horizontal/chatglm/chatglm-demo/configuration_chatglm.py
""" ChatGLM model configuration """ from transformers.configuration_utils import PretrainedConfig from transformers.utils import logging logger = logging.get_logger(__name__) class ChatGLMConfig(PretrainedConfig): r""" This is the configuration class to store the configuration of a [`~ChatGLMModel`]. It...
4,276
40.125
122
py
XFL
XFL-master/demo/horizontal/chatglm/chatglm-demo/quantization.py
from torch.nn import Linear from torch.nn.parameter import Parameter import bz2 import torch import base64 import ctypes from transformers.utils import logging from typing import List from functools import partial logger = logging.get_logger(__name__) try: from cpm_kernels.kernels.base import LazyKernelCModule,...
15,054
73.529703
7,375
py
XFL
XFL-master/demo/horizontal/chatglm/chatglm-demo/modeling_chatglm.py
""" PyTorch ChatGLM model. """ import math import copy import os import warnings import re import sys import torch import torch.utils.checkpoint import torch.nn.functional as F from torch import nn from torch.nn import CrossEntropyLoss, LayerNorm from torch.nn.utils import skip_init from typing import Optional, Tuple...
57,568
39.089833
121
py
XFL
XFL-master/demo/horizontal/logistic_regression/3party/config/__init__.py
0
0
0
py
XFL
XFL-master/docs/en/source/conf.py
# Copyright 2022 The XFL Authors. All rights reserved. # # 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 # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable ...
3,375
32.76
79
py
XFL
XFL-master/docs/zh_CN/source/conf.py
# Copyright 2022 The XFL Authors. All rights reserved. # # 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 # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable ...
3,378
32.79
79
py
benchmark
benchmark-main/setup.py
import contextlib import os import platform import shutil import sysconfig from pathlib import Path import setuptools from setuptools.command import build_ext PYTHON_INCLUDE_PATH_PLACEHOLDER = "<PYTHON_INCLUDE_PATH>" IS_WINDOWS = platform.system() == "Windows" IS_MAC = platform.system() == "Darwin" @contextlib.co...
3,777
32.140351
81
py
benchmark
benchmark-main/.ycm_extra_conf.py
import os import ycm_core # These are the compilation flags that will be used in case there's no # compilation database set (by default, one is not set). # CHANGE THIS LIST OF FLAGS. YES, THIS IS THE DROID YOU HAVE BEEN LOOKING FOR. flags = [ '-Wall', '-Werror', '-pedantic-errors', '-std=c++0x', '-fno-strict-aliasing'...
3,640
30.387931
79
py
benchmark
benchmark-main/tools/compare.py
#!/usr/bin/env python3 import unittest """ compare.py - versatile benchmark output compare tool """ import argparse from argparse import ArgumentParser import json import sys import os import gbench from gbench import util, report def check_inputs(in1, in2, flags): """ Perform checking on the user provided ...
18,479
41.678984
513
py
benchmark
benchmark-main/tools/strip_asm.py
#!/usr/bin/env python3 """ strip_asm.py - Cleanup ASM output for the specified file """ from argparse import ArgumentParser import sys import os import re def find_used_labels(asm): found = set() label_re = re.compile("\s*j[a-z]+\s+\.L([a-zA-Z0-9][a-zA-Z0-9_]*)") for l in asm.splitlines(): m = la...
4,419
28.078947
92
py
benchmark
benchmark-main/tools/gbench/report.py
"""report.py - Utilities for reporting statistics about benchmark results """ import unittest import os import re import copy import random from scipy.stats import mannwhitneyu, gmean from numpy import array class BenchmarkColor(object): def __init__(self, name, code): self.name = name self.code...
46,852
37.979201
140
py
benchmark
benchmark-main/tools/gbench/util.py
"""util.py - General utilities for running, loading, and processing benchmarks """ import json import os import re import subprocess import sys import tempfile # Input file type enumeration IT_Invalid = 0 IT_JSON = 1 IT_Executable = 2 _num_magic_bytes = 2 if sys.platform.startswith('win') else 4 def is_executable_...
6,858
32.622549
133
py
benchmark
benchmark-main/tools/gbench/__init__.py
"""Google Benchmark tooling""" __author__ = 'Eric Fiselier' __email__ = 'eric@efcs.ca' __versioninfo__ = (0, 5, 0) __version__ = '.'.join(str(v) for v in __versioninfo__) + 'dev' __all__ = []
194
20.666667
63
py
benchmark
benchmark-main/bindings/python/google_benchmark/example.py
# Copyright 2020 Google Inc. All rights reserved. # # 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 # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or a...
3,858
27.167883
88
py
benchmark
benchmark-main/bindings/python/google_benchmark/__init__.py
# Copyright 2020 Google Inc. All rights reserved. # # 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 # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or a...
4,463
26.386503
90
py
StructuralInspectionPlanner
StructuralInspectionPlanner-master/utils/ExportToPX4/SIP2PX4.py
# ___SIPtoPX4___ # StructuralInspectionPlanner Path Exporter to PX4 Mission # # This script reads the output *.csv file of an inspection path generated by # the StructuralInspectionPlanner Toolbox and exports a *.txt file that can # be loaded at QGroudControl or any other service to import it as a PX4/Pixhawk # aut...
5,131
29.188235
158
py
StructuralInspectionPlanner
StructuralInspectionPlanner-master/utils/ExportToPX4/KML2PX4.py
# __KML2PX4__ # KML (.kml) to PX4/Pixhawk Mission File Parsing and Export # # This script accepts a *.kml file as an input and exports the # corresponding PX4/Pixhawk autopilot mission to be loaded using # QGroundControl or other compative software # # More Info on PX4/Pixhawk and ...
6,553
38.245509
234
py
StructuralInspectionPlanner
StructuralInspectionPlanner-master/utils/ExportToRotorS/SIP2RotorS.py
# ___SIPtoRotorS___ # StructuralInspectionPlanner Path Exporter to RotorS missions # # This script reads the output *.csv file of an inspection path generated by # the StructuralInspectionPlanner Toolbox and exports a *.txt file that can # be loaded by the waypoint sampler of the RotorS simulator. Note that speed #...
3,188
34.043956
206
py
StructuralInspectionPlanner
StructuralInspectionPlanner-master/utils/Tools/LKH_Python_Interface/InvokeLKH.py
# __InvokeLKH__ # Interface the TSP LKH Solver # # This script is a simple python interface to a compiled # version of the LKH TSP Solver. It requires that the # solver is compiled at the given directories. # # # Example Syntax: # python InvokeLKH.py # # This script is part of the "utils" section of the Struc...
3,731
30.627119
111
py
StructuralInspectionPlanner
StructuralInspectionPlanner-master/utils/Tools/Airplane2p5D/Airplane2p5D.py
# __Airplane2p5D__ # 2.5D Airplane Point to Point Connections # A Python script for simplified Aircraft Kinematics # # Computes Point - to - Point Aircraft connections based on # 2D dubins curves for the XY-plane and constrained linear # interpolation for the altitude component. # # For the dubins curve s...
4,392
31.540741
129
py
StructuralInspectionPlanner
StructuralInspectionPlanner-master/utils/ExportToDJI/SIP2DJI.py
# ___SIPtoDJI___ # StructuralInspectionPlanner Path Exporter to DJI Missions # # This script reads the output *.csv file of an inspection path generated by # the StructuralInspectionPlanner Toolbox and exports a *.awm file that can # be loaded at the Groud Control Station of the DJI Drones. Note that all constraint...
6,266
32.15873
156
py
StructuralInspectionPlanner
StructuralInspectionPlanner-master/utils/PathToTrajectory/PATH2TRAJ.py
# __PATH2TRAJ__ # SIP Path to Trajectory based on simple second-order linear model # and an LQ controller with saturated control actions # # This script accepts an input file with the path and exports a # trajectory based on second-order closed-loop simulation of simplified # syste...
15,749
39.076336
164
py
StructuralInspectionPlanner
StructuralInspectionPlanner-master/optec/interfaces/python/setup.py
#!/usr/bin/env python ## ## This file is part of qpOASES. ## ## qpOASES -- An Implementation of the Online Active Set Strategy. ## Copyright (C) 2007-2014 by Hans Joachim Ferreau, Andreas Potschka, ## Christian Kirches et al. All rights reserved. ## ## qpOASES is free software; you can redistribute it and/or ## ...
2,182
31.58209
82
py
StructuralInspectionPlanner
StructuralInspectionPlanner-master/optec/interfaces/python/examples/example2.py
## ## This file is part of qpOASES. ## ## qpOASES -- An Implementation of the Online Active Set Strategy. ## Copyright (C) 2007-2014 by Hans Joachim Ferreau, Andreas Potschka, ## Christian Kirches et al. All rights reserved. ## ## qpOASES is free software; you can redistribute it and/or ## modify it under the terms of ...
2,876
30.615385
81
py
StructuralInspectionPlanner
StructuralInspectionPlanner-master/optec/interfaces/python/examples/example1.py
## ## This file is part of qpOASES. ## ## qpOASES -- An Implementation of the Online Active Set Strategy. ## Copyright (C) 2007-2014 by Hans Joachim Ferreau, Andreas Potschka, ## Christian Kirches et al. All rights reserved. ## ## qpOASES is free software; you can redistribute it and/or ## modify it under the terms of ...
2,227
27.935065
84
py
StructuralInspectionPlanner
StructuralInspectionPlanner-master/optec/interfaces/python/examples/example1b.py
## ## This file is part of qpOASES. ## ## qpOASES -- An Implementation of the Online Active Set Strategy. ## Copyright (C) 2007-2014 by Hans Joachim Ferreau, Andreas Potschka, ## Christian Kirches et al. All rights reserved. ## ## qpOASES is free software; you can redistribute it and/or ## modify it under the terms of ...
2,282
30.273973
81
py
StructuralInspectionPlanner
StructuralInspectionPlanner-master/optec/interfaces/python/examples/cython/setup.py
from distutils.core import setup from distutils.extension import Extension from Cython.Distutils import build_ext ext_module = Extension( "example1", ["example1.pyx"], extra_compile_args=['-fopenmp'], extra_link_args=['-fopenmp'], ) setup( name = 'Hello world app', cmdclass = {'build_ext': bui...
363
20.411765
41
py
StructuralInspectionPlanner
StructuralInspectionPlanner-master/optec/interfaces/python/tests/test_idhessian.py
""" This file is part of qpOASES. qpOASES -- An Implementation of the Online Active Set Strategy. Copyright (C) 2007-2009 by Hans Joachim Ferreau et al. All rights reserved. qpOASES is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the ...
3,128
31.936842
79
py
StructuralInspectionPlanner
StructuralInspectionPlanner-master/optec/interfaces/python/tests/test_examples.py
""" This file is part of qpOASES. qpOASES -- An Implementation of the Online Active Set Strategy. Copyright (C) 2007-2009 by Hans Joachim Ferreau et al. All rights reserved. qpOASES is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the ...
12,207
36.106383
166
py
StructuralInspectionPlanner
StructuralInspectionPlanner-master/optec/interfaces/python/tests/test_testbench.py
""" This file is part of qpOASES. qpOASES -- An Implementation of the Online Active Set Strategy. Copyright (C) 2007-2009 by Hans Joachim Ferreau et al. All rights reserved. qpOASES is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the ...
9,796
28.42042
132
py
StructuralInspectionPlanner
StructuralInspectionPlanner-master/optec/interfaces/python/tests/__init__.py
1
0
0
py
ultrasound-nerve-segmentation
ultrasound-nerve-segmentation-master/data.py
from __future__ import print_function import os import numpy as np from skimage.io import imsave, imread data_path = 'raw/' image_rows = 420 image_cols = 580 def create_train_data(): train_data_path = os.path.join(data_path, 'train') images = os.listdir(train_data_path) total = len(images) / 2 im...
2,446
25.031915
87
py
ultrasound-nerve-segmentation
ultrasound-nerve-segmentation-master/submission.py
from __future__ import print_function import numpy as np from skimage.transform import resize from data import image_cols, image_rows def prep(img): img = img.astype('float32') img = (img > 0.5).astype(np.uint8) # threshold img = resize(img, (image_cols, image_rows), preserve_range=True) return img ...
1,643
24.292308
68
py
ultrasound-nerve-segmentation
ultrasound-nerve-segmentation-master/train.py
from __future__ import print_function import os from skimage.transform import resize from skimage.io import imsave import numpy as np from keras.models import Model from keras.layers import Input, concatenate, Conv2D, MaxPooling2D, Conv2DTranspose from keras.optimizers import Adam from keras.callbacks import ModelChec...
5,352
33.75974
107
py
deep-video-mvs
deep-video-mvs-master/setup.py
from setuptools import setup setup( name='deep-video-mvs', version='1.0', description='Deep Video Multi-View Stereo', author='Arda Düzceker', packages=['dvmvs'] )
184
17.5
47
py
deep-video-mvs
deep-video-mvs-master/dataset/utils.py
import re import numpy as np def write_point_cloud(ply_filename, points): formatted_points = [] for point in points: formatted_points.append("%f %f %f %d %d %d 0\n" % (point[0], point[1], point[2], point[3], point[4], point[5])) out_file = open(ply_filename, "w") out_file.write('''ply fo...
2,575
22.633028
119
py
deep-video-mvs
deep-video-mvs-master/dataset/build_point_cloud.py
import os import sys import numpy as np import cv2 from path import Path from tqdm import tqdm sys.path.append('.') from utils import depth_image_to_point_cloud, write_point_cloud def build_point_cloud(dataset_folder, scene_name, is_test=True): scene_folder = Path(dataset_folder) / scene_name poses = np.fr...
1,662
32.938776
101
py
deep-video-mvs
deep-video-mvs-master/dataset/rgbdscenes-export/rgbdscenes-export.py
import os import shutil from functools import partial from multiprocessing.pool import Pool import cv2 import numpy as np from path import Path from scipy.spatial.transform.rotation import Rotation def process_scene(scene_no, input_directory, output_folder): image_filenames = sorted((input_directory / 'imgs' / "...
2,918
35.037037
136
py
deep-video-mvs
deep-video-mvs-master/dataset/tum-rgbd-export/tum-rgbd-export.py
import os import shutil from functools import partial from multiprocessing.pool import Pool import cv2 import numpy as np from path import Path from scipy.spatial.transform import Rotation def get_closest_index(target_timestamp, other_timestamps): differences = np.abs(other_timestamps - target_timestamp) ret...
4,003
38.643564
127
py
deep-video-mvs
deep-video-mvs-master/dataset/augmented-iclnuim-export/iclnuim-export.py
import os import shutil from functools import partial from multiprocessing.pool import Pool import cv2 import numpy as np from path import Path def process_scene(input_directory, output_folder): # For K, https://github.com/intel-isl/Open3D/issues/540 K = np.array([[525.0, 0.0, 320.0], [0.0,...
2,725
30.697674
127
py
deep-video-mvs
deep-video-mvs-master/dataset/7scenes-export/7scenes-export-depth.py
import shutil import cv2 import numpy as np from path import Path scenes = [("7scenes_chess", "01", "02"), ("7scenes_fire", "01", "02"), ("7scenes_heads", "02"), ("7scenes_office", "01", "03"), ("7scenes_pumpkin", "03", "06"), ("7scenes_redkitchen", "01", "07"), ...
1,434
33.166667
84
py
deep-video-mvs
deep-video-mvs-master/dataset/7scenes-export/7scenes-export-color.py
import os import shutil from multiprocessing.pool import Pool import cv2 import numpy as np from functools import partial from path import Path def process_scene(input_directory, output_folder): K = np.array([[525.0, 0.0, 320.0], [0.0, 525.0, 240.0], [0.0, 0.0, 1.0]]) prin...
2,596
31.4625
136
py
deep-video-mvs
deep-video-mvs-master/dataset/scannet-export/scannet-export.py
import os import random import numpy as np from multiprocessing import Pool import copy import os import struct import zlib from itertools import groupby import cv2 import imageio import numpy as np import torch COMPRESSION_TYPE_COLOR = {-1: 'unknown', 0: 'raw', 1: 'png', 2: 'jpeg'} COMPRESSION_TYPE_DEPTH = {-1: 'unkn...
12,059
40.586207
124
py
deep-video-mvs
deep-video-mvs-master/dvmvs/keyframe_buffer.py
from collections import deque import numpy as np from dvmvs.utils import is_pose_available, pose_distance class KeyframeBuffer: def __init__(self, buffer_size, keyframe_pose_distance, optimal_t_score, optimal_R_score, store_return_indices): self.buffer = deque([], maxlen=buffer_size) self.keyfra...
6,058
45.607692
146
py
deep-video-mvs
deep-video-mvs-master/dvmvs/losses.py
from __future__ import division import torch from torch import nn class LossMeter(object): def __init__(self): self.count = 0.0 self.sum = 0.0 self.avg = 0.0 self.item_average = 0.0 def update(self, loss, count): self.sum += loss self.count += count s...
3,529
41.53012
146
py
deep-video-mvs
deep-video-mvs-master/dvmvs/errors.py
import numpy as np def compute_errors(gt, pred, max_depth=np.inf): valid1 = gt >= 0.5 valid2 = gt <= max_depth valid = valid1 & valid2 gt = gt[valid] pred = pred[valid] n_valid = np.float32(len(gt)) if n_valid == 0: return np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np...
1,369
34.128205
126
py
deep-video-mvs
deep-video-mvs-master/dvmvs/simulate_keyframe_buffer.py
import numpy as np from path import Path from dvmvs.keyframe_buffer import KeyframeBuffer, SimpleBuffer def simulate_keyframe_buffer(test_dataset_path, output_folder, n_measurement_frames): test_dataset_path = Path(test_dataset_path) scene_folders = sorted(test_dataset_path.listdir()) test_keyframe_buff...
5,005
42.155172
139
py
deep-video-mvs
deep-video-mvs-master/dvmvs/utils.py
from __future__ import division import os import zipfile import cv2 import kornia import numpy as np import torch from path import Path from pytorch3d import structures, renderer from dvmvs.errors import compute_errors # GEOMETRIC UTILS def pose_distance(reference_pose, measurement_pose): """ :param refere...
19,349
47.014888
156
py
deep-video-mvs
deep-video-mvs-master/dvmvs/layers.py
import torch def down_conv_layer(input_channels, output_channels, kernel_size): return torch.nn.Sequential( torch.nn.Conv2d( input_channels, output_channels, kernel_size, padding=(kernel_size - 1) // 2, stride=1, bias=False), ...
1,984
29.075758
84
py
deep-video-mvs
deep-video-mvs-master/dvmvs/config.py
import time class Config: # training settings train_image_width = 256 train_image_height = 256 train_min_depth = 0.25 train_max_depth = 20.0 train_n_depth_levels = 64 train_minimum_pose_distance = 0.125 train_maximum_pose_distance = 0.325 train_crawl_step = 3 train_subsequence_...
1,830
34.211538
106
py
deep-video-mvs
deep-video-mvs-master/dvmvs/dataset_loader.py
import copy import random from functools import partial from multiprocessing import Manager from multiprocessing.pool import Pool import cv2 import numpy as np import torch from kornia import adjust_brightness, adjust_gamma, adjust_contrast from path import Path from torch.utils.data import Dataset, DataLoader from d...
21,202
38.192237
128
py
deep-video-mvs
deep-video-mvs-master/dvmvs/convlstm.py
import torch import torch.nn as nn from dvmvs.utils import warp_frame_depth class MVSLayernormConvLSTMCell(nn.Module): def __init__(self, input_dim, hidden_dim, kernel_size, activation_function=None): super(MVSLayernormConvLSTMCell, self).__init__() self.activation_function = activation_functio...
2,554
38.307692
116
py
deep-video-mvs
deep-video-mvs-master/dvmvs/__init__.py
0
0
0
py
deep-video-mvs
deep-video-mvs-master/dvmvs/train.py
import torch import torchvision from tqdm import tqdm from dvmvs.config import Config from dvmvs.losses import LossMeter from dvmvs.utils import save_checkpoint, save_optimizer, freeze_batchnorm def switch_mode(model, mode): if mode == 'train': for module in model: module.train() ...
8,579
56.583893
153
py
deep-video-mvs
deep-video-mvs-master/dvmvs/baselines/mvdepthnet/encoder.py
import torch import torch.nn as nn import torch.nn.functional as F from torch.autograd import Variable from dvmvs.utils import freeze_batchnorm def down_conv_layer(input_channels, output_channels, kernel_size): return nn.Sequential( nn.Conv2d( input_channels, output_channels, ...
3,979
28.051095
77
py
deep-video-mvs
deep-video-mvs-master/dvmvs/baselines/mvdepthnet/run-testing.py
import cv2 import numpy as np import torch from path import Path from tqdm import tqdm from dvmvs.baselines.mvdepthnet.decoder import Decoder from dvmvs.baselines.mvdepthnet.encoder import Encoder from dvmvs.config import Config from dvmvs.dataset_loader import PreprocessImage, load_image from dvmvs.utils import cost_...
9,324
48.078947
138
py
deep-video-mvs
deep-video-mvs-master/dvmvs/baselines/mvdepthnet/decoder.py
import torch import torch.nn as nn import torch.nn.functional as F from dvmvs.utils import freeze_batchnorm def down_conv_layer(input_channels, output_channels, kernel_size): return nn.Sequential( nn.Conv2d( input_channels, output_channels, kernel_size, padd...
3,920
28.044444
80
py
deep-video-mvs
deep-video-mvs-master/dvmvs/baselines/deltas/base_model.py
import collections from abc import ABCMeta, abstractmethod from torch import nn def dict_update(d, u): """Improved update for nested dictionaries. Arguments: d: The dictionary to be updated. u: The update dictionary. Returns: The updated dictionary. """ d = d.copy() ...
1,752
24.042857
75
py
deep-video-mvs
deep-video-mvs-master/dvmvs/baselines/deltas/utils.py
import torch def reorder_desc(desc, batch_sz): """Reorders Descriptors""" b, c, h, w = desc.shape desc = desc.view(-1, batch_sz, c, h, w) desc = desc.transpose(1, 0) return desc def pose_square(pose): """Converts pose matrix of size 3x4 to a square matrix of size 4x4""" pose_sh = pose....
1,006
24.175
73
py
deep-video-mvs
deep-video-mvs-master/dvmvs/baselines/deltas/superpoint.py
import torch import torchvision from .base_model import BaseModel def simple_nms(scores, radius): """Performs non maximum suppression on the heatmap using max-pooling. This method does not suppress contiguous points that have the same score. Arguments: scores: the score heatmap, with shape `[B, H...
9,883
38.536
153
py
deep-video-mvs
deep-video-mvs-master/dvmvs/baselines/deltas/densedepth.py
import math import torch import torch.nn as nn import torch.nn.functional as F from .base_model import BaseModel from .resnet_s2d import resnet50 def conv3x3(in_planes, out_planes, stride=1): """3x3 convolution with padding""" return nn.Conv2d(in_planes, out_planes, kernel_size=3, stride=stride, ...
13,604
37.109244
160
py
deep-video-mvs
deep-video-mvs-master/dvmvs/baselines/deltas/run-testing.py
import argparse import cv2 import numpy as np import torch.backends.cudnn as cudnn import torch.utils.data from path import Path from tqdm import tqdm from dvmvs.baselines.deltas import superpoint, triangulation, densedepth from dvmvs.baselines.deltas.utils import * from dvmvs.config import Config from dvmvs.dataset_...
15,377
46.462963
170
py
deep-video-mvs
deep-video-mvs-master/dvmvs/baselines/deltas/resnet_s2d.py
import torch.nn as nn __all__ = ['ResNet', 'resnet18', 'resnet34', 'resnet50', 'resnet101', 'resnet152'] def conv3x3(in_planes, out_planes, stride=1, groups=1, dilation=1): """3x3 convolution with padding""" return nn.Conv2d(in_planes, out_planes, kernel_size=3, stride=stride, padding=di...
9,946
36.394737
106
py
deep-video-mvs
deep-video-mvs-master/dvmvs/baselines/deltas/triangulation.py
import numpy as np import torch from torch import svd from .base_model import BaseModel def homogeneous_to_euclidean(points): """Converts homogeneous points to euclidean Args: points numpy array or torch tensor of shape (N, M + 1): N homogeneous points of dimension M Returns: numpy arra...
22,576
37.527304
157
py
deep-video-mvs
deep-video-mvs-master/dvmvs/baselines/gpmvs/encoder.py
import torch import torch.nn as nn from dvmvs.utils import freeze_batchnorm def down_conv_layer(input_channels, output_channels, kernel_size): return nn.Sequential( nn.Conv2d( input_channels, output_channels, kernel_size, padding=(kernel_size - 1) // 2, ...
2,588
26.542553
66
py
deep-video-mvs
deep-video-mvs-master/dvmvs/baselines/gpmvs/run-testing.py
from copy import deepcopy import cv2 import numpy as np import torch from path import Path from scipy.linalg import expm from tqdm import tqdm from dvmvs.baselines.gpmvs.decoder import Decoder from dvmvs.baselines.gpmvs.encoder import Encoder from dvmvs.baselines.gpmvs.gplayer import GPlayer from dvmvs.config import ...
10,783
45.283262
153
py
deep-video-mvs
deep-video-mvs-master/dvmvs/baselines/gpmvs/decoder.py
import torch import torch.nn as nn import torch.nn.functional as F from dvmvs.utils import freeze_batchnorm def down_conv_layer(input_channels, output_channels, kernel_size): return nn.Sequential( nn.Conv2d( input_channels, output_channels, kernel_size, padd...
3,920
28.044444
80
py
deep-video-mvs
deep-video-mvs-master/dvmvs/baselines/gpmvs/gplayer.py
import math import torch from dvmvs.utils import freeze_batchnorm class GPlayer(torch.nn.Module): def __init__(self, device): super(GPlayer, self).__init__() self.gamma2 = torch.nn.Parameter(torch.randn(1).to(device).float(), requires_grad=True) self.ell = torch.nn.Parameter(torch.randn(...
1,637
37.093023
134
py
deep-video-mvs
deep-video-mvs-master/dvmvs/baselines/dpsnet/run-testing.py
import cv2 import numpy as np import torch from path import Path from tqdm import tqdm from dvmvs.baselines.dpsnet.dpsnet import PSNet from dvmvs.config import Config from dvmvs.dataset_loader import PreprocessImage, load_image from dvmvs.utils import save_results, InferenceTimer, visualize_predictions def predict()...
7,607
46.849057
138
py
deep-video-mvs
deep-video-mvs-master/dvmvs/baselines/dpsnet/dpsnet.py
from __future__ import print_function import math import numpy as np import torch import torch.nn as nn import torch.nn.functional as F import torch.utils.data import torch.utils.data from torch.autograd import Variable from dvmvs.utils import freeze_batchnorm pixel_coords = None def set_id_grid(depth): globa...
16,381
40.684478
157
py
deep-video-mvs
deep-video-mvs-master/dvmvs/pairnet/run-training.py
import datetime import itertools import os import numpy as np from path import Path from tensorboardX import SummaryWriter from torch.backends import cudnn from torch.utils.data import DataLoader from dvmvs.dataset_loader import MVSDataset from dvmvs.losses import LossMeter, update_losses from dvmvs.pairnet.model imp...
12,924
45.160714
132
py
deep-video-mvs
deep-video-mvs-master/dvmvs/pairnet/model.py
from collections import OrderedDict import torch from torchvision import models from torchvision.ops import FeaturePyramidNetwork from dvmvs.config import Config from dvmvs.layers import conv_layer, depth_layer_3x3 fpn_output_channels = 32 hyper_channels = 32 class StandardLayer(torch.nn.Module): def __init__(...
14,393
46.193443
127
py
deep-video-mvs
deep-video-mvs-master/dvmvs/pairnet/run-testing.py
import cv2 import numpy as np import torch from path import Path from tqdm import tqdm from dvmvs.config import Config from dvmvs.dataset_loader import PreprocessImage, load_image from dvmvs.pairnet.model import FeatureExtractor, FeatureShrinker, CostVolumeEncoder, CostVolumeDecoder from dvmvs.utils import cost_volume...
10,187
50.715736
138
py
deep-video-mvs
deep-video-mvs-master/dvmvs/pairnet/run-testing-online.py
import cv2 import numpy as np import torch from path import Path from tqdm import tqdm from dvmvs.config import Config from dvmvs.dataset_loader import PreprocessImage, load_image from dvmvs.keyframe_buffer import KeyframeBuffer from dvmvs.pairnet.model import FeatureExtractor, FeatureShrinker, CostVolumeEncoder, Cost...
9,280
48.897849
138
py
deep-video-mvs
deep-video-mvs-master/dvmvs/fusionnet/run-training.py
import datetime import itertools import os import numpy as np from path import Path from tensorboardX import SummaryWriter from torch.backends import cudnn from torch.utils.data import DataLoader from dvmvs.dataset_loader import MVSDataset from dvmvs.fusionnet.model import * from dvmvs.losses import LossMeter, update...
13,088
44.290657
144
py
deep-video-mvs
deep-video-mvs-master/dvmvs/fusionnet/model.py
from collections import OrderedDict import torch from torchvision import models from torchvision.ops import FeaturePyramidNetwork from dvmvs.config import Config from dvmvs.convlstm import MVSLayernormConvLSTMCell from dvmvs.layers import conv_layer, depth_layer_3x3 fpn_output_channels = 32 hyper_channels = 32 cla...
15,992
46.316568
127
py
deep-video-mvs
deep-video-mvs-master/dvmvs/fusionnet/run-testing.py
import cv2 import numpy as np import torch from dvmvs.config import Config from dvmvs.dataset_loader import PreprocessImage, load_image from dvmvs.fusionnet.model import FeatureExtractor, FeatureShrinker, CostVolumeEncoder, LSTMFusion, CostVolumeDecoder from dvmvs.utils import cost_volume_fusion, save_results, visualiz...
12,702
53.055319
149
py
deep-video-mvs
deep-video-mvs-master/dvmvs/fusionnet/run-testing-online.py
import cv2 import numpy as np import torch from path import Path from tqdm import tqdm from dvmvs.config import Config from dvmvs.dataset_loader import PreprocessImage, load_image from dvmvs.fusionnet.model import FeatureExtractor, FeatureShrinker, CostVolumeEncoder, LSTMFusion, CostVolumeDecoder from dvmvs.keyframe_b...
12,118
50.351695
149
py
deep-video-mvs
deep-video-mvs-master/sample-data/run-tsdf-reconstruction.py
################################################################################################ ### This implementation is taken and adapted from https://github.com/andyzeng/tsdf-fusion-python ### Copyright (c) 2018 Andy Zeng #############################################################################################...
32,077
47.383107
150
py
uncertainty-project
uncertainty-project-master/Code/core/losses.py
''' losses.py Includes the losses / error functions for different models and tasks ''' import sys from data import predict_label import numpy as np from scipy.integrate import nquad from scipy.stats import multivariate_normal # === LOSSES FOR AMP WITH THE ORDER PARAMETERS def mse(x : np.ndarray, xhat : np.ndarr...
2,392
30.486842
131
py
uncertainty-project
uncertainty-project-master/Code/core/utility.py
# utility.py # various useful functions from typing import List import numpy as np import scipy.optimize as opt4 from scipy.optimize import minimize_scalar, root_scalar from scipy.special import erf, erfc from datetime import datetime # FUNCTION OF THE LOGIT MODEL sigmoid = np.vectorize(lambda x : 1. / (1. + np.exp(...
3,849
33.375
112
py
uncertainty-project
uncertainty-project-master/Code/core/data.py
''' data.py File containing the functions to generate the data So far, only data w/ gaussian covariance matrix NOTE : For now, all ''' from typing import Tuple import numpy as np import sys from numpy.core.fromnumeric import size sys.path.append('..') sys.path.append('core') import core.utility as utility def iid_...
3,045
31.752688
99
py
uncertainty-project
uncertainty-project-master/Code/core/erm.py
''' erm.py Compute exact ERM on logistic or ridge regression w/ sklearn ''' from typing import List, Dict import pandas as pd from sklearn.linear_model import LogisticRegression, Ridge from data import * import losses def get_errors(w0 : List[float], X : List[List[float]], y : List[float], w : List[float], task :...
2,178
34.145161
158
py
uncertainty-project
uncertainty-project-master/Code/core/calibration.py
# calibration.py # Functions to compute (empirically and theoretically) the calibration import numpy as np from scipy.integrate import nquad, quad import scipy.linalg from scipy.special import erfc, erfcinv import scipy.stats as stats from core import * import data from overlaps import * import utility def compute_b...
4,936
36.976923
131
py
uncertainty-project
uncertainty-project-master/Code/core/gamp.py
# gamp.py # File containing the code for GAMP with sign perceptron and gaussian prior from typing import List import numpy as np from scipy.special import erfc from scipy.integrate import nquad import matplotlib.pyplot as plt import pandas as pd import data from models.bayes_optimal import BayesOptimal from models.a...
3,045
26.196429
150
py
uncertainty-project
uncertainty-project-master/Code/core/__init__.py
# __all__ = ['bo_state_evolution', 'calibration' 'data', 'erm', 'gamp', 'gcm_erm', 'losses', 'overlaps', 'utility']
116
57.5
115
py