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 |
|---|---|---|---|---|---|---|
rcnn | rcnn-master/code/rationale/ubuntu/options.py |
import sys
import argparse
def load_arguments():
argparser = argparse.ArgumentParser(sys.argv[0])
argparser.add_argument("--corpus",
type = str
)
argparser.add_argument("--train",
type = str,
default = ""
)
argparser.add_argument("--test",
... | 3,398 | 23.630435 | 52 | py |
rcnn | rcnn-master/code/rationale/ubuntu/evaluation.py |
# helper class used for computing information retrieval metrics, including MAP / MRR / and Precision @ x
class Evaluation():
def __init__(self,data):
self.data = data
def Precision(self,precision_at):
scores = []
for item in self.data:
temp = item[:precision_at]
if any(val==1 for val in item):
... | 1,047 | 19.96 | 104 | py |
rcnn | rcnn-master/code/rationale/medical/read_dump.py |
import sys
import os
import json
with open(sys.argv[1]) as fin:
for line in fin:
if not line.strip(): continue
x = json.loads(line)
r, t = x["rationale"], x["text"]
trimed = t.lstrip('_ ')
removed = len(t)-len(trimed)
r, t = r[removed:].split(), t[removed:].split()
... | 669 | 25.8 | 56 | py |
rcnn | rcnn-master/code/rationale/medical/rationale.py |
import os, sys, gzip
import time
import math
import json
import numpy as np
import theano
import theano.tensor as T
from theano.sandbox.rng_mrg import MRG_RandomStreams
from theano.compile.nanguardmode import NanGuardMode
from nn import create_optimization_updates, get_activation_by_name, sigmoid, linear, tanh
from ... | 22,004 | 34.606796 | 98 | py |
rcnn | rcnn-master/code/rationale/medical/myio.py |
import gzip
import random
import json
import theano
import numpy as np
from nn import EmbeddingLayer
from utils import say, load_embedding_iterator
def read_rationales(path):
data = [ ]
fopen = gzip.open if path.endswith(".gz") else open
with fopen(path) as fin:
for line in fin:
item... | 2,483 | 28.571429 | 81 | py |
rcnn | rcnn-master/code/rationale/medical/options.py |
import sys
import argparse
def load_arguments():
argparser = argparse.ArgumentParser(sys.argv[0])
argparser.add_argument("--embedding",
type = str,
default = "",
help = "path to pre-trained word vectors"
)
argparser.add_argument("--save_model",
type ... | 3,921 | 27.215827 | 66 | py |
rcnn | rcnn-master/code/pt/main.py | import sys
import time
import argparse
import gzip
import cPickle as pickle
from prettytable import PrettyTable
import numpy as np
import theano
import theano.tensor as T
from utils import load_embedding_iterator
from nn import get_activation_by_name, create_optimization_updates
from nn import Layer, EmbeddingLayer, ... | 17,855 | 32.438202 | 98 | py |
rcnn | rcnn-master/code/pt/myio.py | import sys
import gzip
import random
from collections import Counter
from sklearn.feature_extraction.text import TfidfVectorizer
import numpy as np
import theano
from nn import EmbeddingLayer
def say(s, stream=sys.stdout):
stream.write(s)
stream.flush()
def read_corpus(path):
empty_cnt = 0
raw_corpu... | 5,724 | 32.284884 | 92 | py |
rcnn | rcnn-master/code/pt/evaluation.py |
# helper class used for computing information retrieval metrics, including MAP / MRR / and Precision @ x
class Evaluation():
def __init__(self,data):
self.data = data
def Precision(self,precision_at):
scores = []
for item in self.data:
temp = item[:precision_at]
if any(val==1 for val in item):
... | 1,047 | 19.96 | 104 | py |
rcnn | rcnn-master/code/sentiment/main.py | import os, sys, random, argparse, time, math, gzip
import cPickle as pickle
from collections import Counter
import numpy as np
import theano
import theano.tensor as T
from nn import get_activation_by_name, create_optimization_updates, softmax
from nn import Layer, EmbeddingLayer, LSTM, RCNN, StrCNN, Dropout, apply_dr... | 17,121 | 31.184211 | 109 | py |
rcnn | rcnn-master/code/mnist/feedforward_net.py | import os
import sys
import gzip
import time
import math
import argparse
import cPickle as pickle
import numpy as np
import theano
import theano.tensor as T
from nn import Layer, softmax, ReLU, create_optimization_updates, apply_dropout
from utils import say
'''
Load MNIST dataset. Code taken from Theano Deep Le... | 11,114 | 30.848138 | 92 | py |
rcnn | rcnn-master/code/mnist/logistic_regression.py | import os
import sys
import gzip
import time
import argparse
import math
import cPickle as pickle
import numpy as np
import theano
import theano.tensor as T
from nn import Layer, softmax, create_optimization_updates
from utils import say
'''
Load MNIST dataset. Code taken from Theano Deep Learning Tutorial:
... | 8,999 | 30.80212 | 92 | py |
rcnn | rcnn-master/code/language_model/lstm_bptt.py |
import sys
import os
import argparse
import time
import random
import math
import numpy as np
import theano
import theano.tensor as T
import nn
from nn import Dropout, EmbeddingLayer, RecurrentLayer, Layer, LSTM, apply_dropout
from nn import get_activation_by_name, create_optimization_updates
from nn.evaluation impo... | 11,799 | 32.427762 | 93 | py |
rcnn | rcnn-master/code/utils/__init__.py |
import sys
import gzip
import numpy as np
def say(s, stream=sys.stdout):
stream.write("{}".format(s))
stream.flush()
def load_embedding_iterator(path):
file_open = gzip.open if path.endswith(".gz") else open
with file_open(path) as fin:
for line in fin:
line = line.strip()
... | 503 | 21.909091 | 64 | py |
rcnn | rcnn-master/code/qa/main.py | import sys
import time
import argparse
import gzip
import cPickle as pickle
from prettytable import PrettyTable
import numpy as np
import theano
import theano.tensor as T
from utils import load_embedding_iterator
from nn import get_activation_by_name, create_optimization_updates
from nn import EmbeddingLayer, LSTM, G... | 16,650 | 31.26938 | 98 | py |
rcnn | rcnn-master/code/qa/api.py |
import json
import theano
import myio
from myio import say
from main import Model
from utils import load_embedding_iterator
class QRAPI:
def __init__(self, model_path, corpus_path, emb_path):
raw_corpus = myio.read_corpus(corpus_path)
embedding_layer = myio.create_embedding_layer(
... | 2,545 | 29.674699 | 73 | py |
rcnn | rcnn-master/code/qa/myio.py | import sys
import gzip
import random
from collections import Counter
from sklearn.feature_extraction.text import TfidfVectorizer
import numpy as np
import theano
from nn import EmbeddingLayer
def say(s, stream=sys.stdout):
stream.write(s)
stream.flush()
def read_corpus(path):
empty_cnt = 0
raw_corpu... | 6,455 | 33.897297 | 92 | py |
rcnn | rcnn-master/code/qa/evaluation.py |
# helper class used for computing information retrieval metrics, including MAP / MRR / and Precision @ x
class Evaluation():
def __init__(self,data):
self.data = data
def Precision(self,precision_at):
scores = []
for item in self.data:
temp = item[:precision_at]
if any(val==1 for val in item):
... | 1,047 | 19.96 | 104 | py |
pix2pix3D | pix2pix3D-main/legacy.py | # SPDX-FileCopyrightText: Copyright (c) 2021-2022 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
# SPDX-License-Identifier: LicenseRef-NvidiaProprietary
#
# NVIDIA CORPORATION, its affiliates and licensors retain all intellectual
# property and proprietary rights in and to this material, related
# documentation ... | 16,675 | 50.153374 | 154 | py |
pix2pix3D | pix2pix3D-main/camera_utils.py | # SPDX-FileCopyrightText: Copyright (c) 2021-2022 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
# SPDX-License-Identifier: LicenseRef-NvidiaProprietary
#
# NVIDIA CORPORATION, its affiliates and licensors retain all intellectual
# property and proprietary rights in and to this material, related
# documentation ... | 6,814 | 44.738255 | 142 | py |
pix2pix3D | pix2pix3D-main/train.py | # SPDX-FileCopyrightText: Copyright (c) 2021-2022 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
# SPDX-License-Identifier: LicenseRef-NvidiaProprietary
#
# NVIDIA CORPORATION, its affiliates and licensors retain all intellectual
# property and proprietary rights in and to this material, related
# documentation ... | 31,932 | 57.808471 | 223 | py |
pix2pix3D | pix2pix3D-main/training/dual_discriminator.py | # SPDX-FileCopyrightText: Copyright (c) 2021-2022 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
# SPDX-License-Identifier: LicenseRef-NvidiaProprietary
#
# NVIDIA CORPORATION, its affiliates and licensors retain all intellectual
# property and proprietary rights in and to this material, related
# documentation ... | 13,110 | 51.23506 | 149 | py |
pix2pix3D | pix2pix3D-main/training/loss_utils.py | import torch
import torch.nn.functional as F
def cross_entropy2d(input, target, weight=None, size_average=True):
n, c, h, w = input.size()
nt, ht, wt = target.size()
if (h != ht) or (w != wt):
# upsample labels
input = F.interpolate(input, size=(ht, wt), mode='bilinear', align_corners=True... | 519 | 29.588235 | 88 | py |
pix2pix3D | pix2pix3D-main/training/superresolution.py | # SPDX-FileCopyrightText: Copyright (c) 2021-2022 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
# SPDX-License-Identifier: LicenseRef-NvidiaProprietary
#
# NVIDIA CORPORATION, its affiliates and licensors retain all intellectual
# property and proprietary rights in and to this material, related
# documentation ... | 18,911 | 52.123596 | 140 | py |
pix2pix3D | pix2pix3D-main/training/loss.py | # SPDX-FileCopyrightText: Copyright (c) 2021-2022 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
# SPDX-License-Identifier: LicenseRef-NvidiaProprietary
#
# NVIDIA CORPORATION, its affiliates and licensors retain all intellectual
# property and proprietary rights in and to this material, related
# documentation ... | 58,286 | 55.865366 | 472 | py |
pix2pix3D | pix2pix3D-main/training/augment.py | # SPDX-FileCopyrightText: Copyright (c) 2021-2022 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
# SPDX-License-Identifier: LicenseRef-NvidiaProprietary
#
# NVIDIA CORPORATION, its affiliates and licensors retain all intellectual
# property and proprietary rights in and to this material, related
# documentation ... | 26,919 | 59.904977 | 366 | py |
pix2pix3D | pix2pix3D-main/training/utils.py | import numpy as np
color_list = [[255, 255, 255], [204, 0, 0], [76, 153, 0], [204, 204, 0], [51, 51, 255], [204, 0, 204], [0, 255, 255], [255, 204, 204], [102, 51, 0], [255, 0, 0], [102, 204, 0], [255, 255, 0], [0, 0, 153], [0, 0, 204], [255, 51, 153], [0, 204, 204], [0, 51, 0], [255, 153, 51], [0, 204, 0]]
def color... | 1,322 | 41.677419 | 289 | py |
pix2pix3D | pix2pix3D-main/training/dataset.py | # SPDX-FileCopyrightText: Copyright (c) 2021-2022 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
# SPDX-License-Identifier: LicenseRef-NvidiaProprietary
#
# NVIDIA CORPORATION, its affiliates and licensors retain all intellectual
# property and proprietary rights in and to this material, related
# documentation ... | 20,459 | 37.676749 | 159 | py |
pix2pix3D | pix2pix3D-main/training/crosssection_utils.py | # SPDX-FileCopyrightText: Copyright (c) 2021-2022 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
# SPDX-License-Identifier: LicenseRef-NvidiaProprietary
#
# NVIDIA CORPORATION, its affiliates and licensors retain all intellectual
# property and proprietary rights in and to this material, related
# documentation ... | 1,199 | 45.153846 | 154 | py |
pix2pix3D | pix2pix3D-main/training/triplane.py | # SPDX-FileCopyrightText: Copyright (c) 2021-2022 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
# SPDX-License-Identifier: LicenseRef-NvidiaProprietary
#
# NVIDIA CORPORATION, its affiliates and licensors retain all intellectual
# property and proprietary rights in and to this material, related
# documentation ... | 7,562 | 54.610294 | 258 | py |
pix2pix3D | pix2pix3D-main/training/__init__.py | # SPDX-FileCopyrightText: Copyright (c) 2021-2022 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
# SPDX-License-Identifier: LicenseRef-NvidiaProprietary
#
# NVIDIA CORPORATION, its affiliates and licensors retain all intellectual
# property and proprietary rights in and to this material, related
# documentation ... | 562 | 45.916667 | 103 | py |
pix2pix3D | pix2pix3D-main/training/training_loop.py | # SPDX-FileCopyrightText: Copyright (c) 2021-2022 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
# SPDX-License-Identifier: LicenseRef-NvidiaProprietary
#
# NVIDIA CORPORATION, its affiliates and licensors retain all intellectual
# property and proprietary rights in and to this material, related
# documentation ... | 45,240 | 55.410224 | 266 | py |
pix2pix3D | pix2pix3D-main/training/networks_stylegan2.py | # SPDX-FileCopyrightText: Copyright (c) 2021-2022 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
# SPDX-License-Identifier: LicenseRef-NvidiaProprietary
#
# NVIDIA CORPORATION, its affiliates and licensors retain all intellectual
# property and proprietary rights in and to this material, related
# documentation ... | 40,563 | 49.83208 | 164 | py |
pix2pix3D | pix2pix3D-main/training/networks_stylegan3.py | # SPDX-FileCopyrightText: Copyright (c) 2021-2022 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
# SPDX-License-Identifier: LicenseRef-NvidiaProprietary
#
# NVIDIA CORPORATION, its affiliates and licensors retain all intellectual
# property and proprietary rights in and to this material, related
# documentation ... | 26,322 | 49.816602 | 141 | py |
pix2pix3D | pix2pix3D-main/training/triplane_cond.py | # SPDX-FileCopyrightText: Copyright (c) 2021-2022 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
# SPDX-License-Identifier: LicenseRef-NvidiaProprietary
#
# NVIDIA CORPORATION, its affiliates and licensors retain all intellectual
# property and proprietary rights in and to this material, related
# documentation ... | 68,256 | 53.6056 | 313 | py |
pix2pix3D | pix2pix3D-main/training/volumetric_rendering/renderer.py | # SPDX-FileCopyrightText: Copyright (c) 2021-2022 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
# SPDX-License-Identifier: LicenseRef-NvidiaProprietary
#
# NVIDIA CORPORATION, its affiliates and licensors retain all intellectual
# property and proprietary rights in and to this material, related
# documentation ... | 23,948 | 53.553531 | 211 | py |
pix2pix3D | pix2pix3D-main/training/volumetric_rendering/ray_sampler.py | # SPDX-FileCopyrightText: Copyright (c) 2021-2022 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
# SPDX-License-Identifier: LicenseRef-NvidiaProprietary
#
# NVIDIA CORPORATION, its affiliates and licensors retain all intellectual
# property and proprietary rights in and to this material, related
# documentation ... | 2,783 | 43.190476 | 250 | py |
pix2pix3D | pix2pix3D-main/training/volumetric_rendering/__init__.py | # SPDX-FileCopyrightText: Copyright (c) 2021-2022 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
# SPDX-License-Identifier: LicenseRef-NvidiaProprietary
#
# NVIDIA CORPORATION, its affiliates and licensors retain all intellectual
# property and proprietary rights in and to this material, related
# documentation ... | 561 | 50.090909 | 103 | py |
pix2pix3D | pix2pix3D-main/training/volumetric_rendering/ray_marcher.py | # SPDX-FileCopyrightText: Copyright (c) 2021-2022 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
# SPDX-License-Identifier: LicenseRef-NvidiaProprietary
#
# NVIDIA CORPORATION, its affiliates and licensors retain all intellectual
# property and proprietary rights in and to this material, related
# documentation ... | 2,747 | 42.619048 | 147 | py |
pix2pix3D | pix2pix3D-main/training/volumetric_rendering/math_utils.py | # MIT License
# Copyright (c) 2022 Petr Kellnhofer
# 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... | 4,708 | 38.571429 | 124 | py |
pix2pix3D | pix2pix3D-main/torch_utils/custom_ops.py | # SPDX-FileCopyrightText: Copyright (c) 2021-2022 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
# SPDX-License-Identifier: LicenseRef-NvidiaProprietary
#
# NVIDIA CORPORATION, its affiliates and licensors retain all intellectual
# property and proprietary rights in and to this material, related
# documentation ... | 6,780 | 41.38125 | 146 | py |
pix2pix3D | pix2pix3D-main/torch_utils/training_stats.py | # SPDX-FileCopyrightText: Copyright (c) 2021-2022 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
# SPDX-License-Identifier: LicenseRef-NvidiaProprietary
#
# NVIDIA CORPORATION, its affiliates and licensors retain all intellectual
# property and proprietary rights in and to this material, related
# documentation ... | 10,834 | 38.98155 | 118 | py |
pix2pix3D | pix2pix3D-main/torch_utils/persistence.py | # SPDX-FileCopyrightText: Copyright (c) 2021-2022 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
# SPDX-License-Identifier: LicenseRef-NvidiaProprietary
#
# NVIDIA CORPORATION, its affiliates and licensors retain all intellectual
# property and proprietary rights in and to this material, related
# documentation ... | 9,866 | 37.846457 | 144 | py |
pix2pix3D | pix2pix3D-main/torch_utils/misc.py | # SPDX-FileCopyrightText: Copyright (c) 2021-2022 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
# SPDX-License-Identifier: LicenseRef-NvidiaProprietary
#
# NVIDIA CORPORATION, its affiliates and licensors retain all intellectual
# property and proprietary rights in and to this material, related
# documentation ... | 11,902 | 41.359431 | 133 | py |
pix2pix3D | pix2pix3D-main/torch_utils/__init__.py | # SPDX-FileCopyrightText: Copyright (c) 2021-2022 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
# SPDX-License-Identifier: LicenseRef-NvidiaProprietary
#
# NVIDIA CORPORATION, its affiliates and licensors retain all intellectual
# property and proprietary rights in and to this material, related
# documentation ... | 562 | 45.916667 | 103 | py |
pix2pix3D | pix2pix3D-main/torch_utils/ops/bias_act.py | # SPDX-FileCopyrightText: Copyright (c) 2021-2022 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
# SPDX-License-Identifier: LicenseRef-NvidiaProprietary
#
# NVIDIA CORPORATION, its affiliates and licensors retain all intellectual
# property and proprietary rights in and to this material, related
# documentation ... | 9,927 | 45.830189 | 185 | py |
pix2pix3D | pix2pix3D-main/torch_utils/ops/grid_sample_gradfix.py | # SPDX-FileCopyrightText: Copyright (c) 2021-2022 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
# SPDX-License-Identifier: LicenseRef-NvidiaProprietary
#
# NVIDIA CORPORATION, its affiliates and licensors retain all intellectual
# property and proprietary rights in and to this material, related
# documentation ... | 3,134 | 38.1875 | 132 | py |
pix2pix3D | pix2pix3D-main/torch_utils/ops/conv2d_gradfix.py | # SPDX-FileCopyrightText: Copyright (c) 2021-2022 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
# SPDX-License-Identifier: LicenseRef-NvidiaProprietary
#
# NVIDIA CORPORATION, its affiliates and licensors retain all intellectual
# property and proprietary rights in and to this material, related
# documentation ... | 9,494 | 46.475 | 280 | py |
pix2pix3D | pix2pix3D-main/torch_utils/ops/upfirdn2d.py | # SPDX-FileCopyrightText: Copyright (c) 2021-2022 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
# SPDX-License-Identifier: LicenseRef-NvidiaProprietary
#
# NVIDIA CORPORATION, its affiliates and licensors retain all intellectual
# property and proprietary rights in and to this material, related
# documentation ... | 16,506 | 41.109694 | 120 | py |
pix2pix3D | pix2pix3D-main/torch_utils/ops/filtered_lrelu.py | # SPDX-FileCopyrightText: Copyright (c) 2021-2022 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
# SPDX-License-Identifier: LicenseRef-NvidiaProprietary
#
# NVIDIA CORPORATION, its affiliates and licensors retain all intellectual
# property and proprietary rights in and to this material, related
# documentation ... | 12,998 | 45.927798 | 164 | py |
pix2pix3D | pix2pix3D-main/torch_utils/ops/conv2d_resample.py | # SPDX-FileCopyrightText: Copyright (c) 2021-2022 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
# SPDX-License-Identifier: LicenseRef-NvidiaProprietary
#
# NVIDIA CORPORATION, its affiliates and licensors retain all intellectual
# property and proprietary rights in and to this material, related
# documentation ... | 6,879 | 46.123288 | 130 | py |
pix2pix3D | pix2pix3D-main/torch_utils/ops/fma.py | # SPDX-FileCopyrightText: Copyright (c) 2021-2022 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
# SPDX-License-Identifier: LicenseRef-NvidiaProprietary
#
# NVIDIA CORPORATION, its affiliates and licensors retain all intellectual
# property and proprietary rights in and to this material, related
# documentation ... | 2,161 | 33.31746 | 105 | py |
pix2pix3D | pix2pix3D-main/torch_utils/ops/__init__.py | # SPDX-FileCopyrightText: Copyright (c) 2021-2022 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
# SPDX-License-Identifier: LicenseRef-NvidiaProprietary
#
# NVIDIA CORPORATION, its affiliates and licensors retain all intellectual
# property and proprietary rights in and to this material, related
# documentation ... | 562 | 45.916667 | 103 | py |
pix2pix3D | pix2pix3D-main/metrics/metric_utils.py | # SPDX-FileCopyrightText: Copyright (c) 2021-2022 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
# SPDX-License-Identifier: LicenseRef-NvidiaProprietary
#
# NVIDIA CORPORATION, its affiliates and licensors retain all intellectual
# property and proprietary rights in and to this material, related
# documentation ... | 12,059 | 41.765957 | 167 | py |
pix2pix3D | pix2pix3D-main/metrics/kernel_inception_distance.py | # SPDX-FileCopyrightText: Copyright (c) 2021-2022 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
# SPDX-License-Identifier: LicenseRef-NvidiaProprietary
#
# NVIDIA CORPORATION, its affiliates and licensors retain all intellectual
# property and proprietary rights in and to this material, related
# documentation ... | 2,443 | 48.877551 | 133 | py |
pix2pix3D | pix2pix3D-main/metrics/frechet_inception_distance.py | # SPDX-FileCopyrightText: Copyright (c) 2021-2022 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
# SPDX-License-Identifier: LicenseRef-NvidiaProprietary
#
# NVIDIA CORPORATION, its affiliates and licensors retain all intellectual
# property and proprietary rights in and to this material, related
# documentation ... | 2,181 | 48.590909 | 133 | py |
pix2pix3D | pix2pix3D-main/metrics/equivariance.py | # SPDX-FileCopyrightText: Copyright (c) 2021-2022 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
# SPDX-License-Identifier: LicenseRef-NvidiaProprietary
#
# NVIDIA CORPORATION, its affiliates and licensors retain all intellectual
# property and proprietary rights in and to this material, related
# documentation ... | 10,982 | 39.677778 | 165 | py |
pix2pix3D | pix2pix3D-main/metrics/perceptual_path_length.py | # SPDX-FileCopyrightText: Copyright (c) 2021-2022 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
# SPDX-License-Identifier: LicenseRef-NvidiaProprietary
#
# NVIDIA CORPORATION, its affiliates and licensors retain all intellectual
# property and proprietary rights in and to this material, related
# documentation ... | 5,370 | 40.960938 | 131 | py |
pix2pix3D | pix2pix3D-main/metrics/inception_score.py | # SPDX-FileCopyrightText: Copyright (c) 2021-2022 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
# SPDX-License-Identifier: LicenseRef-NvidiaProprietary
#
# NVIDIA CORPORATION, its affiliates and licensors retain all intellectual
# property and proprietary rights in and to this material, related
# documentation ... | 2,015 | 48.170732 | 133 | py |
pix2pix3D | pix2pix3D-main/metrics/metric_main.py | # SPDX-FileCopyrightText: Copyright (c) 2021-2022 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
# SPDX-License-Identifier: LicenseRef-NvidiaProprietary
#
# NVIDIA CORPORATION, its affiliates and licensors retain all intellectual
# property and proprietary rights in and to this material, related
# documentation ... | 5,789 | 36.115385 | 147 | py |
pix2pix3D | pix2pix3D-main/metrics/__init__.py | # SPDX-FileCopyrightText: Copyright (c) 2021-2022 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
# SPDX-License-Identifier: LicenseRef-NvidiaProprietary
#
# NVIDIA CORPORATION, its affiliates and licensors retain all intellectual
# property and proprietary rights in and to this material, related
# documentation ... | 562 | 45.916667 | 103 | py |
pix2pix3D | pix2pix3D-main/metrics/precision_recall.py | # SPDX-FileCopyrightText: Copyright (c) 2021-2022 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
# SPDX-License-Identifier: LicenseRef-NvidiaProprietary
#
# NVIDIA CORPORATION, its affiliates and licensors retain all intellectual
# property and proprietary rights in and to this material, related
# documentation ... | 3,758 | 56.830769 | 159 | py |
pix2pix3D | pix2pix3D-main/dnnlib/util.py | # SPDX-FileCopyrightText: Copyright (c) 2021-2022 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
# SPDX-License-Identifier: LicenseRef-NvidiaProprietary
#
# NVIDIA CORPORATION, its affiliates and licensors retain all intellectual
# property and proprietary rights in and to this material, related
# documentation ... | 17,246 | 33.912955 | 151 | py |
pix2pix3D | pix2pix3D-main/dnnlib/__init__.py | # SPDX-FileCopyrightText: Copyright (c) 2021-2022 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
# SPDX-License-Identifier: LicenseRef-NvidiaProprietary
#
# NVIDIA CORPORATION, its affiliates and licensors retain all intellectual
# property and proprietary rights in and to this material, related
# documentation ... | 602 | 49.25 | 103 | py |
pix2pix3D | pix2pix3D-main/applications/extract_mesh.py | import sys
sys.path.append('./')
import os
import re
from typing import List, Optional, Tuple, Union
import click
import dnnlib
import numpy as np
import PIL.Image
import torch
from tqdm import tqdm
import legacy
from camera_utils import LookAtPoseSampler
from matplotlib import pyplot as plt
from pathlib import P... | 12,502 | 45.827715 | 218 | py |
pix2pix3D | pix2pix3D-main/applications/generate_samples.py | import sys
sys.path.append('./')
import os
import re
from typing import List, Optional, Tuple, Union
import click
import dnnlib
import numpy as np
import PIL.Image
import torch
from tqdm import tqdm
import legacy
from matplotlib import pyplot as plt
from pathlib import Path
import json
from training.utils impor... | 5,868 | 44.851563 | 218 | py |
pix2pix3D | pix2pix3D-main/applications/generate_video.py | import sys
sys.path.append('./')
import os
import re
from typing import List, Optional, Tuple, Union
import click
import dnnlib
import numpy as np
import PIL.Image
import torch
from tqdm import tqdm
import legacy
from camera_utils import LookAtPoseSampler
from matplotlib import pyplot as plt
from pathlib import P... | 12,390 | 55.322727 | 218 | py |
DMGC | DMGC-master/inits.py | import tensorflow as tf
import numpy as np
def uniform(shape, scale=1. / 3., name=None):
"""Uniform init."""
initial = tf.random_uniform(shape, minval=-scale, maxval=scale, dtype=tf.float32)
return tf.Variable(initial, name=name)
def glorot(shape, name=None):
"""Glorot & Bengio (AISTATS 2010) init."... | 950 | 28.71875 | 95 | py |
DMGC | DMGC-master/run_exp.py | import os
import numpy as np
import tensorflow as tf
import time
from inits import *
from utils import get_edges
from DMGC import DMGC
from datasets import load_data
import metrics
tf.random.set_random_seed(1234)
import warnings
warnings.simplefilter(action='ignore', category=FutureWarning)
os.environ["CUDA_DEVICE_O... | 3,122 | 25.466102 | 116 | py |
DMGC | DMGC-master/tsne.py | # coding='utf-8'
from time import time
import numpy as np
import matplotlib.pyplot as plt
from sklearn import datasets
from sklearn.manifold import TSNE
def get_data(db):
data = np.load(db)
print(data.shape)
n_samples, n_features = data.shape
return data, n_samples, n_features
def draw0_with_centers(data, label... | 1,321 | 23.481481 | 169 | py |
DMGC | DMGC-master/DMGC.py | from sklearn.cluster import KMeans
from sklearn.metrics.cluster import normalized_mutual_info_score as nmi
from time import time
import numpy as np
import tensorflow as tf
import metrics
from layers import *
from inits import *
from utils import *
flags = tf.app.flags
FLAGS = flags.FLAGS
sess = tf.Session()
class Gr... | 12,692 | 30.186732 | 314 | py |
DMGC | DMGC-master/vis.py | from tsne import draw0_with_centers
import numpy as np
from datasets import load_data
output_dir = '.'
embs = np.load(output_dir+'/emb.npy', allow_pickle=True)
best_res = np.load(output_dir+'/pred.npy', allow_pickle=True)
align = np.load(output_dir+'/align.npy', allow_pickle=True)
centers = np.load(output_dir+'/center... | 519 | 29.588235 | 67 | py |
DMGC | DMGC-master/utils.py | import numpy as np
import networkx as nx
def gaussian_normalization(train_x):
mu = np.mean(train_x, axis=0)
dev = np.std(train_x, axis=0)
norm_x = (train_x - mu) / (dev + 1e-12)
# print norm_x
return norm_x
def min_max_normalization(train_x):
_max = np.max(train_x, axis=0)
_min = np.min(tr... | 1,154 | 23.0625 | 55 | py |
DMGC | DMGC-master/layers.py | from inits import *
import tensorflow as tf
# global unique layer ID dictionary for layer name assignment
_LAYER_UIDS = {}
def get_layer_uid(layer_name=''):
"""Helper function, assigns unique layer IDs."""
if layer_name not in _LAYER_UIDS:
_LAYER_UIDS[layer_name] = 1
return 1
else:
_LAYER_UIDS[layer_name] ... | 4,514 | 25.25 | 93 | py |
DMGC | DMGC-master/datasets.py | import numpy as np
import networkx as nx
from numpy.linalg import norm
from scipy.sparse import csr_matrix
from utils import *
def getAdj(file,begin=0,directed=False,weighted=False,maxids=None,addself=False):
edges=set()
row = []
col = []
data =[]
rowmax=-1
colmax =-1
if weighted:
leng =3
else:
leng = 2... | 5,675 | 17.857143 | 95 | py |
DMGC | DMGC-master/metrics.py | import numpy as np
from sklearn.metrics import normalized_mutual_info_score, adjusted_rand_score
nmi = normalized_mutual_info_score
ari = adjusted_rand_score
def eval_acc(tru, pre):
# true label: numpy, vector in col
# pred lable: numpy, vector in row
tru = np.array(tru)
num_labels = tru.shape[0]
# accuracy
... | 924 | 22.125 | 77 | py |
TSEGAN | TSEGAN-main/evaluate.py | import numpy as np
import soundfile
import librosa
from pesq import pesq
import pysepm
from pystoi import stoi
from scipy.io import wavfile
import glob
import matplotlib.pyplot as plt
import os
from utility.sdr import calc_sdr
# 评测单组音频
def evaluate_one(clean_name,estimation_name,sample_rate=16000):
# print(clea... | 7,545 | 34.42723 | 140 | py |
TSEGAN | TSEGAN-main/conv_tasnet.py | import torch
import torch.nn as nn
import torch.nn.functional as F
from torch.autograd import Variable
from utility import models, sdr
# Conv-TasNet
class TasNet(nn.Module):
def __init__(self, enc_dim=512, feature_dim=128, sr=16000, win=2, layer=8, stack=3,
kernel=3, num_spk=1, causal=False):
... | 5,788 | 30.461957 | 114 | py |
TSEGAN | TSEGAN-main/SetDataset.py | import numpy as np
import librosa
import torch
import glob
import os
from torch.utils.data import DataLoader,SubsetRandomSampler,Dataset
# 自定义Dataset,保证mix与clean对应导入
# class AudioDataset(Dataset):
# def __init__(self,mix_path,clean_path):
# super(AudioDataset,self).__init__()
#
# mix_wavs = glob.g... | 3,376 | 33.111111 | 124 | py |
TSEGAN | TSEGAN-main/pre-process.py | import numpy as np
import librosa
import soundfile as sf
import os
import glob
## 语音预处理,将数据划分为1s的块(sr),overlap = 50%
# 分割重写单个音频
def process_one(wav,aim_path):
'''
input:
wav: audio file for process
aim_path: where the result is writed
example:
wav = r'E:\DeepStudy\segan\data\noisy_... | 3,178 | 27.9 | 86 | py |
TSEGAN | TSEGAN-main/plot.py | import torch
import librosa.display
import numpy as np
import matplotlib.pyplot as plt
y, sr = librosa.load(r'./data/clean_testset_wav/p232_199.wav',sr=None)
y = torch.from_numpy(y).float().unsqueeze(0).cuda()
G = torch.load(r'./nets/G_useful/G_good-batch70-epoch-84-step-400-sdr-18.71.pkl')
# models = G.modules()
... | 843 | 19.585366 | 81 | py |
TSEGAN | TSEGAN-main/clean.py | import numpy as np
import librosa
import soundfile as sf
import glob
import os
from time import *
import torch
import torch.nn as nn
from tqdm import tqdm
from utility.utils import get_model, get_last_model
from train import device_ids
device = torch.device('cuda:1')
# 增强测试
def test_GAN_clean(test_mix_path,aim_path)... | 1,880 | 29.836066 | 90 | py |
TSEGAN | TSEGAN-main/train.py | import numpy as np
import torch
import torch.nn as nn
from torch.optim.lr_scheduler import ReduceLROnPlateau
import torch.autograd as autograd
from tqdm import tqdm
import time
from utility import models, sdr, utils
from SetDataset import AudioDataset, split_dataloader
import conv_tasnet
# 超参数
BATCH_SIZE = 20
LR = 1... | 24,476 | 36.541411 | 136 | py |
TSEGAN | TSEGAN-main/utility/utils.py | import numpy as np
import glob
import os
import torch
def new_filedir(file_path):
# 如果操作路径不存在,则创建它
if not os.path.exists(file_path):
# print(file_path)
os.makedirs(file_path)
# 模型梯度设置
def set_requires_grad(nets, requires_grad=False):
"""
Args:
nets(list): networks
requi... | 3,816 | 29.293651 | 102 | py |
TSEGAN | TSEGAN-main/utility/sdr.py | import numpy as np
from itertools import permutations
from torch.autograd import Variable
import scipy,time,numpy
import itertools
import pysepm
import torch
def Q_calc_pesq(estimation, origin, mask=None):
"""
batch-wise SDR calculation for one audio file on pytorch Variables.
estimation: (batch, nspk, n... | 10,524 | 30.797583 | 112 | py |
TSEGAN | TSEGAN-main/utility/models.py | import numpy as np
import os
import torch
import torch.nn as nn
import torch.nn.functional as F
from torch.autograd import Variable
from torch.nn.utils import spectral_norm
class cLN(nn.Module):
def __init__(self, dimension, eps = 1e-8, trainable=True):
super(cLN, self).__init__()
self.eps... | 20,616 | 33.361667 | 133 | py |
streetview | streetview-master/setup.py | from setuptools import setup
from version import VERSION
def readme():
with open("readme.md") as f:
return f.read()
setup(
name="streetview",
version=VERSION,
description="Retrieve current and historical photos from Google Street View",
long_description=readme(),
long_description_co... | 623 | 20.517241 | 81 | py |
streetview | streetview-master/version.py | VERSION = "0.0.0"
| 18 | 8.5 | 17 | py |
streetview | streetview-master/streetview/download.py | import itertools
import time
from dataclasses import dataclass
from io import BytesIO
from typing import Generator
import requests
from PIL import Image
@dataclass
class TileInfo:
x: int
y: int
fileurl: str
@dataclass
class Tile:
x: int
y: int
image: Image.Image
def get_width_and_height_f... | 2,298 | 24.831461 | 96 | py |
streetview | streetview-master/streetview/api.py | from io import BytesIO
from typing import Dict, Union
import requests
from PIL import Image
from pydantic import BaseModel
class Location(BaseModel):
lat: float
lng: float
class MetaData(BaseModel):
date: str
location: Location
pano_id: str
def get_panorama_meta(pano_id: str, api_key: str) ->... | 2,129 | 26.307692 | 79 | py |
streetview | streetview-master/streetview/__init__.py | from .api import get_panorama_meta, get_streetview # noqa
from .download import get_panorama # noqa
from .search import search_panoramas # noqa
| 147 | 36 | 58 | py |
streetview | streetview-master/streetview/search.py | import json
import re
from typing import List, Optional
import requests
from pydantic import BaseModel
from requests.models import Response
class Panorama(BaseModel):
pano_id: str
lat: float
lon: float
heading: float
pitch: float
roll: float
date: Optional[str]
def make_search_url(lat: ... | 2,645 | 26 | 78 | py |
streetview | streetview-master/tests/test_api.py | import os
import pytest
from streetview import get_streetview
GOOGLE_MAPS_API_KEY = os.environ.get("GOOGLE_MAPS_API_KEY", None)
@pytest.mark.vcr(filter_query_parameters=["key"])
def test_readme_metadata_example():
from streetview import get_panorama_meta
meta = get_panorama_meta(
pano_id="_R1mwpMk... | 1,138 | 22.244898 | 74 | py |
streetview | streetview-master/tests/test_search.py | import os
import pytest
from streetview import get_panorama_meta, search_panoramas
GOOGLE_MAPS_API_KEY = os.environ.get("GOOGLE_MAPS_API_KEY", None)
SYDNEY = {
"lat": -33.8796052,
"lon": 151.1655341,
}
BELGRAVIA = {
"lat": 51.4986562,
"lon": -0.1570917,
}
MIDDLE_OF_OCEAN = {
"lat": 28.092432,... | 2,551 | 22.850467 | 80 | py |
streetview | streetview-master/tests/test_download.py | import hashlib
from io import BytesIO
import pytest
from PIL import Image
from streetview import get_panorama
from streetview.download import (
TileInfo,
fetch_panorama_tile,
get_width_and_height_from_zoom,
iter_tile_info,
iter_tiles,
make_download_url,
)
# This MD5 was retrieved empirically ... | 2,554 | 29.416667 | 87 | py |
TIP-GNN | TIP-GNN-main/exper_node_np.py | """Unified interface to all dynamic graph model experiments"""
import argparse
import logging
import math
import os
import random
import sys
import time
import numpy as np
import pandas as pd
import torch
from data_util import load_data, load_graph, load_label_data
from sklearn.metrics import (accuracy_score, average_... | 18,192 | 35.386 | 133 | py |
TIP-GNN | TIP-GNN-main/check_preprocess.py | import argparse
import logging
import math
import numpy as np
from tqdm import trange
from data_util import _iterate_datasets
from graph import SubgraphNeighborFinder
from preprocess import load_data_var, init_adj
from sampling import NeighborFinder
def check(edges, sg_ngh_finder, ngh_finder, BATCHSIZE=200, NUM_NGH... | 3,186 | 38.8375 | 94 | py |
TIP-GNN | TIP-GNN-main/inductive_edge_np.py | '''Unified interface to all dynamic graph model experiments'''
import argparse
import logging
import math
import os
import random
import sys
import time
import networkx as nx
import numpy as np
import pandas as pd
import torch
from sklearn.metrics import (accuracy_score, average_precision_score, f1_score,
... | 15,108 | 36.214286 | 128 | py |
TIP-GNN | TIP-GNN-main/exper_edge_np.py | """Unified interface to all dynamic graph model experiments"""
import math
import logging
import time
import random
import os
import sys
import argparse
from tqdm import trange
import torch
import pandas as pd
import numpy as np
#import numba
from sklearn.metrics import accuracy_score
from sklearn.metrics import aver... | 14,956 | 36.114144 | 103 | py |
TIP-GNN | TIP-GNN-main/mlp.py | import torch
import torch.nn as nn
import torch.nn.functional as F
class MLP(nn.Module):
def __init__(self, num_layers, input_dim, hidden_dim):
'''
num_layers: number of layers in the neural networks (EXCLUDING the input layer). If num_layers=1, this becomes a linear model.
input_d... | 1,100 | 32.363636 | 138 | py |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.