repo stringlengths 1 99 | file stringlengths 13 215 | code stringlengths 12 59.2M | file_length int64 12 59.2M | avg_line_length float64 3.82 1.48M | max_line_length int64 12 2.51M | extension_type stringclasses 1
value |
|---|---|---|---|---|---|---|
head2head | head2head-master/models/flownet2_pytorch/networks/FlowNetC.py | import torch
import torch.nn as nn
from torch.nn import init
import math
import numpy as np
from .correlation_package.correlation import Correlation
from .submodules import *
'Parameter count , 39,175,298 '
class FlowNetC(nn.Module):
def __init__(self, args, batchNorm=True, div_flow = 20):
super(FlowNet... | 4,953 | 36.530303 | 119 | py |
head2head | head2head-master/models/flownet2_pytorch/networks/FlowNetFusion.py | import torch
import torch.nn as nn
from torch.nn import init
import math
import numpy as np
from .submodules import *
'Parameter count = 581,226'
class FlowNetFusion(nn.Module):
def __init__(self,args, batchNorm=True):
super(FlowNetFusion,self).__init__()
self.batchNorm = batchNorm
self.... | 2,329 | 33.264706 | 69 | py |
head2head | head2head-master/models/flownet2_pytorch/networks/FlowNetSD.py | import torch
import torch.nn as nn
from torch.nn import init
import math
import numpy as np
from .submodules import *
'Parameter count = 45,371,666'
class FlowNetSD(nn.Module):
def __init__(self, args, batchNorm=True):
super(FlowNetSD,self).__init__()
self.batchNorm = batchNorm
self.conv... | 4,187 | 38.140187 | 69 | py |
head2head | head2head-master/models/flownet2_pytorch/networks/FlowNetS.py | '''
Portions of this code copyright 2017, Clement Pinard
'''
import torch
import torch.nn as nn
from torch.nn import init
import math
import numpy as np
from .submodules import *
'Parameter count : 38,676,504 '
class FlowNetS(nn.Module):
def __init__(self, args, input_channels = 12, batchNorm=True):
sup... | 3,652 | 37.052083 | 91 | py |
head2head | head2head-master/models/flownet2_pytorch/networks/submodules.py | # freda (todo) :
import torch.nn as nn
import torch
import numpy as np
def conv(batchNorm, in_planes, out_planes, kernel_size=3, stride=1):
if batchNorm:
return nn.Sequential(
nn.Conv2d(in_planes, out_planes, kernel_size=kernel_size, stride=stride, padding=(kernel_size-1)//2, bias=False),
... | 2,728 | 28.344086 | 125 | py |
head2head | head2head-master/models/flownet2_pytorch/networks/channelnorm_package/setup.py | #!/usr/bin/env python3
import os
import torch
from setuptools import setup
from torch.utils.cpp_extension import BuildExtension, CUDAExtension
cxx_args = ['-std=c++11']
nvcc_args = [
'-gencode', 'arch=compute_52,code=sm_52',
'-gencode', 'arch=compute_60,code=sm_60',
'-gencode', 'arch=compute_61,code=sm_6... | 725 | 24.034483 | 67 | py |
head2head | head2head-master/models/flownet2_pytorch/networks/channelnorm_package/channelnorm.py | from torch.autograd import Function, Variable
from torch.nn.modules.module import Module
import channelnorm_cuda
class ChannelNormFunction(Function):
@staticmethod
def forward(ctx, input1, norm_deg=2):
assert input1.is_contiguous()
b, _, h, w = input1.size()
output = input1.new(b, 1, h... | 1,075 | 25.9 | 77 | py |
head2head | head2head-master/models/flownet2_pytorch/networks/correlation_package/correlation.py | import torch
from torch.nn.modules.module import Module
from torch.autograd import Function
import correlation_cuda
class CorrelationFunction(Function):
def __init__(self, pad_size=3, kernel_size=3, max_displacement=20, stride1=1, stride2=2, corr_multiply=1):
super(CorrelationFunction, self).__init__()
... | 2,264 | 34.952381 | 155 | py |
head2head | head2head-master/models/flownet2_pytorch/networks/correlation_package/setup.py | #!/usr/bin/env python3
import os
import torch
from setuptools import setup, find_packages
from torch.utils.cpp_extension import BuildExtension, CUDAExtension
cxx_args = ['-std=c++11']
nvcc_args = [
'-gencode', 'arch=compute_50,code=sm_50',
'-gencode', 'arch=compute_52,code=sm_52',
'-gencode', 'arch=compu... | 791 | 25.4 | 67 | py |
head2head | head2head-master/models/flownet2_pytorch/networks/resample2d_package/setup.py | #!/usr/bin/env python3
import os
import torch
from setuptools import setup
from torch.utils.cpp_extension import BuildExtension, CUDAExtension
cxx_args = ['-std=c++11']
nvcc_args = [
'-gencode', 'arch=compute_50,code=sm_50',
'-gencode', 'arch=compute_52,code=sm_52',
'-gencode', 'arch=compute_60,code=sm_6... | 767 | 24.6 | 67 | py |
head2head | head2head-master/models/flownet2_pytorch/networks/resample2d_package/resample2d.py | from torch.nn.modules.module import Module
from torch.autograd import Function, Variable
import resample2d_cuda
class Resample2dFunction(Function):
@staticmethod
def forward(ctx, input1, input2, kernel_size=1):
assert input1.is_contiguous()
assert input2.is_contiguous()
ctx.save_for_b... | 1,407 | 28.957447 | 75 | py |
head2head | head2head-master/models/flownet2_pytorch/utils/param_utils.py | import torch
import torch.nn as nn
import numpy as np
def parse_flownetc(modules, weights, biases):
keys = [
'conv1',
'conv2',
'conv3',
'conv_redir',
'conv3_1',
'conv4',
'conv4_1',
'conv5',
'conv5_1',
'conv6',
'conv6_1',
'deconv5',
'deconv4',
'deconv3',
... | 6,878 | 25.976471 | 102 | py |
head2head | head2head-master/models/flownet2_pytorch/utils/tools.py | # freda (todo) :
import os, time, sys, math
import subprocess, shutil
from os.path import *
import numpy as np
from inspect import isclass
from pytz import timezone
from datetime import datetime
import inspect
import torch
def datestr():
pacific = timezone('US/Pacific')
now = datetime.now(pacific)
return... | 5,388 | 36.165517 | 161 | py |
head2head | head2head-master/util/image_pool.py | import random
import numpy as np
import torch
from torch.autograd import Variable
class ImagePool():
def __init__(self, pool_size):
self.pool_size = pool_size
if self.pool_size > 0:
self.num_imgs = 0
self.images = []
def query(self, images):
if self.pool_size == ... | 1,109 | 32.636364 | 67 | py |
head2head | head2head-master/util/util.py | from __future__ import print_function
import torch
import numpy as np
from PIL import Image
import inspect, re
import numpy as np
import os
import collections
from PIL import Image
import cv2
from scipy.spatial import distance
def reshape(tensors):
if isinstance(tensors, list):
return [reshape(tensor) for ... | 7,995 | 41.989247 | 162 | py |
head2head | head2head-master/scripts/download_files.py | import zipfile
import wget
import os
import argparse
class MyProgressBar():
def __init__(self, message):
self.message = message
def get_bar(self, current, total, width=80):
print(self.message + ": %d%%" % (current / total * 100), end="\r")
def unzip_file(file_name, unzip_path):
zip_ref = ... | 1,549 | 35.904762 | 124 | py |
head2head | head2head-master/scripts/compile_flownet2.py | import os
os.system('cd ./models/flownet2_pytorch/; bash install.sh; cd ../../')
| 82 | 19.75 | 70 | py |
head2head | head2head-master/data/custom_dataset_data_loader.py | import torch.utils.data
from data.base_data_loader import BaseDataLoader
def CreateDataset(opt):
if opt.dataset_mode == 'video':
from data.video_dataset import videoDataset
dataset = videoDataset()
elif opt.dataset_mode == 'landmarks':
from data.landmarks_dataset import landmarksDataset... | 1,703 | 31.769231 | 99 | py |
head2head | head2head-master/data/landmarks_dataset.py | import os
import random
import torch
import numpy as np
import torchvision
from PIL import Image
from data.base_dataset import BaseDataset, get_params, get_transform, get_video_parameters
from data.image_folder import make_video_dataset, assert_valid_pairs
from data.landmarks_to_image import create_landmarks_image
cla... | 5,535 | 50.259259 | 132 | py |
head2head | head2head-master/data/base_dataset.py | import torch.utils.data as data
import torch
from PIL import Image
import torchvision.transforms as transforms
import numpy as np
import random
class BaseDataset(data.Dataset):
def __init__(self):
super(BaseDataset, self).__init__()
def name(self):
return 'BaseDataset'
def initialize(self... | 3,429 | 34.729167 | 102 | py |
head2head | head2head-master/data/image_folder.py | import os
import random
from PIL import Image
import torch.utils.data as data
IMG_EXTENSIONS = [
'.jpg', '.JPG', '.jpeg', '.JPEG', '.pgm', '.PGM',
'.png', '.PNG', '.ppm', '.PPM', '.bmp', '.BMP', '.tiff',
'.txt', '.json'
]
def is_image_file(filename):
return any(filename.endswith(extension) for extensi... | 2,914 | 33.294118 | 127 | py |
head2head | head2head-master/data/video_dataset.py | import os
import random
import torch
import numpy as np
import torchvision
from PIL import Image
from data.base_dataset import BaseDataset, get_params, get_transform, get_video_parameters
from data.image_folder import make_video_dataset, assert_valid_pairs
from data.landmarks_to_image import create_eyes_image
class vi... | 6,279 | 52.220339 | 146 | py |
head2head | head2head-master/preprocessing/compute_eye_landmarks_distance.py | import cv2
import os
import numpy as np
import argparse
import collections
from skimage import io
import torch
import itertools
import dlib
from tqdm import tqdm
import util.util as util
from detect_landmarks70 import detect_landmarks
from reconstruction import _procrustes
IMG_EXTENSIONS = ['.png']
def is_image_file(... | 3,661 | 38.376344 | 116 | py |
head2head | head2head-master/preprocessing/detect.py | import os
import cv2
import numpy as np
import pandas as pd
import scipy.signal
from PIL import Image
import torch
import argparse
from facenet_pytorch import MTCNN, extract_face
import matplotlib.pyplot as plt
import collections
from tqdm import tqdm
VID_EXTENSIONS = ['.mp4']
def is_video_file(filename):
return ... | 11,618 | 42.354478 | 169 | py |
head2head | head2head-master/preprocessing/compute_pixel_distance.py | import cv2
import os
import numpy as np
import argparse
import collections
import torch
import itertools
from tqdm import tqdm
import util.util as util
IMG_EXTENSIONS = ['.png']
def is_image_file(filename):
return any(filename.endswith(extension) for extension in IMG_EXTENSIONS)
def get_image_paths_dict(dir):
... | 2,865 | 36.710526 | 116 | py |
head2head | head2head-master/preprocessing/compute_distances.py | import cv2
import os
import numpy as np
import argparse
import collections
import torch
import itertools
from tqdm import tqdm
from preprocessing import transform
from reconstruction import NMFCRenderer
IMG_EXTENSIONS = ['.png']
def is_image_file(filename):
return any(filename.endswith(extension) for extension in... | 6,642 | 38.778443 | 132 | py |
head2head | head2head-master/preprocessing/reenact.py | import cv2
import os
import numpy as np
import torch
import argparse
import sys
import scipy.io as io
from shutil import copyfile
import itertools
from preprocessing.reconstruction import NMFCRenderer
def mkdirs(paths):
for path in paths:
if not os.path.exists(path):
os.makedirs(path)
def save... | 16,876 | 47.358166 | 126 | py |
head2head | head2head-master/preprocessing/reconstruct.py | import cv2
import os
import numpy as np
import argparse
import sys
import collections
import torch
from shutil import copyfile, rmtree
from tqdm import tqdm
from sklearn.decomposition import PCA
from sklearn.preprocessing import StandardScaler
from reconstruction import NMFCRenderer
def mkdir(path):
if not os.pat... | 7,470 | 42.436047 | 158 | py |
head2head | head2head-master/preprocessing/multiface/fc_predictor.py | import cv2
import numpy as np
import mxnet as mx
# import datetime
from skimage import transform as trans
import insightface
from . import img_helper
arcface_src = np.array([
[38.2946, 51.6963],
[73.5318, 51.5014],
[56.0252, 71.7366],
[41.5493, 92.3655],
[70.7299, 92.2041] ], dtype=np.float32 ) #... | 4,626 | 31.584507 | 100 | py |
SphereNet-pytorch | SphereNet-pytorch-master/example.py | import argparse
from spherenet import OmniMNIST, OmniFashionMNIST
from spherenet import SphereConv2D, SphereMaxPool2D
import torch
from torch import nn
import torch.nn.functional as F
import numpy as np
class SphereNet(nn.Module):
def __init__(self):
super(SphereNet, self).__init__()
self.conv1 = ... | 6,671 | 42.894737 | 129 | py |
SphereNet-pytorch | SphereNet-pytorch-master/setup.py | from setuptools import setup
setup(name='spherenet',
version='0.1',
description='Pytorch implementation of ECCV 2018 paper: '
'SphereNet: Learning Spherical Representations '
'for Detection and Classification in Omnidirectional Images',
url='https://github.com/ChiW... | 532 | 37.071429 | 79 | py |
SphereNet-pytorch | SphereNet-pytorch-master/spherenet/dataset.py | # Mathematical
import numpy as np
from scipy.ndimage.interpolation import map_coordinates
# Pytorch
import torch
from torch.utils import data
from torchvision import datasets
# Misc
from functools import lru_cache
def genuv(h, w):
u, v = np.meshgrid(np.arange(w), np.arange(h))
u = (u + 0.5) * 2 * np.pi / w ... | 7,232 | 32.486111 | 92 | py |
SphereNet-pytorch | SphereNet-pytorch-master/spherenet/sphere_cnn.py | import numpy as np
from numpy import sin, cos, tan, pi, arcsin, arctan
from functools import lru_cache
import torch
from torch import nn
from torch.nn.parameter import Parameter
# Calculate kernels of SphereCNN
@lru_cache(None)
def get_xy(delta_phi, delta_theta):
return np.array([
[
(-tan(delt... | 6,050 | 32.065574 | 102 | py |
nanobind | nanobind-master/tests/test_ndarray.py | import test_ndarray_ext as t
import pytest
import warnings
import importlib
from common import collect
try:
import numpy as np
def needs_numpy(x):
return x
except:
needs_numpy = pytest.mark.skip(reason="NumPy is required")
try:
import torch
def needs_torch(x):
return x
except:
... | 15,526 | 27.594843 | 148 | py |
OverlapTransformer | OverlapTransformer-master/valid/valid_seq.py | #!/usr/bin/env python3
# Developed by Junyi Ma, Xieyuanli Chen, and Jun Zhang
# This file is covered by the LICENSE file in the root of the project OverlapTransformer:
# https://github.com/haomo-ai/OverlapTransformer/
# Brief: validation with KITTI 02
import os
import sys
p = os.path.dirname(os.path.dirname((os.path.... | 3,710 | 36.11 | 134 | py |
OverlapTransformer | OverlapTransformer-master/tools/read_samples.py | #!/usr/bin/env python3
# Developed by Junyi Ma, Xieyuanli Chen, and Jun Zhang
# This file is covered by the LICENSE file in the root of the project OverlapTransformer:
# https://github.com/haomo-ai/OverlapTransformer/
# Brief: read sampled range images of KITTI sequences as single input or batch input
import os
impor... | 5,576 | 39.708029 | 159 | py |
OverlapTransformer | OverlapTransformer-master/tools/read_samples_haomo.py | #!/usr/bin/env python3
# Developed by Junyi Ma, Xieyuanli Chen, and Jun Zhang
# This file is covered by the LICENSE file in the root of the project OverlapTransformer:
# https://github.com/haomo-ai/OverlapTransformer/
# Brief: read sampled range images of Haomo dataset as single input or batch input
import os
import ... | 5,365 | 38.167883 | 183 | py |
OverlapTransformer | OverlapTransformer-master/modules/loss.py | import os
import sys
p = os.path.dirname(os.path.dirname((os.path.abspath(__file__))))
if p not in sys.path:
sys.path.append(p)
import torch
import torch.nn as nn
import os
import numpy as np
def best_pos_distance(query, pos_vecs):
num_pos = pos_vecs.shape[0]
query_copies = query.repeat(int(num_pos),... | 2,625 | 28.840909 | 111 | py |
OverlapTransformer | OverlapTransformer-master/modules/netvlad.py | import os
import sys
p = os.path.dirname(os.path.dirname((os.path.abspath(__file__))))
if p not in sys.path:
sys.path.append(p)
import torch
import torch.nn as nn
import torch.nn.functional as F
import math
class NetVLADLoupe(nn.Module):
def __init__(self, feature_size, max_samples, cluster_size, output_... | 5,385 | 33.525641 | 83 | py |
OverlapTransformer | OverlapTransformer-master/modules/overlap_transformer_haomo.py | #!/usr/bin/env python3
# Developed by Junyi Ma, Xieyuanli Chen, and Jun Zhang
# This file is covered by the LICENSE file in the root of the project OverlapTransformer:
# https://github.com/haomo-ai/OverlapTransformer/
# Brief: OverlapTransformer modules for Haomo dataset
import os
import sys
p = os.path.dirname(os.pa... | 6,016 | 38.585526 | 143 | py |
OverlapTransformer | OverlapTransformer-master/modules/overlap_transformer.py | #!/usr/bin/env python3
# Developed by Junyi Ma, Xieyuanli Chen, and Jun Zhang
# This file is covered by the LICENSE file in the root of the project OverlapTransformer:
# https://github.com/haomo-ai/OverlapTransformer/
# Brief: OverlapTransformer modules for KITTI sequences
import os
import sys
p = os.path.dirname(os.... | 6,503 | 39.90566 | 143 | py |
OverlapTransformer | OverlapTransformer-master/test/test_kitti00_prepare.py | #!/usr/bin/env python3
# Developed by Junyi Ma, Xieyuanli Chen, and Jun Zhang
# This file is covered by the LICENSE file in the root of the project OverlapTransformer:
# https://github.com/haomo-ai/OverlapTransformer/
# Brief: generate the prediction files for the following PR, F1max and Recall@N calculation
import o... | 5,570 | 37.958042 | 111 | py |
OverlapTransformer | OverlapTransformer-master/test/test_haomo_topn_prepare.py | #!/usr/bin/env python3
# Developed by Junyi Ma, Xieyuanli Chen, and Jun Zhang
# This file is covered by the LICENSE file in the root of the project OverlapTransformer:
# https://github.com/haomo-ai/OverlapTransformer/
# Brief: generate the prediction files for the following Recall@N calculation
import os
import sys
p... | 5,229 | 39.859375 | 139 | py |
OverlapTransformer | OverlapTransformer-master/visualize/viz_kitti.py | #!/usr/bin/env python3
# Developed by Junyi Ma, Xieyuanli Chen, and Jun Zhang
# This file is covered by the LICENSE file in the root of the project OverlapTransformer:
# https://github.com/haomo-ai/OverlapTransformer/
# Brief: Visualize evaluation on KITTI 00
import os
import sys
p = os.path.dirname(os.path.dirname((... | 7,304 | 37.650794 | 127 | py |
OverlapTransformer | OverlapTransformer-master/visualize/viz_haomo.py | #!/usr/bin/env python3
# Developed by Junyi Ma, Xieyuanli Chen, and Jun Zhang
# This file is covered by the LICENSE file in the root of the project OverlapTransformer:
# https://github.com/haomo-ai/OverlapTransformer/
# Brief: Visualize evaluation on Hamo dataset
import os
import sys
p = os.path.dirname(os.path.dirna... | 7,463 | 42.905882 | 156 | py |
OverlapTransformer | OverlapTransformer-master/OT_libtorch/gen_libtorch_model.py | #!/usr/bin/env python3
# Developed by Junyi Ma, Xieyuanli Chen, and Jun Zhang
# This file is covered by the LICENSE file in the root of the project OverlapTransformer:
# https://github.com/haomo-ai/OverlapTransformer/
# Brief: Generate OT model for Libtorch
import os
import sys
p = os.path.dirname(os.path.dirname((os.... | 1,493 | 31.478261 | 89 | py |
OverlapTransformer | OverlapTransformer-master/train/training_overlap_transformer_haomo.py | #!/usr/bin/env python3
# Developed by Junyi Ma, Xieyuanli Chen, and Jun Zhang
# This file is covered by the LICENSE file in the root of the project OverlapTransformer:
# https://github.com/haomo-ai/OverlapTransformer/
# Brief: train OverlapTransformer with Haomo dataset
import os
import sys
p = os.path.dirname(os.pat... | 8,190 | 40.790816 | 143 | py |
OverlapTransformer | OverlapTransformer-master/train/training_overlap_transformer_kitti.py | #!/usr/bin/env python3
# Developed by Junyi Ma, Xieyuanli Chen, and Jun Zhang
# This file is covered by the LICENSE file in the root of the project OverlapTransformer:
# https://github.com/haomo-ai/OverlapTransformer/
# Brief: train OverlapTransformer with KITTI sequences
import os
import sys
p = os.path.dirname(os.p... | 10,370 | 42.944915 | 143 | py |
OverlapTransformer | OverlapTransformer-master/demo/demo_compute_overlap_sim.py | import os
import sys
p = os.path.dirname(os.path.dirname((os.path.abspath(__file__))))
if p not in sys.path:
sys.path.append(p)
import matplotlib.pyplot as plt
import numpy as np
from com_overlap import com_overlap
import yaml
from tools.utils.utils import *
from modules.overlap_transformer import featureExtracter
... | 3,224 | 35.647727 | 103 | py |
torch-ac | torch-ac-master/setup.py | from setuptools import setup, find_packages
setup(
name="torch_ac",
version="1.4.0",
keywords="reinforcement learning, actor-critic, a2c, ppo, multi-processes, gpu",
packages=find_packages(),
install_requires=[
"numpy>=1.13.0",
"torch>=1.0.0",
],
)
| 290 | 21.384615 | 84 | py |
torch-ac | torch-ac-master/torch_ac/format.py | import torch
def default_preprocess_obss(obss, device=None):
return torch.tensor(obss, device=device) | 106 | 25.75 | 47 | py |
torch-ac | torch-ac-master/torch_ac/model.py | from abc import abstractmethod, abstractproperty
import torch.nn as nn
import torch.nn.functional as F
class ACModel:
recurrent = False
@abstractmethod
def __init__(self, obs_space, action_space):
pass
@abstractmethod
def forward(self, obs):
pass
class RecurrentACModel(ACModel):
... | 485 | 17.692308 | 48 | py |
torch-ac | torch-ac-master/torch_ac/__init__.py | from torch_ac.algos import A2CAlgo, PPOAlgo
from torch_ac.model import ACModel, RecurrentACModel
from torch_ac.utils import DictList | 132 | 43.333333 | 52 | py |
torch-ac | torch-ac-master/torch_ac/algos/base.py | from abc import ABC, abstractmethod
import torch
from torch_ac.format import default_preprocess_obss
from torch_ac.utils import DictList, ParallelEnv
class BaseAlgo(ABC):
"""The base class for RL algorithms."""
def __init__(self, envs, acmodel, device, num_frames_per_proc, discount, lr, gae_lambda, entropy_... | 10,236 | 40.783673 | 110 | py |
torch-ac | torch-ac-master/torch_ac/algos/a2c.py | import numpy
import torch
import torch.nn.functional as F
from torch_ac.algos.base import BaseAlgo
class A2CAlgo(BaseAlgo):
"""The Advantage Actor-Critic algorithm."""
def __init__(self, envs, acmodel, device=None, num_frames_per_proc=None, discount=0.99, lr=0.01, gae_lambda=0.95,
entropy_co... | 3,659 | 31.972973 | 117 | py |
torch-ac | torch-ac-master/torch_ac/algos/ppo.py | import numpy
import torch
import torch.nn.functional as F
from torch_ac.algos.base import BaseAlgo
class PPOAlgo(BaseAlgo):
"""The Proximal Policy Optimization algorithm
([Schulman et al., 2015](https://arxiv.org/abs/1707.06347))."""
def __init__(self, envs, acmodel, device=None, num_frames_per_proc=None... | 6,011 | 37.292994 | 118 | py |
torch-ac | torch-ac-master/torch_ac/algos/__init__.py | from torch_ac.algos.a2c import A2CAlgo
from torch_ac.algos.ppo import PPOAlgo | 77 | 38 | 38 | py |
torch-ac | torch-ac-master/torch_ac/utils/__init__.py | from torch_ac.utils.dictlist import DictList
from torch_ac.utils.penv import ParallelEnv | 88 | 43.5 | 44 | py |
datmo | datmo-master/docs/conf.py | # -*- coding: utf-8 -*-
#
# Datmo documentation build configuration file, created by
# sphinx-quickstart on Tue Mar 20 08:36:19 2018.
#
# 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.
#
# All... | 6,140 | 32.375 | 79 | py |
datmo | datmo-master/datmo/cli/command/tests/test_environment.py | """
Tests for EnvironmentCommand
"""
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
import os
import glob
import time
import pytest
import uuid
import tempfile
import shutil
import platform
from argparse import ArgumentError
try:
to_unicode = unicode
e... | 15,312 | 35.898795 | 100 | py |
datmo | datmo-master/datmo/cli/command/tests/test_project.py | """
Tests for Project Commands
"""
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
# TODO: include builtin libraries for the appropriate Python
# try:
# import __builtin__
# except ImportError:
# # Python 3
# import builtins as __builtin__
try:
... | 23,703 | 39.176271 | 163 | py |
datmo | datmo-master/datmo/cli/driver/tests/test_helper.py | """
Tests for Datmo CLI Helper
"""
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
from future import standard_library
standard_library.install_aliases()
from builtins import input
import os
import sys
import pytest
import tempfile
import platform
try:
... | 10,036 | 30.964968 | 107 | py |
Image-manipulation-detection | Image-manipulation-detection-main/hashing/general_hash.py | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Mon Mar 14 20:14:08 2022
@author: cyrilvallez
"""
# =============================================================================
# Contains the hashing pipeline, linking neural, perceptual and keypoint-related
# algorithms in a single fremework.
# =======... | 21,988 | 32.72546 | 95 | py |
Image-manipulation-detection | Image-manipulation-detection-main/hashing/neuralhash.py | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Fri Mar 4 09:13:39 2022
@author: cyrilvallez
"""
# =============================================================================
# Contains the neural methods logic
# =============================================================================
import nu... | 21,953 | 27.074169 | 161 | py |
Image-manipulation-detection | Image-manipulation-detection-main/hashing/SimCLRv2/download.py | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Mon Jul 11 16:21:47 2022
@author: cyrilvallez
"""
import tensorflow as tf
import torch
import numpy as np
import torch.nn as nn
import os
import argparse
from math import ceil
import requests
from tqdm import tqdm
from resnet import get_resnet, name_to_pa... | 7,783 | 38.714286 | 111 | py |
Image-manipulation-detection | Image-manipulation-detection-main/hashing/SimCLRv2/resnet.py | import torch
import torch.nn as nn
import torch.nn.functional as F
BATCH_NORM_EPSILON = 1e-5
BATCH_NORM_DECAY = 0.9 # == pytorch's default value as well
class BatchNormRelu(nn.Sequential):
def __init__(self, num_channels, relu=True):
super().__init__(nn.BatchNorm2d(num_channels, eps=BATCH_NORM_EPSILON),... | 6,996 | 37.234973 | 116 | py |
Image-manipulation-detection | Image-manipulation-detection-main/hashing/SimCLRv1/download.py | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Tue Jul 12 09:51:28 2022
@author: cyrilvallez
"""
import torch
import torch.nn as nn
import numpy as np
import tensorflow as tf
import argparse
import os
from math import ceil
import requests
from tqdm import tqdm
from resnet_wider import resnet50x1, resn... | 5,386 | 33.312102 | 105 | py |
Image-manipulation-detection | Image-manipulation-detection-main/hashing/SimCLRv1/resnet_wider.py | import torch
import torch.nn as nn
def conv3x3(in_planes, out_planes, stride=1, groups=1, dilation=1):
"""3x3 convolution with padding"""
return nn.Conv2d(in_planes, out_planes, kernel_size=3, stride=stride,
padding=dilation, groups=groups, bias=False, dilation=dilation)
def conv1x1(in_... | 7,944 | 33.846491 | 106 | py |
Image-manipulation-detection | Image-manipulation-detection-main/generator/generate_attacks.py | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Mon Feb 14 08:29:00 2022
@author: cyrilvallez
"""
# =============================================================================
# This script generates numerous variations of an image, designed to test
# the robustness of different hashing algorithms
# =... | 25,390 | 29.81432 | 92 | py |
iOS-ObjectDetection | iOS-ObjectDetection-master/conv.py | import coremltools
coreml_model = coremltools.converters.keras.convert(
'yolo-tiny.h5',
input_names='image',
image_input_names='image',
input_name_shape_dict={'image': [None, 416, 416, 3]},
image_scale=1/255.)
coreml_model.license = 'Public Domain'
coreml_model.input_description['image'] = 'Input ... | 361 | 26.846154 | 57 | py |
DDN | DDN-main/base.py | import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.utils.data as Data
from torch.optim import Adam
from tqdm import tqdm
class VariationalLayer(nn.Module):
def __init__(self, in_features, out_features):
super(VariationalLayer, self).__init__()
self.fc_mu = nn.Linear(in_... | 2,952 | 30.414894 | 85 | py |
DDN | DDN-main/ddn.py | import torch
import torch.nn as nn
import torch.nn.functional as F
from torch.distributions import Categorical
import math
from base import BaseMLPWithEqualMapping, VariationalLayer, BaseMLP
from utils import perm_generator
class DeconvEstimator(nn.Module):
def __init__(self, in_channels, out_channels_list, groups... | 9,770 | 40.75641 | 120 | py |
DDN | DDN-main/uci.py | import os
import torch
import urllib
import pandas as pd
import zipfile
import numpy as np
from torch.utils import data
class UCIDataset():
def __init__(self, name, data_path='data'):
self.datasets = {
'concrete': 'https://archive.ics.uci.edu/ml/machine-learning-databases/concrete/compressive/... | 4,335 | 46.130435 | 134 | py |
DDN | DDN-main/toy.py | import torch
import math
from torch.distributions import Uniform, Bernoulli, Normal, Uniform
class Toy2D_Task1():
# Squares
def sample(self, num_samples):
x = Uniform(-1, 1).sample((num_samples, 1))
a = Bernoulli(0.5).sample((num_samples, 1))
b = Uniform(-5 + x, -1 + x).s... | 4,193 | 37.127273 | 109 | py |
DDN | DDN-main/utils.py | import torch
def perm_generator(length):
seen = set()
while True:
perm = tuple(torch.randperm(length).tolist())
if perm not in seen:
seen.add(perm)
yield perm
| 210 | 16.583333 | 53 | py |
ParaCNN | ParaCNN-main/calculate_bleu.py | from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import torch
import torch.nn as nn
import torch.nn.functional as F
import numpy as np
import json
from json import encoder
import random
import string
import time
import os
import sys
import misc.utils as utils... | 1,833 | 28.580645 | 103 | py |
ParaCNN | ParaCNN-main/pre_train_autoregressive.py | from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import torch
import torch.nn as nn
import torch.optim as optim
import numpy as np
import torch.nn.functional as F
import time
import os
from six.moves import cPickle
import math
import opts
import models
from... | 9,346 | 34.812261 | 144 | py |
ParaCNN | ParaCNN-main/eval_lang.py | from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import json
import numpy as np
import time
import os
from six.moves import cPickle
import opts
import models
from dataloader import *
from dataloaderraw import *
import eval_utils_trigram
import argparse
impo... | 2,139 | 24.783133 | 111 | py |
ParaCNN | ParaCNN-main/sample.py | import sys
import math
import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.optim as optim
from torch.autograd import Variable
import numpy as np
def sample_greedy_orig(batchsize_cap, max_tokens, model, ix_to_word, captions):
outcap = np.empty((batchsize_cap, 0)).tolist()
max_token... | 3,739 | 44.609756 | 148 | py |
ParaCNN | ParaCNN-main/eval_utils_para_trigram.py | from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import torch
import torch.nn as nn
import torch.nn.functional as F
import numpy as np
import json
from json import encoder
import random
import string
import time
import os
import sys
import misc.utils as utils... | 11,902 | 42.600733 | 165 | py |
ParaCNN | ParaCNN-main/train_conv.py | from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import torch
import torch.nn as nn
import torch.optim as optim
import numpy as np
import torch.nn.functional as F
import time
import os
from six.moves import cPickle
import math
import opts
from models import ... | 12,981 | 40.343949 | 144 | py |
ParaCNN | ParaCNN-main/train_rl_meshed.py | from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import torch
import torch.nn as nn
import torch.optim as optim
import numpy as np
import torch.nn.functional as F
import time
import os
from six.moves import cPickle
import opts
from models.transformer_revise... | 9,675 | 40.350427 | 173 | py |
ParaCNN | ParaCNN-main/train_twin.py | from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import torch
import torch.nn as nn
import torch.optim as optim
import numpy as np
import torch.nn.functional as F
import time
import os
from six.moves import cPickle
import math
import opts
import models
from... | 16,250 | 39.729323 | 144 | py |
ParaCNN | ParaCNN-main/discriminator.py |
import torch
import torch.nn as nn
import torch.nn.functional as F
class Discriminator(nn.Module):
def __init__(self, input_size, hidden_size, linear_size, lin_dropout):
super(Discriminator, self).__init__()
self.hidden_size = hidden_size
self.linear_size = linear_size
self.r... | 1,546 | 30.571429 | 101 | py |
ParaCNN | ParaCNN-main/train_rl.py | from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import torch
import torch.nn as nn
import torch.optim as optim
import numpy as np
import torch.nn.functional as F
import time
import os
from six.moves import cPickle
import opts
from models.AttModel import *
... | 9,652 | 40.252137 | 173 | py |
ParaCNN | ParaCNN-main/eval_meshed2.py | from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from dataloader import *
from dataloaderraw import *
import eval_utils_trigram
import misc.utils as utils
import torch
import opts
opt = opts.parse_opt()
from models.transformer_revise.transformer import convc... | 1,701 | 23.666667 | 100 | py |
ParaCNN | ParaCNN-main/eval_att.py | from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import json
import numpy as np
import time
import os
from six.moves import cPickle
import opts
from models.AttModel import *
from dataloader import *
from dataloaderraw import *
import eval_utils_para_trigram... | 1,944 | 21.882353 | 100 | py |
ParaCNN | ParaCNN-main/dataloaderraw.py | from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import json
import h5py
import os
import numpy as np
import random
import torch
import skimage
import skimage.io
import scipy.misc
from torchvision import transforms as trn
preprocess = trn.Compose([
#... | 4,581 | 31.964029 | 100 | py |
ParaCNN | ParaCNN-main/eval_utils_transformer.py | from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import torch
import torch.nn as nn
import torch.nn.functional as F
import numpy as np
import json
from json import encoder
import random
import string
import time
import os
import sys
import misc.utils as utils... | 5,445 | 33.687898 | 165 | py |
ParaCNN | ParaCNN-main/dataloader.py | from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import json
import h5py
import os
import numpy as np
import random
import torch
import torch.utils.data as data
from functools import reduce
import multiprocessing
from PIL import Image
import torchvision.tra... | 13,018 | 41.407166 | 175 | py |
ParaCNN | ParaCNN-main/seq_auto.py | import torch
import torch.nn as nn
import torchvision.models as models
from torch.nn.utils.rnn import pack_padded_sequence
from torch.autograd import Variable
import torch.nn.functional as F
import copy
import math
def clones(module, N):
"Produce N identical layers."
return nn.ModuleList([copy.deepcopy(module) ... | 6,961 | 34.702564 | 113 | py |
ParaCNN | ParaCNN-main/beamsearch.py | import time
import torch
import torch.nn as nn
from torch.autograd import Variable
import itertools
class beamsearch(object):
"""Beam search on output softmax distribution (or posterior)"""
def __init__(self, beam_size, batch_size, maxlen):
self.beam_size = beam_size
self.batch_size = batch_size
self.... | 4,341 | 35.183333 | 99 | py |
ParaCNN | ParaCNN-main/train_twin_wgan.py | from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import torch
import torch.nn as nn
import torch.optim as optim
import numpy as np
import torch.nn.functional as F
import time
import os
from six.moves import cPickle
import math
import opts
from models.transf... | 19,211 | 40.405172 | 192 | py |
ParaCNN | ParaCNN-main/train_off_policy.py | from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import torch
import torch.nn as nn
import torch.optim as optim
import numpy as np
import torch.nn.functional as F
import time
import os
from six.moves import cPickle
import math
import opts
import models
from... | 10,474 | 42.645833 | 193 | py |
ParaCNN | ParaCNN-main/train_reconstruct.py | from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import torch
import torch.nn as nn
import torch.optim as optim
import numpy as np
import torch.nn.functional as F
import time
import os
from six.moves import cPickle
import opts
import models
from dataloader ... | 11,536 | 41.72963 | 144 | py |
ParaCNN | ParaCNN-main/train_professor_forcing4.py | from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import torch
import torch.nn as nn
import torch.optim as optim
import numpy as np
import torch.nn.functional as F
import time
import os
from six.moves import cPickle
import math
import opts
import models
from... | 16,335 | 40.780051 | 144 | py |
ParaCNN | ParaCNN-main/train_paracnn.py | from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import torch
import torch.nn as nn
import torch.optim as optim
import numpy as np
import torch.nn.functional as F
import time
import os
from six.moves import cPickle
import math
import opts
from models import ... | 12,981 | 40.343949 | 144 | py |
ParaCNN | ParaCNN-main/eval.py | from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import json
import numpy as np
import time
import os
from six.moves import cPickle
import opts
import models
from dataloader import *
from dataloaderraw import *
import eval_utils_trigram
import argparse
impo... | 2,223 | 24.563218 | 114 | py |
ParaCNN | ParaCNN-main/dataloader_revise.py | from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import json
import h5py
import os
import numpy as np
import random
import torch
import torch.utils.data as data
import multiprocessing
class DataLoader(data.Dataset):
def reset_iterator(self, split):
... | 12,262 | 41.140893 | 164 | py |
ParaCNN | ParaCNN-main/train_meshed.py | from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import torch
import torch.nn as nn
import torch.optim as optim
import numpy as np
import torch.nn.functional as F
import time
import os
from six.moves import cPickle
import math
import opts
import models
from... | 14,116 | 38.878531 | 144 | py |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.