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
models
models-master/research/object_detection/builders/model_builder_tf2_test.py
# Copyright 2020 The TensorFlow 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 applica...
21,312
35.494863
80
py
models
models-master/research/object_detection/builders/hyperparams_builder_test.py
# Copyright 2017 The TensorFlow 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 applica...
35,961
33.087204
80
py
models
models-master/research/object_detection/builders/hyperparams_builder.py
# Copyright 2017 The TensorFlow 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 applica...
18,424
37.871308
80
py
models
models-master/research/delf/delf/python/training/global_features_utils.py
# Copyright 2021 The TensorFlow 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 applicab...
8,790
38.599099
80
py
models
models-master/research/delf/delf/python/training/train.py
# Lint as: python3 # Copyright 2020 The TensorFlow 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 ...
22,754
39.706619
80
py
models
models-master/research/delf/delf/python/training/global_features/train_utils.py
# Lint as: python3 # Copyright 2021 The TensorFlow 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 ...
15,531
39.553525
80
py
models
models-master/research/delf/delf/python/training/global_features/train.py
# Lint as: python3 # Copyright 2021 The TensorFlow 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 ...
15,702
42.258953
80
py
models
models-master/research/delf/delf/python/training/model/delf_model_test.py
# Lint as: python3 # Copyright 2020 The TensorFlow 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 ...
4,198
37.522936
80
py
models
models-master/research/delf/delf/python/training/model/delf_model.py
# Lint as: python3 # Copyright 2020 The TensorFlow 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 ...
9,075
36.659751
80
py
models
models-master/research/delf/delf/python/training/model/delg_model.py
# Lint as: python3 # Copyright 2020 The TensorFlow 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 ...
7,641
41.692737
80
py
models
models-master/research/delf/delf/python/training/model/delg_model_test.py
# Lint as: python3 # Copyright 2021 The TensorFlow 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 ...
5,899
37.815789
80
py
models
models-master/research/delf/delf/python/training/model/resnet50.py
# Copyright 2017 The TensorFlow 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 applica...
17,089
36.071584
80
py
models
models-master/research/delf/delf/python/training/model/global_model.py
# Lint as: python3 # Copyright 2021 The TensorFlow 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 ...
10,632
36.178322
80
py
models
models-master/research/delf/delf/python/training/model/export_CNN_global.py
# Lint as: python3 # Copyright 2021 The TensorFlow 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 ...
6,604
36.95977
80
py
models
models-master/research/delf/delf/python/training/losses/ranking_losses.py
# Copyright 2021 The TensorFlow 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 applicab...
6,201
34.238636
80
py
models
models-master/research/delf/delf/python/datasets/utils.py
# Lint as: python3 # Copyright 2021 The TensorFlow 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 r...
2,662
34.506667
80
py
models
models-master/research/delf/delf/python/normalization_layers/normalization.py
# Copyright 2021 The TensorFlow 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 applicab...
1,348
31.902439
80
py
models
models-master/research/delf/delf/python/pooling_layers/pooling.py
# Copyright 2021 The TensorFlow 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 applicab...
6,125
30.415385
80
py
models
models-master/research/delf/delf/python/pooling_layers/pooling_test.py
# Copyright 2021 The TensorFlow 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 applicab...
3,148
36.047059
80
py
models
models-master/research/deeplab/core/conv2d_ws.py
# Lint as: python2, python3 # Copyright 2019 The TensorFlow 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 # #...
15,881
41.924324
80
py
models
models-master/research/deeplab/core/resnet_v1_beta.py
# Lint as: python2, python3 # Copyright 2018 The TensorFlow 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 # #...
34,236
40.349034
80
py
models
models-master/research/seq_flow_lite/trainer_v2.py
# Copyright 2021 The TensorFlow 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 applicab...
3,869
32.947368
80
py
models
models-master/research/seq_flow_lite/trainer.py
# Copyright 2020 The TensorFlow 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 applicab...
6,640
35.489011
80
py
models
models-master/research/seq_flow_lite/models/pqrnn.py
# Copyright 2020 The TensorFlow 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 applicab...
3,838
37.009901
80
py
models
models-master/research/seq_flow_lite/models/charformer.py
# Copyright 2022 The TensorFlow 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 applicab...
6,598
41.850649
82
py
models
models-master/research/seq_flow_lite/models/byteqrnn.py
# Copyright 2022 The TensorFlow 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 applicab...
6,033
41.195804
80
py
models
models-master/research/seq_flow_lite/models/transformer_encoder.py
# Copyright 2020 The TensorFlow 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 applicab...
4,408
38.017699
105
py
models
models-master/research/seq_flow_lite/models/transformer_uniform_attn_decoder.py
# Copyright 2020 The TensorFlow 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 applicab...
20,439
38.535783
94
py
models
models-master/research/seq_flow_lite/models/prado.py
# Copyright 2020 The TensorFlow 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 applicab...
8,180
40.739796
80
py
models
models-master/research/seq_flow_lite/models/sgnn/sgnn_test.py
# Copyright 2020 The TensorFlow 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 applicab...
2,771
36.972603
95
py
models
models-master/research/seq_flow_lite/models/sgnn/sgnn.py
# Copyright 2020 The TensorFlow 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 applicab...
8,235
35.281938
80
py
models
models-master/research/seq_flow_lite/models/sgnn/train.py
# Copyright 2020 The TensorFlow 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 applicab...
4,226
33.647541
86
py
models
models-master/research/seq_flow_lite/layers/base_layers.py
# Copyright 2020 The TensorFlow 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 applicab...
4,899
33.027778
80
py
models
models-master/research/seq_flow_lite/layers/misc_layers.py
# Copyright 2020 The TensorFlow 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 applicab...
10,559
42.636364
80
py
models
models-master/research/seq_flow_lite/layers/dense_layers.py
# Copyright 2020 The TensorFlow 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 applicab...
4,317
34.105691
80
py
models
models-master/research/seq_flow_lite/layers/qrnn_layers.py
# Copyright 2020 The TensorFlow 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 applicab...
17,000
36.864143
80
py
models
models-master/research/seq_flow_lite/layers/embedding_layers.py
# Copyright 2020 The TensorFlow 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 applicab...
2,814
36.039474
80
py
models
models-master/research/seq_flow_lite/layers/normalization_layers.py
# Copyright 2020 The TensorFlow 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 applicab...
5,515
38.4
80
py
models
models-master/research/seq_flow_lite/layers/transformer_layers.py
# Copyright 2020 The TensorFlow 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 applicab...
30,161
43.817236
80
py
models
models-master/research/seq_flow_lite/layers/conv_layers.py
# Copyright 2020 The TensorFlow 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 applicab...
4,468
34.468254
80
py
models
models-master/research/seq_flow_lite/layers/quantization_layers.py
# Copyright 2020 The TensorFlow 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 applicab...
4,237
40.145631
80
py
models
models-master/research/attention_ocr/python/sequence_layers.py
# Copyright 2017 The TensorFlow 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 applicab...
15,179
34.886525
88
py
models
models-master/research/deep_speech/deep_speech_model.py
# Copyright 2018 The TensorFlow 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 applica...
6,717
36.741573
89
py
models
models-master/research/deep_speech/deep_speech.py
# Copyright 2018 The TensorFlow 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 applica...
14,268
33.136364
89
py
models
models-master/research/slim/nets/resnet_utils.py
# Copyright 2016 The TensorFlow 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 ...
11,826
41.696751
80
py
models
models-master/research/slim/datasets/build_imagenet_data.py
# Copyright 2016 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...
26,229
36.152975
87
py
models
models-master/research/vid2depth/project.py
# Copyright 2017 The TensorFlow 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 applicab...
11,467
36.477124
83
py
models
models-master/orbit/controller_test.py
# Copyright 2023 The Orbit 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 l...
31,588
35.903037
80
py
models
models-master/orbit/examples/single_task/single_task_evaluator.py
# Copyright 2023 The Orbit 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 l...
3,195
35.735632
80
py
models
models-master/orbit/examples/single_task/single_task_trainer_test.py
# Copyright 2023 The Orbit 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 l...
1,961
31.163934
74
py
models
models-master/orbit/examples/single_task/single_task_trainer.py
# Copyright 2023 The Orbit 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 l...
5,647
39.056738
80
py
models
models-master/orbit/examples/single_task/single_task_evaluator_test.py
# Copyright 2023 The Orbit 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 l...
2,088
30.651515
80
py
cyphercat
cyphercat-master/scripts/test_train.py
from __future__ import print_function try: import os import sys import argparse import numpy as np import matplotlib.pyplot as plt import torch import torchvision import torch.nn as nn import torch.optim as optim from cyphercat.models import get_predef_model, weight...
4,030
32.31405
116
py
cyphercat
cyphercat-master/scripts/test_load.py
from __future__ import print_function try: import time import os import sys import argparse import torch from cyphercat.load_data import prep_data from cyphercat.utils import Configurator, DataStruct except ImportError as e: print(e) raise ImportError def main(): global...
1,500
26.290909
163
py
cyphercat
cyphercat-master/scripts/test_train_libri.py
from __future__ import print_function try: import os import sys import argparse import numpy as np import matplotlib.pyplot as plt import torch import torchvision import torch.nn as nn import torch.optim as optim from cyphercat.models import get_predef_model, weight...
3,781
33.697248
124
py
cyphercat
cyphercat-master/Utils/transformations.py
import torch import librosa as libr import numpy as np class ToMFCC: ''' Transformation to convert soundfile loaded via LibriSpeechDataset to Mel- frequency cepstral coefficients (MFCCs) Args: number_of_mels: Number of bins to use for cepstral coefficients Returns: torch.float tensor ...
1,449
28.591837
79
py
cyphercat
cyphercat-master/Utils/datasets.py
from torch.utils.data import Dataset from tqdm import tqdm import soundfile as sf import pandas as pd import numpy as np import os LIBRISPEECH_SAMPLING_RATE = 16000 PATH = '/home/mlomnitz/mlomnitz/Datasets' sex_to_label = {'M': False, 'F': True} label_to_sex = {False: 'M', True: 'F'} def to_categorical(y, num_classe...
18,446
38.082627
119
py
cyphercat
cyphercat-master/Utils/visualize_object_survey.py
#!/usr/bin/python3 """ Set of functions used to call a series of algorithms used to visualize the object localization of a pre-trained network in PyTorch. The different algorithms are discussed in several papers, while the implementation is based, roughly, on work in the following repository (https://github.com/sar-...
8,615
31.513208
117
py
cyphercat
cyphercat-master/Utils/models.py
import torch from torch import nn import torch.nn.functional as F import numpy as np import os.path def new_size_conv(size, kernel, stride=1, padding=0): return np.floor((size + 2*padding - (kernel -1)-1)/stride +1) def new_size_max_pool(size, kernel, stride=None, padding=0): if stride == None: ...
14,560
32.018141
128
py
cyphercat
cyphercat-master/Utils/metrics.py
import torch import torch.nn.functional as F import numpy as np import matplotlib.pyplot as plt from sklearn.pipeline import Pipeline from SVC_Utils import * from sklearn.metrics import roc_curve, auc # determine device to run network on (runs on gpu if available) device = torch.device("cuda:0" if torch.cuda.is_avail...
11,084
35.22549
134
py
cyphercat
cyphercat-master/Utils/SVC_Utils.py
import numpy as np import matplotlib.pyplot as plt import os from sklearn import svm from sklearn.decomposition import PCA from sklearn.pipeline import make_pipeline from sklearn.preprocessing import MinMaxScaler from sklearn.externals import joblib import torch import torchvision def load(dataloader): """Load...
3,655
30.791304
116
py
cyphercat
cyphercat-master/Utils/train.py
import torch import torch.nn.functional as F import numpy as np import matplotlib.pyplot as plt from metrics import * # determine device to run network on (runs on gpu if available) device = torch.device("cuda:0" if torch.cuda.is_available() else "cpu") def train(net, data_loader, test_loader, optimizer, criterion...
8,087
35.432432
142
py
cyphercat
cyphercat-master/cyphercat/defenses.py
import copy # Torch imports import torch import torch.optim as optim # Local imports from .train import train, softCrossEntropy from .metrics import eval_target_model def transfer_learn(model=None, data_loader=None, test_loader=None, optimizer=None, criterion=None, lr=0, n_epochs=0, ...
6,149
37.198758
78
py
cyphercat
cyphercat-master/cyphercat/models.py
import os import torch import numpy as np from torch import nn import torch.nn.functional as fcnal def new_size_conv(size, kernel, stride=1, padding=0): """Calculates the output size of a convolutional layer Args: size (int): Size of input (assumed square). kernel (int): kernel size for conv...
14,856
31.509847
79
py
cyphercat
cyphercat-master/cyphercat/metrics.py
import torch import torch.nn.functional as fcnal import numpy as np import pandas as pd from sklearn.pipeline import Pipeline # determine device to run network on (runs on gpu if available) device = torch.device("cuda:0" if torch.cuda.is_available() else "cpu") def eval_target_model(model=None, data_loader=None, c...
9,273
33.221402
78
py
cyphercat
cyphercat-master/cyphercat/train.py
import numpy as np import torch import torch.nn as nn import torch.nn.functional as fcnal from sklearn.pipeline import Pipeline from .metrics import eval_target_model # Determine device to run network on (runs on gpu if available) device = torch.device("cuda:0" if torch.cuda.is_available() else "cpu") def label_t...
15,691
35.749415
79
py
cyphercat
cyphercat-master/cyphercat/attacks.py
# Pytorch imports import torch # Cyphercat imports from .train import train, train_attacker from .metrics import eval_membership_inference, eval_attack_model # Device to run on device = torch.device("cuda:0" if torch.cuda.is_available() else "cpu") def ml_leaks1(target=None, shadow_model=None, attacker_model=None, ...
5,614
40.286765
79
py
cyphercat
cyphercat-master/cyphercat/datadefs/lfw_dataset.py
import os import shutil import numpy as np from skimage import io from torch.utils.data.dataset import Dataset class LFWDataset(Dataset): """ Faces in the Wild specific dataset class. Includes indexing functionality. Inherets from PyTorch Dataset class. """ def __init__(self, data_struct=None...
2,692
27.956989
79
py
cyphercat
cyphercat-master/cyphercat/datadefs/cyphercat_dataset.py
from cyphercat.definitions import DATASETS_DIR, DATASPLITS_DIR from .cifar10_dataset import Cifar10_preload_and_split from .libri_dataset import Libri_preload_and_split class CCATDataset(): """ This is a generic cyphercat dataset class for accessing the various datasets accessible to the package. # A...
2,715
33.820513
93
py
cyphercat
cyphercat-master/cyphercat/datadefs/cifar10_dataset.py
import torch from torch.utils.data import Dataset, ConcatDataset import torchvision from cyphercat.definitions import DATASETS_DIR, DATASPLITS_DIR from tqdm import tqdm import pandas as pd import numpy as np import pickle import os from .splitter import splitter, dataset_split def Cifar10_preload_and_split(path=None,...
2,161
31.757576
105
py
cyphercat
cyphercat-master/cyphercat/datadefs/splitter.py
from torch import randperm from torch._utils import _accumulate from torch.utils.data.dataset import Subset import pandas as pd def dataset_split(dataset=None, lengths=None, indices=None): """ Split a dataset into non-overlapping new datasets of given lengths. If indices is undefined, then a random permu...
7,516
35.848039
79
py
cyphercat
cyphercat-master/cyphercat/datadefs/voices_dataset.py
from torch.utils.data import Dataset from cyphercat.definitions import DATASETS_DIR, DATASPLITS_DIR from tqdm import tqdm import soundfile as sf import pandas as pd import numpy as np import os from .splitter import splitter, splitter2 LIBRISPEECH_SAMPLING_RATE = 16000 sex_to_label = {'M': False, 'F': True} label_to_...
24,898
38.966292
80
py
cyphercat
cyphercat-master/cyphercat/datadefs/libri_dataset.py
from torch.utils.data import Dataset from cyphercat.definitions import DATASETS_DIR, DATASPLITS_DIR from tqdm import tqdm import soundfile as sf import pandas as pd import numpy as np import os from .splitter import splitter LIBRISPEECH_SAMPLING_RATE = 16000 sex_to_label = {'M': False, 'F': True} label_to_sex = {Fals...
21,505
39.96381
80
py
cyphercat
cyphercat-master/cyphercat/tests/test_dim_reduction.py
import sys sys.path.insert(0, '../../') import cyphercat as cc import torch import torch.nn as nn import numpy as np class test_cnn(nn.Module): def __init__(self, n_in=3, n_classes=10, n_filters=64, size=64): super(test_cnn, self).__init__() self.size = size self.n_filte...
2,350
31.205479
77
py
cyphercat
cyphercat-master/cyphercat/utils/visualize_utils.py
#!/usr/bin/python3 """ Set of functions used to call a series of algorithms used to visualize the object localization of a pre-trained network in PyTorch. The different algorithms are discussed in several papers, while the implementation is based, roughly, on work in the following repository (https://github.com/sar-...
8,630
31.085502
117
py
cyphercat
cyphercat-master/cyphercat/utils/svc_utils.py
from __future__ import print_function import os import numpy as np import torch import torchvision from sklearn import svm from sklearn.decomposition import PCA from sklearn.pipeline import make_pipeline from sklearn.preprocessing import MinMaxScaler from sklearn.externals import joblib def load(dataloader): "...
3,817
29.790323
118
py
3DDFA
3DDFA-master/main.py
#!/usr/bin/env python3 # coding: utf-8 __author__ = 'cleardusk' """ The pipeline of 3DDFA prediction: given one image, predict the 3d face vertices, 68 landmarks and visualization. [todo] 1. CPU optimization: https://pmchojnacki.wordpress.com/2018/10/07/slow-pytorch-cpu-performance """ import torch import torchvisi...
9,511
45.174757
121
py
3DDFA
3DDFA-master/video_demo.py
#!/usr/bin/env python3 # coding: utf-8 import torch import torchvision.transforms as transforms import mobilenet_v1 import numpy as np import cv2 import dlib from utils.ddfa import ToTensorGjz, NormalizeGjz import scipy.io as sio from utils.inference import ( parse_roi_box_from_landmark, crop_img, predict_6...
3,552
31.3
88
py
3DDFA
3DDFA-master/benchmark.py
#!/usr/bin/env python3 # coding: utf-8 import torch import torch.nn as nn import torch.utils.data as data import torchvision.transforms as transforms import torch.backends.cudnn as cudnn import mobilenet_v1 import time import numpy as np from benchmark_aflw2000 import calc_nme as calc_nme_alfw2000 from benchmark_aflw...
3,554
28.87395
111
py
3DDFA
3DDFA-master/speed_cpu.py
#!/usr/bin/env python3 # coding: utf-8 import timeit import numpy as np SETUP_CODE = ''' import mobilenet_v1 import torch model = mobilenet_v1.mobilenet_1() model.eval() data = torch.rand(1, 3, 120, 120) ''' TEST_CODE = ''' with torch.no_grad(): model(data) ''' def main(): repeat, number = 5, 100 res ...
693
18.277778
78
py
3DDFA
3DDFA-master/wpdc_loss.py
#!/usr/bin/env python3 # coding: utf-8 import torch import torch.nn as nn from math import sqrt from utils.io import _numpy_to_cuda from utils.params import * _to_tensor = _numpy_to_cuda # gpu def _parse_param_batch(param): """Work for both numpy and tensor""" N = param.shape[0] p_ = param[:, :12].view...
4,540
33.664122
108
py
3DDFA
3DDFA-master/vdc_loss.py
#!/usr/bin/env python3 # coding: utf-8 import torch import torch.nn as nn from utils.io import _load, _numpy_to_cuda, _numpy_to_tensor from utils.params import * _to_tensor = _numpy_to_cuda # gpu def _parse_param_batch(param): """Work for both numpy and tensor""" N = param.shape[0] p_ = param[:, :12].v...
3,606
34.362745
104
py
3DDFA
3DDFA-master/train.py
#!/usr/bin/env python3 # coding: utf-8 import os.path as osp from pathlib import Path import numpy as np import argparse import time import logging import torch import torch.nn as nn import torchvision.transforms as transforms from torch.utils.data import DataLoader import mobilenet_v1 import torch.backends.cudnn as ...
9,938
34.244681
105
py
3DDFA
3DDFA-master/mobilenet_v1.py
#!/usr/bin/env python3 # coding: utf-8 from __future__ import division """ Creates a MobileNet Model as defined in: Andrew G. Howard Menglong Zhu Bo Chen, et.al. (2017). MobileNets: Efficient Convolutional Neural Networks for Mobile Vision Applications. Copyright (c) Yang Lu, 2017 Modified By cleardusk """ import...
5,224
32.709677
110
py
3DDFA
3DDFA-master/c++/convert_to_onnx.py
#!/usr/bin/env python3 # coding: utf-8 import torch import mobilenet_v1 def main(): # checkpoint_fp = 'weights/phase1_wpdc_vdc.pth.tar' checkpoint_fp = 'weights/mb_1.p' arch = 'mobilenet_1' checkpoint = torch.load(checkpoint_fp, map_location=lambda storage, loc: storage)['state_dict'] model = get...
1,135
32.411765
100
py
3DDFA
3DDFA-master/c++/mobilenet_v1.py
#!/usr/bin/env python3 # coding: utf-8 from __future__ import division """ Creates a MobileNet Model as defined in: Andrew G. Howard Menglong Zhu Bo Chen, et.al. (2017). MobileNets: Efficient Convolutional Neural Networks for Mobile Vision Applications. Copyright (c) Yang Lu, 2017 Modified By cleardusk """ import...
5,224
32.709677
110
py
3DDFA
3DDFA-master/utils/io.py
#!/usr/bin/env python3 # coding: utf-8 import os import numpy as np import torch import pickle import scipy.io as sio def mkdir(d): """only works on *nix system""" if not os.path.isdir(d) and not os.path.exists(d): os.system('mkdir -p {}'.format(d)) def _get_suffix(filename): """a.jpg -> jpg"""...
3,012
24.974138
97
py
3DDFA
3DDFA-master/utils/ddfa.py
#!/usr/bin/env python3 # coding: utf-8 import os.path as osp from pathlib import Path import numpy as np import torch import torch.utils.data as data import cv2 import pickle import argparse from .io import _numpy_to_tensor, _load_cpu, _load_gpu from .params import * def _parse_param(param): """Work for both nu...
4,316
26.673077
118
py
Squeezeformer
Squeezeformer-main/examples/squeezeformer/test.py
# Copyright 2020 Huy Le Nguyen (@usimarit) # # 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 agreed t...
8,644
37.59375
117
py
Squeezeformer
Squeezeformer-main/src/models/base_model.py
# Copyright 2020 Huy Le Nguyen (@usimarit) # # 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 agreed t...
6,880
35.026178
111
py
Squeezeformer
Squeezeformer-main/src/models/conformer_encoder.py
# Copyright 2020 Huy Le Nguyen (@usimarit) # # 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 agreed t...
23,551
39.191126
124
py
Squeezeformer
Squeezeformer-main/src/models/ctc.py
# Copyright 2020 Huy Le Nguyen (@usimarit) # # 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 agreed t...
5,608
41.172932
113
py
Squeezeformer
Squeezeformer-main/src/models/conformer.py
import tensorflow as tf from tensorflow.python.keras.utils import losses_utils from tensorflow.python.framework import ops from tensorflow.python.eager import def_function from .ctc import CtcModel from .conformer_encoder import ConformerEncoder from ..augmentations.augmentation import SpecAugmentation from ..utils im...
9,029
39.493274
160
py
Squeezeformer
Squeezeformer-main/src/models/submodules/multihead_attention.py
# Copyright 2020 Huy Le Nguyen (@usimarit) # # 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 agreed t...
10,251
37.397004
116
py
Squeezeformer
Squeezeformer-main/src/models/submodules/time_reduction.py
import tensorflow as tf from ...utils import shape_util class TimeReductionLayer(tf.keras.layers.Layer): def __init__( self, input_dim, output_dim, kernel_size=5, stride=2, dropout=0.0, name="time_reduction", **kwargs, ): super(TimeReducti...
2,287
42.169811
101
py
Squeezeformer
Squeezeformer-main/src/models/submodules/subsampling.py
# Copyright 2020 Huy Le Nguyen (@usimarit) # # 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 agreed t...
4,228
43.989362
108
py
Squeezeformer
Squeezeformer-main/src/models/submodules/glu.py
# Copyright 2020 Huy Le Nguyen (@usimarit) # # 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 agreed t...
1,132
31.371429
74
py
Squeezeformer
Squeezeformer-main/src/models/submodules/positional_encoding.py
# Copyright 2020 Huy Le Nguyen (@usimarit) # # 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 agreed t...
1,965
38.32
104
py
Squeezeformer
Squeezeformer-main/src/augmentations/augmentation.py
# Copyright 2020 Huy Le Nguyen (@usimarit) # # 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 agreed t...
3,294
38.698795
109
py
Squeezeformer
Squeezeformer-main/src/featurizers/speech_featurizers.py
# Copyright 2020 Huy Le Nguyen (@usimarit) and Huy Phan (@pquochuy) # # 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 a...
9,943
36.104478
122
py