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 |
|---|---|---|---|---|---|---|
MHCNN | MHCNN-main/MHCNN_syndataset/utils/utils_matconvnet.py | # -*- coding: utf-8 -*-
import numpy as np
import torch
from collections import OrderedDict
# import scipy.io as io
import hdf5storage
"""
# --------------------------------------------
# Convert matconvnet SimpleNN model into pytorch model
# --------------------------------------------
# Kai Zhang (cskaizhang@gmail.... | 6,804 | 33.368687 | 239 | py |
MHCNN | MHCNN-main/MHCNN_syndataset/utils/utils_sisr.py | # -*- coding: utf-8 -*-
from utils import utils_image as util
import random
import scipy
import scipy.stats as ss
import scipy.io as io
from scipy import ndimage
from scipy.interpolate import interp2d
import numpy as np
import torch
"""
# --------------------------------------------
# Super-Resolution
# -----------... | 23,082 | 26.188457 | 138 | py |
MHCNN | MHCNN-main/MHCNN_syndataset/utils/utils_image.py | import os
import math
import random
import numpy as np
import torch
import cv2
from torchvision.utils import make_grid
from datetime import datetime
# import torchvision.transforms as transforms
import matplotlib.pyplot as plt
from mpl_toolkits.mplot3d import Axes3D
os.environ["KMP_DUPLICATE_LIB_OK"] = "TRUE"
'''
# -... | 31,897 | 31.090543 | 108 | py |
MHCNN | MHCNN-main/MHCNN_syndataset/utils/utils_params.py | import torch
import torchvision
from models import basicblock as B
def show_kv(net):
for k, v in net.items():
print(k)
# should run train debug mode first to get an initial model
#crt_net = torch.load('../../experiments/debug_SRResNet_bicx4_in3nf64nb16/models/8_G.pth')
#
#for k, v in crt_net.items():
# ... | 4,039 | 28.705882 | 103 | py |
MHCNN | MHCNN-main/MHCNN_syndataset/utils/utils_image_sidd.py | import os
import math
import random
import numpy as np
import torch
import cv2
from torchvision.utils import make_grid
from datetime import datetime
# import torchvision.transforms as transforms
import matplotlib.pyplot as plt
from mpl_toolkits.mplot3d import Axes3D
import glob
os.environ["KMP_DUPLICATE_LIB_OK"] = "TR... | 33,051 | 31.277344 | 108 | py |
MHCNN | MHCNN-main/MHCNN_syndataset/utils/utils_deblur.py | # -*- coding: utf-8 -*-
import numpy as np
import scipy
from scipy import fftpack
import torch
from math import cos, sin
from numpy import zeros, ones, prod, array, pi, log, min, mod, arange, sum, mgrid, exp, pad, round
from numpy.random import randn, rand
from scipy.signal import convolve2d
import cv2
import random
#... | 19,609 | 28.893293 | 188 | py |
MHCNN | MHCNN-main/MHCNN_syndataset/utils/utils_model.py | # -*- coding: utf-8 -*-
import numpy as np
import torch
from utils import utils_image as util
import re
import glob
import os
'''
# --------------------------------------------
# Model
# --------------------------------------------
# Kai Zhang (github: https://github.com/cszn)
# 03/Mar/2019
# ------------------------... | 9,805 | 28.805471 | 148 | py |
MHCNN | MHCNN-main/MHCNN_syndataset/utils/utils_regularizers.py | import torch
import torch.nn as nn
'''
# --------------------------------------------
# Kai Zhang (github: https://github.com/cszn)
# 03/Mar/2019
# --------------------------------------------
'''
# --------------------------------------------
# SVD Orthogonal Regularization
# --------------------------------------... | 3,416 | 31.542857 | 87 | py |
MHCNN | MHCNN-main/MHCNN_syndataset/utils/batchrenorm.py | import torch
__all__ = ["BatchRenorm1d", "BatchRenorm2d", "BatchRenorm3d"]
class BatchRenorm(torch.jit.ScriptModule):
def __init__(
self,
num_features: int,
eps: float = 1e-3,
momentum: float = 0.01,
affine: bool = True,
):
super().__init__()
self.regi... | 3,178 | 31.111111 | 78 | py |
MHCNN | MHCNN-main/MHCNN_syndataset/utils/antialias.py | # Copyright (c) 2019, Adobe Inc. All rights reserved.
#
# This work is licensed under the Creative Commons Attribution-NonCommercial-ShareAlike
# 4.0 International Public License. To view a copy of this license, visit
# https://creativecommons.org/licenses/by-nc-sa/4.0/legalcode.
######## https://github.com/adobe/a... | 4,580 | 35.648 | 143 | py |
MHCNN | MHCNN-main/MHCNN_syndataset/utils/metric.py |
import torch
from skimage.measure import compare_psnr,compare_ssim
def torch2numpy(tensor, gamma=None):
tensor = torch.clamp(tensor, 0.0, 1.0)
# Convert to 0 - 255
if gamma is not None:
tensor = torch.pow(tensor, gamma)
tensor *= 255.0
while len(tensor.size()) < 4:
tensor = tenso... | 1,291 | 29.761905 | 68 | py |
MHCNN | MHCNN-main/MHCNN_syndataset/utils/utils_bnorm.py | import torch
import torch.nn as nn
"""
# --------------------------------------------
# Batch Normalization
# --------------------------------------------
# Kai Zhang (cskaizhang@gmail.com)
# https://github.com/cszn
# 01/Jan/2019
# --------------------------------------------
"""
# --------------------------------... | 3,132 | 33.054348 | 187 | py |
MHCNN | MHCNN-main/MHCNN_syndataset/utils/utils_modelsummary.py | import torch.nn as nn
import torch
import numpy as np
'''
---- 1) FLOPs: floating point operations
---- 2) #Activations: the number of elements of all ‘Conv2d’ outputs
---- 3) #Conv2d: the number of ‘Conv2d’ layers
# --------------------------------------------
# Kai Zhang (github: https://github.com/cszn)
# 21/July/2... | 16,097 | 32.123457 | 129 | py |
MHCNN | MHCNN-main/MHCNN_syndataset/data/dataset_mhcnn_rot90270.py | import os.path
import random
import numpy as np
import torch
import torch.utils.data as data
import utils.utils_image as util
class MyDataset(data.Dataset):
"""
# -----------------------------------------
# Get L/H for denosing on AWGN with fixed sigma.
# Only dataroot_H is needed.
# -------------... | 4,288 | 33.869919 | 92 | py |
MHCNN | MHCNN-main/MHCNN_syndataset/data/dataset_mhcnn_single.py | import os.path
import random
import numpy as np
import torch
import torch.utils.data as data
import utils.utils_image as util
class MyDataset(data.Dataset):
"""
# -----------------------------------------
# Get L/H for denosing on AWGN with fixed sigma.
# Only dataroot_H is needed.
# -------------... | 3,501 | 33.673267 | 92 | py |
MHCNN | MHCNN-main/MHCNN_syndataset/data/dataset_mhcnn.py | import os.path
import random
import numpy as np
import torch
import torch.utils.data as data
import utils.utils_image as util
class MyDataset(data.Dataset):
"""
# -----------------------------------------
# Get L/H for denosing on AWGN with fixed sigma.
# Only dataroot_H is needed.
# -------------... | 4,228 | 33.382114 | 92 | py |
MHCNN | MHCNN-main/MHCNN_syndataset/data/dataset_mhcnn_rot180270.py | import os.path
import random
import numpy as np
import torch
import torch.utils.data as data
import utils.utils_image as util
class MyDataset(data.Dataset):
"""
# -----------------------------------------
# Get L/H for denosing on AWGN with fixed sigma.
# Only dataroot_H is needed.
# -------------... | 4,288 | 33.869919 | 92 | py |
MHCNN | MHCNN-main/MHCNN_syndataset/data/dataset_mhcnn_norot.py | import os.path
import random
import numpy as np
import torch
import torch.utils.data as data
import utils.utils_image as util
class MyDataset(data.Dataset):
"""
# -----------------------------------------
# Get L/H for denosing on AWGN with fixed sigma.
# Only dataroot_H is needed.
# -------------... | 4,236 | 33.447154 | 92 | py |
MHCNN | MHCNN-main/MHCNN_realworld/test_denoising_dnd.py | import numpy as np
import os
import argparse
from tqdm import tqdm
import torch.nn as nn
import torch
from torch.utils.data import DataLoader
import torch.nn.functional as F
import scipy.io as sio
# from networks.nhnet_model import nhnet
from models.network_mhcnn_color import Net
from dataloaders.data_rgb import get_... | 3,200 | 36.658824 | 138 | py |
MHCNN | MHCNN-main/MHCNN_realworld/main_train_real.py | import os
import torch
import torch.nn as nn
import torch.optim as optim
from torch.utils.data import DataLoader
import glob
import random
import time
import numpy as np
import utils
from dataloaders.data_rgb import get_training_data, get_validation_data
from pdb import set_trace as stx
from tqdm import tqdm
import o... | 5,732 | 33.957317 | 154 | py |
MHCNN | MHCNN-main/MHCNN_realworld/main_test_real.py | import os
import torch
import torch.nn as nn
import torch.optim as optim
from torch.utils.data import DataLoader
import glob
import random
import time
import numpy as np
import utils
from dataloaders.data_rgb import get_training_data, get_validation_data
from pdb import set_trace as stx
from tqdm import tqdm
import o... | 3,322 | 27.895652 | 154 | py |
MHCNN | MHCNN-main/MHCNN_realworld/dnd_py/pytorch_wrapper.py | # Author: Tobias Plötz, TU Darmstadt (tobias.ploetz@visinf.tu-darmstadt.de)
# This file is part of the implementation as described in the CVPR 2017 paper:
# Tobias Plötz and Stefan Roth, Benchmarking Denoising Algorithms with Real Photographs.
# Please see the file LICENSE.txt for the license governing this code.
... | 985 | 31.866667 | 89 | py |
MHCNN | MHCNN-main/MHCNN_realworld/dnd_py/dnd_denoise.py | # Author: Tobias Plötz, TU Darmstadt (tobias.ploetz@visinf.tu-darmstadt.de)
# This file is part of the implementation as described in the CVPR 2017 paper:
# Tobias Plötz and Stefan Roth, Benchmarking Denoising Algorithms with Real Photographs.
# Please see the file LICENSE.txt for the license governing this code.
... | 5,823 | 39.165517 | 106 | py |
MHCNN | MHCNN-main/MHCNN_realworld/dnd_py/__init__.py | from dnd_py.bundle_submissions import bundle_submissions_raw, bundle_submissions_srgb
from dnd_py.dnd_denoise import denoise_raw, denoise_srgb
from dnd_py.pytorch_wrapper import pytorch_denoiser | 194 | 64 | 85 | py |
MHCNN | MHCNN-main/MHCNN_realworld/models/model_base.py | import os
import torch
import torch.nn as nn
from utils.utils_bnorm import merge_bn, tidy_sequential
class ModelBase():
def __init__(self, opt):
self.opt = opt # opt
self.save_dir = opt['path']['models'] # save models
self.device = torch.device('cuda' if opt['gpu_i... | 5,372 | 29.355932 | 148 | py |
MHCNN | MHCNN-main/MHCNN_realworld/models/network_mhcnn_color.py | import torch
import torch.nn as nn
import models.basicblock as B
from models.transformer import Multi_Scale_Attention5
# 还是不好的话,可以去掉那两次注意力,把nc改成128
class D_Block(nn.Module):
def __init__(self, channel_in, channel_out):
super(D_Block, self).__init__()
self.conv_1 = nn.Conv2d(in_channels=channel_in, ... | 2,723 | 31.047059 | 126 | py |
MHCNN | MHCNN-main/MHCNN_realworld/models/model_plain_mhcnn.py | from collections import OrderedDict
import torch
import torch.nn as nn
from torch.optim import lr_scheduler
from torch.optim import Adam
from torch.nn.parallel import DataParallel # , DistributedDataParallel
from models.select_network import define_G
from models.model_base import ModelBase
from models.loss_ssim impor... | 9,242 | 37.194215 | 146 | py |
MHCNN | MHCNN-main/MHCNN_realworld/models/select_network.py | import functools
import torch
from torch.nn import init
"""
# --------------------------------------------
# select the network of G, D and F
# --------------------------------------------
"""
# --------------------------------------------
# Generator, netG, G
# --------------------------------------------
def defi... | 4,357 | 32.267176 | 113 | py |
MHCNN | MHCNN-main/MHCNN_realworld/models/model_plain.py | from collections import OrderedDict
import torch
import torch.nn as nn
from torch.optim import lr_scheduler
from torch.optim import Adam
from torch.nn.parallel import DataParallel # , DistributedDataParallel
from models.select_network import define_G
from models.model_base import ModelBase
from models.loss_ssim impor... | 9,116 | 37.631356 | 146 | py |
MHCNN | MHCNN-main/MHCNN_realworld/models/loss.py | import torch
import torch.nn as nn
# --------------------------------------------
# GAN loss: gan, ragan
# --------------------------------------------
class GANLoss(nn.Module):
def __init__(self, gan_type, real_label_val=1.0, fake_label_val=0.0):
super(GANLoss, self).__init__()
self.gan_type = ga... | 3,823 | 35.075472 | 97 | py |
MHCNN | MHCNN-main/MHCNN_realworld/models/basicblock.py | from collections import OrderedDict
import torch
import torch.nn as nn
import torch.nn.functional as F
from utils.batchrenorm import BatchRenorm2d
def sequential(*args):
"""Advanced nn.Sequential.
Args:
nn.Sequential, nn.Module
Returns:
nn.Sequential
"""
if len(args) == 1:
... | 48,670 | 40.528157 | 169 | py |
MHCNN | MHCNN-main/MHCNN_realworld/models/transformer.py | """
Adapted from https://github.com/lukemelas/simple-bert
"""
import numpy as np
from torch import nn
from torch import Tensor
from torch.nn import functional as F
import torch
from einops import rearrange, repeat
from einops.layers.torch import Rearrange
import models.basicblock as B
# 展开,linear不行,因为你图像尺寸是变得,所以得用1x... | 14,009 | 35.579634 | 80 | py |
MHCNN | MHCNN-main/MHCNN_realworld/models/loss_ssim.py | import torch
import torch.nn.functional as F
from torch.autograd import Variable
import numpy as np
from math import exp
"""
# ============================================
# SSIM loss
# https://github.com/Po-Hsun-Su/pytorch-ssim
# ============================================
"""
def gaussian(window_size, sigma):
... | 3,708 | 30.974138 | 104 | py |
MHCNN | MHCNN-main/MHCNN_realworld/models/network_mhcnn.py | import torch
import torch.nn as nn
import models.basicblock as B
from models.transformer import Multi_Scale_Attention5
class D_Block(nn.Module):
def __init__(self, channel_in, channel_out):
super(D_Block, self).__init__()
self.conv_1 = nn.Conv2d(in_channels=channel_in, out_channels=int(channel_in /... | 2,608 | 32.448718 | 126 | py |
MHCNN | MHCNN-main/MHCNN_realworld/dataloaders/dataset_rgb.py | import numpy as np
import os
from torch.utils.data import Dataset
import torch
import torch.nn.functional as F
import random
import cv2
def is_png_file(filename):
return any(filename.endswith(extension) for extension in [".png"])
def load_img(filepath):
img = cv2.cvtColor(cv2.imread(filepath), cv2.COLOR_BGR2RGB... | 6,864 | 34.569948 | 120 | py |
MHCNN | MHCNN-main/MHCNN_realworld/utils/utils_matconvnet.py | # -*- coding: utf-8 -*-
import numpy as np
import torch
from collections import OrderedDict
# import scipy.io as io
import hdf5storage
"""
# --------------------------------------------
# Convert matconvnet SimpleNN model into pytorch model
# --------------------------------------------
# Kai Zhang (cskaizhang@gmail.... | 6,804 | 33.368687 | 239 | py |
MHCNN | MHCNN-main/MHCNN_realworld/utils/dataset_utils.py | import torch
class Augment_RGB_torch:
def __init__(self):
pass
def transform0(self, torch_tensor):
return torch_tensor
def transform1(self, torch_tensor):
torch_tensor = torch.rot90(torch_tensor, k=1, dims=[-1,-2])
return torch_tensor
def transform2(self, torch_tenso... | 1,633 | 33.041667 | 91 | py |
MHCNN | MHCNN-main/MHCNN_realworld/utils/image_utils.py | import torch
import numpy as np
import pickle
import cv2
def is_numpy_file(filename):
return any(filename.endswith(extension) for extension in [".npy"])
def is_image_file(filename):
return any(filename.endswith(extension) for extension in [".jpg"])
def is_png_file(filename):
return any(filename.endswith(... | 1,363 | 25.230769 | 70 | py |
MHCNN | MHCNN-main/MHCNN_realworld/utils/utils_sisr.py | # -*- coding: utf-8 -*-
from utils import utils_image as util
import random
import scipy
import scipy.stats as ss
import scipy.io as io
from scipy import ndimage
from scipy.interpolate import interp2d
import numpy as np
import torch
"""
# --------------------------------------------
# Super-Resolution
# -----------... | 23,082 | 26.188457 | 138 | py |
MHCNN | MHCNN-main/MHCNN_realworld/utils/model_utils.py | import torch
import os
from collections import OrderedDict
def freeze(model):
for p in model.parameters():
p.requires_grad=False
def unfreeze(model):
for p in model.parameters():
p.requires_grad=True
def is_frozen(model):
x = [p.requires_grad for p in model.parameters()]
return not al... | 1,562 | 27.944444 | 90 | py |
MHCNN | MHCNN-main/MHCNN_realworld/utils/utils_image.py | import os
import math
import random
import numpy as np
import torch
import cv2
from torchvision.utils import make_grid
from datetime import datetime
# import torchvision.transforms as transforms
import matplotlib.pyplot as plt
from mpl_toolkits.mplot3d import Axes3D
os.environ["KMP_DUPLICATE_LIB_OK"] = "TRUE"
'''
# -... | 31,897 | 31.090543 | 108 | py |
MHCNN | MHCNN-main/MHCNN_realworld/utils/load_mh_mirnet.py | import torch
import torch.nn as nn
from networks.mh_mirnet import MH_MIRNet
mhcnn_path = '../pretrained_models/mhcnn.pth'
mirnet_path = '../pretrained_models/mirnet.pth'
mhcnn_weights = torch.load(mhcnn_path,map_location='cpu')['state_dict'],
mirnet_weights = torch.load(mirnet_path,map_location='cpu')['state_dict']
... | 1,070 | 30.5 | 73 | py |
MHCNN | MHCNN-main/MHCNN_realworld/utils/utils_params.py | import torch
import torchvision
from models import basicblock as B
def show_kv(net):
for k, v in net.items():
print(k)
# should run train debug mode first to get an initial model
#crt_net = torch.load('../../experiments/debug_SRResNet_bicx4_in3nf64nb16/models/8_G.pth')
#
#for k, v in crt_net.items():
# ... | 4,039 | 28.705882 | 103 | py |
MHCNN | MHCNN-main/MHCNN_realworld/utils/utils_image_sidd.py | import os
import math
import random
import numpy as np
import torch
import cv2
from torchvision.utils import make_grid
from datetime import datetime
# import torchvision.transforms as transforms
import matplotlib.pyplot as plt
from mpl_toolkits.mplot3d import Axes3D
import glob
os.environ["KMP_DUPLICATE_LIB_OK"] = "TR... | 33,051 | 31.277344 | 108 | py |
MHCNN | MHCNN-main/MHCNN_realworld/utils/utils_deblur.py | # -*- coding: utf-8 -*-
import numpy as np
import scipy
from scipy import fftpack
import torch
from math import cos, sin
from numpy import zeros, ones, prod, array, pi, log, min, mod, arange, sum, mgrid, exp, pad, round
from numpy.random import randn, rand
from scipy.signal import convolve2d
import cv2
import random
#... | 19,609 | 28.893293 | 188 | py |
MHCNN | MHCNN-main/MHCNN_realworld/utils/utils_model.py | # -*- coding: utf-8 -*-
import numpy as np
import torch
from utils import utils_image as util
import re
import glob
import os
'''
# --------------------------------------------
# Model
# --------------------------------------------
# Kai Zhang (github: https://github.com/cszn)
# 03/Mar/2019
# ------------------------... | 9,805 | 28.805471 | 148 | py |
MHCNN | MHCNN-main/MHCNN_realworld/utils/utils_regularizers.py | import torch
import torch.nn as nn
'''
# --------------------------------------------
# Kai Zhang (github: https://github.com/cszn)
# 03/Mar/2019
# --------------------------------------------
'''
# --------------------------------------------
# SVD Orthogonal Regularization
# --------------------------------------... | 3,416 | 31.542857 | 87 | py |
MHCNN | MHCNN-main/MHCNN_realworld/utils/batchrenorm.py | import torch
__all__ = ["BatchRenorm1d", "BatchRenorm2d", "BatchRenorm3d"]
class BatchRenorm(torch.jit.ScriptModule):
def __init__(
self,
num_features: int,
eps: float = 1e-3,
momentum: float = 0.01,
affine: bool = True,
):
super().__init__()
self.regi... | 3,178 | 31.111111 | 78 | py |
MHCNN | MHCNN-main/MHCNN_realworld/utils/antialias.py | # Copyright (c) 2019, Adobe Inc. All rights reserved.
#
# This work is licensed under the Creative Commons Attribution-NonCommercial-ShareAlike
# 4.0 International Public License. To view a copy of this license, visit
# https://creativecommons.org/licenses/by-nc-sa/4.0/legalcode.
######## https://github.com/adobe/a... | 4,580 | 35.648 | 143 | py |
MHCNN | MHCNN-main/MHCNN_realworld/utils/metric.py |
import torch
from skimage.measure import compare_psnr,compare_ssim
def torch2numpy(tensor, gamma=None):
tensor = torch.clamp(tensor, 0.0, 1.0)
# Convert to 0 - 255
if gamma is not None:
tensor = torch.pow(tensor, gamma)
tensor *= 255.0
while len(tensor.size()) < 4:
tensor = tenso... | 1,291 | 29.761905 | 68 | py |
MHCNN | MHCNN-main/MHCNN_realworld/utils/utils_bnorm.py | import torch
import torch.nn as nn
"""
# --------------------------------------------
# Batch Normalization
# --------------------------------------------
# Kai Zhang (cskaizhang@gmail.com)
# https://github.com/cszn
# 01/Jan/2019
# --------------------------------------------
"""
# --------------------------------... | 3,132 | 33.054348 | 187 | py |
MHCNN | MHCNN-main/MHCNN_realworld/utils/utils_modelsummary.py | import torch.nn as nn
import torch
import numpy as np
'''
---- 1) FLOPs: floating point operations
---- 2) #Activations: the number of elements of all ‘Conv2d’ outputs
---- 3) #Conv2d: the number of ‘Conv2d’ layers
# --------------------------------------------
# Kai Zhang (github: https://github.com/cszn)
# 21/July/2... | 16,097 | 32.123457 | 129 | py |
MHCNN | MHCNN-main/MHCNN_realworld/data/dataset_mhcnn_rot90270.py | import os.path
import random
import numpy as np
import torch
import torch.utils.data as data
import utils.utils_image as util
class MyDataset(data.Dataset):
"""
# -----------------------------------------
# Get L/H for denosing on AWGN with fixed sigma.
# Only dataroot_H is needed.
# -------------... | 4,288 | 33.869919 | 92 | py |
MHCNN | MHCNN-main/MHCNN_realworld/data/dataset_mhcnn_single.py | import os.path
import random
import numpy as np
import torch
import torch.utils.data as data
import utils.utils_image as util
class MyDataset(data.Dataset):
"""
# -----------------------------------------
# Get L/H for denosing on AWGN with fixed sigma.
# Only dataroot_H is needed.
# -------------... | 3,501 | 33.673267 | 92 | py |
MHCNN | MHCNN-main/MHCNN_realworld/data/dataset_mhcnn.py | import os.path
import random
import numpy as np
import torch
import torch.utils.data as data
import utils.utils_image as util
class MyDataset(data.Dataset):
"""
# -----------------------------------------
# Get L/H for denosing on AWGN with fixed sigma.
# Only dataroot_H is needed.
# -------------... | 4,228 | 33.382114 | 92 | py |
MHCNN | MHCNN-main/MHCNN_realworld/data/dataset_mhcnn_rot180270.py | import os.path
import random
import numpy as np
import torch
import torch.utils.data as data
import utils.utils_image as util
class MyDataset(data.Dataset):
"""
# -----------------------------------------
# Get L/H for denosing on AWGN with fixed sigma.
# Only dataroot_H is needed.
# -------------... | 4,288 | 33.869919 | 92 | py |
MHCNN | MHCNN-main/MHCNN_realworld/data/dataset_sidd.py | import os.path
import random
import numpy as np
import torch
import torch.utils.data as data
import utils.utils_image_sidd as util
import cv2
class DatasetSIDD(data.Dataset):
"""
# -----------------------------------------
# Get L/H for denosing on AWGN with fixed sigma.
# Only dataroot_H is needed.
... | 3,995 | 36.345794 | 92 | py |
MHCNN | MHCNN-main/MHCNN_realworld/data/dataset_mhcnn_norot.py | import os.path
import random
import numpy as np
import torch
import torch.utils.data as data
import utils.utils_image as util
class MyDataset(data.Dataset):
"""
# -----------------------------------------
# Get L/H for denosing on AWGN with fixed sigma.
# Only dataroot_H is needed.
# -------------... | 4,236 | 33.447154 | 92 | py |
GraphNormalization | GraphNormalization-master/main_molecules_graph_regression.py |
"""
IMPORTING LIBS
"""
import dgl
import numpy as np
import os
import socket
import time
import random
import glob
import argparse, json
import pickle
import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.optim as optim
from torch.utils.data import DataLoader
from tensorboardX imp... | 19,020 | 40.440087 | 202 | py |
GraphNormalization | GraphNormalization-master/main_TSP_edge_classification.py |
"""
IMPORTING LIBS
"""
import dgl
import numpy as np
import os
import socket
import time
import random
import glob
import argparse, json
import pickle
import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.optim as optim
from torch.utils.data import DataLoader
from tensorboardX imp... | 18,162 | 39.452116 | 202 | py |
GraphNormalization | GraphNormalization-master/main_superpixels_graph_classification.py |
"""
IMPORTING LIBS
"""
import dgl
import numpy as np
import os
import socket
import time
import random
import glob
import argparse, json
import pickle
import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.optim as optim
from torch.utils.data import DataLoader
from tensorboardX imp... | 18,725 | 40.986547 | 202 | py |
GraphNormalization | GraphNormalization-master/main_SBMs_node_classification.py |
"""
IMPORTING LIBS
"""
import dgl
import numpy as np
import os
import socket
import time
import random
import glob
import argparse, json
import pickle
import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.optim as optim
from torch.utils.data import DataLoader
from tensorboardX imp... | 18,400 | 39.176856 | 202 | py |
GraphNormalization | GraphNormalization-master/main_COLLAB_edge_classification.py |
"""
IMPORTING LIBS
"""
import dgl
import numpy as np
import os
import socket
import time
import random
import glob
import argparse, json
import pickle
import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.optim as optim
from torch.utils.data import DataLoader
from tensorboardX imp... | 18,754 | 41.722096 | 202 | py |
GraphNormalization | GraphNormalization-master/norm/norm.py | """
File to load dataset based on user control from main file
"""
import torch.nn as nn
from norm.graph_norm import GraphNorm
from norm.adjance_norm import AdjaNodeNorm, AdjaEdgeNorm
from norm.united_norm import UnitedNormBase
from norm.united_norm_common import UnitedNormCommon
from norm.united_norm_softmax import... | 1,431 | 29.468085 | 139 | py |
GraphNormalization | GraphNormalization-master/norm/united_norm_softmax.py | import torch.nn as nn
import torch
from norm.united_norm import UnitedNormBase
import torch.nn.functional as F
class UnitedNormSoftmax(UnitedNormBase):
def __init__(self, *args):
super(UnitedNormSoftmax, self).__init__(*args)
self.clamp = False
def norm_lambda(self):
concat_lambda = ... | 727 | 35.4 | 90 | py |
GraphNormalization | GraphNormalization-master/norm/graph_norm.py | import torch.nn as nn
import torch
class GraphNorm(nn.Module):
"""
Param: []
"""
def __init__(self, num_features, eps=1e-5, affine=True, is_node=True):
super().__init__()
self.eps = eps
self.num_features = num_features
self.affine = affine
self.is_node = is_... | 1,179 | 27.780488 | 78 | py |
GraphNormalization | GraphNormalization-master/norm/adjance_norm.py | import torch.nn as nn
import torch
# Adjance norm for node
class AdjaNodeNorm(nn.Module):
def __init__(self, num_features, eps=1e-5, affine=True):
super(AdjaNodeNorm, self).__init__()
self.eps = eps
self.affine = affine
self.num_features = num_features
if self.affine:
... | 2,861 | 29.126316 | 68 | py |
GraphNormalization | GraphNormalization-master/norm/united_norm.py | import torch.nn as nn
import torch
from norm.graph_norm import GraphNorm
from norm.adjance_norm import AdjaNodeNorm, AdjaEdgeNorm
class UnitedNormBase(nn.Module):
def __init__(self, num_features, is_node=True):
super(UnitedNormBase, self).__init__()
self.clamp = False
self.num_features = n... | 1,631 | 39.8 | 95 | py |
GraphNormalization | GraphNormalization-master/norm/united_norm_common.py | import torch.nn as nn
import torch
from norm.united_norm import UnitedNormBase
class UnitedNormCommon(UnitedNormBase):
def __init__(self, *args):
super(UnitedNormCommon, self).__init__(*args)
self.clamp = True
def norm_lambda(self):
lambda_sum = self.lambda_batch + self.lambda_graph ... | 551 | 31.470588 | 96 | py |
GraphNormalization | GraphNormalization-master/nets/CSL_graph_classification/gat_net.py | import torch
import torch.nn as nn
import torch.nn.functional as F
import dgl
"""
GAT: Graph Attention Network
Graph Attention Networks (Veličković et al., ICLR 2018)
https://arxiv.org/abs/1710.10903
"""
from layers.gat_layer import GATLayer
from layers.mlp_readout_layer import MLPReadout
class GATNet(nn... | 2,643 | 33.789474 | 115 | py |
GraphNormalization | GraphNormalization-master/nets/CSL_graph_classification/ring_gnn_net.py | import torch
import torch.nn as nn
import torch.nn.functional as F
import dgl
import time
"""
Ring-GNN
On the equivalence between graph isomorphism testing and function approximation with GNNs (Chen et al, 2019)
https://arxiv.org/pdf/1905.12560v1.pdf
"""
from layers.ring_gnn_equiv_layer import RingGNNEqui... | 2,384 | 35.136364 | 141 | py |
GraphNormalization | GraphNormalization-master/nets/CSL_graph_classification/three_wl_gnn_net.py | import torch
import torch.nn as nn
import torch.nn.functional as F
import dgl
import time
"""
3WLGNN / ThreeWLGNN
Provably Powerful Graph Networks (Maron et al., 2019)
https://papers.nips.cc/paper/8488-provably-powerful-graph-networks.pdf
CODE adapted from https://github.com/hadarser/ProvablyPowe... | 3,132 | 37.207317 | 118 | py |
GraphNormalization | GraphNormalization-master/nets/CSL_graph_classification/graphsage_net.py | import torch
import torch.nn as nn
import torch.nn.functional as F
import dgl
"""
GraphSAGE:
William L. Hamilton, Rex Ying, Jure Leskovec, Inductive Representation Learning on Large Graphs (NeurIPS 2017)
https://cs.stanford.edu/people/jure/pubs/graphsage-nips17.pdf
"""
from layers.graphsage_layer import... | 2,716 | 34.285714 | 122 | py |
GraphNormalization | GraphNormalization-master/nets/CSL_graph_classification/gin_net.py | import torch
import torch.nn as nn
import torch.nn.functional as F
import dgl
from dgl.nn.pytorch.glob import SumPooling, AvgPooling, MaxPooling
"""
GIN: Graph Isomorphism Networks
HOW POWERFUL ARE GRAPH NEURAL NETWORKS? (Keyulu Xu, Weihua Hu, Jure Leskovec and Stefanie Jegelka, ICLR 2019)
https://arxiv.o... | 3,216 | 34.351648 | 113 | py |
GraphNormalization | GraphNormalization-master/nets/CSL_graph_classification/gcn_net.py | import torch
import torch.nn as nn
import torch.nn.functional as F
import dgl
"""
GCN: Graph Convolutional Networks
Thomas N. Kipf, Max Welling, Semi-Supervised Classification with Graph Convolutional Networks (ICLR 2017)
http://arxiv.org/abs/1609.02907
"""
from layers.gcn_layer import GCNLayer
from layer... | 2,664 | 34.065789 | 115 | py |
GraphNormalization | GraphNormalization-master/nets/CSL_graph_classification/gated_gcn_net.py | import torch
import torch.nn as nn
import torch.nn.functional as F
import dgl
"""
ResGatedGCN: Residual Gated Graph ConvNets
An Experimental Study of Neural Networks for Variable Graphs (Xavier Bresson and Thomas Laurent, ICLR 2018)
https://arxiv.org/pdf/1711.07553v2.pdf
"""
from layers.gated_gcn_layer im... | 3,003 | 34.761905 | 117 | py |
GraphNormalization | GraphNormalization-master/nets/CSL_graph_classification/mlp_net.py | import torch
import torch.nn as nn
import torch.nn.functional as F
import dgl
from layers.mlp_readout_layer import MLPReadout
class MLPNet(nn.Module):
def __init__(self, net_params):
super().__init__()
num_node_type = net_params['num_node_type']
num_edge_type = net_params['num_edge_type']... | 2,555 | 30.555556 | 81 | py |
GraphNormalization | GraphNormalization-master/nets/CSL_graph_classification/mo_net.py | import torch
import torch.nn as nn
import torch.nn.functional as F
import dgl
import numpy as np
"""
GMM: Gaussian Mixture Model Convolution layer
Geometric Deep Learning on Graphs and Manifolds using Mixture Model CNNs (Federico Monti et al., CVPR 2017)
https://arxiv.org/pdf/1611.08402.pdf
"""
from lay... | 3,661 | 35.257426 | 115 | py |
GraphNormalization | GraphNormalization-master/nets/SBMs_node_classification/gat_net.py | import torch
import torch.nn as nn
import torch.nn.functional as F
import dgl
"""
GAT: Graph Attention Network
Graph Attention Networks (Veličković et al., ICLR 2018)
https://arxiv.org/abs/1710.10903
"""
from layers.gat_layer import GATLayer
from layers.mlp_readout_layer import MLPReadout
class GATNet(nn... | 2,523 | 29.780488 | 109 | py |
GraphNormalization | GraphNormalization-master/nets/SBMs_node_classification/ring_gnn_net.py | import torch
import torch.nn as nn
import torch.nn.functional as F
import dgl
import time
"""
Ring-GNN
On the equivalence between graph isomorphism testing and function approximation with GNNs (Chen et al, 2019)
https://arxiv.org/pdf/1905.12560v1.pdf
"""
from layers.ring_gnn_equiv_layer import RingGNNEqui... | 3,202 | 38.060976 | 141 | py |
GraphNormalization | GraphNormalization-master/nets/SBMs_node_classification/three_wl_gnn_net.py | import torch
import torch.nn as nn
import torch.nn.functional as F
import dgl
import time
"""
3WLGNN / ThreeWLGNN
Provably Powerful Graph Networks (Maron et al., 2019)
https://papers.nips.cc/paper/8488-provably-powerful-graph-networks.pdf
CODE adapted from https://github.com/hadarser/ProvablyPowe... | 4,050 | 36.859813 | 118 | py |
GraphNormalization | GraphNormalization-master/nets/SBMs_node_classification/graphsage_net.py | import torch
import torch.nn as nn
import torch.nn.functional as F
import dgl
"""
GraphSAGE:
William L. Hamilton, Rex Ying, Jure Leskovec, Inductive Representation Learning on Large Graphs (NeurIPS 2017)
https://cs.stanford.edu/people/jure/pubs/graphsage-nips17.pdf
"""
from layers.graphsage_layer import... | 2,662 | 31.47561 | 122 | py |
GraphNormalization | GraphNormalization-master/nets/SBMs_node_classification/gin_net.py | import torch
import torch.nn as nn
import torch.nn.functional as F
import dgl
from dgl.nn.pytorch.glob import SumPooling, AvgPooling, MaxPooling
"""
GIN: Graph Isomorphism Networks
HOW POWERFUL ARE GRAPH NEURAL NETWORKS? (Keyulu Xu, Weihua Hu, Jure Leskovec and Stefanie Jegelka, ICLR 2019)
https://arxiv.o... | 3,060 | 34.593023 | 113 | py |
GraphNormalization | GraphNormalization-master/nets/SBMs_node_classification/gcn_net.py | import torch
import torch.nn as nn
import torch.nn.functional as F
import dgl
import numpy as np
"""
GCN: Graph Convolutional Networks
Thomas N. Kipf, Max Welling, Semi-Supervised Classification with Graph Convolutional Networks (ICLR 2017)
http://arxiv.org/abs/1609.02907
"""
from layers.gcn_layer import ... | 2,468 | 28.392857 | 109 | py |
GraphNormalization | GraphNormalization-master/nets/SBMs_node_classification/gated_gcn_net.py | import torch
import torch.nn as nn
import torch.nn.functional as F
import dgl
import numpy as np
"""
ResGatedGCN: Residual Gated Graph ConvNets
An Experimental Study of Neural Networks for Variable Graphs (Xavier Bresson and Thomas Laurent, ICLR 2018)
https://arxiv.org/pdf/1711.07553v2.pdf
"""
from layers... | 2,729 | 33.556962 | 111 | py |
GraphNormalization | GraphNormalization-master/nets/SBMs_node_classification/mlp_net.py | import torch
import torch.nn as nn
import torch.nn.functional as F
import dgl
from layers.mlp_readout_layer import MLPReadout
class MLPNet(nn.Module):
def __init__(self, net_params):
super().__init__()
in_dim_node = net_params['in_dim'] # node_dim (feat is an integer)
hidden_dim = net_... | 2,399 | 28.268293 | 90 | py |
GraphNormalization | GraphNormalization-master/nets/SBMs_node_classification/mo_net.py | import torch
import torch.nn as nn
import torch.nn.functional as F
import dgl
import numpy as np
"""
GMM: Gaussian Mixture Model Convolution layer
Geometric Deep Learning on Graphs and Manifolds using Mixture Model CNNs (Federico Monti et al., CVPR 2017)
https://arxiv.org/pdf/1611.08402.pdf
"""
from lay... | 3,518 | 37.25 | 115 | py |
GraphNormalization | GraphNormalization-master/nets/COLLAB_edge_classification/gat_net.py | import torch
import torch.nn as nn
import torch.nn.functional as F
import dgl
"""
GAT: Graph Attention Network
Graph Attention Networks (Veličković et al., ICLR 2018)
https://arxiv.org/abs/1710.10903
"""
from layers.gat_layer import GATLayer, CustomGATLayer, CustomGATLayerEdgeReprFeat, CustomGATLayerIsotr... | 2,960 | 34.674699 | 122 | py |
GraphNormalization | GraphNormalization-master/nets/COLLAB_edge_classification/graphsage_net.py | import torch
import torch.nn as nn
import torch.nn.functional as F
import dgl
"""
GraphSAGE:
William L. Hamilton, Rex Ying, Jure Leskovec, Inductive Representation Learning on Large Graphs (NeurIPS 2017)
https://cs.stanford.edu/people/jure/pubs/graphsage-nips17.pdf
"""
from layers.graphsage_layer import... | 3,026 | 35.035714 | 122 | py |
GraphNormalization | GraphNormalization-master/nets/COLLAB_edge_classification/gin_net.py | import torch
import torch.nn as nn
import torch.nn.functional as F
import dgl
"""
GIN: Graph Isomorphism Networks
HOW POWERFUL ARE GRAPH NEURAL NETWORKS? (Keyulu Xu, Weihua Hu, Jure Leskovec and Stefanie Jegelka, ICLR 2019)
https://arxiv.org/pdf/1810.00826.pdf
"""
from layers.gin_layer import GINLayer, A... | 2,086 | 32.126984 | 113 | py |
GraphNormalization | GraphNormalization-master/nets/COLLAB_edge_classification/gcn_net.py | import torch
import torch.nn as nn
import torch.nn.functional as F
import dgl
"""
GCN: Graph Convolutional Networks
Thomas N. Kipf, Max Welling, Semi-Supervised Classification with Graph Convolutional Networks (ICLR 2017)
http://arxiv.org/abs/1609.02907
"""
from layers.gcn_layer import GCNLayer
from layer... | 2,017 | 33.793103 | 109 | py |
GraphNormalization | GraphNormalization-master/nets/COLLAB_edge_classification/matrix_factorization.py | import torch
import torch.nn as nn
import torch.nn.functional as F
import dgl
from layers.mlp_readout_layer import MLPReadout
class MatrixFactorization(nn.Module):
def __init__(self, net_params):
super().__init__()
num_embs = net_params['num_embs']
hidden_dim = net_params['hidden_dim']
... | 1,084 | 28.324324 | 77 | py |
GraphNormalization | GraphNormalization-master/nets/COLLAB_edge_classification/gated_gcn_net.py | import torch
import torch.nn as nn
import torch.nn.functional as F
import dgl
"""
ResGatedGCN: Residual Gated Graph ConvNets
An Experimental Study of Neural Networks for Variable Graphs (Xavier Bresson and Thomas Laurent, ICLR 2018)
https://arxiv.org/pdf/1711.07553v2.pdf
"""
from layers.gated_gcn_layer im... | 2,860 | 35.679487 | 116 | py |
GraphNormalization | GraphNormalization-master/nets/COLLAB_edge_classification/mlp_net.py | import torch
import torch.nn as nn
import torch.nn.functional as F
import dgl
from layers.mlp_readout_layer import MLPReadout
class MLPNet(nn.Module):
def __init__(self, net_params):
super().__init__()
in_dim = net_params['in_dim']
hidden_dim = net_params['hidden_dim']
in_feat_dro... | 1,656 | 29.685185 | 81 | py |
GraphNormalization | GraphNormalization-master/nets/COLLAB_edge_classification/mo_net.py | import torch
import torch.nn as nn
import torch.nn.functional as F
import dgl
import numpy as np
"""
GMM: Gaussian Mixture Model Convolution layer
Geometric Deep Learning on Graphs and Manifolds using Mixture Model CNNs (Federico Monti et al., CVPR 2017)
https://arxiv.org/pdf/1611.08402.pdf
"""
from lay... | 2,586 | 33.493333 | 111 | py |
GraphNormalization | GraphNormalization-master/nets/superpixels_graph_classification/gat_net.py | import torch
import torch.nn as nn
import torch.nn.functional as F
import dgl
"""
GAT: Graph Attention Network
Graph Attention Networks (Veličković et al., ICLR 2018)
https://arxiv.org/abs/1710.10903
"""
from layers.gat_layer import GATLayer
from layers.mlp_readout_layer import MLPReadout
class GATNet(nn... | 2,117 | 33.721311 | 109 | py |
GraphNormalization | GraphNormalization-master/nets/superpixels_graph_classification/ring_gnn_net.py | import torch
import torch.nn as nn
import torch.nn.functional as F
import dgl
import time
"""
Ring-GNN
On the equivalence between graph isomorphism testing and function approximation with GNNs (Chen et al, 2019)
https://arxiv.org/pdf/1905.12560v1.pdf
"""
from layers.ring_gnn_equiv_layer import RingGNNEqui... | 2,384 | 35.136364 | 141 | py |
GraphNormalization | GraphNormalization-master/nets/superpixels_graph_classification/three_wl_gnn_net.py | import torch
import torch.nn as nn
import torch.nn.functional as F
import dgl
import time
"""
3WLGNN / ThreeWLGNN
Provably Powerful Graph Networks (Maron et al., 2019)
https://papers.nips.cc/paper/8488-provably-powerful-graph-networks.pdf
CODE adapted from https://github.com/hadarser/ProvablyPowe... | 3,132 | 37.207317 | 118 | py |
GraphNormalization | GraphNormalization-master/nets/superpixels_graph_classification/graphsage_net.py | import torch
import torch.nn as nn
import torch.nn.functional as F
import dgl
"""
GraphSAGE:
William L. Hamilton, Rex Ying, Jure Leskovec, Inductive Representation Learning on Large Graphs (NeurIPS 2017)
https://cs.stanford.edu/people/jure/pubs/graphsage-nips17.pdf
"""
from layers.graphsage_layer import... | 2,260 | 34.888889 | 122 | py |
GraphNormalization | GraphNormalization-master/nets/superpixels_graph_classification/gin_net.py | import torch
import torch.nn as nn
import torch.nn.functional as F
import dgl
from dgl.nn.pytorch.glob import SumPooling, AvgPooling, MaxPooling
"""
GIN: Graph Isomorphism Networks
HOW POWERFUL ARE GRAPH NEURAL NETWORKS? (Keyulu Xu, Weihua Hu, Jure Leskovec and Stefanie Jegelka, ICLR 2019)
https://arxiv.o... | 2,876 | 34.085366 | 113 | py |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.