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 |
|---|---|---|---|---|---|---|
pyUSID-legacy | pyUSID-master-legacy/tests/io/data_utils.py | from __future__ import division, print_function, unicode_literals, absolute_import
import os
import sys
import socket
from warnings import warn
import h5py
import numpy as np
from io import StringIO
from contextlib import contextmanager
from platform import platform
from sidpy.hdf.hdf_utils import get_attr
from sidpy.... | 25,569 | 44.336879 | 130 | py |
pyUSID-legacy | pyUSID-master-legacy/tests/io/test_dimension.py | # -*- coding: utf-8 -*-
"""
Created on Tue Nov 3 15:07:16 2017
@author: Suhas Somnath
"""
from __future__ import division, print_function, unicode_literals, absolute_import
import sys
import unittest
import numpy as np
from pyUSID.io import dimension
if sys.version_info.major == 3:
unicode = str
class TestDim... | 4,008 | 32.974576 | 100 | py |
pyUSID-legacy | pyUSID-master-legacy/tests/io/__init__.py | 0 | 0 | 0 | py | |
pyUSID-legacy | pyUSID-master-legacy/tests/io/test_reg_ref.py | # -*- coding: utf-8 -*-
"""
Created on Fri Jun 29 15:07:16 2018
@author: Suhas Somnath
"""
from __future__ import division, print_function, unicode_literals, absolute_import
import unittest
import os
import sys
import h5py
import numpy as np
from . import data_utils
sys.path.append("../../pyUSID/")
from pyUSID.io.hd... | 810 | 19.275 | 82 | py |
pyUSID-legacy | pyUSID-master-legacy/tests/io/simple_process.py | """
Simple process class for purpose of testing.
Created on: Jul 19, 2019
Author: Emily Costa
"""
import h5py
from pyUSID.processing.process import Process
import numpy as np
from pyUSID import hdf_utils
import matplotlib.pyplot as plt
class SimpleProcess(Process):
def __init__(self, h5_main, verbose=True, **kwar... | 2,354 | 38.915254 | 149 | py |
pyUSID-legacy | pyUSID-master-legacy/tests/io/hdf_utils/test_simple.py | # -*- coding: utf-8 -*-
"""
Created on Tue Nov 3 15:07:16 2017
@author: Suhas Somnath
"""
from __future__ import division, print_function, unicode_literals, absolute_import
import unittest
import os
import sys
import h5py
import numpy as np
import shutil
sys.path.append("../../pyUSID/")
from pyUSID.io import hdf_uti... | 77,720 | 48.566964 | 127 | py |
pyUSID-legacy | pyUSID-master-legacy/tests/io/hdf_utils/__init__.py | 0 | 0 | 0 | py | |
pyUSID-legacy | pyUSID-master-legacy/tests/io/hdf_utils/test_model.py | # -*- coding: utf-8 -*-
"""
Created on Tue Nov 3 15:07:16 2017
@author: Suhas Somnath
"""
from __future__ import division, print_function, unicode_literals, absolute_import
import unittest
import os
import sys
import h5py
import numpy as np
import dask.array as da
import shutil
sys.path.append("../../pyUSID/")
from ... | 48,034 | 46.79602 | 133 | py |
pyUSID-legacy | pyUSID-master-legacy/tests/io/hdf_utils/test_base.py | # -*- coding: utf-8 -*-
"""
Created on Tue Nov 3 15:07:16 2017
@author: Suhas Somnath
"""
from __future__ import division, print_function, unicode_literals, absolute_import
import unittest
import os
import sys
import h5py
import numpy as np
sys.path.append("../../pyUSID/")
from pyUSID.io import hdf_utils
from .. im... | 19,421 | 36.785992 | 102 | py |
pyUSID-legacy | pyUSID-master-legacy/tests/processing/__init__.py | 0 | 0 | 0 | py | |
pyUSID-legacy | pyUSID-master-legacy/tests/processing/test_process.py | # -*- coding: utf-8 -*-
# -*- coding: utf-8 -*-
"""
Created on Tue Nov 3 15:07:16 2017
@author: Suhas Somnath
"""
from __future__ import division, print_function, unicode_literals, absolute_import
import unittest
from ..io import data_utils
from ..io.data_utils import *
sys.path.append("../../../pyUSID/")
import pyUS... | 22,925 | 39.150613 | 161 | py |
pyUSID-legacy | pyUSID-master-legacy/docs/source/conf.py | # -*- coding: utf-8 -*-
#
# Configuration file for the Sphinx documentation builder.
#
# This file does only contain a selection of the most common options. For a
# full list see the documentation:
# http://www.sphinx-doc.org/en/master/config
# -- Path setup ------------------------------------------------------------... | 14,888 | 32.160356 | 124 | py |
pyUSID-legacy | pyUSID-master-legacy/notebooks/user_guide/supporting_docs/peak_finding.py | from __future__ import division, print_function, absolute_import, unicode_literals
import numpy as np
from scipy.signal import find_peaks_cwt
def find_all_peaks(vector, width_bounds, num_steps=20, **kwargs):
"""
This is the function that will be mapped by multiprocess. This is a wrapper around the scipy func... | 1,077 | 32.6875 | 106 | py |
few-shot-hypernets-public | few-shot-hypernets-public-master/test_regression.py | import torch
import torch.nn as nn
import torch.optim as optim
import configs
from data.qmul_loader import get_batch, train_people, test_people
from io_utils import parse_args_regression, get_resume_file
from methods.DKT_regression import DKT
from methods.feature_transfer_regression import FeatureTransfer
import backbo... | 1,301 | 31.55 | 114 | py |
few-shot-hypernets-public | few-shot-hypernets-public-master/test.py | from pathlib import Path
import torch
import numpy as np
import random
import torch.optim
import torch.utils.data.sampler
import os
import time
from typing import Type
import configs
import backbone
import data.feature_loader as feat_loader
from data.datamgr import SetDataManager
from methods.baselinefinetune import ... | 11,323 | 40.028986 | 195 | py |
few-shot-hypernets-public | few-shot-hypernets-public-master/test_uncertainty.py | import torch
import numpy as np
import random
from torch.autograd import Variable
import torch.nn as nn
import torch.optim
import json
import torch.utils.data.sampler
import os
import glob
import time
import configs
import backbone
import data.feature_loader as feat_loader
from data.datamgr import SetDataManager
from ... | 11,741 | 43.309434 | 127 | py |
few-shot-hypernets-public | few-shot-hypernets-public-master/utils.py | import torch
import numpy as np
def one_hot(y, num_class):
return torch.zeros((len(y), num_class)).scatter_(1, y.unsqueeze(1), 1)
def DBindex(cl_data_file):
class_list = cl_data_file.keys()
cl_num= len(class_list)
cl_means = []
stds = []
DBs = []
for cl in class_list:
cl_m... | 1,052 | 31.90625 | 102 | py |
few-shot-hypernets-public | few-shot-hypernets-public-master/backbone.py | # This code is modified from https://github.com/facebookresearch/low-shot-shrink-hallucinate
import torch
import torch.nn as nn
import math
import torch.nn.functional as F
from torch.nn.utils.weight_norm import WeightNorm
# Basic ResNet model
def init_layer(L):
# Initialization using fan-in
if isinstance(L, n... | 21,085 | 35.355172 | 206 | py |
few-shot-hypernets-public | few-shot-hypernets-public-master/train_regression.py | import torch
import torch.nn as nn
import torch.optim as optim
import configs
from data.qmul_loader import get_batch, train_people, test_people
from io_utils import parse_args_regression, get_resume_file
from methods.DKT_regression import DKT
from methods.feature_transfer_regression import FeatureTransfer
import backbo... | 1,334 | 32.375 | 114 | py |
few-shot-hypernets-public | few-shot-hypernets-public-master/hn_args.py | from argparse import ArgumentParser
from methods.hypernets.hypernet_poc import ALLOWED_AGGREGATIONS
def add_hn_args_to_parser(parser: ArgumentParser) -> ArgumentParser:
hypershot_args = parser.add_argument_group("HyperShot-related arguments")
hypershot_args.add_argument('--hn_adaptation_strategy', type=str, ... | 8,176 | 102.506329 | 191 | py |
few-shot-hypernets-public | few-shot-hypernets-public-master/metrics_explorer.py | # run with:
# streamlit run metrics_explorer.py
from typing import Tuple, Dict, List, Union, Any
import numpy as np
import streamlit as st
from pathlib import Path
import json
import pandas as pd
import matplotlib.pyplot as plt
import seaborn as sns
import altair as alt
import base64
from collections import defaultdic... | 4,036 | 33.211864 | 124 | py |
few-shot-hypernets-public | few-shot-hypernets-public-master/save_features.py | import numpy as np
import torch
from torch.autograd import Variable
import os
import glob
import h5py
import configs
import backbone
from data.datamgr import SimpleDataManager
from methods.baselinetrain import BaselineTrain
from methods.baselinefinetune import BaselineFinetune
from methods.hypernets import hypernet_ty... | 5,138 | 35.707143 | 178 | py |
few-shot-hypernets-public | few-shot-hypernets-public-master/train.py | import json
import sys
from collections import defaultdict
from typing import Type, List, Union, Dict, Optional
from copy import deepcopy
import numpy as np
import torch
import random
from neptune.new import Run
import torch.optim
import torch.optim.lr_scheduler as lr_scheduler
import os
import configs
import backbon... | 21,822 | 42.733467 | 186 | py |
few-shot-hypernets-public | few-shot-hypernets-public-master/configs.py | save_dir = './save/'
data_dir = {}
data_dir['CUB'] = './filelists/CUB/'
data_dir['miniImagenet'] = './filelists/miniImagenet/'
data_dir['omniglot'] = './filelists/omniglot/'
data_dir['emnist'] = './filelists/emnist/'
kernel_type = 'bncossim' #'nn' #linea... | 395 | 48.5 | 127 | py |
few-shot-hypernets-public | few-shot-hypernets-public-master/io_utils.py | import sys
from pathlib import Path
import neptune.new as neptune
import numpy as np
import os
import glob
import argparse
from neptune.new import Run
import backbone
import configs
import hn_args
from methods.hypernets import hypernet_types
model_dict = dict(
Conv4 = backbone.Conv4,
Conv4Po... | 10,149 | 58.705882 | 283 | py |
few-shot-hypernets-public | few-shot-hypernets-public-master/methods/relationnet.py | # This code is modified from https://github.com/floodsung/LearningToCompare_FSL
import backbone
import torch
import torch.nn as nn
from torch.autograd import Variable
import numpy as np
import torch.nn.functional as F
from methods.meta_template import MetaTemplate
import utils
class RelationNet(MetaTemplate):
de... | 6,459 | 40.677419 | 170 | py |
few-shot-hypernets-public | few-shot-hypernets-public-master/methods/kernels.py | import gpytorch
import torch
import torch.nn as nn
class NNKernel(nn.Module):
def __init__(self, input_dim: int, output_dim: int, num_layers: int, hidden_dim: int, flatten: bool =False, **kwargs):
super().__init__()
self.input_dim = input_dim
self.output_dim = output_dim
self.num_l... | 11,422 | 37.591216 | 122 | py |
few-shot-hypernets-public | few-shot-hypernets-public-master/methods/maml.py | # This code is modified from https://github.com/dragen1860/MAML-Pytorch and https://github.com/katerakelly/pytorch-maml
import torch
import backbone
import numpy as np
import torch.nn as nn
from torch.autograd import Variable
from methods.meta_template import MetaTemplate
from time import time
class MAML(MetaTempla... | 6,570 | 39.312883 | 176 | py |
few-shot-hypernets-public | few-shot-hypernets-public-master/methods/meta_template.py | from collections import defaultdict
from typing import Tuple
import backbone
import torch
import torch.nn as nn
from torch.autograd import Variable
import numpy as np
import torch.nn.functional as F
import utils
from abc import abstractmethod
class MetaTemplate(nn.Module):
def __init__(self, model_func, n_way, n_... | 5,764 | 36.679739 | 140 | py |
few-shot-hypernets-public | few-shot-hypernets-public-master/methods/DKT.py | ## Original packages
import backbone
import torch
import torch.nn as nn
from torch.autograd import Variable
import numpy as np
import torch.nn.functional as F
from methods.meta_template import MetaTemplate
## Our packages
import gpytorch
from time import gmtime, strftime
import random
from configs import kernel_type
f... | 20,017 | 50.328205 | 251 | py |
few-shot-hypernets-public | few-shot-hypernets-public-master/methods/protonet.py | # This code is modified from https://github.com/jakesnell/prototypical-networks
import backbone
import torch
import torch.nn as nn
from torch.autograd import Variable
import numpy as np
import torch.nn.functional as F
from methods.meta_template import MetaTemplate
class ProtoNet(MetaTemplate):
def __init__(self,... | 1,434 | 27.7 | 112 | py |
few-shot-hypernets-public | few-shot-hypernets-public-master/methods/baselinetrain.py | import backbone
import utils
import torch
import torch.nn as nn
from torch.autograd import Variable
import numpy as np
import torch.nn.functional as F
class BaselineTrain(nn.Module):
def __init__(self, model_func, num_class, loss_type = 'softmax'):
super(BaselineTrain, self).__init__()
self.featur... | 1,780 | 32.603774 | 124 | py |
few-shot-hypernets-public | few-shot-hypernets-public-master/methods/baselinefinetune.py | import backbone
import torch
import torch.nn as nn
from torch.autograd import Variable
import numpy as np
import torch.nn.functional as F
from methods.meta_template import MetaTemplate
class BaselineFinetune(MetaTemplate):
def __init__(self, model_func, n_way, n_support, loss_type = "softmax"):
super(Base... | 2,381 | 39.372881 | 124 | py |
few-shot-hypernets-public | few-shot-hypernets-public-master/methods/kernel_convolutions.py | import torch
import torch.nn as nn
class KernelConv(nn.Module):
def __init__(self, n_shot, hn_kernel_convolution_output_dim):
super(KernelConv, self).__init__()
if n_shot == 5:
self.conv = nn.Sequential(
nn.Conv2d(1, 2, kernel_size=(5, 5)),
nn.ReLU(inpla... | 1,174 | 34.606061 | 78 | py |
few-shot-hypernets-public | few-shot-hypernets-public-master/methods/transformer.py | import math
import torch
import torch.nn as nn
import torch.nn.functional as F
def scaled_dot_product(q, k, v, mask=None):
d_k = q.size()[-1]
attn_logits = torch.matmul(q, k.transpose(-2, -1))
attn_logits = attn_logits / math.sqrt(d_k)
if mask is not None:
attn_logits = attn_logits.masked_fill... | 4,046 | 32.172131 | 98 | py |
few-shot-hypernets-public | few-shot-hypernets-public-master/methods/feature_transfer_regression.py | import numpy as np
import gpytorch
import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.optim as optim
import backbone
from torch.autograd import Variable
from data.qmul_loader import get_batch, train_people, test_people
class Regressor(nn.Module):
def __init__(self):
super(Regre... | 3,110 | 33.955056 | 123 | py |
few-shot-hypernets-public | few-shot-hypernets-public-master/methods/__init__.py | from . import meta_template
from . import baselinetrain
from . import baselinefinetune
from . import matchingnet
from . import protonet
from . import relationnet
from . import maml
from . import transformer
from . import kernels
from . import kernel_convolutions | 263 | 25.4 | 33 | py |
few-shot-hypernets-public | few-shot-hypernets-public-master/methods/DKT_regression.py | ## Original packages
import backbone
import torch
import torch.nn as nn
from torch.autograd import Variable
import numpy as np
import math
import torch.nn.functional as F
## Our packages
import gpytorch
from time import gmtime, strftime
import random
from statistics import mean
from data.qmul_loader import get_batch, ... | 4,900 | 36.7 | 130 | py |
few-shot-hypernets-public | few-shot-hypernets-public-master/methods/matchingnet.py | # This code is modified from https://github.com/facebookresearch/low-shot-shrink-hallucinate
import backbone
import torch
import torch.nn as nn
from torch.autograd import Variable
import numpy as np
import torch.nn.functional as F
from methods.meta_template import MetaTemplate
import utils
import copy
class MatchingN... | 3,749 | 35.764706 | 199 | py |
few-shot-hypernets-public | few-shot-hypernets-public-master/methods/hypernets/hypernet_kernel.py | from copy import deepcopy
from typing import Optional, Tuple
import torch
from torch import nn
from methods.hypernets import HyperNetPOC
from methods.hypernets.utils import set_from_param_dict, accuracy_from_scores
from methods.kernel_convolutions import KernelConv
from methods.kernels import init_kernel_function
fro... | 13,719 | 43.983607 | 131 | py |
few-shot-hypernets-public | few-shot-hypernets-public-master/methods/hypernets/hypermaml.py | from collections import defaultdict
from copy import deepcopy
from time import time
import numpy as np
import torch
from torch import nn as nn
from torch.autograd import Variable
from torch.nn import functional as F
import backbone
from methods.hypernets.utils import get_param_dict, accuracy_from_scores
from methods.... | 23,248 | 39.503484 | 147 | py |
few-shot-hypernets-public | few-shot-hypernets-public-master/methods/hypernets/utils.py | from typing import Dict
import numpy as np
import torch
from torch import nn
def get_param_dict(net: nn.Module) -> Dict[str, nn.Parameter]:
"""A dict of named parameters of an nn.Module"""
return {
n: p
for (n, p) in net.named_parameters()
}
def set_from_param_dict(module: nn.Module, pa... | 2,398 | 31.418919 | 110 | py |
few-shot-hypernets-public | few-shot-hypernets-public-master/methods/hypernets/hypernet_poc.py | from collections import defaultdict
from copy import deepcopy
from typing import Dict, Optional
import numpy as np
import torch
from torch import nn
from torch.utils.data import DataLoader
from methods.hypernets.utils import get_param_dict, set_from_param_dict, SinActivation, accuracy_from_scores
from methods.meta_te... | 18,022 | 41.607565 | 180 | py |
few-shot-hypernets-public | few-shot-hypernets-public-master/methods/hypernets/__init__.py | from methods.hypernets.hypernet_poc import HyperNetPOC, HypernetPPA
from methods.hypernets.hypernet_kernel import HyperShot
hypernet_types = {
"hyper_shot": HyperShot,
"hn_ppa": HypernetPPA,
"hn_poc": HyperNetPOC
} | 226 | 31.428571 | 67 | py |
few-shot-hypernets-public | few-shot-hypernets-public-master/methods/hypernets/bayeshmaml.py | from copy import deepcopy
import numpy as np
import torch
from torch import nn as nn
from torch.autograd import Variable
from torch.nn import functional as F
import backbone
from methods.hypernets.utils import get_param_dict, kl_diag_gauss_with_standard_gauss, \
reparameterize
from methods.hypernets.hypermaml impo... | 20,114 | 41.08159 | 147 | py |
few-shot-hypernets-public | few-shot-hypernets-public-master/models/gp_kernels.py | import gpytorch
import torch
import torch.nn as nn
import numpy as np
class NNKernel(gpytorch.kernels.Kernel):
def __init__(self, input_dim, output_dim, num_layers, hidden_dim, flatten=False, **kwargs):
super(NNKernel, self).__init__(**kwargs)
self.input_dim = input_dim
self.output_dim = ... | 8,368 | 39.429952 | 118 | py |
few-shot-hypernets-public | few-shot-hypernets-public-master/models/__init__.py | 0 | 0 | 0 | py | |
few-shot-hypernets-public | few-shot-hypernets-public-master/filelists/QMUL/write_QMUL_filelist.py | import numpy as np
from os import listdir
from os.path import isfile, isdir, join
import os
import json
import random
from tqdm import tqdm
from PIL import Image
cwd = os.getcwd()
data_path = join(cwd,'QMUL_360degreeViewSphere_FaceDatabase/Set1_Greyscale')
folder_list = [f for f in listdir(data_path) if isdir(join(d... | 3,153 | 31.854167 | 138 | py |
few-shot-hypernets-public | few-shot-hypernets-public-master/filelists/omniglot/write_cross_char_base_filelist.py | import numpy as np
from os import listdir
from os.path import isfile, isdir, join
import os
import json
import random
import re
cwd = os.getcwd()
data_path = join(cwd,'images')
savedir = './'
#if not os.path.exists(savedir):
# os.makedirs(savedir)
cl = -1
folderlist = []
language_folder_list = [f for f in listd... | 1,885 | 28.015385 | 171 | py |
few-shot-hypernets-public | few-shot-hypernets-public-master/filelists/omniglot/write_omniglot_filelist.py | import numpy as np
from os import listdir
from os.path import isfile, isdir, join
import os
import json
import random
import re
cwd = os.getcwd()
data_path = join(cwd,'images')
savedir = './'
dataset_list = ['base', 'val', 'novel']
#if not os.path.exists(savedir):
# os.makedirs(savedir)
cl = -1
folderlist = []
... | 1,755 | 28.266667 | 110 | py |
few-shot-hypernets-public | few-shot-hypernets-public-master/filelists/omniglot/rot_omniglot.py | import numpy as np
from os import listdir
from os.path import isfile, isdir, join
import os
import json
import random
from PIL import Image
cwd = os.getcwd()
data_path = join(cwd,'images')
savedir = './'
#if not os.path.exists(savedir):
# os.makedirs(savedir)
language_folder_list = [f for f in listdir(data_path)... | 1,413 | 36.210526 | 133 | py |
few-shot-hypernets-public | few-shot-hypernets-public-master/filelists/miniImagenet/write_miniImagenet_filelist.py | import numpy as np
from os import listdir
from os.path import isfile, isdir, join
import os
import json
import random
import re
#cwd = os.getcwd()
#data_path = join(cwd,'ILSVRC2015/Data/CLS-LOC/train')
data_path = '/shared/sets/datasets/vision/ImageNet/train'
savedir = './'
dataset_list = ['base', 'val', 'novel']
#i... | 2,359 | 31.777778 | 118 | py |
few-shot-hypernets-public | few-shot-hypernets-public-master/filelists/miniImagenet/write_cross_filelist.py | import numpy as np
from os import listdir
from os.path import isfile, isdir, join
import os
import json
import random
import re
#cwd = os.getcwd()
#data_path = join(cwd,'ILSVRC2015/Data/CLS-LOC/train')
data_path = '/shared/sets/datasets/vision/ImageNet/train'
savedir = './'
dataset_list = ['base', 'val', 'novel']
#i... | 2,472 | 32.418919 | 118 | py |
few-shot-hypernets-public | few-shot-hypernets-public-master/filelists/CUB/write_CUB_filelist.py | import numpy as np
from os import listdir
from os.path import isfile, isdir, join
import os
import json
import random
#cwd = os.getcwd()
#data_path = join(cwd,'CUB_200_2011/images')
data_path = '/shared/sets/datasets/cub_birds/images'
savedir = './'
dataset_list = ['base','val','novel']
#if not os.path.exists(savedi... | 2,151 | 31.119403 | 138 | py |
few-shot-hypernets-public | few-shot-hypernets-public-master/filelists/emnist/invert_emnist.py | import numpy as np
from os import listdir
from os.path import isfile, isdir, join
import os
import json
import random
from PIL import Image
import PIL.ImageOps
cwd = os.getcwd()
data_path = join(cwd,'emnist')
inv_data_path = join(cwd,'inv_emnist')
savedir = './'
#if not os.path.exists(savedir):
# os.makedirs(save... | 1,105 | 32.515152 | 129 | py |
few-shot-hypernets-public | few-shot-hypernets-public-master/filelists/emnist/write_cross_char_valnovel_filelist.py | import numpy as np
from os import listdir
from os.path import isfile, isdir, join
import os
import json
import random
cwd = os.getcwd()
data_path = join(cwd,'inv_emnist')
savedir = './'
dataset_list = ['val','novel']
#if not os.path.exists(savedir):
# os.makedirs(savedir)
folder_list = [str(i) for i in range(62)... | 1,841 | 29.7 | 138 | py |
few-shot-hypernets-public | few-shot-hypernets-public-master/data/additional_transforms.py | # Copyright 2017-present, Facebook, Inc.
# All rights reserved.
#
# This source code is licensed under the license found in the
# LICENSE file in the root directory of this source tree.
import torch
from PIL import ImageEnhance
transformtypedict=dict(Brightness=ImageEnhance.Brightness, Contrast=ImageEnhance.Contrast... | 850 | 24.787879 | 150 | py |
few-shot-hypernets-public | few-shot-hypernets-public-master/data/feature_loader.py | import torch
import numpy as np
import h5py
class SimpleHDF5Dataset:
def __init__(self, file_handle = None):
if file_handle == None:
self.f = ''
self.all_feats_dset = []
self.all_labels = []
self.total = 0
else:
self.f = file_handle
... | 1,293 | 27.755556 | 78 | py |
few-shot-hypernets-public | few-shot-hypernets-public-master/data/dataset.py | # This code is modified from https://github.com/facebookresearch/low-shot-shrink-hallucinate
import torch
from PIL import Image
import json
import numpy as np
import torchvision.transforms as transforms
import os
identity = lambda x:x
class SimpleDataset:
def __init__(self, data_file, transform, target_transform=i... | 2,913 | 31.741573 | 108 | py |
few-shot-hypernets-public | few-shot-hypernets-public-master/data/datamgr.py | # This code is modified from https://github.com/facebookresearch/low-shot-shrink-hallucinate
import torch
from PIL import Image
import numpy as np
import torchvision.transforms as transforms
import data.additional_transforms as add_transforms
from data.dataset import SimpleDataset, SetDataset, EpisodicBatchSampler
fro... | 3,560 | 38.566667 | 118 | py |
few-shot-hypernets-public | few-shot-hypernets-public-master/data/__init__.py | from . import datamgr
from . import dataset
from . import additional_transforms
from . import feature_loader
| 109 | 21 | 35 | py |
few-shot-hypernets-public | few-shot-hypernets-public-master/data/qmul_loader.py | import torch
import torch.nn as nn
import torch.nn.functional as F
import numpy as np
from torch.autograd import Variable
import torchvision.transforms as transforms
from PIL import Image
train_people = ['DennisPNoGlassesGrey','JohnGrey','SimonBGrey','SeanGGrey','DanJGrey','AdamBGrey','JackGrey','RichardHGrey','Yongmi... | 2,209 | 35.833333 | 347 | py |
AICare | AICare-main/AICare.py | class Sparsemax(nn.Module):
"""Sparsemax function."""
def __init__(self, dim=None):
super(Sparsemax, self).__init__()
self.dim = -1 if dim is None else dim
def forward(self, input, device='cuda'):
original_size = input.size()
input = input.view(-1, input.size(self.dim))
... | 19,067 | 42.042889 | 195 | py |
prob-alpha | prob-alpha-master/src/Shape.py | """
A `Shape` represents a topological tree. The data structure implemented here is of recursive type: a `Shape` can be either
a leaf or a list of `Shape` objects. Leaves are not distinguishable, but we know that they are leaves.
We choose a sorted shape to be the class representant of all shapes isomorphic to it.
In o... | 7,393 | 32.156951 | 132 | py |
prob-alpha | prob-alpha-master/src/PhyloTree.py | """
For us, a Phylogenetic Tree (a `PhyloTree` instance) is a special case of Shape in which labels of leaves can be distinguished.
We import modules Shape.py and newick.py; the latter will be used for reading Newick code in string format and turning it
into trees; it can be found in https://github.com/glottobank/pytho... | 4,022 | 31.707317 | 127 | py |
prob-alpha | prob-alpha-master/src/newick.py | # coding: utf8
"""
Functionality to read and write the Newick serialization format for trees.
.. seealso:: https://en.wikipedia.org/wiki/Newick_format
"""
from __future__ import unicode_literals
import io
import re
RESERVED_PUNCTUATION = ':;,()'
COMMENT = re.compile('\[[^\]]*\]')
def length_parser(x):
return f... | 12,861 | 31.979487 | 90 | py |
prob-alpha | prob-alpha-master/src/Probs.py | """
This module computes the probabilities and functions defined in the article, for binary trees only.
In order to do that, we need to import these modules.
Variable `a` represents the alpha in Ford's Alpha model.
"""
from __future__ import division
import Shape, PhyloTree, newick
from sage.all import *
from sympy imp... | 5,462 | 35.178808 | 132 | py |
bioselector | bioselector-master/scripts/addAggregator.py | import sys
import json
from efsassembler import ScriptsManager
args = sys.argv[1]
input_data = json.loads(args)
personalized_aggregator_path = input_data[0]
sm = ScriptsManager()
sm.add_aggregation_algorithm(personalized_aggregator_path)
print("Aggregator added:", personalized_aggregator_path)
sys.stdout.flush() | 317 | 21.714286 | 58 | py |
bioselector | bioselector-master/scripts/addSelector.py | import sys
import json
from efsassembler import ScriptsManager
args = sys.argv[1]
input_data = json.loads(args)
personalized_selector_path = input_data[0]
sm = ScriptsManager()
sm.add_fs_algorithm(personalized_selector_path)
print("Selector added:", personalized_selector_path)
sys.stdout.flush() | 300 | 20.5 | 52 | py |
bioselector | bioselector-master/scripts/runExperiments.py | import sys
import json
import rpy2.robjects.packages as rpackages
from efsassembler import Experiments
args = sys.argv[1]
input_data = json.loads(args)
experiments = input_data[0]
results_path = input_data[1]
exp = Experiments(experiments, results_path)
exp.run() | 266 | 19.538462 | 44 | py |
GANFingerprints | GANFingerprints-master/classifier/tfutil.py | # Copyright (c) 2018, NVIDIA CORPORATION. All rights reserved.
#
# This work is licensed under the Creative Commons Attribution-NonCommercial
# 4.0 International License. To view a copy of this license, visit
# http://creativecommons.org/licenses/by-nc/4.0/ or send a letter to
# Creative Commons, PO Box 1866, Mountain ... | 37,226 | 48.438247 | 154 | py |
GANFingerprints | GANFingerprints-master/classifier/legacy.py | # Copyright (c) 2018, NVIDIA CORPORATION. All rights reserved.
#
# This work is licensed under the Creative Commons Attribution-NonCommercial
# 4.0 International License. To view a copy of this license, visit
# http://creativecommons.org/licenses/by-nc/4.0/ or send a letter to
# Creative Commons, PO Box 1866, Mountain ... | 5,249 | 43.491525 | 122 | py |
GANFingerprints | GANFingerprints-master/classifier/loss.py | # Copyright (c) 2018, NVIDIA CORPORATION. All rights reserved.
#
# This work is licensed under the Creative Commons Attribution-NonCommercial
# 4.0 International License. To view a copy of this license, visit
# http://creativecommons.org/licenses/by-nc/4.0/ or send a letter to
# Creative Commons, PO Box 1866, Mountain... | 1,183 | 37.193548 | 114 | py |
GANFingerprints | GANFingerprints-master/classifier/misc.py | # Copyright (c) 2018, NVIDIA CORPORATION. All rights reserved.
#
# This work is licensed under the Creative Commons Attribution-NonCommercial
# 4.0 International License. To view a copy of this license, visit
# http://creativecommons.org/licenses/by-nc/4.0/ or send a letter to
# Creative Commons, PO Box 1866, Mountain ... | 14,955 | 36.111663 | 177 | py |
GANFingerprints | GANFingerprints-master/classifier/dataset.py | # Copyright (c) 2018, NVIDIA CORPORATION. All rights reserved.
#
# This work is licensed under the Creative Commons Attribution-NonCommercial
# 4.0 International License. To view a copy of this license, visit
# http://creativecommons.org/licenses/by-nc/4.0/ or send a letter to
# Creative Commons, PO Box 1866, Mountain ... | 12,112 | 49.053719 | 134 | py |
GANFingerprints | GANFingerprints-master/classifier/networks.py | # Copyright (c) 2018, NVIDIA CORPORATION. All rights reserved.
#
# This work is licensed under the Creative Commons Attribution-NonCommercial
# 4.0 International License. To view a copy of this license, visit
# http://creativecommons.org/licenses/by-nc/4.0/ or send a letter to
# Creative Commons, PO Box 1866, Mountain ... | 13,945 | 52.43295 | 202 | py |
GANFingerprints | GANFingerprints-master/classifier/data_preparation.py | # Copyright (c) 2018, NVIDIA CORPORATION. All rights reserved.
#
# This work is licensed under the Creative Commons Attribution-NonCommercial
# 4.0 International License. To view a copy of this license, visit
# http://creativecommons.org/licenses/by-nc/4.0/ or send a letter to
# Creative Commons, PO Box 1866, Mountain ... | 7,445 | 47.350649 | 212 | py |
GANFingerprints | GANFingerprints-master/classifier/run.py | # Copyright (c) 2018, NVIDIA CORPORATION. All rights reserved.
#
# This work is licen sed under the Creative Commons Attribution-NonCommercial
# 4.0 International License. To view a copy of this license, visit
# http://creativecommons.org/licenses/by-nc/4.0/ or send a letter to
# Creative Commons, PO Box 1866, Mountain... | 18,514 | 52.822674 | 177 | py |
GANFingerprints | GANFingerprints-master/classifier/config.py | # Copyright (c) 2018, NVIDIA CORPORATION. All rights reserved.
#
# This work is licensed under the Creative Commons Attribution-NonCommercial
# 4.0 International License. To view a copy of this license, visit
# http://creativecommons.org/licenses/by-nc/4.0/ or send a letter to
# Creative Commons, PO Box 1866, Mountain ... | 4,057 | 63.412698 | 337 | py |
GANFingerprints | GANFingerprints-master/classifier/custom_vgg19.py | import os, inspect
import tensorflow as tf
import numpy as np
import time
from tensorflow_vgg import vgg19
VGG_MEAN = [103.939, 116.779, 123.68]
def loadWeightsData(vgg19_npy_path=None):
if vgg19_npy_path is None:
path = inspect.getfile(Vgg19)
path = os.path.abspath(os.path.join(path, os.pardir))... | 2,618 | 35.887324 | 74 | py |
GANFingerprints | GANFingerprints-master/classifier/util_scripts.py | # Copyright (c) 2018, NVIDIA CORPORATION. All rights reserved.
#
# This work is licensed under the Creative Commons Attribution-NonCommercial
# 4.0 International License. To view a copy of this license, visit
# http://creativecommons.org/licenses/by-nc/4.0/ or send a letter to
# Creative Commons, PO Box 1866, Mountain ... | 3,485 | 48.8 | 356 | py |
GANFingerprints | GANFingerprints-master/classifier/nets/inception_resnet_v2_test.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 ... | 14,119 | 44.25641 | 80 | py |
GANFingerprints | GANFingerprints-master/classifier/nets/mobilenet_v1_eval.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... | 4,826 | 30.54902 | 80 | py |
GANFingerprints | GANFingerprints-master/classifier/nets/pix2pix_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 applicable ... | 5,965 | 37 | 79 | py |
GANFingerprints | GANFingerprints-master/classifier/nets/mobilenet_v1_train.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... | 7,494 | 34.187793 | 80 | py |
GANFingerprints | GANFingerprints-master/classifier/nets/resnet_v1_test.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 ... | 24,143 | 42.42446 | 80 | py |
GANFingerprints | GANFingerprints-master/classifier/nets/vgg_test.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 ... | 23,141 | 38.626712 | 80 | py |
GANFingerprints | GANFingerprints-master/classifier/nets/resnet_v1.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 ... | 16,861 | 43.845745 | 80 | py |
GANFingerprints | GANFingerprints-master/classifier/nets/cifarnet.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 applica... | 4,683 | 38.694915 | 80 | py |
GANFingerprints | GANFingerprints-master/classifier/nets/resnet_v2_test.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 ... | 20,356 | 41.766807 | 80 | py |
GANFingerprints | GANFingerprints-master/classifier/nets/inception.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 ... | 1,676 | 43.131579 | 80 | py |
GANFingerprints | GANFingerprints-master/classifier/nets/pix2pix.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 applicable ... | 9,439 | 31.21843 | 80 | py |
GANFingerprints | GANFingerprints-master/classifier/nets/nets_factory.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 applicable ... | 7,201 | 46.381579 | 80 | py |
GANFingerprints | GANFingerprints-master/classifier/nets/vgg.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 ... | 14,019 | 45.270627 | 80 | py |
GANFingerprints | GANFingerprints-master/classifier/nets/cyclegan.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... | 10,300 | 36.594891 | 80 | py |
GANFingerprints | GANFingerprints-master/classifier/nets/dcgan.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 applica... | 7,546 | 36.17734 | 80 | py |
GANFingerprints | GANFingerprints-master/classifier/nets/inception_v1_test.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 ... | 10,157 | 40.802469 | 80 | py |
GANFingerprints | GANFingerprints-master/classifier/nets/resnet_v2.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 ... | 15,466 | 44.760355 | 80 | py |
GANFingerprints | GANFingerprints-master/classifier/nets/inception_v4.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 ... | 16,409 | 47.550296 | 80 | py |
GANFingerprints | GANFingerprints-master/classifier/nets/inception_v3.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 ... | 28,320 | 47.82931 | 80 | py |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.