python_code
stringlengths
0
679k
repo_name
stringlengths
9
41
file_path
stringlengths
6
149
# Copyright (c) 2023, NVIDIA CORPORATION & AFFILIATES. 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 License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless requi...
modulus-launch-main
modulus/launch/logging/launch.py
# Copyright (c) 2023, NVIDIA CORPORATION & AFFILIATES. 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 License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless requi...
modulus-launch-main
modulus/launch/logging/utils.py
# Copyright (c) 2023, NVIDIA CORPORATION & AFFILIATES. 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 License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless requi...
modulus-launch-main
test/utils/test_checkpoint.py
# Copyright (c) 2023, NVIDIA CORPORATION & AFFILIATES. 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 License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless requi...
modulus-launch-main
test/ci_tests/header_check.py
# Copyright (c) 2023, NVIDIA CORPORATION & AFFILIATES. 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 License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless requi...
modulus-launch-main
docs/conf.py
# Copyright (c) 2023, NVIDIA CORPORATION & AFFILIATES. 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 License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless requi...
modulus-launch-main
examples/weather/dlwp/era5_hdf5.py
# Copyright (c) 2023, NVIDIA CORPORATION & AFFILIATES. 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 License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless requi...
modulus-launch-main
examples/weather/dlwp/train_dlwp.py
# Copyright (c) 2023, NVIDIA CORPORATION & AFFILIATES. 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 License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless requi...
modulus-launch-main
examples/weather/dlwp/cube_sphere_plotter_no_subplots.py
# Copyright (c) 2023, NVIDIA CORPORATION & AFFILIATES. 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 License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless requi...
modulus-launch-main
examples/weather/dlwp/data_curation/data_download_simple.py
# Copyright (c) 2023, NVIDIA CORPORATION & AFFILIATES. 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 License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless requi...
modulus-launch-main
examples/weather/dlwp/data_curation/post_processing.py
# Copyright (c) 2023, NVIDIA CORPORATION & AFFILIATES. 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 License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless requi...
modulus-launch-main
examples/weather/graphcast/train_utils.py
# Copyright (c) 2023, NVIDIA CORPORATION & AFFILIATES. 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 License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless requi...
modulus-launch-main
examples/weather/graphcast/constants.py
# Copyright (c) 2023, NVIDIA CORPORATION & AFFILIATES. 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 License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless requi...
modulus-launch-main
examples/weather/graphcast/__init__.py
# Copyright (c) 2023, NVIDIA CORPORATION & AFFILIATES. 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 License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless requi...
modulus-launch-main
examples/weather/graphcast/train_graphcast.py
# Copyright (c) 2023, NVIDIA CORPORATION & AFFILIATES. 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 License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless requi...
modulus-launch-main
examples/weather/graphcast/train_base.py
# Copyright (c) 2023, NVIDIA CORPORATION & AFFILIATES. 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 License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless requi...
modulus-launch-main
examples/weather/graphcast/validation.py
# Copyright (c) 2023, NVIDIA CORPORATION & AFFILIATES. 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 License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless requi...
modulus-launch-main
examples/weather/graphcast/loss/__init__.py
# Copyright (c) 2023, NVIDIA CORPORATION & AFFILIATES. 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 License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless requi...
modulus-launch-main
examples/weather/graphcast/loss/utils.py
# Copyright (c) 2023, NVIDIA CORPORATION & AFFILIATES. 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 License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless requi...
modulus-launch-main
examples/weather/fcn_sfno/ensembler.py
# Copyright (c) 2023, NVIDIA CORPORATION & AFFILIATES. 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 License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless requi...
modulus-launch-main
examples/weather/fcn_sfno/models.py
# Copyright (c) 2023, NVIDIA CORPORATION & AFFILIATES. 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 License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless requi...
modulus-launch-main
examples/weather/fcn_sfno/inferencer.py
# Copyright (c) 2023, NVIDIA CORPORATION & AFFILIATES. 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 License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless requi...
modulus-launch-main
examples/weather/fcn_sfno/visualize.py
# Copyright (c) 2023, NVIDIA CORPORATION & AFFILIATES. 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 License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless requi...
modulus-launch-main
examples/weather/fcn_sfno/train.py
# Copyright (c) 2023, NVIDIA CORPORATION & AFFILIATES. 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 License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless requi...
modulus-launch-main
examples/weather/fcn_sfno/trainer.py
# Copyright (c) 2023, NVIDIA CORPORATION & AFFILIATES. 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 License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless requi...
modulus-launch-main
examples/weather/fcn_sfno/helpers.py
# Copyright (c) 2023, NVIDIA CORPORATION & AFFILIATES. 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 License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless requi...
modulus-launch-main
examples/weather/fcn_afno/train_era5.py
# Copyright (c) 2023, NVIDIA CORPORATION & AFFILIATES. 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 License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless requi...
modulus-launch-main
examples/cfd/gray_scott_rnn/gray_scott_rnn.py
# Copyright (c) 2023, NVIDIA CORPORATION & AFFILIATES. 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 License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless requi...
modulus-launch-main
examples/cfd/navier_stokes_rnn/navier_stokes_rnn.py
# Copyright (c) 2023, NVIDIA CORPORATION & AFFILIATES. 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 License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless requi...
modulus-launch-main
examples/cfd/ahmed_body_mgn/constants.py
# Copyright (c) 2023, NVIDIA CORPORATION & AFFILIATES. 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 License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless requi...
modulus-launch-main
examples/cfd/ahmed_body_mgn/utils.py
# Copyright (c) 2023, NVIDIA CORPORATION & AFFILIATES. 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 License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless requi...
modulus-launch-main
examples/cfd/ahmed_body_mgn/train.py
# Copyright (c) 2023, NVIDIA CORPORATION & AFFILIATES. 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 License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless requi...
modulus-launch-main
examples/cfd/ahmed_body_mgn/inference.py
# Copyright (c) 2023, NVIDIA CORPORATION & AFFILIATES. 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 License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless requi...
modulus-launch-main
examples/cfd/darcy_fno/validator.py
# Copyright (c) 2023, NVIDIA CORPORATION & AFFILIATES. 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 License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless requi...
modulus-launch-main
examples/cfd/darcy_fno/train_fno_darcy.py
# Copyright (c) 2023, NVIDIA CORPORATION & AFFILIATES. 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 License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless requi...
modulus-launch-main
examples/cfd/darcy_nested_fnos/train_nested_darcy.py
# Copyright (c) 2023, NVIDIA CORPORATION & AFFILIATES. 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 License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless requi...
modulus-launch-main
examples/cfd/darcy_nested_fnos/generate_nested_darcy.py
# Copyright (c) 2023, NVIDIA CORPORATION & AFFILIATES. 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 License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless requi...
modulus-launch-main
examples/cfd/darcy_nested_fnos/evaluate_nested_darcy.py
# Copyright (c) 2023, NVIDIA CORPORATION & AFFILIATES. 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 License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless requi...
modulus-launch-main
examples/cfd/darcy_nested_fnos/utils.py
# Copyright (c) 2023, NVIDIA CORPORATION & AFFILIATES. 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 License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless requi...
modulus-launch-main
examples/cfd/vortex_shedding_mgn/constants.py
# Copyright (c) 2023, NVIDIA CORPORATION & AFFILIATES. 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 License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless requi...
modulus-launch-main
examples/cfd/vortex_shedding_mgn/train.py
# Copyright (c) 2023, NVIDIA CORPORATION & AFFILIATES. 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 License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless requi...
modulus-launch-main
examples/cfd/vortex_shedding_mgn/inference.py
### Copyright (C) 2017 NVIDIA Corporation. All rights reserved. ### Licensed under the CC BY-NC-SA 4.0 license (https://creativecommons.org/licenses/by-nc-sa/4.0/legalcode). import time import os import numpy as np from collections import OrderedDict from torch.autograd import Variable from options.test_options import...
vid2vid-master
test.py
### Copyright (C) 2017 NVIDIA Corporation. All rights reserved. ### Licensed under the CC BY-NC-SA 4.0 license (https://creativecommons.org/licenses/by-nc-sa/4.0/legalcode). import time import os import torch from subprocess import call from options.train_options import TrainOptions from data.data_loader import Creat...
vid2vid-master
train.py
from .base_options import BaseOptions class TestOptions(BaseOptions): def initialize(self): BaseOptions.initialize(self) self.parser.add_argument('--ntest', type=int, default=float("inf"), help='# of test examples.') self.parser.add_argument('--results_dir', type=str, default='./results/',...
vid2vid-master
options/test_options.py
from .base_options import BaseOptions class TrainOptions(BaseOptions): def initialize(self): BaseOptions.initialize(self) self.parser.add_argument('--display_freq', type=int, default=100, help='frequency of showing training results on screen') self.parser.add_argument('--print_freq', type=...
vid2vid-master
options/train_options.py
vid2vid-master
options/__init__.py
import argparse import os from util import util import torch class BaseOptions(): def __init__(self): self.parser = argparse.ArgumentParser() self.initialized = False def initialize(self): self.parser.add_argument('--dataroot', type=str, default='datasets/Cityscapes/') ...
vid2vid-master
options/base_options.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 == ...
vid2vid-master
util/image_pool.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 collections import OrderedDict def save_all_tensors(opt, real_A, fake_B, fake_B_first, fake_B_raw, real_B, flow_ref, conf_...
vid2vid-master
util/util.py
import dominate from dominate.tags import * import os class HTML: def __init__(self, web_dir, title, reflesh=0): self.title = title self.web_dir = web_dir self.img_dir = os.path.join(self.web_dir, 'images') if not os.path.exists(self.web_dir): os.makedirs(self.web_dir) ...
vid2vid-master
util/html.py
vid2vid-master
util/__init__.py
### Copyright (C) 2017 NVIDIA Corporation. All rights reserved. ### Licensed under the CC BY-NC-SA 4.0 license (https://creativecommons.org/licenses/by-nc-sa/4.0/legalcode). import numpy as np import os import time from . import util from . import html import scipy.misc try: from StringIO import StringIO # Pytho...
vid2vid-master
util/visualizer.py
### Copyright (C) 2017 NVIDIA Corporation. All rights reserved. ### Licensed under the CC BY-NC-SA 4.0 license (https://creativecommons.org/licenses/by-nc-sa/4.0/legalcode). import numpy as np import math import torch import torch.nn.functional as F import os import sys from collections import OrderedDict from torch.a...
vid2vid-master
models/vid2vid_model_G.py
### Copyright (C) 2017 NVIDIA Corporation. All rights reserved. ### Licensed under the CC BY-NC-SA 4.0 license (https://creativecommons.org/licenses/by-nc-sa/4.0/legalcode). import os import torch import torch.nn as nn import numpy as np import fractions def lcm(a,b): return abs(a * b)/fractions.gcd(a,b) if a and b el...
vid2vid-master
models/models.py
import numpy as np import torch import sys from .base_model import BaseModel class FlowNet(BaseModel): def name(self): return 'FlowNet' def initialize(self, opt): BaseModel.initialize(self, opt) # flownet 2 from .flownet2_pytorch import models as flownet2_models ...
vid2vid-master
models/flownet.py
vid2vid-master
models/__init__.py
import os, sys import numpy as np import torch from .networks import get_grid class BaseModel(torch.nn.Module): def name(self): return 'BaseModel' def initialize(self, opt): self.opt = opt self.gpu_ids = opt.gpu_ids self.isTrain = opt.isTrain self.Tensor = torch.cuda.Fl...
vid2vid-master
models/base_model.py
### Copyright (C) 2017 NVIDIA Corporation. All rights reserved. ### Licensed under the CC BY-NC-SA 4.0 license (https://creativecommons.org/licenses/by-nc-sa/4.0/legalcode). import torch import torch.nn as nn from torch.nn import init import functools from torch.autograd import Variable import numpy as np import torch...
vid2vid-master
models/networks.py
### Copyright (C) 2017 NVIDIA Corporation. All rights reserved. ### Licensed under the CC BY-NC-SA 4.0 license (https://creativecommons.org/licenses/by-nc-sa/4.0/legalcode). import numpy as np import torch import os import sys from collections import OrderedDict from torch.autograd import Variable import util.util as ...
vid2vid-master
models/vid2vid_model_D.py
import torch import torch.nn as nn from torch.nn import init import math import numpy as np from .networks.resample2d_package.resample2d import Resample2d from .networks.channelnorm_package.channelnorm import ChannelNorm from .networks import FlowNetC from .networks import FlowNetS from .networks import FlowNetSD fr...
vid2vid-master
models/flownet2_pytorch/models.py
#!/usr/bin/env python2.7 import caffe from caffe.proto import caffe_pb2 import sys, os import torch import torch.nn as nn import argparse, tempfile import numpy as np parser = argparse.ArgumentParser() parser.add_argument('caffe_model', help='input model in hdf5 or caffemodel format') parser.add_argument('prototxt_...
vid2vid-master
models/flownet2_pytorch/convert.py
import torch import torch.utils.data as data import os, math, random from os.path import * import numpy as np from glob import glob import utils.frame_utils as frame_utils from scipy.misc import imread, imresize class StaticRandomCrop(object): def __init__(self, image_size, crop_size): self.th, self.tw ...
vid2vid-master
models/flownet2_pytorch/datasets.py
vid2vid-master
models/flownet2_pytorch/__init__.py
''' Portions of this code copyright 2017, Clement Pinard ''' # freda (todo) : adversarial loss import torch import torch.nn as nn import math def EPE(input_flow, target_flow): return torch.norm(target_flow-input_flow,p=2,dim=1).mean() class L1(nn.Module): def __init__(self): super(L1, self).__init_...
vid2vid-master
models/flownet2_pytorch/losses.py
#!/usr/bin/env python import torch import torch.nn as nn from torch.utils.data import DataLoader from torch.autograd import Variable from tensorboardX import SummaryWriter import argparse, os, sys, subprocess import setproctitle, colorama import numpy as np from tqdm import tqdm from glob import glob from os.path imp...
vid2vid-master
models/flownet2_pytorch/main.py
import numpy as np TAG_CHAR = np.array([202021.25], np.float32) def readFlow(fn): """ Read .flo file in Middlebury format""" # Code adapted from: # http://stackoverflow.com/questions/28013200/reading-middlebury-flow-files-with-python-bytes-array-numpy # WARNING: this will work on little-endian archit...
vid2vid-master
models/flownet2_pytorch/utils/flow_utils.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...
vid2vid-master
models/flownet2_pytorch/utils/tools.py
vid2vid-master
models/flownet2_pytorch/utils/__init__.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', ...
vid2vid-master
models/flownet2_pytorch/utils/param_utils.py
import numpy as np from os.path import * from scipy.misc import imread from . import flow_utils def read_gen(file_name): ext = splitext(file_name)[-1] if ext == '.png' or ext == '.jpeg' or ext == '.ppm' or ext == '.jpg': im = imread(file_name) if im.shape[2] > 3: return im[:,:,:3] ...
vid2vid-master
models/flownet2_pytorch/utils/frame_utils.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...
vid2vid-master
models/flownet2_pytorch/networks/FlowNetS.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....
vid2vid-master
models/flownet2_pytorch/networks/FlowNetFusion.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), ...
vid2vid-master
models/flownet2_pytorch/networks/submodules.py
vid2vid-master
models/flownet2_pytorch/networks/__init__.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...
vid2vid-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 .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...
vid2vid-master
models/flownet2_pytorch/networks/FlowNetSD.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...
vid2vid-master
models/flownet2_pytorch/networks/channelnorm_package/channelnorm.py
vid2vid-master
models/flownet2_pytorch/networks/channelnorm_package/__init__.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...
vid2vid-master
models/flownet2_pytorch/networks/channelnorm_package/setup.py
vid2vid-master
models/flownet2_pytorch/networks/correlation_package/__init__.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...
vid2vid-master
models/flownet2_pytorch/networks/correlation_package/setup.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__() ...
vid2vid-master
models/flownet2_pytorch/networks/correlation_package/correlation.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...
vid2vid-master
models/flownet2_pytorch/networks/resample2d_package/resample2d.py
vid2vid-master
models/flownet2_pytorch/networks/resample2d_package/__init__.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...
vid2vid-master
models/flownet2_pytorch/networks/resample2d_package/setup.py
import os from download_gdrive import * file_id = '1E8re-b6csNuo-abg1vJKCDjCzlIam50F' chpt_path = './models/flownet2_pytorch/' destination = os.path.join(chpt_path, 'FlowNet2_checkpoint.pth.tar') download_file_from_google_drive(file_id, destination)
vid2vid-master
scripts/download_models_flownet2.py
import os from download_gdrive import * file_id = '1rPcbnanuApZeo2uc7h55OneBkbcFCnnf' chpt_path = './datasets/' if not os.path.isdir(chpt_path): os.makedirs(chpt_path) destination = os.path.join(chpt_path, 'datasets.zip') download_file_from_google_drive(file_id, destination) unzip_file(destination, chpt_path)
vid2vid-master
scripts/download_datasets.py
# Download code taken from Code taken from https://stackoverflow.com questions/25010369/wget-curl-large-file-from-google-drive/39225039#39225039 import requests, zipfile, os def download_file_from_google_drive(id, destination): URL = "https://docs.google.com/uc?export=download" session = requests.Session() ...
vid2vid-master
scripts/download_gdrive.py
import os from download_gdrive import * import torch """if torch.__version__ == '0.4.1': file_id = '1gKwE1Ad41TwtAzwDcN3dYa_S6DcVyiSl' file_name = 'flownet2_pytorch_041.zip' else: file_id = '1F2h_6e8gyTqxnbmFFW72zsxx_JX0dKFo' file_name = 'flownet2_pytorch_040.zip'""" chpt_path = './models/' if not os.path.isdir(...
vid2vid-master
scripts/download_flownet2.py
import os from download_gdrive import * file_id = '10LvNw-2lrh-6sPGkWbQDfHspkqz5AKxb' chpt_path = './checkpoints/' if not os.path.isdir(chpt_path): os.makedirs(chpt_path) destination = os.path.join(chpt_path, 'models_face.zip') download_file_from_google_drive(file_id, destination) unzip_file(destination, chpt_path)
vid2vid-master
scripts/face/download_models.py
# Download code taken from Code taken from https://stackoverflow.com questions/25010369/wget-curl-large-file-from-google-drive/39225039#39225039 import requests, zipfile, os def download_file_from_google_drive(id, destination): URL = "https://docs.google.com/uc?export=download" session = requests.Session() ...
vid2vid-master
scripts/face/download_gdrive.py
import os from download_gdrive import * file_id = '1QoE1p3QikxNVbbTBWWRDtIspg-RcLE8y' chpt_path = './checkpoints/' if not os.path.isdir(chpt_path): os.makedirs(chpt_path) destination = os.path.join(chpt_path, 'models_g1.zip') download_file_from_google_drive(file_id, destination) unzip_file(destination, chpt_path)
vid2vid-master
scripts/street/download_models_g1.py
import os from download_gdrive import * file_id = '1MKtImgtnGC28EPU7Nh9DfFpHW6okNVkl' chpt_path = './checkpoints/' if not os.path.isdir(chpt_path): os.makedirs(chpt_path) destination = os.path.join(chpt_path, 'models.zip') download_file_from_google_drive(file_id, destination) unzip_file(destination, chpt_path)
vid2vid-master
scripts/street/download_models.py
# Download code taken from Code taken from https://stackoverflow.com questions/25010369/wget-curl-large-file-from-google-drive/39225039#39225039 import requests, zipfile, os def download_file_from_google_drive(id, destination): URL = "https://docs.google.com/uc?export=download" session = requests.Session() ...
vid2vid-master
scripts/street/download_gdrive.py
from util.util import add_dummy_to_tensor 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): ret...
vid2vid-master
data/base_dataset.py
import os.path import torchvision.transforms as transforms import torch from PIL import Image import numpy as np import cv2 from skimage import feature from data.base_dataset import BaseDataset, get_img_params, get_transform, get_video_params, concat_frame from data.image_folder import make_grouped_dataset, check_path...
vid2vid-master
data/face_dataset.py
def CreateDataLoader(opt): from data.custom_dataset_data_loader import CustomDatasetDataLoader data_loader = CustomDatasetDataLoader() print(data_loader.name()) data_loader.initialize(opt) return data_loader
vid2vid-master
data/data_loader.py
import os.path from PIL import Image import numpy as np import json import glob from scipy.optimize import curve_fit import warnings def func(x, a, b, c): return a * x**2 + b * x + c def linear(x, a, b): return a * x + b def setColor(im, yy, xx, color): if len(im.shape) == 3: if (im[yy, xx] =...
vid2vid-master
data/keypoint2img.py
class BaseDataLoader(): def __init__(self): pass def initialize(self, opt): self.opt = opt pass def load_data(): return None
vid2vid-master
data/base_data_loader.py
vid2vid-master
data/__init__.py