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 |
|---|---|---|---|---|---|---|
deep_direct_stat | deep_direct_stat-master/models/__init__.py | 0 | 0 | 0 | py | |
deep_direct_stat | deep_direct_stat-master/datasets/pascal3d.py | import os
from os.path import dirname
import h5py
import numpy as np
PASCAL_CLASSES = ['aeroplane', 'bicycle', 'boat', 'bottle', 'bus', 'car',
'chair', 'diningtable', 'motorbike', 'sofa', 'train', 'tvmonitor']
def help():
print("File %s not found!\n\n"
"Download the preprocessed PASC... | 3,758 | 30.066116 | 116 | py |
deep_direct_stat | deep_direct_stat-master/datasets/__init__.py | 0 | 0 | 0 | py | |
deep_direct_stat | deep_direct_stat-master/datasets/caviar.py | import pickle
import gzip
import numpy as np
def load_caviar(data_path,
val_split=0.5,
canonical_split=True,
verbose=0):
(xtr, ytr_deg, *info_tr), (xvalte, yvalte_deg, *info_valte) = pickle.load(gzip.open(data_path, 'rb'))
def _parse_info(info):
parsed... | 1,454 | 26.980769 | 105 | py |
deep_direct_stat | deep_direct_stat-master/datasets/idiap.py | import numpy as np
import joblib
def load_idiap(data_path,
val_split=0.5,
canonical_split=True,
verbose=0):
""" Load, preprocess and perform val-test split for IDIAP headpose dataset
You can download
Parameters
----------
data_path: str
pat... | 2,995 | 31.215054 | 110 | py |
deep_direct_stat | deep_direct_stat-master/datasets/towncentre.py | import numpy as np
import pickle, gzip
def split_dataset(X, y, img_names, split=0.1):
itr, ival, ite, trs, vals, tes = [], [], [], set(), set(), set()
for i, name in enumerate(img_names):
# Extract the person's ID.
pid = int(name.split('_')[1])
# Decide where to put that person.
... | 2,899 | 32.333333 | 91 | py |
deep_direct_stat | deep_direct_stat-master/utils/losses.py | import numpy as np
import tensorflow as tf
from scipy.special import i0 as mod_bessel0
from scipy.special import i1 as mod_bessel1
from keras import backend as K
from scipy.stats import multivariate_normal
def cosine_loss_np(y_target, y_pred):
return 1 - np.sum(np.multiply(y_target, y_pred),axis=1)
def mad_loss... | 14,052 | 33.27561 | 119 | py |
deep_direct_stat | deep_direct_stat-master/utils/sampling.py | import numpy as np
def sample_multiple_gauassians_np(mu, std, n_samples=10):
"""Sample points from multiple multivariate gaussian distributions
Parameters
----------
mu: numpy array of shape [n_points, n_dims]
mean values of multiple multivariate gaussians
std: numpy array of shape [n_po... | 2,883 | 30.010753 | 118 | py |
deep_direct_stat | deep_direct_stat-master/utils/angles.py | import numpy as np
def rad2bit(angles_rad):
""" radians to biternion ([cos, sin])
"""
return np.array([np.cos(angles_rad), np.sin(angles_rad)]).T
def deg2bit(angles_deg):
""" degrees to biternion ([cos, sin])
"""
angles_rad = np.deg2rad(angles_deg)
return np.array([np.cos(angles_rad), np... | 1,490 | 26.109091 | 104 | py |
deep_direct_stat | deep_direct_stat-master/utils/__init__.py | 0 | 0 | 0 | py | |
deep_direct_stat | deep_direct_stat-master/utils/custom_keras_callbacks.py | import keras
import numpy as np
import pandas as pd
import warnings
class SideModelCheckpoint(keras.callbacks.Callback):
def __init__(self, model_name, model_to_save, save_path, save_weights_only=False):
self.model_name = model_name
self.model = model_to_save
self.save_path = save_path
... | 6,614 | 43.695946 | 106 | py |
deep_direct_stat | deep_direct_stat-master/training_scripts/train_towncentre.py | import sys
import os
from os.path import dirname
from datasets.towncentre import load_towncentre
from models.infinite_mixture import BiternionMixture
import datetime
from utils import angles
import numpy as np
def log_step(mess):
dtstr = datetime.datetime.now().strftime('%Y-%m-%d %H:%M:%S')
print(' '.join([dts... | 2,094 | 30.742424 | 97 | py |
deep_direct_stat | deep_direct_stat-master/training_scripts/train_pascal3d.py | import sys
import os
from os.path import dirname
from datasets import pascal3d
from models.infinite_mixture import BiternionMixture
import datetime
def log_step(mess):
dtstr = datetime.datetime.now().strftime('%Y-%m-%d %H:%M:%S')
print(' '.join([dtstr, mess]))
def main():
cls = sys.argv[1] # if cls is ... | 1,894 | 31.672414 | 117 | py |
KG-DQN | KG-DQN-master/scripts/format_to_drqa.py | import re
from nltk.tokenize import sent_tokenize
from fuzzywuzzy import fuzz
import json
import random
data_list = []
with open('./oracle.txt', 'r') as f:
cur = []
cur_admissible_actions = "N, S, E, W, look, examine"
cur_taken_action = ""
id = 0
for line in f:
line = line.replace('\n', '... | 2,845 | 35.961039 | 140 | py |
KG-DQN | KG-DQN-master/scripts/datacollector.py | import numpy as np
import textworld
import re
import sys
import glob
import requests
import json
class NaiveAgent(textworld.Agent):
def __init__(self, seed=1234):
self.seed = seed
self.rng = np.random.RandomState(self.seed)
self.actions = ["north", "south", "east", "west", "up", "down",
... | 7,454 | 33.041096 | 117 | py |
KG-DQN | KG-DQN-master/dqn/dqn.py | import math, random
import textworld
import numpy as np
import torch
import torch.nn as nn
import torch.optim as optim
import torch.autograd as autograd
import torch.nn.functional as F
from collections import deque
from nltk.tokenize import word_tokenize
#from matplotlib import use
#use('Agg')
import matplotlib.pypl... | 9,801 | 34.132616 | 118 | py |
KG-DQN | KG-DQN-master/dqn/train.py | from dqn import DQNTrainer
from utils.grid_search import RandomGridSearch
from joblib import Parallel, delayed
import multiprocessing
import gc
#from guppy import hpy
#from memory_profiler import profile
#@profile
def parallelize(game, params):
print(params)
#game = "/home/eilab/Raj/tw-drl/Games/obj_20_qlen_5_... | 1,746 | 28.610169 | 103 | py |
KG-DQN | KG-DQN-master/utils/graph_replay.py | from collections import deque
import numpy as np
import random
class GraphReplayBuffer(object):
def __init__(self, capacity):
self.buffer = deque(maxlen=capacity)
def push(self, state, action, reward, next_state, done):
self.buffer.append((state, action, reward, next_state, done))
def sa... | 2,149 | 37.392857 | 108 | py |
KG-DQN | KG-DQN-master/utils/replay.py | from collections import deque
import numpy as np
import random
class ReplayBuffer(object):
def __init__(self, capacity):
self.buffer = deque(maxlen=capacity)
def push(self, state, action, reward, next_state, done):
state = np.expand_dims(state, 0)
next_state = np.expand_dims(next_stat... | 2,867 | 41.80597 | 190 | py |
KG-DQN | KG-DQN-master/utils/grid_search.py | import utils.schedule
import itertools
import random
def generate_cartesian_product(dict):
result = []
dict_notags = []
keys = []
for key in dict:
keys.append(key)
dict_notags.append(dict[key])
for p in itertools.product(*dict_notags):
pending_object = {}
for index ... | 1,188 | 26.022727 | 77 | py |
KG-DQN | KG-DQN-master/utils/schedule.py | import math
"""
Adapted from https://github.com/berkeleydeeprlcourse/homework
"""
class Schedule(object):
def value(self, t):
"""Value of the schedule at time t"""
raise NotImplementedError()
class ConstantSchedule(object):
def __init__(self, value):
"""Value remains constant over ti... | 3,728 | 35.203883 | 94 | py |
KG-DQN | KG-DQN-master/utils/drqa_utils.py | import argparse
class AverageMeter(object):
"""Keep exponential weighted averages."""
def __init__(self, beta=0.99):
self.beta = beta
self.moment = 0
self.value = 0
self.t = 0
def state_dict(self):
return vars(self)
def load(self, state_dict):
for k, v... | 829 | 23.411765 | 69 | py |
KG-DQN | KG-DQN-master/kgdqn/gdqn.py | import networkx as nx
import torch
import torch.nn as nn
import torch.optim as optim
import torch.autograd as autograd
import torch.nn.functional as F
import spacy
import logging
import textworld
import matplotlib.pyplot as plt
from representations import StateNAction
from utils.schedule import *
#from utils.priorit... | 8,916 | 36.624473 | 110 | py |
KG-DQN | KG-DQN-master/kgdqn/layers.py | import torch
import torch.nn as nn
import torch.nn.functional as F
from torch.autograd import Variable
import numpy as np
class GraphAttentionLayer(nn.Module):
"""
Simple GAT layer, similar to https://arxiv.org/abs/1710.10903
"""
def __init__(self, in_features, out_features, dropout, alpha, concat=Fa... | 6,418 | 35.68 | 215 | py |
KG-DQN | KG-DQN-master/kgdqn/rnn_reader.py | import torch
import torch.nn as nn
from layers import *
class RnnDocReader(nn.Module):
"""Network for the Document Reader module of DrQA."""
RNN_TYPES = {'lstm': nn.LSTM, 'gru': nn.GRU, 'rnn': nn.RNN}
def __init__(self, opt, padding_idx=0, embedding=None):
super(RnnDocReader, self).__init__()
... | 5,938 | 39.958621 | 84 | py |
KG-DQN | KG-DQN-master/kgdqn/models.py | import torch
import torch.nn as nn
import torch.optim as optim
import torch.autograd as autograd
import torch.nn.functional as F
import spacy
import numpy as np
from layers import *
from drqa import *
class GAT(nn.Module):
def __init__(self, nfeat, nhid, nclass, dropout, alpha, nheads):
super(GAT, self).... | 8,466 | 40.915842 | 115 | py |
KG-DQN | KG-DQN-master/kgdqn/train.py | from gdqn import KGDQNTrainer
from utils.grid_search import RandomGridSearch
from joblib import Parallel, delayed
def parallelize(game, params):
print(params)
trainer = KGDQNTrainer(game, params)
trainer.train()
if __name__ == "__main__":
#Example for random grid search on the parameter space
""... | 2,461 | 27.298851 | 86 | py |
KG-DQN | KG-DQN-master/kgdqn/representations.py | import networkx as nx
import requests
from nltk import sent_tokenize, word_tokenize
import json
import numpy as np
import re
import matplotlib.pyplot as plt
import itertools
import random
def call_stanford_openie(sentence):
url = "http://localhost:9000/"
querystring = {
"properties": "%7B%22annotators... | 11,697 | 34.7737 | 109 | py |
KG-DQN | KG-DQN-master/kgdqn/drqa.py | import random
import torch
import torch.optim as optim
import torch.nn.functional as F
import numpy as np
import logging
from torch.autograd import Variable
from utils.drqa_utils import AverageMeter
from rnn_reader import RnnDocReader
class DocReaderModel(object):
"""High level model that handles intializing the... | 5,300 | 35.061224 | 89 | py |
Slic | Slic-master/utils.py | import torch
from dataset import SolarDataset
from model import SolarClassifier
from torch.utils.data import DataLoader
import numpy as np
from tqdm import tqdm
import sunpy.cm as cm
import matplotlib.pyplot as plt
import torch.nn.functional as F
import os, html
from astropy.io import fits
import sunpy.map as m
from sk... | 7,245 | 41.623529 | 250 | py |
Slic | Slic-master/model.py | import torch
import torch.nn as nn
from torch.nn.init import kaiming_normal_
class SolarClassifier(nn.Module):
def __init__(self):
super().__init__()
self.max_pool = nn.MaxPool2d(kernel_size=2,stride=2)
self.layer1 = nn.Sequential(
nn.Conv2d(1,64,kernel_size=3,padding=1),
... | 2,842 | 32.05814 | 231 | py |
Slic | Slic-master/dataset.py | import numpy as np
from torch.utils.data import Dataset
class SolarDataset(Dataset):
def __init__(self,source="from_file",dat_file=None,data_arr=None,label_arr=None,test=False):
super().__init__()
self.test = test
if not self.test:
if source == "from_file":
if da... | 2,892 | 33.035294 | 141 | py |
Slic | Slic-master/data.py | import numpy as np
from astropy.io.fits import getdata
import os,argparse
from scipy.misc import imresize
from tqdm import tqdm
def train_test_data(dataset,percentage_split=10,save_dir="./"):
'''
Parameters
----------
dataset : str
The path to the dataset to be prepped.
percentage_split : i... | 2,750 | 42.666667 | 196 | py |
Slic | Slic-master/confusion_matrix.py | import numpy as np
import pandas as pd
from dataset import *
from model import solar_classifier
import torch
from torch.utils.data import DataLoader
class ConfusionMatrix():
'''
A class to store the confusion matrix, its features and the associated statistics that go along with it.
Parameters
--------... | 9,563 | 32.093426 | 279 | py |
Slic | Slic-master/train.py | import torch
import torch.nn as nn
import torch.optim as optim
from torch.utils.data import DataLoader
import numpy as np
from dataset import SolarDataset
from model import SolarClassifier
import argparse
from tqdm import tqdm
def train(model,device,data_loader,optimiser,epoch,criterion):
model.to(device)
mode... | 4,003 | 51.684211 | 158 | py |
dancin_seq2seq | dancin_seq2seq-master/adversarial.py | """
adversarial.py - Adversarial classes.
Classes:
Autoencoder: a general autoencoder interface.
SpamSeq2SeqAutoencoder: a sequence to sequence autoencoder interface.
"""
from __future__ import division
import gc
import logging
import numpy as np
import os
import scipy
import scipy.stats
import sklearn
impo... | 14,259 | 43.5625 | 168 | py |
dancin_seq2seq | dancin_seq2seq-master/discriminator.py | """
discriminator.py - Discriminator classes.
Classes:
Discriminator: a general discriminator interface.
MultinomialNBDiscriminator: a multinomial NaiveBayes subclass.
"""
from __future__ import division
import os
import numpy as np
import scipy
import scipy.stats
import sklearn
import sklearn.feature_extract... | 6,178 | 38.608974 | 117 | py |
dancin_seq2seq | dancin_seq2seq-master/dataset.py | """
dataset.py
Classes:
DatasetEncoderDecoder: encodes and decodes sentences according to a fixed, written vocabulary.
SpamDataset: utility functions to read and write dataset files.
"""
import os
import numpy as np
import sklearn
class DatasetEncoderDecoder(object):
"""
Encodes and decodes sentences... | 5,820 | 40.283688 | 113 | py |
dancin_seq2seq | dancin_seq2seq-master/autoencoder.py | """
autoencoder.py - Autoencoder classes.
Classes:
Autoencoder: a general autoencoder interface.
SpamSeq2SeqAutoencoder: a sequence to sequence autoencoder interface.
"""
from __future__ import division
import logging
import numpy as np
import os
import scipy
import scipy.stats
import sklearn
import torch
... | 7,919 | 35.837209 | 115 | py |
dancin_seq2seq | dancin_seq2seq-master/__init__.py | 0 | 0 | 0 | py | |
Rail-Detection | Rail-Detection-main/train.py | import torch, os, datetime, copy, json, scipy, cv2
import numpy as np
from model.model import parsingNet
from data.dataloader import get_train_loader
from data.dataset import raildb_row_anchor
from utils.evaluation import LaneEval, grid_2_inter
from utils.dist_utils import dist_print, dist_tqdm, is_main_process
from ... | 12,493 | 46.325758 | 158 | py |
Rail-Detection | Rail-Detection-main/segmentation/backbone.py | import torch,pdb
import torchvision
import torch.nn.modules
class vgg16bn(torch.nn.Module):
def __init__(self,pretrained = False):
super(vgg16bn,self).__init__()
model = list(torchvision.models.vgg16_bn(pretrained=pretrained).features.children())
model = model[:33]+model[34:43]
self... | 2,097 | 35.172414 | 92 | py |
Rail-Detection | Rail-Detection-main/segmentation/speed_simple.py | <<<<<<< HEAD
import torch
import time, sys
import numpy as np
from model_seg import parsingNet
torch.backends.cudnn.benchmark = True
net = parsingNet(pretrained = False, backbone='18', cls_dim=(200, 52, 4)).cuda()
net.eval()
x = torch.zeros((1,3,288,800)).cuda() + 1
for i in range(10):
y = net(x)
t_all = []
for ... | 1,764 | 22.851351 | 80 | py |
Rail-Detection | Rail-Detection-main/segmentation/__init__.py | 0 | 0 | 0 | py | |
Rail-Detection | Rail-Detection-main/segmentation/model_seg.py | from turtle import forward
import torch, sys
from backbone import resnet
import numpy as np
import torch
import torch.nn as nn
import torch.nn.functional as F
class conv_bn_relu(nn.Module):
def __init__(self, in_channels, out_channels, upsample=0):
super(conv_bn_relu,self).__init__()
self.conv = t... | 5,456 | 33.980769 | 126 | py |
Rail-Detection | Rail-Detection-main/segmentation/train.py | <<<<<<< HEAD
from wsgiref import validate
from matplotlib.pyplot import plot
import torch, os, datetime, copy, json, scipy, time, sys, cv2
import numpy as np
from IPython import embed
from model_seg import parsingNet
sys.path.append("..")
from data.dataloader import get_train_loader
from data.constant import raildb_ro... | 24,730 | 48.860887 | 158 | py |
Rail-Detection | Rail-Detection-main/hand-crafted/hand_crafted.py | # -*- coding: utf-8 -*-
"""
Created on Sun Oct 8 21:49:26 2017
@author: zander
"""
import os, random, sys, json
import cv2
import hand_utils
import matplotlib.pyplot as plt
import numpy as np
from PIL import Image
import time, tqdm
from IPython import embed
import pandas as pd
import torch.multiprocessing
torch.mult... | 3,461 | 34.690722 | 132 | py |
Rail-Detection | Rail-Detection-main/hand-crafted/hand_utils.py | # -*- coding: utf-8 -*-
"""
Created on Fri Oct 6 23:37:10 2017
@author: yang
"""
import numpy as np
import os
import cv2
import matplotlib.pyplot as plt
import matplotlib.image as mpimg
from IPython import embed
import pdb
color_list = [(0,0,225), (255,0,0), (0,225,0), (255,0,225), (255,255,225), (0,255,255), (255,... | 14,160 | 38.555866 | 125 | py |
Rail-Detection | Rail-Detection-main/hand-crafted/__init__.py | 0 | 0 | 0 | py | |
Rail-Detection | Rail-Detection-main/hand-crafted/line.py | # -*- coding: utf-8 -*-
"""
Created on Tue Oct 10 19:38:04 2017
@author: yang
"""
import numpy as np
# Define a class to receive the characteristics of each line detection
class Line():
def __init__(self):
# was the line detected in the last iteration?
self.detected = False
# x values of... | 2,265 | 36.147541 | 117 | py |
Rail-Detection | Rail-Detection-main/configs/raildb.py | # DATA
dataset = 'raildb'
data_root = '/home/xinpeng/Rail-DB/'
# TRAIN
epoch = 50
batch_size = 64
optimizer = 'Adam' #['SGD','Adam']
# learning_rate = 0.1
learning_rate = 4e-4
weight_decay = 1e-4
momentum = 0.9
scheduler = 'cos' #['multi', 'cos']
# steps = [50,75]
gamma = 0.1
warmup = 'linear'
warmup_iters = ... | 653 | 15.35 | 55 | py |
Rail-Detection | Rail-Detection-main/configs/__init__.py | 0 | 0 | 0 | py | |
Rail-Detection | Rail-Detection-main/utils/deploy.py | import torch, os, cv2, sys
import scipy.special, tqdm
import numpy as np
import torchvision.transforms as transforms
from PIL import Image
sys.path.append("..")
from model.model import parsingNet
from utils.common import merge_config
from utils.dist_utils import dist_print
from utils.evaluation import grid_2_inter
fr... | 4,050 | 35.827273 | 122 | py |
Rail-Detection | Rail-Detection-main/utils/loss.py | import torch
import torch.nn as nn
import torch.nn.functional as F
import numpy as np
from IPython import embed
class OhemCELoss(nn.Module):
def __init__(self, thresh, n_min, ignore_lb=255, *args, **kwargs):
super(OhemCELoss, self).__init__()
self.thresh = -torch.log(torch.tensor(thresh, dtype=tor... | 2,528 | 34.125 | 86 | py |
Rail-Detection | Rail-Detection-main/utils/dist_utils.py | import torch
import torch.distributed as dist
import pickle
def get_world_size():
if not dist.is_available():
return 1
if not dist.is_initialized():
return 1
return dist.get_world_size()
def to_python_float(t):
if hasattr(t, 'item'):
return t.item()
else:
return t... | 4,623 | 25.574713 | 77 | py |
Rail-Detection | Rail-Detection-main/utils/config.py | import json
import os.path as osp
import shutil
import sys
import tempfile
from argparse import Action, ArgumentParser
from collections import abc
from importlib import import_module
from addict import Dict
BASE_KEY = '_base_'
DELETE_KEY = '_delete_'
class ConfigDict(Dict):
def __missing__(self, name):
... | 12,100 | 33.377841 | 79 | py |
Rail-Detection | Rail-Detection-main/utils/common.py |
import os, argparse
from utils.dist_utils import is_main_process, dist_print, DistSummaryWriter
from utils.config import Config
import torch
import time
def str2bool(v):
if isinstance(v, bool):
return v
if v.lower() in ('yes', 'true', 't', 'y', '1'):
return True
elif v.lower() in ('no', 'fa... | 5,025 | 43.477876 | 260 | py |
Rail-Detection | Rail-Detection-main/utils/factory.py |
from utils.loss import SoftmaxFocalLoss, ParsingRelationLoss, ParsingRelationDis
from utils.metrics import MultiLabelAcc, AccTopk, Metric_mIoU
from utils.dist_utils import DistSummaryWriter
import torch
def get_optimizer(net,cfg):
training_params = filter(lambda p: p.requires_grad, net.parameters())
if cfg.o... | 4,637 | 33.61194 | 160 | py |
Rail-Detection | Rail-Detection-main/utils/speed_simple.py | import torch
import time, sys
import numpy as np
sys.path.append("..")
from model.model import parsingNet
# from segmentation.model_seg import parsingNet
torch.backends.cudnn.benchmark = True
net = parsingNet(pretrained = False, backbone='34', cls_dim=(200, 52, 4)).cuda()
net.eval()
x = torch.zeros((1,3,288,800)).cud... | 934 | 23.605263 | 80 | py |
Rail-Detection | Rail-Detection-main/utils/metrics.py | import numpy as np
import torch
import time,pdb
def converter(data):
if isinstance(data,torch.Tensor):
data = data.cpu().data.numpy().flatten()
return data.flatten()
def fast_hist(label_pred, label_true, num_classes):
hist = np.bincount(num_classes * label_true.astype(int) + label_pred, minlen... | 3,271 | 31.39604 | 111 | py |
Rail-Detection | Rail-Detection-main/utils/__init__.py | 0 | 0 | 0 | py | |
Rail-Detection | Rail-Detection-main/utils/evaluation.py | import numpy as np
import json
from scipy import special
from IPython import embed
color_list = [(0,0,225), (255,0,0), (0,225,0), (255,0,225), (255,255,225), (0,255,255), (255,255,0), (125,255,255)]
thickness_list = [1, 3, 5, 7, 9, 11, 13, 15]
thickness_list.reverse()
def grid_2_inter(out, griding_num):
out = ou... | 3,658 | 32.568807 | 119 | py |
Rail-Detection | Rail-Detection-main/data/mytransforms.py | import numbers
import random
import numpy as np
from PIL import Image, ImageOps, ImageFilter
#from config import cfg
import torch
import pdb
import cv2
# ===============================img tranforms============================
class Compose2(object):
# compose all transforms for image and label
def __init__(s... | 5,217 | 30.245509 | 129 | py |
Rail-Detection | Rail-Detection-main/data/constant.py | # row anchors are a series of pre-defined coordinates in image height to detect lanes
# the row anchors are defined according to the evaluation protocol of CULane and Tusimple
# since our method will resize the image to 288x800 for training, the row anchors are defined with the height of 288
# you can modify these row ... | 745 | 66.818182 | 116 | py |
Rail-Detection | Rail-Detection-main/data/dataloader.py | import torch, os
import numpy as np
import torchvision.transforms as transforms
import data.mytransforms as mytransforms
from data.dataset import raildb_row_anchor
from data.dataset import RailClsDataset, RailTestDataset
def get_train_loader(batch_size, data_root, griding_num=56, distributed=True, num_rails=4, mode='... | 3,045 | 37.075 | 122 | py |
Rail-Detection | Rail-Detection-main/data/dataset.py | import torch
from PIL import Image
import os
import pdb
import numpy as np
import cv2
import random
import csv
import pandas as pd
import data.mytransforms as mytransforms
# import mytransforms as mytransforms
import torchvision.transforms as transforms
from IPython import embed
import os
os.environ["KMP_DUPLICATE_LI... | 8,571 | 38.141553 | 137 | py |
Rail-Detection | Rail-Detection-main/data/__init__.py | 0 | 0 | 0 | py | |
Rail-Detection | Rail-Detection-main/model/hubconf.py | <<<<<<< HEAD
# Optional list of dependencies required by the package
dependencies = ["torch"]
from torchvision.models.alexnet import alexnet
from torchvision.models.convnext import convnext_tiny, convnext_small, convnext_base, convnext_large
from torchvision.models.densenet import densenet121, densenet169, densenet201... | 4,315 | 28.972222 | 101 | py |
Rail-Detection | Rail-Detection-main/model/model.py | <<<<<<< HEAD
import torch
from model.backbone import resnet, mobilenet, squeezenet, VisionTransformer
import numpy as np
class conv_bn_relu(torch.nn.Module):
def __init__(self,in_channels, out_channels, kernel_size, stride=1, padding=0, dilation=1,bias=False):
super(conv_bn_relu,self).__init__()
se... | 7,248 | 33.850962 | 106 | py |
Rail-Detection | Rail-Detection-main/model/backbone.py | <<<<<<< HEAD
import torch, pdb
import torchvision
import torch.nn.modules
from IPython import embed
from model.hubconf import *
# from hubconf import *
class mobilenet(torch.nn.Module):
def __init__(self, backbone, pretrained = False):
super(mobilenet, self).__init__()
features = list(mobilenet_v2(... | 8,429 | 31.929688 | 92 | py |
Rail-Detection | Rail-Detection-main/model/__init__.py | 0 | 0 | 0 | py | |
git_unordered_points_plane | git_unordered_points_plane-main/library.py | # ****************************************************************************
# Copyright (C) 2022 Patricio Gallardo, Benjamin Schmidt
# Contact: <[email protected], [email protected]>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public Lice... | 3,386 | 42.987013 | 79 | py |
modern-srwm | modern-srwm-main/reinforcement_learning/setup.py | # Copyright (c) Facebook, Inc. and its affiliates.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or ... | 3,827 | 25.957746 | 86 | py |
modern-srwm | modern-srwm-main/reinforcement_learning/atari_data.py | # Taken from https://github.com/deepmind/dqn_zoo/blob/master/dqn_zoo/atari_data.py
#
# Copyright 2019 DeepMind Technologies Limited. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the ... | 4,282 | 36.902655 | 82 | py |
modern-srwm | modern-srwm-main/reinforcement_learning/nest/setup.py | # Copyright (c) Facebook, Inc. and its affiliates.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or ... | 2,736 | 28.117021 | 84 | py |
modern-srwm | modern-srwm-main/reinforcement_learning/nest/nest_test.py | # Copyright (c) Facebook, Inc. and its affiliates.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or ... | 5,498 | 31.157895 | 79 | py |
modern-srwm | modern-srwm-main/reinforcement_learning/tests/vtrace_test.py | # This file taken from
# https://github.com/deepmind/scalable_agent/blob/
# d24bd74bd53d454b7222b7f0bea57a358e4ca33e/vtrace_test.py
# and modified.
# Copyright 2018 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the Licen... | 9,701 | 35.611321 | 87 | py |
modern-srwm | modern-srwm-main/reinforcement_learning/tests/polybeast_net_test.py | # Copyright (c) Facebook, Inc. and its affiliates.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or ... | 3,863 | 41.933333 | 88 | py |
modern-srwm | modern-srwm-main/reinforcement_learning/tests/batching_queue_test.py | # Copyright (c) Facebook, Inc. and its affiliates.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or ... | 4,880 | 30.490323 | 85 | py |
modern-srwm | modern-srwm-main/reinforcement_learning/tests/polybeast_loss_functions_test.py | # Copyright (c) Facebook, Inc. and its affiliates.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or ... | 6,870 | 36.752747 | 88 | py |
modern-srwm | modern-srwm-main/reinforcement_learning/tests/inference_speed_profiling.py | # Copyright (c) Facebook, Inc. and its affiliates.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or ... | 3,562 | 25.992424 | 86 | py |
modern-srwm | modern-srwm-main/reinforcement_learning/tests/dynamic_batcher_test.py | # Copyright (c) Facebook, Inc. and its affiliates.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or ... | 7,972 | 28.639405 | 87 | py |
modern-srwm | modern-srwm-main/reinforcement_learning/tests/contiguous_arrays_test.py | # Copyright (c) Facebook, Inc. and its affiliates.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or ... | 2,650 | 31.728395 | 87 | py |
modern-srwm | modern-srwm-main/reinforcement_learning/tests/contiguous_arrays_env.py | # Copyright (c) Facebook, Inc. and its affiliates.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or ... | 1,220 | 31.131579 | 74 | py |
modern-srwm | modern-srwm-main/reinforcement_learning/tests/core_agent_state_env.py | # Copyright (c) Facebook, Inc. and its affiliates.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or ... | 1,230 | 29.02439 | 74 | py |
modern-srwm | modern-srwm-main/reinforcement_learning/tests/polybeast_learn_function_test.py | # Copyright (c) Facebook, Inc. and its affiliates.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or ... | 7,901 | 39.111675 | 85 | py |
modern-srwm | modern-srwm-main/reinforcement_learning/tests/core_agent_state_test.py | # Copyright (c) Facebook, Inc. and its affiliates.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or ... | 4,910 | 33.584507 | 88 | py |
modern-srwm | modern-srwm-main/reinforcement_learning/tests/polybeast_inference_test.py | # Copyright (c) Facebook, Inc. and its affiliates.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or ... | 5,191 | 39.248062 | 89 | py |
modern-srwm | modern-srwm-main/reinforcement_learning/torchbeast/layer.py | import math
import torch
from torch import nn
from torch.nn import functional as F
from torchbeast.fast_weight import fast_weight_delta
from torchbeast.fast_transformers import fast_weight_sum
from torchbeast.rec_update_fwm_tanh import rec_update_fwm_tanh
from torchbeast.fast_weight_rnn_v2 import fast_rnn_v2
from tor... | 42,905 | 33.573731 | 85 | py |
modern-srwm | modern-srwm-main/reinforcement_learning/torchbeast/atari_wrappers.py | # The MIT License
#
# Copyright (c) 2017 OpenAI (http://openai.com)
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, co... | 11,424 | 32.902077 | 130 | py |
modern-srwm | modern-srwm-main/reinforcement_learning/torchbeast/polybeast.py | # Copyright (c) Facebook, Inc. and its affiliates.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or ... | 1,674 | 26.916667 | 83 | py |
modern-srwm | modern-srwm-main/reinforcement_learning/torchbeast/noneg_polybeast_learner.py | # Copyright (c) Facebook, Inc. and its affiliates.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or ... | 35,307 | 37.088457 | 130 | py |
modern-srwm | modern-srwm-main/reinforcement_learning/torchbeast/polybeast_env.py | # Copyright (c) Facebook, Inc. and its affiliates.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or ... | 2,801 | 29.791209 | 86 | py |
modern-srwm | modern-srwm-main/reinforcement_learning/torchbeast/model.py | import nest
import torch
from torch import nn
from torch.nn import functional as F
from torchbeast.layer import DeltaNetLayer
from torchbeast.layer import LinearTransformerLayer
from torchbeast.layer import FastFFRecUpdateTanhLayer
from torchbeast.layer import FastRNNModelLayer
from torchbeast.layer import DeltaDelta... | 32,836 | 33.895855 | 86 | py |
modern-srwm | modern-srwm-main/reinforcement_learning/torchbeast/polybeast_learner.py | # Copyright (c) Facebook, Inc. and its affiliates.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or ... | 31,262 | 37.596296 | 130 | py |
modern-srwm | modern-srwm-main/reinforcement_learning/torchbeast/core/vtrace.py | # This file taken from
# https://github.com/deepmind/scalable_agent/blob/
# cd66d00914d56c8ba2f0615d9cdeefcb169a8d70/vtrace.py
# and modified.
# Copyright 2018 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
#... | 4,350 | 30.078571 | 86 | py |
modern-srwm | modern-srwm-main/reinforcement_learning/torchbeast/core/environment.py | # Copyright (c) Facebook, Inc. and its affiliates.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or ... | 2,470 | 32.849315 | 75 | py |
modern-srwm | modern-srwm-main/reinforcement_learning/torchbeast/core/prof.py | # Copyright (c) Facebook, Inc. and its affiliates.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or ... | 2,572 | 30.378049 | 88 | py |
modern-srwm | modern-srwm-main/reinforcement_learning/torchbeast/core/file_writer.py | # Copyright (c) Facebook, Inc. and its affiliates.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or ... | 7,787 | 35.055556 | 84 | py |
modern-srwm | modern-srwm-main/reinforcement_learning/torchbeast/self_ref_v0/__init__.py | # Adaptation of the original code from
# https://github.com/idiap/fast-transformers/blob/master/fast_transformers/causal_product/__init__.py
# Copyright (c) 2020 Idiap Research Institute, http://www.idiap.ch/
# Written by Angelos Katharopoulos <[email protected]>,
# Apoorv Vyas <[email protected]>
# Modificat... | 14,184 | 33.85258 | 113 | py |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.