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 |
|---|---|---|---|---|---|---|
ModProp | ModProp-main/lsnn/toolbox/file_saver_dumper_no_h5py.py | """
The Clear BSD License
Copyright (c) 2019 the LSNN team, institute for theoretical computer science, TU Graz
All rights reserved.
Redistribution and use in source and binary forms, with or without modification, are permitted (subject to the limitations in the disclaimer below) provided that the following condition... | 5,938 | 40.243056 | 844 | py |
ModProp | ModProp-main/lsnn/toolbox/rewiring_tools.py | """
The Clear BSD License
Copyright (c) 2019 the LSNN team, institute for theoretical computer science, TU Graz
All rights reserved.
Redistribution and use in source and binary forms, with or without modification, are permitted (subject to the limitations in the disclaimer below) provided that the following condition... | 19,259 | 43.790698 | 844 | py |
ModProp | ModProp-main/lsnn/toolbox/tensorflow_utils.py | """
The Clear BSD License
Copyright (c) 2019 the LSNN team, institute for theoretical computer science, TU Graz
All rights reserved.
Redistribution and use in source and binary forms, with or without modification, are permitted (subject to the limitations in the disclaimer below) provided that the following condition... | 13,530 | 34.514436 | 844 | py |
ModProp | ModProp-main/lsnn/toolbox/matplotlib_extension.py | """
The Clear BSD License
Copyright (c) 2019 the LSNN team, institute for theoretical computer science, TU Graz
All rights reserved.
Redistribution and use in source and binary forms, with or without modification, are permitted (subject to the limitations in the disclaimer below) provided that the following condition... | 3,976 | 41.763441 | 844 | py |
ModProp | ModProp-main/lsnn/toolbox/__init__.py | 0 | 0 | 0 | py | |
ModProp | ModProp-main/lsnn/toolbox/tensorflow_einsums/test_bij_ki_to_bkj.py | """
The Clear BSD License
Copyright (c) 2019 the LSNN team, institute for theoretical computer science, TU Graz
All rights reserved.
Redistribution and use in source and binary forms, with or without modification, are permitted (subject to the limitations in the disclaimer below) provided that the following condition... | 2,164 | 54.512821 | 844 | py |
ModProp | ModProp-main/lsnn/toolbox/tensorflow_einsums/test_bi_ijk_to_bjk.py | """
The Clear BSD License
Copyright (c) 2019 the LSNN team, institute for theoretical computer science, TU Graz
All rights reserved.
Redistribution and use in source and binary forms, with or without modification, are permitted (subject to the limitations in the disclaimer below) provided that the following condition... | 2,156 | 58.916667 | 844 | py |
ModProp | ModProp-main/lsnn/toolbox/tensorflow_einsums/test_bij_jk_to_bik.py | """
The Clear BSD License
Copyright (c) 2019 the LSNN team, institute for theoretical computer science, TU Graz
All rights reserved.
Redistribution and use in source and binary forms, with or without modification, are permitted (subject to the limitations in the disclaimer below) provided that the following condition... | 2,279 | 57.461538 | 844 | py |
ModProp | ModProp-main/lsnn/toolbox/tensorflow_einsums/__init__.py | 0 | 0 | 0 | py | |
ModProp | ModProp-main/lsnn/toolbox/tensorflow_einsums/einsum_re_written.py | """
The Clear BSD License
Copyright (c) 2019 the LSNN team, institute for theoretical computer science, TU Graz
All rights reserved.
Redistribution and use in source and binary forms, with or without modification, are permitted (subject to the limitations in the disclaimer below) provided that the following condition... | 3,076 | 39.486842 | 844 | py |
ModProp | ModProp-main/lsnn/toolbox/tensorflow_einsums/test_bi_bij_to_bj.py | """
The Clear BSD License
Copyright (c) 2019 the LSNN team, institute for theoretical computer science, TU Graz
All rights reserved.
Redistribution and use in source and binary forms, with or without modification, are permitted (subject to the limitations in the disclaimer below) provided that the following condition... | 2,152 | 58.805556 | 844 | py |
query-selected-attention | query-selected-attention-main/test.py | import os
import torch
from options.test_options import TestOptions
from data import create_dataset
from models import create_model
from util.visualizer import save_images
from util import html
import util.util as util
if __name__ == '__main__':
opt = TestOptions().parse() # get test options
# hard-code some... | 2,235 | 49.818182 | 123 | py |
query-selected-attention | query-selected-attention-main/train.py | import time
import torch
from options.train_options import TrainOptions
from data import create_dataset
from models import create_model
from util.visualizer import Visualizer
if __name__ == '__main__':
opt = TrainOptions().parse() # get training options
dataset = create_dataset(opt) # create a dataset give... | 4,279 | 55.315789 | 186 | py |
query-selected-attention | query-selected-attention-main/options/train_options.py | from .base_options import BaseOptions
class TrainOptions(BaseOptions):
"""This class includes training options.
It also includes shared options defined in BaseOptions.
"""
def initialize(self, parser):
parser = BaseOptions.initialize(self, parser)
# visdom and HTML visualization para... | 3,799 | 83.444444 | 210 | py |
query-selected-attention | query-selected-attention-main/options/base_options.py | import argparse
import os
from util import util
import torch
import models
import data
class BaseOptions():
"""This class defines options used during both training and test time.
It also implements several helper functions such as parsing, printing, and saving the options.
It also gathers additional opti... | 9,260 | 57.613924 | 287 | py |
query-selected-attention | query-selected-attention-main/options/__init__.py | """This package options includes option modules: training options, test options, and basic options (used in both training and test)."""
| 136 | 67.5 | 135 | py |
query-selected-attention | query-selected-attention-main/options/test_options.py | from .base_options import BaseOptions
class TestOptions(BaseOptions):
"""This class includes test options.
It also includes shared options defined in BaseOptions.
"""
def initialize(self, parser):
parser = BaseOptions.initialize(self, parser) # define shared options
parser.add_argum... | 975 | 43.363636 | 104 | py |
query-selected-attention | query-selected-attention-main/models/base_model.py | import os
import torch
from collections import OrderedDict
from abc import ABC, abstractmethod
from . import networks_global
class BaseModel(ABC):
"""This class is an abstract base class (ABC) for models.
To create a subclass, you need to implement the following five functions:
-- <__init__>: ... | 11,231 | 42.366795 | 260 | py |
query-selected-attention | query-selected-attention-main/models/patchnce.py | from packaging import version
import torch
from torch import nn
class PatchNCELoss(nn.Module):
def __init__(self, opt):
super().__init__()
self.opt = opt
self.cross_entropy_loss = torch.nn.CrossEntropyLoss(reduction='none')
self.mask_dtype = torch.uint8 if version.parse(torch.__ver... | 1,598 | 38 | 114 | py |
query-selected-attention | query-selected-attention-main/models/qs_model.py | import numpy as np
import torch
from .base_model import BaseModel
from . import networks_global, networks_local, networks_local_global
from .patchnce import PatchNCELoss
import util.util as util
class QSModel(BaseModel):
@staticmethod
def modify_commandline_options(parser, is_train=True):
parser.add_a... | 9,580 | 47.145729 | 204 | py |
query-selected-attention | query-selected-attention-main/models/networks_local.py | import torch
import torch.nn as nn
import torch.nn.functional as F
from torch.nn import init
import functools
from torch.optim import lr_scheduler
import numpy as np
###############################################################################
# Helper Functions
######################################################... | 61,828 | 42.480309 | 187 | py |
query-selected-attention | query-selected-attention-main/models/networks_global.py | import torch
import torch.nn as nn
import torch.nn.functional as F
from torch.nn import init
import functools
from torch.optim import lr_scheduler
import numpy as np
###############################################################################
# Helper Functions
######################################################... | 61,118 | 42.19364 | 187 | py |
query-selected-attention | query-selected-attention-main/models/__init__.py | """This package contains modules related to objective functions, optimizations, and network architectures.
To add a custom model class called 'dummy', you need to add a file called 'dummy_model.py' and define a subclass DummyModel inherited from BaseModel.
You need to implement the following five functions:
-- <__... | 3,072 | 44.191176 | 250 | py |
query-selected-attention | query-selected-attention-main/models/networks_local_global.py | import torch
import torch.nn as nn
import torch.nn.functional as F
from torch.nn import init
import functools
from torch.optim import lr_scheduler
import numpy as np
###############################################################################
# Helper Functions
######################################################... | 61,819 | 42.443429 | 187 | py |
query-selected-attention | query-selected-attention-main/util/image_pool.py | import random
import torch
class ImagePool():
"""This class implements an image buffer that stores previously generated images.
This buffer enables us to update discriminators using a history of generated images
rather than the ones produced by the latest generators.
"""
def __init__(self, pool_... | 2,226 | 39.490909 | 140 | py |
query-selected-attention | query-selected-attention-main/util/html.py | import dominate
from dominate.tags import meta, h3, table, tr, td, p, a, img, br
import os
class HTML:
"""This HTML class allows us to save images and write texts into a single HTML file.
It consists of functions such as <add_header> (add a text header to the HTML file),
<add_images> (add a row of imag... | 3,223 | 36.057471 | 157 | py |
query-selected-attention | query-selected-attention-main/util/visualizer.py | import numpy as np
import os
import sys
import ntpath
import time
from . import util, html
from subprocess import Popen, PIPE
if sys.version_info[0] == 2:
VisdomExceptionBase = Exception
else:
VisdomExceptionBase = ConnectionError
def save_images(webpage, visuals, image_path, aspect_ratio=1.0, width=256):
... | 11,187 | 45.041152 | 139 | py |
query-selected-attention | query-selected-attention-main/util/util.py | """This module contains simple helper functions """
from __future__ import print_function
import torch
import numpy as np
from PIL import Image
import os
import importlib
import argparse
from argparse import Namespace
import torchvision
def str2bool(v):
if isinstance(v, bool):
return v
if v.lower() in... | 5,135 | 29.754491 | 145 | py |
query-selected-attention | query-selected-attention-main/util/__init__.py | """This package includes a miscellaneous collection of useful helper functions."""
from util import *
| 102 | 33.333333 | 82 | py |
query-selected-attention | query-selected-attention-main/util/get_data.py | from __future__ import print_function
import os
import tarfile
import requests
from warnings import warn
from zipfile import ZipFile
from bs4 import BeautifulSoup
from os.path import abspath, isdir, join, basename
class GetData(object):
"""A Python script for downloading CycleGAN or pix2pix datasets.
Paramet... | 3,639 | 31.792793 | 90 | py |
query-selected-attention | query-selected-attention-main/datasets/combine_A_and_B.py | import os
import numpy as np
import cv2
import argparse
parser = argparse.ArgumentParser('create image pairs')
parser.add_argument('--fold_A', dest='fold_A', help='input directory for image A', type=str, default='../dataset/50kshoes_edges')
parser.add_argument('--fold_B', dest='fold_B', help='input directory for image... | 2,208 | 44.081633 | 129 | py |
query-selected-attention | query-selected-attention-main/datasets/prepare_cityscapes_dataset.py | import os
import glob
from PIL import Image
help_msg = """
The dataset can be downloaded from https://cityscapes-dataset.com.
Please download the datasets [gtFine_trainvaltest.zip] and [leftImg8bit_trainvaltest.zip] and unzip them.
gtFine contains the semantics segmentations. Use --gtFine_dir to specify the path to th... | 4,040 | 43.406593 | 142 | py |
query-selected-attention | query-selected-attention-main/datasets/detect_cat_face.py | import cv2
import os
import glob
import argparse
def get_file_paths(folder):
image_file_paths = []
for root, dirs, filenames in os.walk(folder):
filenames = sorted(filenames)
for filename in filenames:
input_path = os.path.abspath(root)
file_path = os.path.join(input_pa... | 2,566 | 38.492308 | 115 | py |
query-selected-attention | query-selected-attention-main/datasets/make_dataset_aligned.py | import os
from PIL import Image
def get_file_paths(folder):
image_file_paths = []
for root, dirs, filenames in os.walk(folder):
filenames = sorted(filenames)
for filename in filenames:
input_path = os.path.abspath(root)
file_path = os.path.join(input_path, filename)
... | 2,257 | 34.28125 | 97 | py |
query-selected-attention | query-selected-attention-main/data/base_dataset.py | """This module implements an abstract base class (ABC) 'BaseDataset' for datasets.
It also includes common transformation functions (e.g., get_transform, __scale_width), which can be later used in subclasses.
"""
import random
import numpy as np
import torch.utils.data as data
from PIL import Image
import torchvision.... | 8,026 | 33.748918 | 153 | py |
query-selected-attention | query-selected-attention-main/data/unaligned_dataset.py | import os.path
from data.base_dataset import BaseDataset, get_transform
from data.image_folder import make_dataset
from PIL import Image
import random
import util.util as util
class UnalignedDataset(BaseDataset):
"""
This dataset class can load unaligned/unpaired datasets.
It requires two directories to ... | 3,582 | 43.7875 | 122 | py |
query-selected-attention | query-selected-attention-main/data/image_folder.py | """A modified image folder class
We modify the official PyTorch image folder (https://github.com/pytorch/vision/blob/master/torchvision/datasets/folder.py)
so that this class can load images from both current directory and its subdirectories.
"""
import torch.utils.data as data
from PIL import Image
import os
import... | 1,941 | 27.985075 | 122 | py |
query-selected-attention | query-selected-attention-main/data/__init__.py | """This package includes all the modules related to data loading and preprocessing
To add a custom dataset class called 'dummy', you need to add a file called 'dummy_dataset.py' and define a subclass 'DummyDataset' inherited from BaseDataset.
You need to implement four functions:
-- <__init__>: ... | 3,667 | 36.050505 | 176 | py |
query-selected-attention | query-selected-attention-main/data/template_dataset.py | """Dataset class template
This module provides a template for users to implement custom datasets.
You can specify '--dataset_mode template' to use this dataset.
The class name should be consistent with both the filename and its dataset_mode option.
The filename should be <dataset_mode>_dataset.py
The class name should... | 3,506 | 45.144737 | 156 | py |
query-selected-attention | query-selected-attention-main/data/single_dataset.py | from data.base_dataset import BaseDataset, get_transform
from data.image_folder import make_dataset
from PIL import Image
class SingleDataset(BaseDataset):
"""This dataset class can load a set of images specified by the path --dataroot /path/to/data.
It can be used for generating CycleGAN results only for on... | 1,495 | 35.487805 | 105 | py |
minhashcuda | minhashcuda-master/test.py | from time import time
import unittest
from datasketch import WeightedMinHashGenerator, WeightedMinHash
import libMHCUDA
import numpy
from scipy.sparse import csr_matrix
from scipy.stats import gamma, uniform
class MHCUDATests(unittest.TestCase):
def test_calc_tiny(self):
v1 = [1, 0, 0, 0, 3, 4, 5, 0, 0, ... | 10,279 | 42.375527 | 92 | py |
minhashcuda | minhashcuda-master/setup.py | from multiprocessing import cpu_count
import os
from setuptools import setup
from setuptools.command.build_py import build_py
from setuptools.dist import Distribution
from shutil import copyfile
from subprocess import check_call
import sys
import sysconfig
with open(os.path.join(os.path.dirname(__file__), "README.md")... | 3,487 | 33.534653 | 78 | py |
biosbias | biosbias-master/download_bios.py | from pebble import ProcessPool, ProcessExpired
import os
from argparse import ArgumentParser
from multiprocessing import cpu_count
import time
import gzip
import json
import requests
import sys
import pickle as pkl
from warcio.archiveiterator import ArchiveIterator
import re
MAX_PAGE_LEN = 100 * 1000
MAX_LINE_LEN = 1... | 12,315 | 39.916944 | 668 | py |
biosbias | biosbias-master/preprocess.py | import random, glob, re
import pickle as pkl
from argparse import ArgumentParser
titles_to_ignore = {'real_estate_broker', 'landscape_architect', 'massage_therapist', 'magician', 'acupuncturist'} # close but not enough data on these titles :-(
def save_pkl(obj, filename):
with open(filename, "wb") as f:
p... | 3,535 | 40.116279 | 216 | py |
aircraftnoise | aircraftnoise-master/classifier/__init__.py | 0 | 0 | 0 | py | |
aircraftnoise | aircraftnoise-master/classifier/testing/convnettester.py | import tensorflow as tf
import sys
import os
import numpy as np
'''
The object that encapsulates the training procedure and status
'''
class ConvNetTester(object):
'''
The object constructor
'''
# net: the model object we are training
# server: the server object to use for all... | 4,580 | 44.356436 | 88 | py |
aircraftnoise | aircraftnoise-master/classifier/testing/__init__.py | 0 | 0 | 0 | py | |
aircraftnoise | aircraftnoise-master/classifier/adapters/macadapter.py | from __future__ import division
import numpy as np
import nibabel as nib
import os
from collections import OrderedDict
import sys
# Default batch size (deprecated)
DEF_BATCH_SIZE = 20
class MACAdapter(object):
def __init__(self, input_dir, dim, folds=None):
# store dimensionality
self.dim = dim
... | 4,760 | 37.088 | 85 | py |
aircraftnoise | aircraftnoise-master/classifier/adapters/__init__.py | 0 | 0 | 0 | py | |
aircraftnoise | aircraftnoise-master/classifier/training/convnettrainer.py | import tensorflow as tf
import sys
import os
import numpy as np
'''
The object that encapsulates the training procedure and status
'''
class ConvNetTrainer(object):
'''
The object constructor
'''
# net: the model object we are training
# server: the server object to use for al... | 9,534 | 47.156566 | 148 | py |
aircraftnoise | aircraftnoise-master/classifier/training/__init__.py | 0 | 0 | 0 | py | |
aircraftnoise | aircraftnoise-master/classifier/models/layers.py | from __future__ import print_function, division, absolute_import, unicode_literals
import tensorflow as tf
'''
Functions to initialize variables
'''
def weight_variable(shape, stddev):
return tf.Variable(tf.truncated_normal(shape, stddev=stddev))
def bias_variable(shape):
return tf.Variable(tf.constant(0.1,... | 479 | 23 | 82 | py |
aircraftnoise | aircraftnoise-master/classifier/models/__init__.py | 0 | 0 | 0 | py | |
aircraftnoise | aircraftnoise-master/classifier/models/convnet.py | from __future__ import division
from collections import OrderedDict
import numpy as np
from math import ceil, floor
from models.layers import *
'''
The function that defines the set of computations that takes the input x
to the set of logits predicted for each event
'''
def build_convnet(x, durs, csize=3, ksize=2, di... | 7,062 | 34.671717 | 110 | py |
aircraftnoise | aircraftnoise-master/classifier/scripts/use_convnet.py | from models.convnet import ConvNet
from servers.convnetserver import ConvNetServer
from adapters.macadapter import MACAdapter
from preprocessing.preprocessor import Preprocessor
import numpy as np
import tensorflow as tf
'''
CONFIGURATION
'''
'''
Preprocessing
'''
RAW_FILE = '../raw_data/400_community_events.csv'
DI... | 2,293 | 24.208791 | 77 | py |
aircraftnoise | aircraftnoise-master/classifier/scripts/example_from_api.py |
import json
from models.convnet import ConvNet
from servers.convnetserver import ConvNetServer
from adapters.macadapter import MACAdapter
from preprocessing.preprocessor import Preprocessor
import numpy as np
import tensorflow as tf
'''
CONFIGURATION
'''
# Example JSON file
EXAMPLE_FILE = '../raw_data/sample.json'... | 2,724 | 24.707547 | 101 | py |
aircraftnoise | aircraftnoise-master/classifier/scripts/queue.py |
import json
import os
import psycopg2
import psycopg2.extras
import shutil
import boto3
import signal
import time
import datetime
from models.convnet import ConvNet
from servers.convnetserver import ConvNetServer
from adapters.macadapter import MACAdapter
from preprocessing.preprocessor import Preprocessor
import nu... | 7,149 | 34.39604 | 174 | py |
aircraftnoise | aircraftnoise-master/classifier/scripts/example_training_from_api.py |
import json
from models.convnet import ConvNet
from servers.convnetserver import ConvNetServer
from adapters.macadapter import MACAdapter
from preprocessing.preprocessor import Preprocessor
from training.convnettrainer import ConvNetTrainer
import numpy as np
import tensorflow as tf
'''
CONFIGURATION
'''
# Example... | 3,465 | 26.951613 | 86 | py |
aircraftnoise | aircraftnoise-master/classifier/scripts/test_shape.py | from models.convnet import ConvNet
from servers.convnetserver import ConvNetServer
from training.convnettrainer import ConvNetTrainer
from adapters.macadapter import MACAdapter
import numpy as np
'''
CONFIGURATION
'''
'''
Server
'''
# directory to get training, validation, and testing data from
INPUT_DIR = "devin"
#... | 1,621 | 21.527778 | 70 | py |
aircraftnoise | aircraftnoise-master/classifier/scripts/cv_convnet.py | from models.convnet import ConvNet
from servers.convnetserver import ConvNetServer
from training.convnettrainer import ConvNetTrainer
from adapters.macadapter import MACAdapter
from testing.convnettester import ConvNetTester
import numpy as np
'''
CONFIGURATION
'''
'''
Adapter
'''
# Number of folds for k-fold cross-... | 2,258 | 21.818182 | 76 | py |
aircraftnoise | aircraftnoise-master/classifier/scripts/train_convnet.py | from models.convnet import ConvNet
from servers.convnetserver import ConvNetServer
from training.convnettrainer import ConvNetTrainer
from adapters.macadapter import MACAdapter
import numpy as np
'''
CONFIGURATION
'''
'''
Adapter
'''
# Number of folds for k-fold cross-validation (decided during preprocessing)
FOLDS ... | 2,077 | 22.613636 | 76 | py |
aircraftnoise | aircraftnoise-master/classifier/scripts/__init__.py | 0 | 0 | 0 | py | |
aircraftnoise | aircraftnoise-master/classifier/servers/convnetserver.py | import os
import sys
import numpy as np
import errno
import logging
import time
'''
The object that handles the bulk of the interactions with the operating system
This includes getting feed_dict data, storing predictions, and logging training
'''
class ConvNetServer(object):
'''
The server constructor
'''... | 4,669 | 31.887324 | 91 | py |
aircraftnoise | aircraftnoise-master/classifier/servers/__init__.py | 0 | 0 | 0 | py | |
aircraftnoise | aircraftnoise-master/classifier/preprocessing/crossvalidate.py | from preprocessor import Preprocessor
import sys
# Proportions of data in each resulting set
TRPROP = 0.8 # Training
TEPROP = 0.0 # Testing
# VALIDATION SET IS REST
# Names of files containing the raw data
input_files = ['../raw_data/oml_final.csv', '../raw_data/400_community_events.csv']
# IDs of events in the fir... | 2,772 | 30.511364 | 87 | py |
aircraftnoise | aircraftnoise-master/classifier/preprocessing/event2d.py | import tensorflow as tf
import numpy as np
import json
import math
import sys
keys = ["6.3","8.0","10.0","12.5","16.0","20.0","25.0","31.5","40.0","50.0","63.0","80.0","100","125","160","200","250","315","400","500","630","800","1000","1250","1600","2000","2500","3150","4000","5000","6300","8000","10000","12500","1600... | 3,647 | 33.415094 | 262 | py |
aircraftnoise | aircraftnoise-master/classifier/preprocessing/__init__.py | 0 | 0 | 0 | py | |
aircraftnoise | aircraftnoise-master/classifier/preprocessing/preprocess.py | from preprocessor import Preprocessor
import sys
# Proportions of data in each resulting set
TRPROP = 1.0 # Training
TEPROP = 0.0 # Testing
# VALIDATION SET IS REST
# Names of files containing the raw data
input_files = ['../raw_data/oml_final.csv', '../raw_data/400_community_events.csv']
# IDs of events in the fir... | 2,682 | 30.940476 | 86 | py |
aircraftnoise | aircraftnoise-master/classifier/preprocessing/preprocessor.py | import numpy as np
import tensorflow as tf
import csv
import json
import math
import sys
import random
import os
from event2d import Event2D
class Preprocessor:
# Contructor
# does nothing atm
def __init__(self):
"nothing to be done"
# Utility function of get_raw_data
# adds event to the... | 7,521 | 34.649289 | 115 | py |
aircraftnoise | aircraftnoise-master/histogram/make_histogram.py | import re
import numpy as np
import matplotlib.pyplot as plt
f = open('cvlog.log')
accuracies = []
for line in f:
if line[33:].startswith('This Accuracy:'):
this_accuracy = float(line[48:])
if (this_accuracy > 0.1):
accuracies = accuracies + [this_accuracy]
accuracies = np.array(acc... | 577 | 20.407407 | 53 | py |
aircraftnoise | aircraftnoise-master/preprocessing/crossvalidate.py | from preprocessor import Preprocessor
import sys
# Proportions of data in each resulting set
TRPROP = 0.8 # Training
TEPROP = 0.0 # Testing
# VALIDATION SET IS REST
# Names of files containing the raw data
input_files = ['../raw_data/oml_final.csv', '../raw_data/400_community_events.csv']
# IDs of events in the fir... | 2,772 | 30.511364 | 87 | py |
aircraftnoise | aircraftnoise-master/preprocessing/event2d.py | import tensorflow as tf
import numpy as np
import json
import math
import sys
import matplotlib.pyplot as plt
keys = ["6.3","8.0","10.0","12.5","16.0","20.0","25.0","31.5","40.0","50.0","63.0","80.0","100","125","160","200","250","315","400","500","630","800","1000","1250","1600","2000","2500","3150","4000","5000","... | 3,721 | 31.649123 | 262 | py |
aircraftnoise | aircraftnoise-master/preprocessing/__init__.py | 0 | 0 | 0 | py | |
aircraftnoise | aircraftnoise-master/preprocessing/preprocess.py | from preprocessor import Preprocessor
import sys
# Proportions of data in each resulting set
TRPROP = 1.0 # Training
TEPROP = 0.0 # Testing
# VALIDATION SET IS REST
# Names of files containing the raw data
input_files = ['data/400_community_events.csv', 'data/oml_final.csv']
# IDs of events in the first set that ki... | 2,668 | 30.77381 | 86 | py |
aircraftnoise | aircraftnoise-master/preprocessing/preprocessor.py | import numpy as np
import tensorflow as tf
import csv
import json
import math
import sys
import random
import os
from event2d import Event2D
class Preprocessor:
# Contructor
# does nothing atm
def __init__(self):
"nothing to be done"
# Utility function of get_raw_data
# adds event to the... | 6,979 | 35.165803 | 115 | py |
bottom-up-attention | bottom-up-attention-master/tools/compress_net.py | #!/usr/bin/env python
# --------------------------------------------------------
# Fast R-CNN
# Copyright (c) 2015 Microsoft
# Licensed under The MIT License [see LICENSE for details]
# Written by Ross Girshick
# --------------------------------------------------------
"""Compress a Fast R-CNN network using truncated... | 3,918 | 30.103175 | 81 | py |
bottom-up-attention | bottom-up-attention-master/tools/read_tsv.py | #!/usr/bin/env python
import base64
import numpy as np
import csv
import sys
import zlib
import time
import mmap
csv.field_size_limit(sys.maxsize)
FIELDNAMES = ['image_id', 'image_w','image_h','num_boxes', 'boxes', 'features']
infile = '/data/coco/tsv/trainval/karpathy_val_resnet101_faster_rcnn_genome.tsv'
if... | 1,048 | 26.605263 | 85 | py |
bottom-up-attention | bottom-up-attention-master/tools/train_faster_rcnn_alt_opt.py | #!/usr/bin/env python
# --------------------------------------------------------
# Faster R-CNN
# Copyright (c) 2015 Microsoft
# Licensed under The MIT License [see LICENSE for details]
# Written by Ross Girshick
# --------------------------------------------------------
"""Train a Faster R-CNN network using alternat... | 12,871 | 37.423881 | 80 | py |
bottom-up-attention | bottom-up-attention-master/tools/reval.py | #!/usr/bin/env python
# --------------------------------------------------------
# Fast R-CNN
# Copyright (c) 2015 Microsoft
# Licensed under The MIT License [see LICENSE for details]
# Written by Ross Girshick
# --------------------------------------------------------
"""Reval = re-eval. Re-evaluate saved detections... | 2,126 | 30.746269 | 76 | py |
bottom-up-attention | bottom-up-attention-master/tools/test_net.py | #!/usr/bin/env python
# --------------------------------------------------------
# Fast R-CNN
# Copyright (c) 2015 Microsoft
# Licensed under The MIT License [see LICENSE for details]
# Written by Ross Girshick
# --------------------------------------------------------
"""Test a Fast R-CNN network on an image databas... | 3,742 | 35.696078 | 111 | py |
bottom-up-attention | bottom-up-attention-master/tools/_init_paths.py | # --------------------------------------------------------
# Fast R-CNN
# Copyright (c) 2015 Microsoft
# Licensed under The MIT License [see LICENSE for details]
# Written by Ross Girshick
# --------------------------------------------------------
"""Set up paths for Fast R-CNN."""
import os.path as osp
import sys
d... | 627 | 23.153846 | 58 | py |
bottom-up-attention | bottom-up-attention-master/tools/demo_rfcn.py | #!/usr/bin/env python
# --------------------------------------------------------
# R-FCN
# Copyright (c) 2016 Yuwen Xiong
# Licensed under The MIT License [see LICENSE for details]
# Written by Yuwen Xiong
# --------------------------------------------------------
"""
Demo script showing detections in sample images.
... | 4,938 | 31.708609 | 85 | py |
bottom-up-attention | bottom-up-attention-master/tools/demo.py | #!/usr/bin/env python
# --------------------------------------------------------
# Faster R-CNN
# Copyright (c) 2015 Microsoft
# Licensed under The MIT License [see LICENSE for details]
# Written by Ross Girshick
# --------------------------------------------------------
"""
Demo script showing detections in sample i... | 5,123 | 31.846154 | 80 | py |
bottom-up-attention | bottom-up-attention-master/tools/train_svms.py | #!/usr/bin/env python
# --------------------------------------------------------
# Fast R-CNN
# Copyright (c) 2015 Microsoft
# Licensed under The MIT License [see LICENSE for details]
# Written by Ross Girshick
# --------------------------------------------------------
"""
Train post-hoc SVMs using the algorithm and ... | 13,480 | 37.081921 | 80 | py |
bottom-up-attention | bottom-up-attention-master/tools/train_net_multi_gpu.py | #!/usr/bin/env python
# --------------------------------------------------------
# Written by Bharat Singh
# Modified version of py-R-FCN
# --------------------------------------------------------
"""Train a Fast R-CNN network on a region of interest database."""
import _init_paths
from fast_rcnn.train_multi_gpu imp... | 3,684 | 32.5 | 78 | py |
bottom-up-attention | bottom-up-attention-master/tools/generate_tsv.py | #!/usr/bin/env python
"""Generate bottom-up attention features as a tsv file. Can use multiple gpus, each produces a
separate tsv file that can be merged later (e.g. by using merge_tsv function).
Modify the load_image_ids script as necessary for your data location. """
# Example:
# ./tools/generate_tsv.py -... | 8,584 | 35.688034 | 301 | py |
bottom-up-attention | bottom-up-attention-master/tools/eval_recall.py | #!/usr/bin/env python
import _init_paths
from fast_rcnn.config import cfg, cfg_from_file, cfg_from_list
from datasets.factory import get_imdb
import argparse
import time, os, sys
import numpy as np
def parse_args():
"""
Parse input arguments
"""
parser = argparse.ArgumentParser(description='Test a Fas... | 2,265 | 30.915493 | 77 | py |
bottom-up-attention | bottom-up-attention-master/tools/rpn_generate.py | #!/usr/bin/env python
# --------------------------------------------------------
# Fast/er/ R-CNN
# Copyright (c) 2015 Microsoft
# Licensed under The MIT License [see LICENSE for details]
# Written by Ross Girshick
# --------------------------------------------------------
"""Generate RPN proposals."""
import _init_... | 2,994 | 31.554348 | 78 | py |
bottom-up-attention | bottom-up-attention-master/tools/train_rfcn_alt_opt_5stage.py | #!/usr/bin/env python
# --------------------------------------------------------
# R-FCN
# Copyright (c) 2016 Yuwen Xiong, Haozhi Qi
# Licensed under The MIT License [see LICENSE for details]
# --------------------------------------------------------
"""Train a R-FCN network using alternating optimization.
This tool ... | 18,472 | 37.646444 | 103 | py |
bottom-up-attention | bottom-up-attention-master/tools/demo_vg.py | #!/usr/bin/env python
# --------------------------------------------------------
# Faster R-CNN
# Copyright (c) 2015 Microsoft
# Licensed under The MIT License [see LICENSE for details]
# Written by Ross Girshick
# --------------------------------------------------------
"""
Demo script showing detections in sample i... | 11,553 | 34.550769 | 155 | py |
bottom-up-attention | bottom-up-attention-master/tools/train_net.py | #!/usr/bin/env python
# --------------------------------------------------------
# Fast R-CNN
# Copyright (c) 2015 Microsoft
# Licensed under The MIT License [see LICENSE for details]
# Written by Ross Girshick
# --------------------------------------------------------
"""Train a Fast R-CNN network on a region of int... | 3,747 | 32.168142 | 78 | py |
bottom-up-attention | bottom-up-attention-master/data/genome/create_splits.py | #!/usr/bin/python
''' Determine visual genome data splits to avoid contamination of COCO splits.'''
import argparse
import os
import random
from random import shuffle
import shutil
import subprocess
import sys
import json
random.seed(10) # Make dataset splits repeatable
CURDIR = os.path.dirname(os.path.realpath(__... | 4,163 | 29.844444 | 120 | py |
bottom-up-attention | bottom-up-attention-master/data/genome/setup_vg.py | #!/usr/bin/python
''' Visual genome data analysis and preprocessing.'''
import json
import os
import operator
from visual_genome_python_driver import local as vg
from collections import Counter, defaultdict
import xml.etree.cElementTree as ET
from xml.dom import minidom
dataDir = './data/vg'
outDir = 'data/genome'... | 7,416 | 34.319048 | 96 | py |
bottom-up-attention | bottom-up-attention-master/data/genome/visual_genome_python_driver/local.py | from models import Image, Object, Attribute, Relationship
from models import Region, Graph, QA, QAObject, Synset
import httplib
import json
import utils
import os, gc
"""
Get Image ids from startIndex to endIndex.
"""
def GetAllImageData(dataDir=None):
if dataDir is None:
dataDir = utils.GetDataDir()
dataFile ... | 8,938 | 30.038194 | 104 | py |
bottom-up-attention | bottom-up-attention-master/data/genome/visual_genome_python_driver/utils.py | from models import Image, Object, Attribute, Relationship
from models import Region, Graph, QA, QAObject, Synset
import httplib
import json
"""
Get the local directory where the Visual Genome data is locally stored.
"""
def GetDataDir():
from os.path import dirname, realpath, join
dataDir = join(dirname(realpath('... | 3,292 | 30.361905 | 105 | py |
bottom-up-attention | bottom-up-attention-master/data/genome/visual_genome_python_driver/api.py | from models import Image, Object, Attribute, Relationship
from models import Region, Graph, QA, QAObject, Synset
import httplib
import json
import utils
"""
Get all Image ids.
"""
def GetAllImageIds():
page = 1
next = '/api/v0/images/all?page=' + str(page)
ids = []
while True:
data = utils.RetrieveData(nex... | 4,121 | 27.427586 | 93 | py |
bottom-up-attention | bottom-up-attention-master/data/genome/visual_genome_python_driver/models.py | """
Visual Genome Python API wrapper, models
"""
"""
Image.
ID int
url hyperlink string
width int
height int
"""
class Image:
def __init__(self, id, url, width, height, coco_id, flickr_id):
self.id = id
self.url = url
self.width = width
self.height = height
self.c... | 4,469 | 21.923077 | 137 | py |
bottom-up-attention | bottom-up-attention-master/data/genome/visual_genome_python_driver/__init__.py | 0 | 0 | 0 | py | |
bottom-up-attention | bottom-up-attention-master/caffe/tools/extra/summarize.py | #!/usr/bin/env python
"""Net summarization tool.
This tool summarizes the structure of a net in a concise but comprehensive
tabular listing, taking a prototxt file as input.
Use this tool to check at a glance that the computation you've specified is the
computation you expect.
"""
from caffe.proto import caffe_pb2
... | 4,880 | 33.617021 | 95 | py |
bottom-up-attention | bottom-up-attention-master/caffe/tools/extra/extract_seconds.py | #!/usr/bin/env python
import datetime
import os
import sys
def extract_datetime_from_line(line, year):
# Expected format: I0210 13:39:22.381027 25210 solver.cpp:204] Iteration 100, lr = 0.00992565
line = line.strip().split()
month = int(line[0][1:3])
day = int(line[0][3:])
timestamp = line[1]
p... | 2,208 | 29.260274 | 97 | py |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.