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
DEAT
DEAT-main/models/pnasnet.py
'''PNASNet in PyTorch. Paper: Progressive Neural Architecture Search ''' import torch import torch.nn as nn import torch.nn.functional as F class SepConv(nn.Module): '''Separable Convolution.''' def __init__(self, in_planes, out_planes, kernel_size, stride): super(SepConv, self).__init__() se...
4,258
32.801587
105
py
DEAT
DEAT-main/models/resnet.py
'''ResNet in PyTorch. For Pre-activation ResNet, see 'preact_resnet.py'. Reference: [1] Kaiming He, Xiangyu Zhang, Shaoqing Ren, Jian Sun Deep Residual Learning for Image Recognition. arXiv:1512.03385 ''' import torch import torch.nn as nn import torch.nn.functional as F class BasicBlock(nn.Module): expansi...
4,218
30.721805
83
py
DEAT
DEAT-main/models/mobilenetv2.py
'''MobileNetV2 in PyTorch. See the paper "Inverted Residuals and Linear Bottlenecks: Mobile Networks for Classification, Detection and Segmentation" for more details. ''' import torch import torch.nn as nn import torch.nn.functional as F class Block(nn.Module): '''expand + depthwise + pointwise''' def __init...
3,092
34.551724
114
py
DEAT
DEAT-main/models/vgg.py
'''VGG11/13/16/19 in Pytorch.''' import torch import torch.nn as nn cfg = { 'VGG11': [64, 'M', 128, 'M', 256, 256, 'M', 512, 512, 'M', 512, 512, 'M'], 'VGG13': [64, 64, 'M', 128, 128, 'M', 256, 256, 'M', 512, 512, 'M', 512, 512, 'M'], 'VGG16': [64, 64, 'M', 128, 128, 'M', 256, 256, 256, 'M', 512, 512, 512...
1,442
29.0625
117
py
DEAT
DEAT-main/models/densenet.py
'''DenseNet in PyTorch.''' import math import torch import torch.nn as nn import torch.nn.functional as F class Bottleneck(nn.Module): def __init__(self, in_planes, growth_rate): super(Bottleneck, self).__init__() self.bn1 = nn.BatchNorm2d(in_planes) self.conv1 = nn.Conv2d(in_planes, 4*gr...
3,542
31.805556
96
py
DEAT
DEAT-main/models/googlenet.py
'''GoogLeNet with PyTorch.''' import torch import torch.nn as nn import torch.nn.functional as F class Inception(nn.Module): def __init__(self, in_planes, n1x1, n3x3red, n3x3, n5x5red, n5x5, pool_planes): super(Inception, self).__init__() # 1x1 conv branch self.b1 = nn.Sequential( ...
3,221
28.833333
83
py
DEAT
DEAT-main/models/resnext.py
'''ResNeXt in PyTorch. See the paper "Aggregated Residual Transformations for Deep Neural Networks" for more details. ''' import torch import torch.nn as nn import torch.nn.functional as F class Block(nn.Module): '''Grouped convolution block.''' expansion = 2 def __init__(self, in_planes, cardinality=32...
3,478
35.239583
129
py
DEAT
DEAT-main/models/senet.py
'''SENet in PyTorch. SENet is the winner of ImageNet-2017. The paper is not released yet. ''' import torch import torch.nn as nn import torch.nn.functional as F class BasicBlock(nn.Module): def __init__(self, in_planes, planes, stride=1): super(BasicBlock, self).__init__() self.conv1 = nn.Conv2d(...
4,027
32.016393
102
py
DEAT
DEAT-main/models/shufflenet.py
'''ShuffleNet in PyTorch. See the paper "ShuffleNet: An Extremely Efficient Convolutional Neural Network for Mobile Devices" for more details. ''' import torch import torch.nn as nn import torch.nn.functional as F class ShuffleBlock(nn.Module): def __init__(self, groups): super(ShuffleBlock, self).__init...
3,542
31.209091
126
py
DEAT
DEAT-main/models/lenet.py
'''LeNet in PyTorch.''' import torch.nn as nn import torch.nn.functional as F class LeNet(nn.Module): def __init__(self): super(LeNet, self).__init__() self.conv1 = nn.Conv2d(3, 6, 5) self.conv2 = nn.Conv2d(6, 16, 5) self.fc1 = nn.Linear(16*5*5, 120) self.fc2 = nn.Linear...
699
28.166667
43
py
DEAT
DEAT-main/models/__init__.py
from .vgg import * from .dpn import * from .lenet import * from .senet import * from .pnasnet import * from .densenet import * from .googlenet import * from .shufflenet import * from .shufflenetv2 import * from .resnet import * from .resnext import * from .mobilenet import * from .mobilenetv2 import * from .efficientne...
353
21.125
27
py
DEAT
DEAT-main/models/mobilenet.py
'''MobileNet in PyTorch. See the paper "MobileNets: Efficient Convolutional Neural Networks for Mobile Vision Applications" for more details. ''' import torch import torch.nn as nn import torch.nn.functional as F class Block(nn.Module): '''Depthwise conv + Pointwise conv''' def __init__(self, in_planes, out_...
2,025
31.677419
123
py
DEAT
DEAT-main/models/dpn.py
'''Dual Path Networks in PyTorch.''' import torch import torch.nn as nn import torch.nn.functional as F class Bottleneck(nn.Module): def __init__(self, last_planes, in_planes, out_planes, dense_depth, stride, first_layer): super(Bottleneck, self).__init__() self.out_planes = out_planes sel...
3,562
34.989899
116
py
DEAT
DEAT-main/Positive_Negative_Momentum/pnm_optim/pnm.py
import math import torch from torch.optim.optimizer import Optimizer, required class PNM(Optimizer): r"""Implements Positive-Negative Momentum (PNM). It has be proposed in `Positive-Negative Momentum: Manipulating Stochastic Gradient Noise to Improve Generalization`__. Args: params (iter...
3,616
39.188889
121
py
DEAT
DEAT-main/Positive_Negative_Momentum/pnm_optim/__init__.py
from .pnm import * from .adapnm import * del pnm del adapnm
62
8
21
py
DEAT
DEAT-main/Positive_Negative_Momentum/pnm_optim/adapnm.py
import math import torch from torch.optim.optimizer import Optimizer, required class AdaPNM(Optimizer): r"""Implements Adaptive Positive-Negative Momentum. It has be proposed in `Positive-Negative Momentum: Manipulating Stochastic Gradient Noise to Improve Generalization`__. Arguments: ...
5,725
45.177419
106
py
DEAT
DEAT-main/Positive_Negative_Momentum/model/resnet.py
'''ResNet in PyTorch. The source code is adopted from: https://github.com/kuangliu/pytorch-cifar Reference: [1] Kaiming He, Xiangyu Zhang, Shaoqing Ren, Jian Sun Deep Residual Learning for Image Recognition. arXiv:1512.03385 ''' import torch import torch.nn as nn import torch.nn.functional as F class BasicBloc...
4,138
34.076271
102
py
DEAT
DEAT-main/Positive_Negative_Momentum/model/vgg.py
'''VGG11/13/16/19 in Pytorch. The source code is adopted from: https://github.com/kuangliu/pytorch-cifar ''' import torch import torch.nn as nn cfg = { 'VGG11': [64, 'M', 128, 'M', 256, 256, 'M', 512, 512, 'M', 512, 512, 'M'], 'VGG13': [64, 64, 'M', 128, 128, 'M', 256, 256, 'M', 512, 512, 'M', 512, 512, 'M']...
1,432
31.568182
117
py
DEAT
DEAT-main/Positive_Negative_Momentum/model/densenet.py
'''DenseNet in PyTorch. The source code is adopted from: https://github.com/kuangliu/pytorch-cifar ''' import math import torch import torch.nn as nn import torch.nn.functional as F class Bottleneck(nn.Module): def __init__(self, in_planes, growth_rate): super(Bottleneck, self).__init__() self....
3,707
33.981132
96
py
DEAT
DEAT-main/Positive_Negative_Momentum/model/googlenet.py
"""google net in pytorch The source code is adopted from: https://github.com/weiaicunzai/pytorch-cifar100/ [1] Christian Szegedy, Wei Liu, Yangqing Jia, Pierre Sermanet, Scott Reed, Dragomir Anguelov, Dumitru Erhan, Vincent Vanhoucke, Andrew Rabinovich. Going Deeper with Convolutions https://arxiv.org/a...
4,443
32.164179
94
py
DEAT
DEAT-main/Positive_Negative_Momentum/model/__init__.py
from .resnet import * from .vgg import * from .densenet import * from .googlenet import * del resnet del vgg del densenet del googlenet
139
10.666667
24
py
beta-tcvae
beta-tcvae-master/disentanglement_metrics.py
import math import os import torch from tqdm import tqdm from torch.utils.data import DataLoader from torch.autograd import Variable import lib.utils as utils from metric_helpers.loader import load_model_and_dataset from metric_helpers.mi_metric import compute_metric_shapes, compute_metric_faces def estimate_entropi...
8,678
34.863636
112
py
beta-tcvae
beta-tcvae-master/vae_quant.py
import os import time import math from numbers import Number import argparse import torch import torch.nn as nn import torch.optim as optim import visdom from torch.autograd import Variable from torch.utils.data import DataLoader import lib.dist as dist import lib.utils as utils import lib.datasets as dset from lib.fl...
18,265
36.975052
120
py
beta-tcvae
beta-tcvae-master/plot_latent_vs_true.py
import matplotlib matplotlib.use('Agg') import matplotlib.pyplot as plt import matplotlib.gridspec as gridspec import torch from torch.autograd import Variable from torch.utils.data import DataLoader import brewer2mpl bmap = brewer2mpl.get_map('Set1', 'qualitative', 3) colors = bmap.mpl_colors plt.style.use('ggplot') ...
8,973
36.864979
109
py
beta-tcvae
beta-tcvae-master/elbo_decomposition.py
import os import math from numbers import Number from tqdm import tqdm import torch from torch.autograd import Variable import lib.dist as dist import lib.flows as flows def estimate_entropies(qz_samples, qz_params, q_dist): """Computes the term: E_{p(x)} E_{q(z|x)} [-log q(z)] and E_{p(x)} E...
8,303
34.33617
109
py
beta-tcvae
beta-tcvae-master/metric_helpers/mi_metric.py
import torch metric_name = 'MIG' def MIG(mi_normed): return torch.mean(mi_normed[:, 0] - mi_normed[:, 1]) def compute_metric_shapes(marginal_entropies, cond_entropies): factor_entropies = [6, 40, 32, 32] mutual_infos = marginal_entropies[None] - cond_entropies mutual_infos = torch.sort(mutual_infos...
882
31.703704
83
py
beta-tcvae
beta-tcvae-master/metric_helpers/loader.py
import torch import lib.dist as dist import lib.flows as flows import vae_quant def load_model_and_dataset(checkpt_filename): print('Loading model and dataset.') checkpt = torch.load(checkpt_filename, map_location=lambda storage, loc: storage) args = checkpt['args'] state_dict = checkpt['state_dict'] ...
1,550
33.466667
115
py
beta-tcvae
beta-tcvae-master/lib/functions.py
import torch from torch.autograd import Function class STHeaviside(Function): @staticmethod def forward(ctx, x): y = torch.zeros(x.size()).type_as(x) y[x >= 0] = 1 return y @staticmethod def backward(ctx, grad_output): return grad_output
290
17.1875
44
py
beta-tcvae
beta-tcvae-master/lib/utils.py
from numbers import Number import math import torch import os def save_checkpoint(state, save, epoch): if not os.path.exists(save): os.makedirs(save) filename = os.path.join(save, 'checkpt-%04d.pth' % epoch) torch.save(state, filename) class AverageMeter(object): """Computes and stores the a...
1,828
23.716216
75
py
beta-tcvae
beta-tcvae-master/lib/datasets.py
import numpy as np import torch import torchvision.datasets as datasets import torchvision.transforms as transforms class Shapes(object): def __init__(self, dataset_zip=None): loc = 'data/dsprites_ndarray_co1sh3sc6or40x32y32_64x64.npz' if dataset_zip is None: self.dataset_zip = np.loa...
1,102
22.978261
75
py
beta-tcvae
beta-tcvae-master/lib/dist.py
import math import numpy as np import torch import torch.nn as nn import torch.nn.functional as F from torch.autograd import Variable from lib.functions import STHeaviside eps = 1e-8 class Normal(nn.Module): """Samples from a Normal distribution using the reparameterization trick. """ def __init__(self,...
8,542
32.501961
84
py
beta-tcvae
beta-tcvae-master/lib/flows.py
import torch import torch.nn as nn import torch.nn.functional as F from torch.autograd import Variable from lib.dist import Normal eps = 1e-8 class FactorialNormalizingFlow(nn.Module): def __init__(self, dim, nsteps): super(FactorialNormalizingFlow, self).__init__() self.dim = dim self....
1,405
30.244444
94
py
ewN2HDECAY
ewN2HDECAY-master/CommonFunctions.py
#!/usr/bin/env python #Filename: CommonFunctions.py ############################################################################################################### # # # ...
3,333
55.508475
113
py
ewN2HDECAY
ewN2HDECAY-master/Config.py
#!/usr/bin/env python #Filename: Config.py ################################################################################################################## # # # ...
4,403
114.894737
384
py
ewN2HDECAY
ewN2HDECAY-master/setup.py
#!/usr/bin/env python #Filename: setup.py ############################################################################################################### # # # ...
134,033
83.404282
397
py
ewN2HDECAY
ewN2HDECAY-master/ewN2HDECAY.py
#!/usr/bin/env python #Filename: ewN2HDECAY.py ################################################################################################################################# # # # ...
16,960
53.362179
143
py
applesoss
applesoss-main/setup.py
#!/usr/bin/env python # -*- coding: utf-8 -*- from setuptools import setup setup(name='applesoss', version='2.0.0', license='MIT', author='Michael Radica', author_email='michael.radica@umontreal.ca', packages=['applesoss'], include_package_data=True, url='https://github.com/r...
882
31.703704
71
py
applesoss
applesoss-main/applesoss/applesoss_utils.py
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Thurs Mar 11 14:35 2020 @author: MCR Miscellaneous utility functions for applesoss. """ from astropy.io import fits from datetime import datetime import numpy as np import warnings try: import webbpsf except ModuleNotFoundError: print('WebbPSF not...
14,004
33.925187
107
py
applesoss
applesoss-main/applesoss/plotting.py
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Fri Jan 22 12:03 2021 @author: MCR File containing all diagnostic plotting functions for the applesoss. """ import matplotlib.pyplot as plt import numpy as np def plot_badpix(clear, mask): """Plot the difference between the originanl dataframe, and ...
1,920
29.015625
78
py
applesoss
applesoss-main/applesoss/edgetrigger_centroids.py
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Wed Nov 04 15:35:32 2020 @author: albert Functions necessary to locate the centroids of the NIRISS SOSS trace using the edgetrigger algorithm. """ from astropy.io import fits from matplotlib import colors import matplotlib.pyplot as plt import numpy as np...
42,334
32.49288
100
py
applesoss
applesoss-main/applesoss/__init__.py
0
0
0
py
applesoss
applesoss-main/applesoss/edgetrigger_utils.py
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Wed Nov 04 15:36:22 2020 @author: albert, MCR Utility functions for the edgetrigger algorithm """ import numpy as np from scipy.optimize import least_squares def zero_roll(a, shift): """Like np.roll but the wrapped around part is set to zero. Only w...
6,141
29.557214
79
py
applesoss
applesoss-main/applesoss/applesoss.py
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Fri Mar 19 11:46 2021 @author: MCR Definitions of the main functions for the applesoss (A Producer of ProfiLEs for SOSS) module. This class will be initialized and called by the user to create models of the spatial profiles for the first, second, and third...
31,493
39.222222
122
py
gunpowder
gunpowder-master/gunpowder/roi.py
from funlib.geometry import Roi # noqa
40
19.5
39
py
gunpowder
gunpowder-master/gunpowder/provider_spec.py
import math from gunpowder.coordinate import Coordinate from gunpowder.array import ArrayKey from gunpowder.array_spec import ArraySpec from gunpowder.graph import GraphKey from gunpowder.graph_spec import GraphSpec from gunpowder.roi import Roi from .freezable import Freezable import time import logging import copy l...
7,634
29.662651
88
py
gunpowder
gunpowder-master/gunpowder/array.py
from .freezable import Freezable from copy import deepcopy from gunpowder.coordinate import Coordinate from gunpowder.roi import Roi import logging import numpy as np import copy logger = logging.getLogger(__name__) class Array(Freezable): """A numpy array with a specification describing the data. Args: ...
6,344
29.07109
86
py
gunpowder
gunpowder-master/gunpowder/batch.py
from copy import copy as shallow_copy import logging import multiprocessing import warnings from .freezable import Freezable from .profiling import ProfilingStats from .array import Array, ArrayKey from .graph import Graph, GraphKey logger = logging.getLogger(__name__) class Batch(Freezable): """Contains the re...
6,565
29.398148
85
py
gunpowder
gunpowder-master/gunpowder/profiling.py
import copy import numpy as np import time from .freezable import Freezable class Timing(Freezable): def __init__(self, node, method_name=None): self.__name = type(node).__name__ self.__method_name = method_name self.__start = 0 self.__first_start = 0 self.__last_stop = 0 ...
3,969
26.762238
89
py
gunpowder
gunpowder-master/gunpowder/graph.py
from .graph_spec import GraphSpec from .roi import Roi from .freezable import Freezable import numpy as np import networkx as nx from copy import deepcopy from typing import Dict, Optional, Set, Iterator, Any import logging import itertools import warnings logger = logging.getLogger(__name__) class Node(Freezable...
20,695
30.028486
102
py
gunpowder
gunpowder-master/gunpowder/array_spec.py
import copy from .coordinate import Coordinate from .freezable import Freezable class ArraySpec(Freezable): """Contains meta-information about an array. This is used by :class:`BatchProviders<BatchProvider>` to communicate the arrays they offer, as well as by :class:`Arrays<Array>` to describe the data th...
3,293
30.075472
88
py
gunpowder
gunpowder-master/gunpowder/ndarray.py
import numpy as np def replace(array, old_values, new_values): """Replace all occurences of ``old_values[i]`` with ``new_values[i]`` in the given array.""" old_values = np.array(old_values) new_values = np.array(new_values) values_map = np.arange(int(array.max() + 1), dtype=new_values.dtype) ...
387
24.866667
80
py
gunpowder
gunpowder-master/gunpowder/freezable.py
class Freezable(object): __isfrozen = False def __setattr__(self, key, value): if self.__isfrozen and not hasattr(self, key): raise TypeError("%r is frozen, you can't add attributes to it" % self) object.__setattr__(self, key, value) def freeze(self): self.__isfrozen = ...
378
26.071429
82
py
gunpowder
gunpowder-master/gunpowder/batch_request.py
import copy from .provider_spec import ProviderSpec from .roi import Roi from .array import ArrayKey from .array_spec import ArraySpec from .graph import GraphKey from .graph_spec import GraphSpec from warnings import warn import time class BatchRequest(ProviderSpec): """A collection of (possibly partial) :class...
4,468
28.596026
81
py
gunpowder
gunpowder-master/gunpowder/__init__.py
from __future__ import absolute_import from .nodes import * from .array import Array, ArrayKey, ArrayKeys from .array_spec import ArraySpec from .batch import Batch from .batch_request import BatchRequest from .build import build from .coordinate import Coordinate from .graph import Graph, Node, Edge, GraphKey, Graph...
648
27.217391
57
py
gunpowder
gunpowder-master/gunpowder/morphology.py
import numpy as np from scipy.ndimage.morphology import distance_transform_edt def enlarge_binary_map( binary_map, radius, voxel_size, ring_fraction=None, in_place=False ): """Enlarge existing regions in a binary map. Args: binary_map (numpy array): A matrix with zeros, in which reg...
3,244
28.5
79
py
gunpowder
gunpowder-master/gunpowder/compat.py
import sys PY2 = sys.version_info[0] == 2 if PY2: binary_type = str else: binary_type = bytes def ensure_str(s): if PY2: if isinstance(s, buffer): s = str(s) else: if isinstance(s, memoryview): s = s.tobytes() if isinstance(s, binary_type): ...
356
16
38
py
gunpowder
gunpowder-master/gunpowder/version_info.py
__major__ = 1 __minor__ = 3 __patch__ = 0 __tag__ = "" __version__ = "{}.{}.{}{}".format(__major__, __minor__, __patch__, __tag__).strip(".") class _Version(object): def major(self): return __major__ def minor(self): return __minor__ def patch(self): return __patch__ def tag...
528
15.53125
86
py
gunpowder
gunpowder-master/gunpowder/coordinate.py
from funlib.geometry import Coordinate # noqa
47
23
46
py
gunpowder
gunpowder-master/gunpowder/pipeline.py
import logging from gunpowder.nodes import BatchProvider logger = logging.getLogger(__name__) class PipelineSetupError(Exception): def __init__(self, provider): self.provider = provider def __str__(self): return f"Exception in {self.provider.name()} while calling setup()" class PipelineTea...
5,738
27.270936
86
py
gunpowder
gunpowder-master/gunpowder/build.py
import logging logger = logging.getLogger(__name__) class build(object): def __init__(self, pipeline): self.pipeline = pipeline def __enter__(self): try: self.pipeline.setup() except: logger.error( "something went wrong during the setup of the ...
702
26.038462
90
py
gunpowder
gunpowder-master/gunpowder/graph_spec.py
import numpy as np import copy from .freezable import Freezable class GraphSpec(Freezable): """Contains meta-information about a graph. This is used by :class:`BatchProviders<BatchProvider>` to communicate the graphs they offer, as well as by :class:`Graph` to describe the data they contain. Attrib...
2,002
26.438356
85
py
gunpowder
gunpowder-master/gunpowder/producer_pool.py
try: import Queue except: import queue as Queue import logging import multiprocessing import os import sys import time import traceback import numpy as np logger = logging.getLogger(__name__) class NoResult(Exception): pass class ParentDied(Exception): pass class WorkersDied(Exception): pass...
4,825
27.388235
83
py
gunpowder
gunpowder-master/gunpowder/torch/__init__.py
from __future__ import absolute_import from .nodes import *
61
14.5
38
py
gunpowder
gunpowder-master/gunpowder/torch/nodes/__init__.py
from __future__ import absolute_import from .train import Train from .predict import Predict __all__ = ["Train", "Predict"]
126
17.142857
38
py
gunpowder
gunpowder-master/gunpowder/torch/nodes/predict.py
from gunpowder.array import ArrayKey, Array from gunpowder.array_spec import ArraySpec from gunpowder.ext import torch from gunpowder.nodes.generic_predict import GenericPredict import logging from typing import Dict, Union logger = logging.getLogger(__name__) class Predict(GenericPredict): """Torch implementat...
5,622
34.815287
83
py
gunpowder
gunpowder-master/gunpowder/torch/nodes/train.py
import logging import numpy as np from gunpowder.array import ArrayKey, Array from gunpowder.array_spec import ArraySpec from gunpowder.ext import torch, tensorboardX, NoSuchModule from gunpowder.nodes.generic_train import GenericTrain from typing import Dict, Union, Optional logger = logging.getLogger(__name__) c...
13,024
36.002841
96
py
gunpowder
gunpowder-master/gunpowder/zoo/__init__.py
0
0
0
py
gunpowder
gunpowder-master/gunpowder/zoo/tensorflow/unet.py
import tensorflow as tf def conv_pass( fmaps_in, kernel_size, num_fmaps, num_repetitions, activation="relu", name="conv_pass", ): """Create a convolution pass:: f_in --> f_1 --> ... --> f_n where each ``-->`` is a convolution followed by a (non-linear) activation function...
6,758
24.996154
88
py
gunpowder
gunpowder-master/gunpowder/zoo/tensorflow/__init__.py
from .unet import unet, conv_pass
34
16.5
33
py
gunpowder
gunpowder-master/gunpowder/jax/generic_jax_model.py
class GenericJaxModel: """An interface for models to follow in order to train or predict. A model implementing this interface will need to contain not only the forward model but also loss and update fn. Some examples can be found in https://github.com/funkelab/funlib.learn.jax Args: is_tra...
2,633
25.34
78
py
gunpowder
gunpowder-master/gunpowder/jax/__init__.py
from .generic_jax_model import GenericJaxModel from .nodes import *
68
22
46
py
gunpowder
gunpowder-master/gunpowder/jax/nodes/__init__.py
from .train import Train from .predict import Predict __all__ = ["Train", "Predict"]
86
16.4
30
py
gunpowder
gunpowder-master/gunpowder/jax/nodes/predict.py
from gunpowder.array import ArrayKey, Array from gunpowder.array_spec import ArraySpec from gunpowder.ext import jax from gunpowder.nodes.generic_predict import GenericPredict from gunpowder.jax import GenericJaxModel import pickle import logging from typing import Dict, Union logger = logging.getLogger(__name__) c...
3,564
32.317757
88
py
gunpowder
gunpowder-master/gunpowder/jax/nodes/train.py
import logging import numpy as np from gunpowder.ext import jax from gunpowder.ext import jnp import pickle import os from gunpowder.array import ArrayKey, Array from gunpowder.array_spec import ArraySpec from gunpowder.ext import tensorboardX, NoSuchModule from gunpowder.nodes.generic_train import GenericTrain from g...
11,796
36.690096
99
py
gunpowder
gunpowder-master/gunpowder/nodes/unsqueeze.py
import copy from typing import List import logging import numpy as np from gunpowder.array import ArrayKey from gunpowder.batch import Batch from gunpowder.batch_request import BatchRequest from .batch_filter import BatchFilter logger = logging.getLogger(__name__) class Unsqueeze(BatchFilter): """Unsqueeze a ...
1,757
29.310345
82
py
gunpowder
gunpowder-master/gunpowder/nodes/squeeze.py
import copy from typing import List import logging import numpy as np from gunpowder.array import ArrayKey from gunpowder.batch_request import BatchRequest from gunpowder.batch import Batch from .batch_filter import BatchFilter logger = logging.getLogger(__name__) class Squeeze(BatchFilter): """Squeeze a batch...
1,832
30.067797
79
py
gunpowder
gunpowder-master/gunpowder/nodes/intensity_augment.py
import numpy as np from gunpowder.batch_request import BatchRequest from .batch_filter import BatchFilter class IntensityAugment(BatchFilter): """Randomly scale and shift the values of an intensity array. Args: array (:class:`ArrayKey`): The intensity array to modify. scale_m...
3,352
30.632075
101
py
gunpowder
gunpowder-master/gunpowder/nodes/elastic_augment.py
import logging import math import numpy as np import random from scipy import ndimage from .batch_filter import BatchFilter from gunpowder.batch_request import BatchRequest from gunpowder.coordinate import Coordinate from gunpowder.ext import augment from gunpowder.roi import Roi from gunpowder.array import ArrayKey ...
24,005
36.924171
96
py
gunpowder
gunpowder-master/gunpowder/nodes/reject.py
import logging import random from .batch_filter import BatchFilter from gunpowder.profiling import Timing logger = logging.getLogger(__name__) class Reject(BatchFilter): """Reject batches based on the masked-in vs. masked-out ratio. If a pipeline also contains a :class:`RandomLocation` node, :class:`Re...
4,419
31.740741
88
py
gunpowder
gunpowder-master/gunpowder/nodes/astype.py
from .batch_filter import BatchFilter from gunpowder.array import ArrayKey, Array from gunpowder.batch import Batch import logging logger = logging.getLogger(__name__) class AsType(BatchFilter): """Cast arrays to a different datatype (ex: np.float32 --> np.uint8). Args: source (:class:`ArrayKey`): ...
1,628
24.857143
73
py
gunpowder
gunpowder-master/gunpowder/nodes/csv_points_source.py
import numpy as np import logging from gunpowder.batch import Batch from gunpowder.coordinate import Coordinate from gunpowder.nodes.batch_provider import BatchProvider from gunpowder.graph import Node, Graph from gunpowder.graph_spec import GraphSpec from gunpowder.profiling import Timing from gunpowder.roi import Roi...
4,231
31.553846
86
py
gunpowder
gunpowder-master/gunpowder/nodes/klb_source.py
import copy import logging import numpy as np import glob from gunpowder.batch import Batch from gunpowder.coordinate import Coordinate from gunpowder.ext import pyklb from gunpowder.profiling import Timing from gunpowder.roi import Roi from gunpowder.array import Array from gunpowder.array_spec import ArraySpec from ...
6,603
31.372549
82
py
gunpowder
gunpowder-master/gunpowder/nodes/resample.py
from .batch_filter import BatchFilter from gunpowder.array import ArrayKey, Array from gunpowder.batch_request import BatchRequest from gunpowder.batch import Batch from gunpowder.coordinate import Coordinate from gunpowder.roi import Roi from skimage.transform import rescale import numpy as np import logging logger =...
5,299
36.323944
232
py
gunpowder
gunpowder-master/gunpowder/nodes/noise_augment.py
import numpy as np import skimage from gunpowder.batch_request import BatchRequest from .batch_filter import BatchFilter class NoiseAugment(BatchFilter): """Add random noise to an array. Uses the scikit-image function skimage.util.random_noise. See scikit-image documentation for more information on argument...
2,041
30.90625
109
py
gunpowder
gunpowder-master/gunpowder/nodes/renumber_connected_components.py
from .batch_filter import BatchFilter from gunpowder.ext import malis class RenumberConnectedComponents(BatchFilter): """Find connected components of the same value, and replace each component with a new label. Args: labels (:class:`ArrayKey`): The label array to modify. """ ...
863
27.8
78
py
gunpowder
gunpowder-master/gunpowder/nodes/batch_provider.py
import numpy as np import copy import logging import random from gunpowder.coordinate import Coordinate from gunpowder.provider_spec import ProviderSpec from gunpowder.array import ArrayKey from gunpowder.array_spec import ArraySpec from gunpowder.graph import GraphKey from gunpowder.graph_spec import GraphSpec logg...
13,607
33.105263
106
py
gunpowder
gunpowder-master/gunpowder/nodes/iterate_locations.py
import logging import multiprocessing as mp from random import randrange from .batch_filter import BatchFilter from gunpowder.batch_request import BatchRequest from gunpowder.coordinate import Coordinate from gunpowder.array import Array from gunpowder.array_spec import ArraySpec logger = logging.getLogger(__name__) ...
7,416
39.091892
88
py
gunpowder
gunpowder-master/gunpowder/nodes/crop.py
import copy import logging from .batch_filter import BatchFilter from gunpowder.coordinate import Coordinate logger = logging.getLogger(__name__) class Crop(BatchFilter): """Limits provided ROIs by either giving a new :class:`Roi` or crop fractions from either face of the provided ROI. Args: k...
2,655
30.619048
86
py
gunpowder
gunpowder-master/gunpowder/nodes/scan.py
import logging import multiprocessing import numpy as np import tqdm from gunpowder.array import Array from gunpowder.batch import Batch from gunpowder.coordinate import Coordinate from gunpowder.graph import Graph from gunpowder.producer_pool import ProducerPool from gunpowder.roi import Roi from .batch_filter import ...
13,722
33.65404
88
py
gunpowder
gunpowder-master/gunpowder/nodes/exclude_labels.py
import logging import numpy as np from scipy.ndimage.morphology import distance_transform_edt from .batch_filter import BatchFilter from gunpowder.array import Array logger = logging.getLogger(__name__) class ExcludeLabels(BatchFilter): """Excludes several labels from the ground-truth. The labels will be r...
3,596
33.257143
88
py
gunpowder
gunpowder-master/gunpowder/nodes/dvid_source.py
import logging import numpy as np from gunpowder.batch import Batch from gunpowder.coordinate import Coordinate from gunpowder.ext import dvision from gunpowder.profiling import Timing from gunpowder.roi import Roi from gunpowder.array import Array from gunpowder.array_spec import ArraySpec from .batch_provider import...
8,505
30.157509
85
py
gunpowder
gunpowder-master/gunpowder/nodes/merge_provider.py
from gunpowder.provider_spec import ProviderSpec from gunpowder.batch import Batch from gunpowder.batch_request import BatchRequest from .batch_provider import BatchProvider import random class MergeProvider(BatchProvider): """Merges different providers:: (a, b, c) + MergeProvider() will create a ...
2,498
36.298507
106
py
gunpowder
gunpowder-master/gunpowder/nodes/add_affinities.py
import logging import numpy as np from .batch_filter import BatchFilter from gunpowder.array import Array from gunpowder.batch_request import BatchRequest from gunpowder.batch import Batch from gunpowder.coordinate import Coordinate logger = logging.getLogger(__name__) def seg_to_affgraph(seg, nhood): nhood = n...
10,113
34.738516
88
py
gunpowder
gunpowder-master/gunpowder/nodes/daisy_request_blocks.py
from gunpowder.batch import Batch from gunpowder.ext import daisy from gunpowder.nodes.batch_filter import BatchFilter from gunpowder.roi import Roi import logging import multiprocessing import time logger = logging.getLogger(__name__) class DaisyRequestBlocks(BatchFilter): """Iteratively requests batches simila...
4,453
34.349206
86
py
gunpowder
gunpowder-master/gunpowder/nodes/generic_predict.py
import logging import multiprocessing import time from gunpowder.nodes.batch_filter import BatchFilter from gunpowder.producer_pool import ProducerPool, WorkersDied, NoResult from gunpowder.array import ArrayKey from gunpowder.array_spec import ArraySpec from gunpowder.batch_request import BatchRequest from queue impo...
7,420
33.840376
88
py
gunpowder
gunpowder-master/gunpowder/nodes/rasterize_graph.py
import copy import logging import numpy as np from scipy.ndimage.filters import gaussian_filter from skimage import draw from .batch_filter import BatchFilter from gunpowder.array import Array from gunpowder.array_spec import ArraySpec from gunpowder.batch_request import BatchRequest from gunpowder.coordinate import C...
15,235
36.07056
94
py
gunpowder
gunpowder-master/gunpowder/nodes/deform_augment.py
from .batch_filter import BatchFilter from gunpowder.batch import Batch from gunpowder.batch_request import BatchRequest from gunpowder.coordinate import Coordinate from gunpowder.roi import Roi from gunpowder.array import ArrayKey, Array from gunpowder.array_spec import ArraySpec from augment.transform import ( c...
24,947
37.205207
138
py
gunpowder
gunpowder-master/gunpowder/nodes/snapshot.py
import logging import numpy as np import os from .batch_filter import BatchFilter from gunpowder.batch_request import BatchRequest from gunpowder.ext import h5py from gunpowder.ext import ZarrFile logger = logging.getLogger(__name__) class Snapshot(BatchFilter): """Save a passing batch in an HDF file. The ...
8,947
34.367589
85
py
gunpowder
gunpowder-master/gunpowder/nodes/simple_augment.py
import logging import random import itertools import numpy as np from .batch_filter import BatchFilter from gunpowder.coordinate import Coordinate logger = logging.getLogger(__name__) class SimpleAugment(BatchFilter): """Randomly mirror and transpose all :class:`Arrays<Array>` and :class:`Graph` in a batch...
11,423
37.857143
88
py
gunpowder
gunpowder-master/gunpowder/nodes/grow_boundary.py
import numpy as np from scipy import ndimage from .batch_filter import BatchFilter from gunpowder.array import Array class GrowBoundary(BatchFilter): """Grow a boundary between regions in a label array. Does not grow at the border of the batch or an optionally provided mask. Args: labels (:clas...
3,510
32.438095
80
py