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
UniVL
UniVL-main/modules/until_config.py
# coding=utf-8 # Copyright 2018 The Google AI Language Team Authors and The HugginFace Inc. team. # Copyright (c) 2018, NVIDIA CORPORATION. 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...
5,036
38.97619
105
py
UniVL
UniVL-main/dataloaders/dataloader_msrvtt_caption.py
from __future__ import absolute_import from __future__ import division from __future__ import unicode_literals from __future__ import print_function import os from torch.utils.data import Dataset import numpy as np import pickle import pandas as pd from collections import defaultdict import json import random class M...
10,371
44.095652
115
py
UniVL
UniVL-main/dataloaders/dataloader_youcook_retrieval.py
from __future__ import absolute_import from __future__ import division from __future__ import unicode_literals from __future__ import print_function from torch.utils.data import Dataset import pandas as pd import os import numpy as np import pickle import random class Youcook_DataLoader(Dataset): """Youcook datas...
7,820
40.163158
113
py
UniVL
UniVL-main/dataloaders/dataloader_youcook_caption.py
from __future__ import absolute_import from __future__ import division from __future__ import unicode_literals from __future__ import print_function from torch.utils.data import Dataset import pandas as pd import os import numpy as np import pickle import re import random import io class Youcook_Caption_DataLoader(Da...
9,662
41.756637
113
py
UniVL
UniVL-main/dataloaders/dataloader_msrvtt_retrieval.py
from __future__ import absolute_import from __future__ import division from __future__ import unicode_literals from __future__ import print_function import os from torch.utils.data import Dataset import numpy as np import pickle import pandas as pd from collections import defaultdict import json import random class M...
15,263
42.240793
113
py
UniVL
UniVL-main/dataloaders/dataloader_howto100m.py
from __future__ import absolute_import from __future__ import division from __future__ import unicode_literals from __future__ import print_function from torch.utils.data import Dataset import pandas as pd import os import numpy as np import random class Youtube_DataLoader(Dataset): """ Youtube dataset loader...
15,835
41.8
127
py
nuts-ml
nuts-ml-master/setup.py
import os import sys import glob import shutil import nutsml from setuptools import setup, find_packages, Command from setuptools.command.test import test as TestCommand class CleanCommand(Command): user_options = [] def initialize_options(self): pass def finalize_options(self): pass ...
2,577
27.644444
71
py
nuts-ml
nuts-ml-master/sphinx/source/conf.py
# -*- coding: utf-8 -*- # # nutsml documentation build configuration file, created by # sphinx-quickstart on Mon May 23 17:01:48 2016. # # This file is execfile()d with the current directory set to its # containing dir. # # Note that not all possible configuration values are present in this # autogenerated file. # # Al...
10,445
31.240741
80
py
nuts-ml
nuts-ml-master/tests/__init__.py
0
0
0
py
nuts-ml
nuts-ml-master/tests/nutsml/test_checkpoint.py
""" .. module:: test_checkpoint :synopsis: Unit tests for checkpoint module """ import pytest import os import shutil import time import nutsml.checkpoint as nc from os.path import join from nutsflow.config import Config from nutsml.network import Network BASEPATH = 'tests/data/checkpoints' @pytest.fixture(scop...
4,703
24.846154
66
py
nuts-ml
nuts-ml-master/tests/nutsml/test_common.py
""" .. module:: test_common :synopsis: Unit tests for common module """ import pytest import numpy as np from six.moves import zip, range from nutsflow import Consume, Collect, Map from nutsflow.common import StableRandom, shapestr from nutsml import (SplitRandom, SplitLeaveOneOut, CheckNaN, PartitionByCol, ...
4,121
31.976
80
py
nuts-ml
nuts-ml-master/tests/nutsml/test_reader.py
""" .. module:: test_reader :synopsis: Unit tests for reader module """ import pytest import pandas as pd import numpy as np import numpy.testing as nt from collections import namedtuple from nutsflow import Collect, Sort from nutsml import ReadNumpy, ReadImage, ReadLabelDirs, ReadPandas def test_ReadLabelDirs(...
6,107
37.904459
78
py
nuts-ml
nuts-ml-master/tests/nutsml/test_batcher.py
""" .. module:: test_batcher :synopsis: Unit tests for batcher module """ import pytest import numpy as np import nutsml.batcher as nb from pytest import approx from nutsflow import Collect, Consume def test_build_number_batch(): numbers = [1, 2, 3, 1] batch = nb.build_number_batch(numbers, 'uint8') ...
6,437
34.766667
78
py
nuts-ml
nuts-ml-master/tests/nutsml/test_datautil.py
""" .. module:: test_datautil :synopsis: Unit tests for datautil module """ import pytest import numpy as np import collections as cl import nutsml.datautil as util from collections import namedtuple from nutsflow.common import StableRandom @pytest.fixture(scope="function") def sampleset(): """Return list w...
2,437
30.662338
77
py
nuts-ml
nuts-ml-master/tests/nutsml/test_plotter.py
""" .. module:: test_plotter :synopsis: Unit tests for plotter module """ from __future__ import print_function import os import numpy as np import nutsml.imageutil as ni import nutsml.plotter as pl import numpy.testing as nt from nutsflow import Collect # Set to True to create test data CREATE_DATA = False de...
1,111
24.860465
68
py
nuts-ml
nuts-ml-master/tests/nutsml/test_network.py
""" .. module:: test_network :synopsis: Unit tests for network module """ import pytest import numpy as np from nutsflow import Collect, GetCols, Print from nutsml.network import Network, TrainValNut, PredictNut, EvalNut class FakeModel(object): def __init__(self): self.saved_weights = None ...
5,786
27.367647
77
py
nuts-ml
nuts-ml-master/tests/nutsml/test_logger.py
""" .. module:: test_logger :synopsis: Unit tests for logger module """ import pytest import os import numpy as np from nutsflow import Collect from nutsml import LogToFile, LogCols @pytest.fixture(scope='function') def filepath(): filepath = 'tests/data/temp_logger.csv' def fin(): if os.path.ex...
2,699
27.125
76
py
nuts-ml
nuts-ml-master/tests/nutsml/test_booster.py
""" .. module:: test_booster :synopsis: Unit tests for booster module """ import pytest import numpy as np from nutsflow import Collect from nutsflow.common import shapestr from nutsml.network import Network, PredictNut from nutsml import Boost, BuildBatch def predict_all_positive(batch): return [np.array([...
1,940
25.958333
63
py
nuts-ml
nuts-ml-master/tests/nutsml/test_stratify.py
""" .. module:: test_stratify :synopsis: Unit tests for stratify module """ import pytest from nutsflow import Collect, Sort, Get, CountValues from nutsflow.common import StableRandom from nutsml import Stratify, CollectStratified def test_CollectStratified(): rand = StableRandom(0) samples = [('pos', 1...
1,507
29.16
76
py
nuts-ml
nuts-ml-master/tests/nutsml/test_viewer.py
""" .. module:: test_viewer :synopsis: Unit tests for viewer module """
75
14.2
42
py
nuts-ml
nuts-ml-master/tests/nutsml/test_imageutil.py
""" .. module:: test_imageutil :synopsis: Unit tests for imageutil module """ from __future__ import print_function import pytest import sys import os import os.path as op import PIL as pil import numpy as np import skimage as ski import nutsml.imageutil as ni import numpy.testing as nt import matplotlib.patches a...
20,658
32.59187
80
py
nuts-ml
nuts-ml-master/tests/nutsml/__init__.py
0
0
0
py
nuts-ml
nuts-ml-master/tests/nutsml/test_metrics.py
""" .. module:: test_metrics :synopsis: Unit tests for metrics module Note: In contrast to losses, which operate on batches, metricies operate on entire collections of samples. """ import pytest from pytest import approx import nutsml.metrics as nm def test_box_intersection(): # no overlap assert nm.box...
4,293
31.530303
80
py
nuts-ml
nuts-ml-master/tests/nutsml/test_writer.py
""" .. module:: test_writer :synopsis: Unit tests for writer module """ import pytest import os import numpy as np from nutsml.imageutil import load_image from nutsflow import Collect, Get, Consume from nutsml import ReadImage, WriteImage def test_ImageWriter(): samples = [('nut_color', 1), ('nut_grayscale'...
1,854
31.54386
73
py
nuts-ml
nuts-ml-master/tests/nutsml/test_transformer.py
""" .. module:: test_transformer :synopsis: Unit tests for transformer module """ import pytest import os import numpy as np import numpy.testing as nt from nutsflow import Collect, Count from nutsml.transformer import (map_transform, TransformImage, AugmentImage, RegularImagePatch...
9,729
34.126354
78
py
nuts-ml
nuts-ml-master/tests/nutsml/test_fileutil.py
""" .. module:: fileutil :synopsis: Unit tests for fileutil module """ import os import os.path as op import shutil import nutsml.fileutil as fu import pytest @pytest.fixture() def init_test_folders(request): """Remove folder 'foo' and sub-folders at setup and teardown.""" path = op.join("data", "foo") ...
3,439
29.990991
77
py
nuts-ml
nuts-ml-master/nutsml/writer.py
""" .. module:: writer :synopsis: Writing of sample and image data """ from __future__ import absolute_import import os import skimage.io as sio from inspect import isfunction from nutsml.fileutil import create_folders from nutsflow.base import NutFunction from nutsflow.source import Enumerate class WriteImage(N...
3,414
37.806818
79
py
nuts-ml
nuts-ml-master/nutsml/reader.py
""" .. module:: reader :synopsis: Reading of sample data and images """ from __future__ import absolute_import import os import pandas as pd import numpy as np from glob import glob from collections import namedtuple from fnmatch import fnmatch from nutsml.imageutil import load_image from nutsml.fileutil import r...
12,144
36.140673
80
py
nuts-ml
nuts-ml-master/nutsml/checkpoint.py
""" .. module:: checkpoint :synopsis: Conveniency class to create checkpoints for network training. """ import os import time from os.path import join, exists, isdir, getmtime from nutsflow.config import Config """ .. module:: checkpoint :synopsis: Creation of checkpoints with network weights and parameters. "...
6,996
34.882051
80
py
nuts-ml
nuts-ml-master/nutsml/stratify.py
""" .. module:: stratify :synopsis: Stratification of sample sets """ from __future__ import absolute_import import random as rnd from nutsflow import nut_processor, nut_sink, Sort from nutsml.datautil import upsample, random_downsample @nut_processor def Stratify(iterable, labelcol, labeldist, rand=None): "...
3,795
37.734694
76
py
nuts-ml
nuts-ml-master/nutsml/batcher.py
""" .. module:: batcher :synopsis: Collecting samples in mini-batches for GPU-based training. """ import warnings import numpy as np import nutsml.imageutil as ni from nutsflow import nut_function from nutsflow.base import Nut from nutsflow.iterfunction import take, PrefetchIterator def build_number_batch(numbers...
13,350
34.889785
79
py
nuts-ml
nuts-ml-master/nutsml/network.py
""" .. module:: network :synopsis: Wrapper around other network APIs such as Lasagne, Keras and Pytorch to enable usage within nuts-flow/ml. For instance, with a wrapped network one can write: samples >> build_batch >> network.train() >> log_loss >> Consume() """ from __futu...
19,583
36.302857
100
py
nuts-ml
nuts-ml-master/nutsml/viewer.py
""" .. module:: viewer :synopsis: Viewing of sample data """ from __future__ import print_function from __future__ import absolute_import import time import numpy as np import nutsml.imageutil as iu from six.moves import range from nutsflow import NutFunction, nut_function from nutsflow.common import as_tuple, a...
8,520
37.382883
80
py
nuts-ml
nuts-ml-master/nutsml/fileutil.py
""" .. module:: fileutil :synopsis: File system utilities. """ import glob import os import os.path as op import shutil import uuid TEMP_FOLDER = 'temp' def create_filename(prefix='', ext=''): """ Create a unique filename. :param str prefix: Prefix to add to filename. :param str ext: Extension t...
3,460
26.91129
78
py
nuts-ml
nuts-ml-master/nutsml/logger.py
""" .. module:: logger :synopsis: Data logging """ import os import numpy as np from warnings import warn from nutsflow import NutFunction from nutsflow.common import as_tuple class LogToFile(NutFunction): """ Log columns of data to file. """ def __init__(self, filepath, cols=None, colnames=None,...
3,320
28.389381
78
py
nuts-ml
nuts-ml-master/nutsml/datautil.py
""" .. module:: datautil :synopsis: Utility functions for non-image data """ import random as rnd import collections as cl from six import iteritems from nutsflow.common import as_set def upsample(samples, labelcol, rand=None): """ Up-sample sample set. Creates stratified samples by up-sampling smal...
6,600
34.111702
80
py
nuts-ml
nuts-ml-master/nutsml/transformer.py
""" .. module:: transformer :synopsis: Data and image transformations """ from __future__ import print_function import numpy as np import os.path as path import random as rnd import nutsml.datautil as ut import nutsml.imageutil as ni from nutsflow import Nut, NutFunction, nut_processor from nutsflow.common import ...
24,592
37.366615
82
py
nuts-ml
nuts-ml-master/nutsml/booster.py
""" .. module:: booster :synopsis: Boosting of wrongly predicted samples """ import random as rnd import numpy as np from nutsflow.common import StableRandom from nutsflow import nut_processor, Tee, Collect, Flatten, Print @nut_processor def Boost(iterable, batcher, network, rand=None): """ iterable >> B...
1,850
34.596154
79
py
nuts-ml
nuts-ml-master/nutsml/common.py
""" .. module:: common :synopsis: Common nuts """ import numpy as np import random as rnd from nutsflow import (nut_function, nut_sink, NutFunction, Flatten, Collect) from nutsflow.common import StableRandom from nutsml.datautil import group_by, shuffle_sublists @nut_function def CheckNaN(d...
9,645
34.20438
79
py
nuts-ml
nuts-ml-master/nutsml/imageutil.py
""" .. module:: imageutil :synopsis: Basic image processing utilities """ from __future__ import absolute_import, print_function import numpy as np import PIL as pil import skimage.exposure as ske import skimage.transform as skt import skimage.color as skc import skimage.util.shape as sks import skimage.io as ski i...
37,685
33.353692
97
py
nuts-ml
nuts-ml-master/nutsml/metrics.py
""" .. module:: metrics :synopsis: Evaluation metrics for model performance """ from __future__ import absolute_import def box_intersect(box1, box2): """ Return intersection box two (bounding) boxes. If the boxes don't intersect (0,0,0,0) is returned. :param (x,y,w,h) box1: First box with x,y spe...
6,763
36.787709
80
py
nuts-ml
nuts-ml-master/nutsml/__init__.py
__version__ = '1.2.3' # exporting all nuts-flow functions under nutsml namespace from nutsflow import * # exporting common nuts-ml functions under nutsml namespace from nutsml.batcher import BuildBatch from nutsml.booster import Boost from nutsml.checkpoint import Checkpoint from nutsml.stratify import Stratify, Coll...
1,107
45.166667
75
py
nuts-ml
nuts-ml-master/nutsml/plotter.py
""" .. module:: plotter :synopsis: Plotting of data, e.g. loss over epochs """ import time import itertools as itt import matplotlib.pyplot as plt from six.moves import range from nutsflow import NutFunction from nutsflow.common import as_tuple, as_list class PlotLines(NutFunction): # pragma no coverage """...
5,309
33.934211
80
py
nuts-ml
nuts-ml-master/nutsml/examples/__init__.py
""" Example nuts-ml pipelines """
33
10.333333
25
py
nuts-ml
nuts-ml-master/nutsml/examples/pytorch_/__init__.py
0
0
0
py
nuts-ml
nuts-ml-master/nutsml/examples/pytorch_/mnist/cnn_train.py
""" .. module:: cnn_train :synopsis: Example nuts-ml pipeline for training a CNN on MNIST """ import torch import torch.nn.functional as F import torch.nn as nn import torch.optim as optim import nutsflow as nf import nutsml as nm import numpy as np from nutsml.network import PytorchNetwork from utils import downl...
5,025
30.810127
79
py
nuts-ml
nuts-ml-master/nutsml/examples/pytorch_/mnist/utils.py
""" Utility functions for downloading the MNIST data set. """ import requests import pickle import gzip from pathlib import Path def download_mnist(): """Download MNIST from web to data folder.""" folder = Path("data/mnist") filename = "mnist.pkl.gz" fullpath = folder / filename url = "http://dee...
810
26.033333
58
py
nuts-ml
nuts-ml-master/nutsml/examples/pytorch_/mnist/__init__.py
0
0
0
py
nuts-ml
nuts-ml-master/nutsml/examples/pytorch_/mnist/mlp_train.py
""" .. module:: cnn_train :synopsis: Example nuts-ml pipeline for training a MLP on MNIST """ import torch import torch.nn.functional as F import torch.nn as nn import torch.optim as optim import nutsflow as nf import nutsml as nm import numpy as np from nutsml.network import PytorchNetwork from utils import downl...
2,959
30.157895
76
py
nuts-ml
nuts-ml-master/nutsml/examples/keras_/__init__.py
0
0
0
py
nuts-ml
nuts-ml-master/nutsml/examples/keras_/autoencoder/conv_autoencoder.py
""" A simple convolutional autoencoder adapted from https://blog.keras.io/building-autoencoders-in-keras.html """ from nutsml import KerasNetwork from tensorflow.keras.layers import Input, Conv2D, MaxPooling2D, UpSampling2D from tensorflow.keras.models import Model from runner import INPUT_SHAPE def create_network()...
1,312
36.514286
77
py
nuts-ml
nuts-ml-master/nutsml/examples/keras_/autoencoder/runner.py
""" Runs training and prediction. Trains an autoencoder on MNIST and in the prediction phase shows the original image, the decoded images and the difference. """ from __future__ import print_function import numpy as np from six.moves import zip, range from nutsflow import * from nutsml import * NUM_EPOCHS = 10 #...
2,640
26.8
78
py
nuts-ml
nuts-ml-master/nutsml/examples/keras_/autoencoder/__init__.py
""" Example autoencoders using nuts. """
40
12.666667
32
py
nuts-ml
nuts-ml-master/nutsml/examples/keras_/mnist/view_train_images.py
""" .. module:: view_train_images :synopsis: Example for showing images with transformation """ from nutsflow import Take, Consume, GetCols from nutsml import ViewImage, TransformImage if __name__ == "__main__": from mlp_train import load_samples samples, _ = load_samples() transform = (TransformImage...
453
27.375
60
py
nuts-ml
nuts-ml-master/nutsml/examples/keras_/mnist/mlp_view_misclassified.py
""" .. module:: mlp_precit :synopsis: Example nuts-ml pipeline for prediction """ from __future__ import print_function from nutsflow import Consume, Zip, Unzip, Map, ArgMax, nut_filter from nutsml import TransformImage, BuildBatch, ViewImageAnnotation BATCH_SIZE = 128 if __name__ == "__main__": from mlp_tra...
1,212
31.783784
79
py
nuts-ml
nuts-ml-master/nutsml/examples/keras_/mnist/mlp_classify.py
""" .. module:: mlp_predict :synopsis: Example nuts-ml pipeline for classification """ from __future__ import print_function from nutsflow import Collect, Consume, Get, Zip, Map, Format, ArgMax from nutsml import (TransformImage, BuildBatch, ReadImage, ReadLabelDirs, ViewImageAnnotation) BATCH...
1,203
34.411765
80
py
nuts-ml
nuts-ml-master/nutsml/examples/keras_/mnist/cnn_train.py
""" .. module:: cnn_train :synopsis: Example nuts-ml pipeline for training a CNN on MNIST This is code is based on a Keras example (see here) https://github.com/fchollet/keras/blob/master/examples/mnist_cnn.py to train a Multi-layer perceptron on the MNIST data and modified to use nuts for the data-preprocessing. "...
3,378
34.568421
78
py
nuts-ml
nuts-ml-master/nutsml/examples/keras_/mnist/write_images.py
""" .. module:: write_images :synopsis: Example for writing of image data """ from six.moves import zip from nutsflow import Take, Consume, Enumerate, Zip, Format, Get, Print from nutsml import WriteImage def load_samples(): from keras.datasets import mnist (X_train, y_train), (X_test, y_test) = mnist.loa...
681
28.652174
80
py
nuts-ml
nuts-ml-master/nutsml/examples/keras_/mnist/read_images.py
""" .. module:: read_images :synopsis: Example for reading and viewing of image data """ from nutsflow import Consume, Print from nutsml import ReadLabelDirs, ReadImage, ViewImageAnnotation, PrintColType if __name__ == "__main__": show_image = ViewImageAnnotation(0, 1, pause=1, figsize=(3, 3)) (ReadLabelD...
421
29.142857
78
py
nuts-ml
nuts-ml-master/nutsml/examples/keras_/mnist/cnn_classify.py
""" .. module:: cnn_predict :synopsis: Example nuts-ml pipeline for network predictions """ from nutsflow import Collect, Consume, Get, Zip, Map, ArgMax, Format from nutsml import (TransformImage, BuildBatch, ReadLabelDirs, ReadImage, ViewImageAnnotation) BATCH_SIZE = 128 if __name__ == "__ma...
955
33.142857
75
py
nuts-ml
nuts-ml-master/nutsml/examples/keras_/mnist/__init__.py
""" Example nuts-ml pipelines for MNIST """
43
13.666667
35
py
nuts-ml
nuts-ml-master/nutsml/examples/keras_/mnist/mlp_train.py
""" .. module:: mlp_train :synopsis: Example nuts-ml pipeline for training and evaluation This is code is based on a Keras example (see here) https://github.com/fchollet/keras/blob/master/examples/mnist_mlp.py to train a Multi-layer perceptron on the MNIST data and modified to use nuts for the data-preprocessing. "...
2,820
31.056818
73
py
nuts-ml
nuts-ml-master/nutsml/examples/keras_/cifar/view_train_images.py
""" .. module:: view_train_images :synopsis: Example nuts-ml pipeline reading and viewing image data """ from nutsflow import Take, Consume, MapCol from nutsml import ViewImageAnnotation, PrintColType, ConvertLabel if __name__ == "__main__": from cnn_train import load_samples, load_names train_samples, _ ...
619
30
69
py
nuts-ml
nuts-ml-master/nutsml/examples/keras_/cifar/cnn_train.py
""" .. module:: mlp_view_misclassified :synopsis: Example for showing misclassified examples """ from __future__ import print_function import pickle import os.path as osp from six.moves import zip, map, range from nutsflow import PrintProgress, Zip, Unzip, Pick, Shuffle, Mean from nutsml import (KerasNetwork, Tr...
4,395
33.614173
76
py
nuts-ml
nuts-ml-master/nutsml/examples/keras_/cifar/write_images.py
""" .. module:: write_images :synopsis: Example nuts-ml pipeline for writing of images """ from nutsflow import (Take, Print, Consume, Enumerate, Zip, Format, MapCol, Get) from nutsml import WriteImage, ConvertLabel if __name__ == "__main__": from cnn_train import load_samples, load_name...
648
29.904762
78
py
nuts-ml
nuts-ml-master/nutsml/examples/keras_/cifar/read_images.py
""" .. module:: read_images :synopsis: Example nuts-ml pipeline for reading and viewing image data """ from glob import glob from nutsflow import Consume from nutsml import ReadImage, ViewImage, PrintColType if __name__ == "__main__": show_image = ViewImage(0, pause=1, figsize=(2, 2), interpolation='spline36')...
429
27.666667
80
py
nuts-ml
nuts-ml-master/nutsml/examples/keras_/cifar/cnn_classify.py
""" .. module:: cnn_predict :synopsis: Example pipeline for viewing annotations and classification """ from __future__ import print_function from glob import glob from nutsflow import Collect, Consume, Get, Zip, Map, ArgMax, Print from nutsml import (TransformImage, BuildBatch, ReadImage, ViewImageAnnotation, ...
1,151
32.882353
79
py
nuts-ml
nuts-ml-master/nutsml/examples/keras_/cifar/view_data.py
""" .. module:: view_data :synopsis: Example nuts-ml pipeline viewing CIFAR-10 image data """ from nutsflow import Take, Consume from nutsml import ViewImage if __name__ == "__main__": from cnn_train import load_samples train_samples, test_samples = load_samples() samples = train_samples + test_sample...
455
25.823529
80
py
nuts-ml
nuts-ml-master/nutsml/examples/keras_/cifar/__init__.py
""" Example nuts-ml pipelines for CIFAR-10 """
46
14.666667
38
py
nuts-ml
nuts-ml-master/nutsml/examples/keras_/cifar/view_augmented_images.py
""" .. module:: view_augmented_images :synopsis: Example nuts-ml pipeline for viewing augmented image data """ from nutsflow import Take, Consume from nutsml import ViewImageAnnotation, AugmentImage if __name__ == "__main__": from cnn_train import load_samples train_samples, _ = load_samples() p = 0....
793
29.538462
71
py
Excessive-Invariance
Excessive-Invariance-master/l0/invariant_l0_attack.py
import tensorflow as tf import random import time import numpy as np from keras.datasets import mnist import sys import os import itertools import sklearn.cluster import scipy.misc import keras from keras.models import Sequential from keras.layers import Dense, Dropout, Flatten, Activation from keras.layers import Con...
14,333
36.03876
152
py
Excessive-Invariance
Excessive-Invariance-master/l0/gan/acgan_mnist.py
import os, sys sys.path.append(os.getcwd()) import time import matplotlib matplotlib.use('Agg') import matplotlib.pyplot as plt import numpy as np import sklearn.datasets import tensorflow as tf import tflib as lib import tflib.ops.linear import tflib.ops.conv2d import tflib.ops.batchnorm import tflib.ops.deconv2d i...
7,752
33.154185
97
py
Excessive-Invariance
Excessive-Invariance-master/l0/gan/tflib/small_imagenet.py
import numpy as np import scipy.misc import time def make_generator(path, n_files, batch_size): epoch_count = [1] def get_epoch(): images = np.zeros((batch_size, 3, 64, 64), dtype='int32') files = list(range(n_files)) random_state = np.random.RandomState(epoch_count[0]) random_s...
1,159
34.151515
98
py
Excessive-Invariance
Excessive-Invariance-master/l0/gan/tflib/save_images.py
""" Image grid saver, based on color_grid_vis from github.com/Newmu """ import numpy as np import scipy.misc from scipy.misc import imsave def save_images(X, save_path): # [0, 1] -> [0,255] if isinstance(X.flatten()[0], np.floating): X = (255.99*X).astype('uint8') n_samples = X.shape[0] rows ...
914
22.461538
91
py
Excessive-Invariance
Excessive-Invariance-master/l0/gan/tflib/inception_score.py
# From https://github.com/openai/improved-gan/blob/master/inception_score/model.py # Code derived from tensorflow/tensorflow/models/image/imagenet/classify_image.py import os.path import sys import tarfile import numpy as np from six.moves import urllib import tensorflow as tf import glob import scipy.misc import ...
3,375
33.44898
90
py
Excessive-Invariance
Excessive-Invariance-master/l0/gan/tflib/cifar10.py
import numpy as np import os import urllib.request, urllib.parse, urllib.error import gzip import pickle as pickle def unpickle(file): fo = open(file, 'rb') dict = pickle.load(fo, encoding='latin1') fo.close() return dict['data'], dict['labels'] def cifar_generator(filenames, batch_size, data_dir): ...
1,197
27.52381
125
py
Excessive-Invariance
Excessive-Invariance-master/l0/gan/tflib/plot.py
import numpy as np import matplotlib matplotlib.use('Agg') import matplotlib.pyplot as plt import collections import time import pickle as pickle _since_beginning = collections.defaultdict(lambda: {}) _since_last_flush = collections.defaultdict(lambda: {}) _iter = [0] def tick(): _iter[0] += 1 def plot(name, valu...
982
22.97561
68
py
Excessive-Invariance
Excessive-Invariance-master/l0/gan/tflib/__init__.py
import numpy as np import tensorflow as tf import locale locale.setlocale(locale.LC_ALL, '') _params = {} _param_aliases = {} def param(name, *args, **kwargs): """ A wrapper for `tf.Variable` which enables parameter sharing in models. Creates and returns theano shared variables similarly to `tf.Vari...
3,755
31.947368
125
py
Excessive-Invariance
Excessive-Invariance-master/l0/gan/tflib/mnist.py
import numpy import os import urllib.request, urllib.parse, urllib.error import gzip import pickle as pickle def mnist_generator(data, batch_size, n_labelled, limit=None): images, targets = data rng_state = numpy.random.get_state() numpy.random.shuffle(images) numpy.random.set_state(rng_state) nu...
2,180
32.553846
105
py
Excessive-Invariance
Excessive-Invariance-master/l0/gan/tflib/ops/conv2d.py
import tflib as lib import numpy as np import tensorflow as tf _default_weightnorm = False def enable_default_weightnorm(): global _default_weightnorm _default_weightnorm = True _weights_stdev = None def set_weights_stdev(weights_stdev): global _weights_stdev _weights_stdev = weights_stdev def unset...
3,860
30.137097
140
py
Excessive-Invariance
Excessive-Invariance-master/l0/gan/tflib/ops/cond_batchnorm.py
import tflib as lib import numpy as np import tensorflow as tf def Batchnorm(name, axes, inputs, is_training=None, stats_iter=None, update_moving_stats=True, fused=True, labels=None, n_labels=None): """conditional batchnorm (dumoulin et al 2016) for BCHW conv filtermaps""" if axes != [0,2,3]: raise Ex...
870
50.235294
135
py
Excessive-Invariance
Excessive-Invariance-master/l0/gan/tflib/ops/batchnorm.py
import tflib as lib import numpy as np import tensorflow as tf def Batchnorm(name, axes, inputs, is_training=None, stats_iter=None, update_moving_stats=True, fused=True): if ((axes == [0,2,3]) or (axes == [0,2])) and fused==True: if axes==[0,2]: inputs = tf.expand_dims(inputs, 3) # Old...
4,374
48.715909
169
py
Excessive-Invariance
Excessive-Invariance-master/l0/gan/tflib/ops/deconv2d.py
import tflib as lib import numpy as np import tensorflow as tf _default_weightnorm = False def enable_default_weightnorm(): global _default_weightnorm _default_weightnorm = True _weights_stdev = None def set_weights_stdev(weights_stdev): global _weights_stdev _weights_stdev = weights_stdev def unset...
3,276
27.25
101
py
Excessive-Invariance
Excessive-Invariance-master/l0/gan/tflib/ops/layernorm.py
import tflib as lib import numpy as np import tensorflow as tf def Layernorm(name, norm_axes, inputs): mean, var = tf.nn.moments(inputs, norm_axes, keep_dims=True) # Assume the 'neurons' axis is the first of norm_axes. This is the case for fully-connected and BCHW conv layers. n_neurons = inputs.get_shap...
821
38.142857
117
py
Excessive-Invariance
Excessive-Invariance-master/l0/gan/tflib/ops/conv1d.py
import tflib as lib import numpy as np import tensorflow as tf _default_weightnorm = False def enable_default_weightnorm(): global _default_weightnorm _default_weightnorm = True def Conv1D(name, input_dim, output_dim, filter_size, inputs, he_init=True, mask_type=None, stride=1, weightnorm=None, biases=True, ...
3,401
30.211009
140
py
Excessive-Invariance
Excessive-Invariance-master/l0/gan/tflib/ops/linear.py
import tflib as lib import numpy as np import tensorflow as tf _default_weightnorm = False def enable_default_weightnorm(): global _default_weightnorm _default_weightnorm = True def disable_default_weightnorm(): global _default_weightnorm _default_weightnorm = False _weights_stdev = None def set_wei...
4,548
29.736486
98
py
Excessive-Invariance
Excessive-Invariance-master/l0/gan/tflib/ops/__init__.py
0
0
0
py
Pal-5-in-Gaia-DR2
Pal-5-in-Gaia-DR2-master/src/significance.py
# -*- coding: utf-8 -*- # ---------------------------------------------------------------------------- # # TITLE : compute significance # AUTHOR : Nathaniel Starkman # PROJECT : AST1501 # # ---------------------------------------------------------------------------- # Docstring and Metadata """Compute Stream Signi...
3,599
22.225806
78
py
Pal-5-in-Gaia-DR2
Pal-5-in-Gaia-DR2-master/src/projection.py
# -*- coding: utf-8 -*- # ---------------------------------------------------------------------------- # # TITLE : projection # AUTHOR : Nathaniel Starkman # PROJECT : AST1501 # # ---------------------------------------------------------------------------- # Docstring and Metadata """Projection. Routine Listings ...
7,816
22.264881
79
py
Pal-5-in-Gaia-DR2
Pal-5-in-Gaia-DR2-master/src/plot.py
# -*- coding: utf-8 -*- # ---------------------------------------------------------------------------- # # TITLE : plotfuncs # AUTHOR : Nathaniel Starkman # PROJECT : AST1501 # # ---------------------------------------------------------------------------- # Docstring and Metadata """plot functions. Routine Listin...
16,398
24.385449
79
py
Pal-5-in-Gaia-DR2
Pal-5-in-Gaia-DR2-master/src/__init__.py
# -*- coding: utf-8 -*- # ---------------------------------------------------------------------------- # # TITLE : src initialization # AUTHOR : Nathaniel Starkman # PROJECT : AST1501 # # ---------------------------------------------------------------------------- # Docstring and Metadata """AST1501. Routine List...
2,834
23.652174
79
py
Pal-5-in-Gaia-DR2
Pal-5-in-Gaia-DR2-master/src/_loadorbits.py
# -*- coding: utf-8 -*- # ---------------------------------------------------------------------------- # # TITLE : loadorbits # AUTHOR : Nathaniel Starkman # PROJECT : AST1501 # # ---------------------------------------------------------------------------- # Docstring and Metadata """load orbits. Routine Listings...
19,689
26.347222
79
py
Pal-5-in-Gaia-DR2
Pal-5-in-Gaia-DR2-master/src/select/gsel.py
#!/usr/bin/env python # -*- coding: utf-8 -*- # ---------------------------------------------------------------------------- # # TITLE : g selection # AUTHOR : Nathaniel Starkman # PROJECT : AST1501 # # ---------------------------------------------------------------------------- # Docstring and Metadata """g selec...
1,663
20.333333
78
py
Pal-5-in-Gaia-DR2
Pal-5-in-Gaia-DR2-master/src/select/cmd.py
#!/usr/bin/env python # -*- coding: utf-8 -*- # ---------------------------------------------------------------------------- # # TITLE : initializing selection functions # AUTHOR : Nathaniel Starkman # PROJECT : AST1501 # # ---------------------------------------------------------------------------- # Docstring an...
4,434
26.042683
78
py
Pal-5-in-Gaia-DR2
Pal-5-in-Gaia-DR2-master/src/select/pm.py
# -*- coding: utf-8 -*- # ---------------------------------------------------------------------------- # # TITLE : initializing selection functions # AUTHOR : Nathaniel Starkman # PROJECT : AST1501 # # ---------------------------------------------------------------------------- # Docstring and Metadata """Proper m...
3,195
24.98374
78
py
Pal-5-in-Gaia-DR2
Pal-5-in-Gaia-DR2-master/src/select/select.py
# -*- coding: utf-8 -*- # ---------------------------------------------------------------------------- # # TITLE : select # AUTHOR : Nathaniel Starkman # PROJECT : AST1501 # # ---------------------------------------------------------------------------- # Docstring and Metadata """Selection Functions. Routine List...
8,358
23.730769
79
py
Pal-5-in-Gaia-DR2
Pal-5-in-Gaia-DR2-master/src/select/__init__.py
# -*- coding: utf-8 -*- # ---------------------------------------------------------------------------- # # TITLE : initializing selection functions # AUTHOR : Nathaniel Starkman # PROJECT : AST1501 # # ---------------------------------------------------------------------------- # Docstring and Metadata """selectio...
758
25.172414
78
py
Pal-5-in-Gaia-DR2
Pal-5-in-Gaia-DR2-master/src/select/combined.py
#!/usr/bin/env python # -*- coding: utf-8 -*- # ---------------------------------------------------------------------------- # # TITLE : # AUTHOR : Nathaniel Starkman # PROJECT : # # ---------------------------------------------------------------------------- # Docstring and Metadata """combine selections.""" __a...
5,018
24.348485
79
py
Pal-5-in-Gaia-DR2
Pal-5-in-Gaia-DR2-master/src/util/mwdust_util.py
# -*- coding: utf-8 -*- # ---------------------------------------------------------------------------- # # TITLE : mwdust_util # AUTHOR : Nathaniel Starkman # PROJECT : AST1501 # # ---------------------------------------------------------------------------- # Docstring and Metadata """utilities for mwdust. TODO u...
5,230
21.450644
78
py
Pal-5-in-Gaia-DR2
Pal-5-in-Gaia-DR2-master/src/util/pickle.py
# -*- coding: utf-8 -*- # ---------------------------------------------------------------------------- # # TITLE : pickle # AUTHOR : Nathaniel Starkman # PROJECT : AST1501 # # ---------------------------------------------------------------------------- # Docstring and Metadata """pickle.""" __author__ = "Nathanie...
1,526
21.130435
78
py