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 |
|---|---|---|---|---|---|---|
BVQI | BVQI-master/prompt_tuning.py | import os, glob
import argparse
import pickle as pkl
import random
from copy import deepcopy
import open_clip
import numpy as np
import torch
import torch.nn as nn
import yaml
from scipy.stats import pearsonr, spearmanr
from scipy.stats import kendalltau as kendallr
from tqdm import tqdm
from buona_vista import dat... | 17,790 | 39.251131 | 158 | py |
BVQI | BVQI-master/load_features.py | import os
import argparse
import pickle as pkl
import random
import open_clip
import numpy as np
import torch
import torch.nn as nn
import yaml
from scipy.stats import pearsonr, spearmanr
from scipy.stats import kendalltau as kendallr
from tqdm import tqdm
from buona_vista import datasets
import wandb
def rescale... | 2,446 | 28.841463 | 100 | py |
BVQI | BVQI-master/pyiqa/test.py | import logging
from os import path as osp
import torch
from pyiqa.data import build_dataloader, build_dataset
from pyiqa.models import build_model
from pyiqa.utils import get_env_info, get_root_logger, get_time_str, make_exp_dirs
from pyiqa.utils.options import dict2str, parse_options
def test_pipeline(root_path):
... | 1,864 | 30.083333 | 87 | py |
BVQI | BVQI-master/pyiqa/train_nsplits.py | import datetime
import logging
import os
import time
from os import path as osp
import numpy as np
import torch
from pyiqa.data.prefetch_dataloader import CPUPrefetcher, CUDAPrefetcher
from pyiqa.models import build_model
from pyiqa.train import create_train_val_dataloader, init_tb_loggers, train_pipeline
from pyiqa.... | 2,387 | 34.641791 | 84 | py |
BVQI | BVQI-master/pyiqa/train.py | import datetime
import logging
import math
import os
import time
from os import path as osp
import torch
from pyiqa.data import build_dataloader, build_dataset
from pyiqa.data.data_sampler import EnlargedSampler
from pyiqa.data.prefetch_dataloader import CPUPrefetcher, CUDAPrefetcher
from pyiqa.models import build_mo... | 11,816 | 36.39557 | 103 | py |
BVQI | BVQI-master/pyiqa/matlab_utils/functions.py | import math
import numpy as np
import torch
import torch.nn.functional as F
from pyiqa.archs.arch_util import ExactPadding2d, symm_pad, to_2tuple
def fspecial(size=None, sigma=None, channels=1, filter_type="gaussian"):
r"""Function same as 'fspecial' in MATLAB, only support gaussian now.
Args:
size ... | 10,439 | 33.569536 | 124 | py |
BVQI | BVQI-master/pyiqa/matlab_utils/math_util.py | r"""Mathematical utilities
Created by: https://github.com/tomrunia/PyTorchSteerablePyramid/blob/master/steerable/math_utils.py
Modified by: Jiadi Mo (https://github.com/JiadiMo)
"""
from __future__ import absolute_import, division, print_function
import numpy as np
import torch
def abs(x):
return torch.sqrt(x... | 2,611 | 26.787234 | 99 | py |
BVQI | BVQI-master/pyiqa/matlab_utils/scfpyr_util.py | r"""Complex-valued steerable pyramid
Created by: https://github.com/tomrunia/PyTorchSteerablePyramid
Modified by: Jiadi Mo (https://github.com/JiadiMo)
Refer to:
- Offical Matlab code from https://github.com/LabForComputationalVision/matlabPyrTools/blob/master/buildSCFpyr.m;
- Original Python code from https... | 8,552 | 36.678414 | 121 | py |
BVQI | BVQI-master/pyiqa/matlab_utils/__init__.py | """This folder contains pytorch implementations of matlab functions.
And should produce the same results as matlab.
Note: to enable GPU acceleration, all functions take batched tensors as inputs,
and return batched results.
"""
from .functions import *
from .resize import imresize
from .scfpyr_util import SCFpyr_PyTo... | 529 | 19.384615 | 79 | py |
BVQI | BVQI-master/pyiqa/matlab_utils/resize.py | """
A standalone PyTorch implementation for fast and efficient bicubic resampling.
The resulting values are the same to MATLAB function imresize('bicubic').
## Author: Sanghyun Son
## Email: sonsang35@gmail.com (primary), thstkdgus35@snu.ac.kr (secondary)
## Version: 1.2.0
## Last update: July 9th, 2020 ... | 12,696 | 27.404922 | 83 | py |
BVQI | BVQI-master/pyiqa/matlab_utils/.ipynb_checkpoints/functions-checkpoint.py | import math
import numpy as np
import torch
import torch.nn.functional as F
from pyiqa.archs.arch_util import ExactPadding2d, symm_pad, to_2tuple
def fspecial(size=None, sigma=None, channels=1, filter_type="gaussian"):
r"""Function same as 'fspecial' in MATLAB, only support gaussian now.
Args:
size ... | 10,439 | 33.569536 | 124 | py |
BVQI | BVQI-master/pyiqa/models/lr_scheduler.py | import math
from collections import Counter
from torch.optim.lr_scheduler import _LRScheduler
class MultiStepRestartLR(_LRScheduler):
"""MultiStep with restarts learning rate scheme.
Args:
optimizer (torch.nn.optimizer): Torch optimizer.
milestones (list): Iterations that will decrease learn... | 4,268 | 32.880952 | 85 | py |
BVQI | BVQI-master/pyiqa/models/base_model.py | import os
import time
from collections import OrderedDict
from copy import deepcopy
import torch
from torch.nn.parallel import DataParallel, DistributedDataParallel
from pyiqa.models import lr_scheduler as lr_scheduler
from pyiqa.utils import get_root_logger
from pyiqa.utils.dist_util import master_only
class BaseM... | 16,657 | 36.859091 | 104 | py |
BVQI | BVQI-master/pyiqa/models/hypernet_model.py | from collections import OrderedDict
import torch
from pyiqa.metrics import calculate_metric
from pyiqa.utils.registry import MODEL_REGISTRY
from .general_iqa_model import GeneralIQAModel
@MODEL_REGISTRY.register()
class HyperNetModel(GeneralIQAModel):
"""General module to train an IQA network."""
def test... | 1,260 | 28.325581 | 86 | py |
BVQI | BVQI-master/pyiqa/models/dbcnn_model.py | from collections import OrderedDict
from os import path as osp
import torch
from tqdm import tqdm
from pyiqa.archs import build_network
from pyiqa.losses import build_loss
from pyiqa.metrics import calculate_metric
from pyiqa.models import lr_scheduler as lr_scheduler
from pyiqa.utils import get_root_logger, imwrite,... | 1,797 | 31.690909 | 79 | py |
BVQI | BVQI-master/pyiqa/models/sr_model.py | from collections import OrderedDict
from os import path as osp
import torch
from tqdm import tqdm
from pyiqa.archs import build_network
from pyiqa.losses import build_loss
from pyiqa.metrics import calculate_metric
from pyiqa.utils import get_root_logger, imwrite, tensor2img
from pyiqa.utils.registry import MODEL_REG... | 9,927 | 35.77037 | 112 | py |
BVQI | BVQI-master/pyiqa/models/pieapp_model.py | from collections import OrderedDict
import numpy as np
import torch
import torch.nn as nn
import torch.nn.functional as F
from tqdm import tqdm
from pyiqa.metrics.correlation_coefficient import calculate_rmse
from pyiqa.utils.registry import MODEL_REGISTRY
from .general_iqa_model import GeneralIQAModel
@MODEL_REGI... | 2,271 | 32.910448 | 130 | py |
BVQI | BVQI-master/pyiqa/models/general_iqa_model.py | from collections import OrderedDict
from os import path as osp
import torch
from tqdm import tqdm
from pyiqa.archs import build_network
from pyiqa.losses import build_loss
from pyiqa.metrics import calculate_metric
from pyiqa.utils import get_root_logger, imwrite, tensor2img
from pyiqa.utils.registry import MODEL_REG... | 8,455 | 36.087719 | 112 | py |
BVQI | BVQI-master/pyiqa/models/bapps_model.py | import os.path as osp
from collections import OrderedDict
import numpy as np
import torch
import torch.nn as nn
import torch.nn.functional as F
from tqdm import tqdm
from pyiqa.metrics import calculate_metric
from pyiqa.utils.registry import MODEL_REGISTRY
from .general_iqa_model import GeneralIQAModel
@MODEL_REGI... | 5,987 | 36.898734 | 125 | py |
BVQI | BVQI-master/pyiqa/models/inference_model.py | from collections import OrderedDict
import torch
import torchvision as tv
from pyiqa.default_model_configs import DEFAULT_CONFIGS
from pyiqa.utils.img_util import imread2tensor
from pyiqa.utils.registry import ARCH_REGISTRY
class InferenceModel(torch.nn.Module):
"""Common interface for quality inference of imag... | 2,613 | 36.884058 | 95 | py |
BVQI | BVQI-master/pyiqa/models/nima_model.py | from collections import OrderedDict
import torch
from pyiqa.metrics import calculate_metric
from pyiqa.utils.registry import MODEL_REGISTRY
from .general_iqa_model import GeneralIQAModel
@MODEL_REGISTRY.register()
class NIMAModel(GeneralIQAModel):
"""General module to train an IQA network."""
def feed_dat... | 2,311 | 31.111111 | 82 | py |
BVQI | BVQI-master/pyiqa/utils/download_util.py | import math
import os
from urllib.parse import urlparse
import requests
from torch.hub import download_url_to_file, get_dir
from tqdm import tqdm
from .misc import sizeof_fmt
def download_file_from_google_drive(file_id, save_path):
"""Download files from google drive.
Ref:
https://stackoverflow.com/que... | 3,398 | 31.371429 | 116 | py |
BVQI | BVQI-master/pyiqa/utils/misc.py | import os
import random
import shutil
import time
from os import path as osp
import numpy as np
import torch
from .dist_util import master_only
def set_random_seed(seed):
"""Set random seeds."""
random.seed(seed)
np.random.seed(seed)
torch.manual_seed(seed)
torch.cuda.manual_seed(seed)
torch... | 4,827 | 30.555556 | 105 | py |
BVQI | BVQI-master/pyiqa/utils/logger.py | import datetime
import logging
import time
from .dist_util import get_dist_info, master_only
initialized_logger = {}
class AvgTimer:
def __init__(self, window=200):
self.window = window # average window
self.current_time = 0
self.total_time = 0
self.count = 0
self.avg_ti... | 7,216 | 30.933628 | 86 | py |
BVQI | BVQI-master/pyiqa/utils/img_util.py | import io
import math
import os
import cv2
import numpy as np
import torch
import torchvision.transforms.functional as TF
from PIL import Image
from torchvision.utils import make_grid
IMG_EXTENSIONS = [
".jpg",
".JPG",
".jpeg",
".JPEG",
".png",
".PNG",
".ppm",
".PPM",
".bmp",
"... | 7,559 | 31.033898 | 123 | py |
BVQI | BVQI-master/pyiqa/utils/options.py | import argparse
import random
from collections import OrderedDict
from os import path as osp
import torch
import yaml
from pyiqa.utils import set_random_seed
from pyiqa.utils.dist_util import get_dist_info, init_dist, master_only
def ordered_yaml():
"""Support OrderedDict for yaml.
Returns:
yaml Lo... | 6,559 | 29.943396 | 86 | py |
BVQI | BVQI-master/pyiqa/utils/color_util.py | r"""Color space conversion functions
Created by: https://github.com/photosynthesis-team/piq/blob/master/piq/functional/colour_conversion.py
Modified by: Chaofeng Chen (https://github.com/chaofengc)
"""
from typing import Dict, Union
import torch
def safe_frac_pow(x: torch.Tensor, p) -> torch.Tensor:
EPS = tor... | 8,153 | 28.759124 | 102 | py |
BVQI | BVQI-master/pyiqa/utils/dist_util.py | # Modified from https://github.com/open-mmlab/mmcv/blob/master/mmcv/runner/dist_utils.py # noqa: E501
import functools
import os
import subprocess
import torch
import torch.distributed as dist
import torch.multiprocessing as mp
def init_dist(launcher, backend="nccl", **kwargs):
if mp.get_start_method(allow_none... | 2,608 | 30.433735 | 102 | py |
BVQI | BVQI-master/pyiqa/data/livechallenge_dataset.py | import os
import pickle
import numpy as np
import torch
import torchvision.transforms as tf
from PIL import Image
from torch.utils import data as data
from torchvision.transforms.functional import normalize
from pyiqa.data.data_util import read_meta_info_file
from pyiqa.data.transforms import augment, transform_mappi... | 2,524 | 33.589041 | 87 | py |
BVQI | BVQI-master/pyiqa/data/general_nr_dataset.py | import pickle
import cv2
import numpy as np
import torch
import torchvision.transforms as tf
from PIL import Image
from torch.utils import data as data
from torchvision.transforms.functional import normalize
from pyiqa.data.data_util import read_meta_info_file
from pyiqa.data.transforms import PairedToTensor, augment... | 2,691 | 31.433735 | 87 | py |
BVQI | BVQI-master/pyiqa/data/multiscale_trans_util.py | r"""Preprocessing utils for Multiscale Transformer
Reference: https://github.com/google-research/google-research/blob/5c622d523c/musiq/model/preprocessing.py
Modified: Chaofeng Chen (https://github.com/chaofengc)
"""
import math
from os import path as osp
from unittest.mock import patch
import numpy as np
import to... | 7,785 | 33.451327 | 106 | py |
BVQI | BVQI-master/pyiqa/data/general_fr_dataset.py | import pickle
import numpy as np
import torch
import torchvision.transforms as tf
from PIL import Image
from torch.utils import data as data
from torchvision.transforms.functional import normalize
from pyiqa.data.data_util import read_meta_info_file
from pyiqa.data.transforms import PairedToTensor, augment, transform... | 3,366 | 32.67 | 87 | py |
BVQI | BVQI-master/pyiqa/data/prefetch_dataloader.py | import queue as Queue
import threading
import torch
from torch.utils.data import DataLoader
class PrefetchGenerator(threading.Thread):
"""A general prefetch generator.
Ref:
https://stackoverflow.com/questions/7323664/python-generator-pre-fetch
Args:
generator: Python generator.
num_... | 3,174 | 23.612403 | 77 | py |
BVQI | BVQI-master/pyiqa/data/data_sampler.py | import math
import torch
from torch.utils.data.sampler import Sampler
class EnlargedSampler(Sampler):
"""Sampler that restricts data loading to a subset of the dataset.
Modified from torch.utils.data.distributed.DistributedSampler
Support enlarging the dataset for iteration-based training, for saving
... | 1,817 | 32.666667 | 83 | py |
BVQI | BVQI-master/pyiqa/data/ava_dataset.py | import itertools
import os
import pickle
import random
import cv2
import numpy as np
import pandas as pd
import torch
import torchvision.transforms as tf
# avoid possible image read error in AVA dataset
from PIL import Image, ImageFile
from torch.utils import data as data
from pyiqa.data.transforms import transform_... | 4,319 | 33.56 | 105 | py |
BVQI | BVQI-master/pyiqa/data/data_util.py | import csv
import os
from os import path as osp
import cv2
import numpy as np
import torch
from torch.nn import functional as F
from pyiqa.data.transforms import mod_crop
from pyiqa.utils import img2tensor, scandir
def read_meta_info_file(img_dir, meta_info_file, mode="nr", ref_dir=None):
"""Generate paths and ... | 13,379 | 32.959391 | 86 | py |
BVQI | BVQI-master/pyiqa/data/flive_dataset.py | import pickle
import cv2
import numpy as np
import torch
import torchvision.transforms as tf
from PIL import Image
from torch.utils import data as data
from torchvision.transforms.functional import normalize
from pyiqa.data.data_util import read_meta_info_file
from pyiqa.data.transforms import transform_mapping
from ... | 2,999 | 33.090909 | 87 | py |
BVQI | BVQI-master/pyiqa/data/bapps_dataset.py | import os
import pickle
import numpy as np
import pandas as pd
import torch
import torchvision.transforms as tf
from PIL import Image
from torch.utils import data as data
from torchvision.transforms.functional import normalize
from pyiqa.data.data_util import read_meta_info_file
from pyiqa.data.transforms import Pair... | 4,533 | 33.090226 | 93 | py |
BVQI | BVQI-master/pyiqa/data/pipal_dataset.py | import pickle
import numpy as np
import torch
import torchvision.transforms as tf
from PIL import Image
from torch.utils import data as data
from torchvision.transforms.functional import normalize
from pyiqa.data.data_util import read_meta_info_file
from pyiqa.data.transforms import PairedToTensor, augment, transform... | 3,241 | 32.42268 | 87 | py |
BVQI | BVQI-master/pyiqa/data/pieapp_dataset.py | import os
import pickle
import numpy as np
import pandas as pd
import torch
import torchvision.transforms as tf
from PIL import Image
from torch.utils import data as data
from torchvision.transforms.functional import normalize
from pyiqa.data.data_util import read_meta_info_file
from pyiqa.data.transforms import Pair... | 5,149 | 34.273973 | 82 | py |
BVQI | BVQI-master/pyiqa/data/__init__.py | import importlib
import random
from copy import deepcopy
from functools import partial
from os import path as osp
import numpy as np
import torch
import torch.utils.data
from pyiqa.data.prefetch_dataloader import PrefetchDataLoader
from pyiqa.utils import get_root_logger, scandir
from pyiqa.utils.dist_util import get... | 4,699 | 34.606061 | 97 | py |
BVQI | BVQI-master/pyiqa/data/transforms.py | import functools
import random
from collections.abc import Sequence
from typing import Union
import cv2
import numpy as np
import torch
import torchvision.transforms as tf
import torchvision.transforms.functional as F
from imgaug import augmenters as iaa
from PIL import Image
from pyiqa.archs.arch_util import to_2tup... | 13,970 | 31.117241 | 101 | py |
BVQI | BVQI-master/pyiqa/archs/maniqa_arch.py | r"""MANIQA proposed by
MANIQA: Multi-dimension Attention Network for No-Reference Image Quality Assessment
Sidi Yang, Tianhe Wu, Shuwei Shi, Shanshan Lao, Yuan Gong, Mingdeng Cao, Jiahao Wang and Yujiu Yang.
CVPR Workshop 2022, winner of NTIRE2022 NRIQA challenge
Reference:
- Official github: https://... | 7,322 | 30.83913 | 112 | py |
BVQI | BVQI-master/pyiqa/archs/dbcnn_arch.py | r"""DBCNN Metric
Created by: https://github.com/zwx8981/DBCNN-PyTorch/blob/master/DBCNN.py
Modified by: Chaofeng Chen (https://github.com/chaofengc)
"""
import torch
import torch.nn as nn
import torch.nn.functional as F
import torchvision
from pyiqa.archs.arch_util import load_pretrained_network
from pyiqa.utils.r... | 6,123 | 32.464481 | 116 | py |
BVQI | BVQI-master/pyiqa/archs/pieapp_arch.py | r"""PieAPP metric, proposed by
Prashnani, Ekta, Hong Cai, Yasamin Mostofi, and Pradeep Sen.
"Pieapp: Perceptual image-error assessment through pairwise preference."
In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, pp. 1808-1817. 2018.
Ref url: https://github.com/prashnani/PerceptualIm... | 5,788 | 37.852349 | 108 | py |
BVQI | BVQI-master/pyiqa/archs/lpips_arch.py | r"""LPIPS Model.
Created by: https://github.com/richzhang/PerceptualSimilarity.
Modified by: Jiadi Mo (https://github.com/JiadiMo)
"""
from collections import namedtuple
import torch
import torch.nn as nn
from torchvision import models
from pyiqa.archs.arch_util import load_pretrained_network
from pyiqa.utils.reg... | 14,838 | 34.670673 | 132 | py |
BVQI | BVQI-master/pyiqa/archs/hypernet_arch.py | r"""HyperNet Metric
Created by: https://github.com/SSL92/hyperIQA
Modified by: Chaofeng Chen (https://github.com/chaofengc)
"""
import timm
import torch
import torch.nn as nn
from pyiqa.utils.registry import ARCH_REGISTRY
@ARCH_REGISTRY.register()
class HyperNet(nn.Module):
"""HyperNet Model.
Args:
... | 7,284 | 34.364078 | 103 | py |
BVQI | BVQI-master/pyiqa/archs/ssim_arch.py | r"""SSIM, MS-SSIM, CW-SSIM Metric
Created by:
- https://github.com/dingkeyan93/IQA-optimization/blob/master/IQA_pytorch/SSIM.py
- https://github.com/dingkeyan93/IQA-optimization/blob/master/IQA_pytorch/MS_SSIM.py
- https://github.com/dingkeyan93/IQA-optimization/blob/master/IQA_pytorch/CW_SSIM.py
Modified by: Jiadi M... | 11,902 | 31.433243 | 110 | py |
BVQI | BVQI-master/pyiqa/archs/ahiq_arch.py | import numpy as np
import timm
import torch
import torch.nn as nn
import torch.nn.functional as F
from pyexpat import model
from timm.models.resnet import BasicBlock, Bottleneck
from timm.models.vision_transformer import Block
from torchvision.ops.deform_conv import DeformConv2d
from pyiqa.archs.arch_util import (
... | 8,605 | 30.992565 | 119 | py |
BVQI | BVQI-master/pyiqa/archs/paq2piq_arch.py | r"""Paq2piq metric, proposed by
Ying, Zhenqiang, Haoran Niu, Praful Gupta, Dhruv Mahajan, Deepti Ghadiyaram, and Alan Bovik.
"From patches to pictures (PaQ-2-PiQ): Mapping the perceptual space of picture quality."
In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pp. 3575-3585. 2020... | 2,853 | 32.186047 | 106 | py |
BVQI | BVQI-master/pyiqa/archs/ckdn_arch.py | """CKDN model.
Created by: Chaofeng Chen (https://github.com/chaofengc)
Refer to:
https://github.com/researchmm/CKDN.
"""
import math
import torch
import torch.nn as nn
import torchvision as tv
from pyiqa.archs.arch_util import load_pretrained_network
from pyiqa.utils.registry import ARCH_REGISTRY
try:
f... | 12,466 | 30.803571 | 118 | py |
BVQI | BVQI-master/pyiqa/archs/dists_arch.py | r"""DISTS metric
Created by: https://github.com/dingkeyan93/DISTS/blob/master/DISTS_pytorch/DISTS_pt.py
Modified by: Jiadi Mo (https://github.com/JiadiMo)
"""
import numpy as np
import torch
import torch.nn as nn
import torch.nn.functional as F
from torchvision import models
from pyiqa.archs.arch_util import load_... | 5,418 | 33.515924 | 111 | py |
BVQI | BVQI-master/pyiqa/archs/inception.py | """
File from: https://github.com/mseitzer/pytorch-fid
"""
import torch
import torch.nn as nn
import torch.nn.functional as F
import torchvision
from .arch_util import load_pretrained_network
# Inception weights ported to Pytorch from
FID_WEIGHTS_URL = "https://github.com/mseitzer/pytorch-fid/releases/download/fid_... | 11,796 | 35.187117 | 140 | py |
BVQI | BVQI-master/pyiqa/archs/maniqa_swin.py | import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.utils.checkpoint as checkpoint
from einops import rearrange
from timm.models.layers import DropPath, to_2tuple, trunc_normal_
from torch import nn
class Mlp(nn.Module):
def __init__(
self,
in_features,
hidden_f... | 17,834 | 32.461538 | 104 | py |
BVQI | BVQI-master/pyiqa/archs/musiq_arch.py | r"""MUSIQ model.
Implemented by: Chaofeng Chen (https://github.com/chaofengc)
Refer to:
Official code from: https://github.com/google-research/google-research/tree/master/musiq
"""
import torch
import torch.nn as nn
import torch.nn.functional as F
from pyiqa.data.multiscale_trans_util import get_multiscale_pat... | 13,679 | 31.494062 | 136 | py |
BVQI | BVQI-master/pyiqa/archs/nlpd_arch.py | r"""NLPD Metric
Created by: https://github.com/dingkeyan93/IQA-optimization/blob/master/IQA_pytorch/NLPD.py
Modified by: Jiadi Mo (https://github.com/JiadiMo)
Refer to:
Matlab code from https://www.cns.nyu.edu/~lcv/NLPyr/NLP_dist.m;
"""
import numpy as np
import torch
import torch.nn as nn
import torch.nn.func... | 7,884 | 31.854167 | 101 | py |
BVQI | BVQI-master/pyiqa/archs/mad_arch.py | r"""MAD Metric
Created by: https://github.com/dingkeyan93/IQA-optimization/blob/master/IQA_pytorch/MAD.py
Modified by: Jiadi Mo (https://github.com/JiadiMo)
Note:
Offical matlab code is not available;
Pytorch version >= 1.8.0;
"""
import math
import numpy as np
import torch
import torch.nn as nn
import tor... | 11,628 | 31.66573 | 100 | py |
BVQI | BVQI-master/pyiqa/archs/arch_util.py | import collections.abc
import math
from builtins import ValueError
from collections import OrderedDict
from itertools import repeat
from typing import Tuple
import numpy as np
import torch
from torch import nn as nn
from torch.nn import functional as F
from torch.nn import init as init
from torch.nn.modules.batchnorm ... | 6,039 | 32.005464 | 103 | py |
BVQI | BVQI-master/pyiqa/archs/fsim_arch.py | r"""FSIM Metric
Created by: https://github.com/photosynthesis-team/piq/blob/master/piq/fsim.py
Modified by: Jiadi Mo (https://github.com/JiadiMo)
Refer to:
Official matlab code from https://www4.comp.polyu.edu.hk/~cslzhang/IQA/FSIM/Files/FeatureSIM.m
PIQA from https://github.com/francois-rozet/piqa/blob/mast... | 18,004 | 36.354772 | 119 | py |
BVQI | BVQI-master/pyiqa/archs/niqe_arch.py | r"""NIQE and ILNIQE Metrics
NIQE Metric
Created by: https://github.com/xinntao/BasicSR/blob/5668ba75eb8a77e8d2dd46746a36fee0fbb0fdcd/basicsr/metrics/niqe.py
Modified by: Jiadi Mo (https://github.com/JiadiMo)
Reference:
MATLAB codes: http://live.ece.utexas.edu/research/quality/niqe_release.zip
ILNIQ... | 20,124 | 35.196043 | 120 | py |
BVQI | BVQI-master/pyiqa/archs/wadiqam_arch.py | r"""WaDIQaM model.
Reference:
Bosse, Sebastian, Dominique Maniry, Klaus-Robert Müller, Thomas Wiegand,
and Wojciech Samek. "Deep neural networks for no-reference and full-reference
image quality assessment." IEEE Transactions on image processing 27, no. 1
(2017): 206-219.
Created by: https://github.co... | 6,704 | 31.391304 | 83 | py |
BVQI | BVQI-master/pyiqa/archs/cnniqa_arch.py | r"""CNNIQA Model.
Created by: https://github.com/lidq92/CNNIQA
Modified by: Chaofeng Chen (https://github.com/chaofengc)
Modification:
- We use 3 channel RGB input.
"""
import torch
import torch.nn as nn
import torch.nn.functional as F
from pyiqa.archs.arch_util import load_pretrained_network
from pyiqa.utils... | 2,425 | 26.568182 | 118 | py |
BVQI | BVQI-master/pyiqa/archs/iqt_arch.py | import numpy as np
import timm
import torch
import torch.nn as nn
import torch.nn.functional as F
from einops import rearrange, repeat
from einops.layers.torch import Rearrange
from pyexpat import model
from timm.models.resnet import BasicBlock, Bottleneck
from timm.models.vision_transformer import Block
from torchvisi... | 25,389 | 35.323319 | 161 | py |
BVQI | BVQI-master/pyiqa/archs/func_util.py | from typing import Tuple
import torch
import torch.nn.functional as F
from pyiqa.matlab_utils import fspecial, imfilter
from .arch_util import excact_padding_2d
EPS = torch.finfo(torch.float32).eps
def extract_2d_patches(x, kernel, stride=1, dilation=1, padding="same"):
"""
Ref: https://stackoverflow.com/... | 6,729 | 31.047619 | 103 | py |
BVQI | BVQI-master/pyiqa/archs/vsi_arch.py | r"""VSI Metric.
Created by: https://github.com/photosynthesis-team/piq/blob/master/piq/vsi.py
Modified by: Jiadi Mo (https://github.com/JiadiMo)
Refer to:
IQA-Optimization from https://github.com/dingkeyan93/IQA-optimization/blob/master/IQA_pytorch/VSI.py
Offical matlab code is not available
"""
import func... | 9,991 | 31.868421 | 115 | py |
BVQI | BVQI-master/pyiqa/archs/nrqm_arch.py | r"""NRQM Metric, proposed in
Chao Ma, Chih-Yuan Yang, Xiaokang Yang, Ming-Hsuan Yang
"Learning a No-Reference Quality Metric for Single-Image Super-Resolution"
Computer Vision and Image Understanding (CVIU), 2017
Matlab reference: https://github.com/chaoma99/sr-metric
This PyTorch implementation by: Chaofeng Chen (ht... | 16,689 | 31.157996 | 197 | py |
BVQI | BVQI-master/pyiqa/archs/nima_arch.py | r"""NIMA model.
Reference:
Talebi, Hossein, and Peyman Milanfar. "NIMA: Neural image assessment."
IEEE transactions on image processing 27, no. 8 (2018): 3998-4011.
Created by: https://github.com/yunxiaoshi/Neural-IMage-Assessment/blob/master/model/model.py
Modified by: Chaofeng Chen (https://github.com/chaof... | 4,045 | 33 | 139 | py |
BVQI | BVQI-master/pyiqa/archs/vif_arch.py | r"""VIF Metric
Created by: https://github.com/dingkeyan93/IQA-optimization/blob/master/IQA_pytorch/VIF.py
Modified by: Jiadi Mo (https://github.com/JiadiMo)
Refer to:
Matlab code from http://live.ece.utexas.edu/research/Quality/vifvec_release.zip;
"""
import numpy as np
import torch
from torch.nn import functi... | 25,964 | 28.913594 | 90 | py |
BVQI | BVQI-master/pyiqa/archs/fid_arch.py | """FID and clean-fid metric
Codes are borrowed from the clean-fid project:
- https://github.com/GaParmar/clean-fid
Ref:
[1] GANs Trained by a Two Time-Scale Update Rule Converge to a Local Nash Equilibrium.
Martin Heusel, Hubert Ramsauer, Thomas Unterthiner, Bernhard Nessler, Sepp Hochreiter
NeurIPS,... | 10,849 | 31.779456 | 151 | py |
BVQI | BVQI-master/pyiqa/archs/brisque_arch.py | r"""BRISQUE Metric
Created by: https://github.com/photosynthesis-team/piq/blob/master/piq/brisque.py
Modified by: Jiadi Mo (https://github.com/JiadiMo)
Reference:
MATLAB codes: https://live.ece.utexas.edu/research/Quality/index_algorithms.htm BRISQUE;
Pretrained model from: https://github.com/photosynthesis-... | 7,328 | 32.774194 | 119 | py |
BVQI | BVQI-master/pyiqa/archs/psnr_arch.py | r"""Peak signal-to-noise ratio (PSNR) Metric
Created by: https://github.com/photosynthesis-team/piq
Modified by: Jiadi Mo (https://github.com/JiadiMo)
Refer to:
Wikipedia from https://en.wikipedia.org/wiki/Peak_signal-to-noise_ratio
QIQA from https://github.com/francois-rozet/piqa/blob/master/piqa/psnr.py
"... | 2,691 | 33.961039 | 100 | py |
BVQI | BVQI-master/pyiqa/archs/gmsd_arch.py | r"""GMSD Metric
Created by: https://github.com/dingkeyan93/IQA-optimization/blob/master/IQA_pytorch/GMSD.py
Modified by: Jiadi Mo (https://github.com/JiadiMo)
Refer to:
Matlab code from https://www4.comp.polyu.edu.hk/~cslzhang/IQA/GMSD/GMSD.m;
"""
import torch
from torch import nn
from torch.nn import function... | 3,418 | 30.657407 | 100 | py |
BVQI | BVQI-master/pyiqa/archs/.ipynb_checkpoints/niqe_arch-checkpoint.py | r"""NIQE and ILNIQE Metrics
NIQE Metric
Created by: https://github.com/xinntao/BasicSR/blob/5668ba75eb8a77e8d2dd46746a36fee0fbb0fdcd/basicsr/metrics/niqe.py
Modified by: Jiadi Mo (https://github.com/JiadiMo)
Reference:
MATLAB codes: http://live.ece.utexas.edu/research/quality/niqe_release.zip
ILNIQ... | 20,124 | 35.196043 | 120 | py |
BVQI | BVQI-master/pyiqa/losses/losses.py | import math
import torch
from torch import autograd as autograd
from torch import nn as nn
from torch.nn import functional as F
from pyiqa.utils.registry import LOSS_REGISTRY
from .loss_util import weighted_loss
_reduction_modes = ["none", "mean", "sum"]
@weighted_loss
def l1_loss(pred, target):
return F.l1_l... | 7,764 | 31.763713 | 98 | py |
BVQI | BVQI-master/pyiqa/losses/loss_util.py | import functools
from torch.nn import functional as F
def reduce_loss(loss, reduction):
"""Reduce loss as specified.
Args:
loss (Tensor): Elementwise loss tensor.
reduction (str): Options are 'none', 'mean' and 'sum'.
Returns:
Tensor: Reduced loss tensor.
"""
reduction_e... | 2,904 | 28.948454 | 78 | py |
BVQI | BVQI-master/pyiqa/losses/iqa_losses.py | import numpy as np
import torch
from cv2 import reduce
from torch import nn as nn
from torch.nn import functional as F
from pyiqa.utils.registry import LOSS_REGISTRY
from .loss_util import weighted_loss
_reduction_modes = ["none", "mean", "sum"]
@weighted_loss
def emd_loss(pred, target, r=2):
"""
Args:
... | 4,414 | 29.874126 | 111 | py |
BVQI | BVQI-master/V1_extraction/extract_multi_scale_v1_features.py | import os
import cv2
import torch
import numpy as np
import pandas as pd
from time import time
from sklearn import decomposition
from torchvision.transforms import transforms
from gabor_filter import GaborFilters
# resolutioin: 960*540,480*270,240*135,120*67
# downsample rate: 1.0, 0.5, 0.25, 0.125
if __name__ == '__... | 4,553 | 34.578125 | 80 | py |
BVQI | BVQI-master/V1_extraction/extract_v1_features_480.py | import os
import cv2
import torch
import numpy as np
import pandas as pd
from time import time
from sklearn import decomposition
from torchvision.transforms import transforms
from gabor_filter import GaborFilters
if __name__ == '__main__':
data_name = 'livevqc'
device = torch.device('cuda' if torch.cuda.is_ava... | 2,798 | 30.1 | 79 | py |
BVQI | BVQI-master/V1_extraction/extract_v1_features.py | import os
import cv2
import torch
import numpy as np
import pandas as pd
from time import time
from sklearn import decomposition
from torchvision.transforms import transforms
from gabor_filter import GaborFilters
if __name__ == '__main__':
data_name = 'livevqc'
device = torch.device('cuda' if torch.cuda.is_ava... | 2,986 | 30.776596 | 79 | py |
BVQI | BVQI-master/V1_extraction/gabor_filter.py | import math
import cmath
import torch
import torch.nn as nn
class GaborFilters(nn.Module):
def __init__(self,
n_scale=5,
n_orientation=8,
kernel_radius=9,
row_downsample=4,
column_downsample=4,
device='cpu'):
... | 3,734 | 31.763158 | 79 | py |
BVQI | BVQI-master/V1_extraction/.ipynb_checkpoints/gabor_filter-checkpoint.py | import math
import cmath
import torch
import torch.nn as nn
class GaborFilters(nn.Module):
def __init__(self,
n_scale=5,
n_orientation=8,
kernel_radius=9,
row_downsample=4,
column_downsample=4,
device='cpu'):
... | 3,734 | 31.763158 | 79 | py |
BVQI | BVQI-master/V1_extraction/.ipynb_checkpoints/extract_v1_features-checkpoint.py | import os
import cv2
import torch
import numpy as np
import pandas as pd
from time import time
from sklearn import decomposition
from torchvision.transforms import transforms
from gabor_filter import GaborFilters
if __name__ == '__main__':
data_name = 'livevqc'
device = torch.device('cuda' if torch.cuda.is_ava... | 2,986 | 30.776596 | 79 | py |
BVQI | BVQI-master/V1_extraction/.ipynb_checkpoints/extract_v1_features_480-checkpoint.py | import os
import cv2
import torch
import numpy as np
import pandas as pd
from time import time
from sklearn import decomposition
from torchvision.transforms import transforms
from gabor_filter import GaborFilters
if __name__ == '__main__':
data_name = ''
device = torch.device('cuda' if torch.cuda.is_available(... | 2,991 | 30.829787 | 79 | py |
BVQI | BVQI-master/buona_vista/datasets/fusion_datasets.py | import copy
import glob
import os
import os.path as osp
import random
from functools import lru_cache
import cv2
import decord
import numpy as np
import skvideo.io
import torch
import torchvision
from decord import VideoReader, cpu, gpu
from tqdm import tqdm
random.seed(42)
decord.bridge.set_bridge("torch")
def ge... | 14,666 | 34.257212 | 149 | py |
BVQI | BVQI-master/buona_vista/datasets/basic_datasets.py | import os.path as osp
import random
import cv2
import decord
import numpy as np
import skvideo.io
import torch
import torchvision
from decord import VideoReader, cpu, gpu
from tqdm import tqdm
random.seed(42)
decord.bridge.set_bridge("torch")
def get_spatial_fragments(
video,
fragments_h=7,
fragments_w... | 29,085 | 34.776138 | 149 | py |
MachineUnlearningPy | MachineUnlearningPy-master/doc/conf.py | # -*- coding: utf-8 -*-
#
# Configuration file for the Sphinx documentation builder.
#
# This file does only contain a selection of the most common options. For a
# full list see the documentation:
# http://www.sphinx-doc.org/en/master/config
# -- Path setup ------------------------------------------------------------... | 6,129 | 31.263158 | 79 | py |
battery-historian | battery-historian-master/scripts/historian.py | #!/usr/bin/python
"""Legacy Historian script for analyzing Android bug reports."""
# Copyright 2016 Google Inc. 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
#
# ht... | 52,562 | 31.87242 | 167 | py |
3DG-STFM | 3DG-STFM-master/train_rgbd_t_s.py | import math
import argparse
import pprint
from distutils.util import strtobool
from pathlib import Path
from loguru import logger as loguru_logger
import pytorch_lightning as pl
from pytorch_lightning.utilities import rank_zero_only
from pytorch_lightning.loggers import TensorBoardLogger
from pytorch_lightning.callbac... | 5,270 | 41.168 | 111 | py |
3DG-STFM | 3DG-STFM-master/train_rgb.py | import math
import argparse
import pprint
from distutils.util import strtobool
from pathlib import Path
from loguru import logger as loguru_logger
import pytorch_lightning as pl
from pytorch_lightning.utilities import rank_zero_only
from pytorch_lightning.loggers import TensorBoardLogger
from pytorch_lightning.callbac... | 5,007 | 40.04918 | 111 | py |
3DG-STFM | 3DG-STFM-master/test_rgbd.py | import pytorch_lightning as pl
import argparse
import pprint
from loguru import logger as loguru_logger
from src.config.default import get_cfg_defaults
from src.utils.profiler import build_profiler
from src.lightning.data import MultiSceneDataModule, RGBDDataModule
from src.lightning.lightning_loftr import PL_LoFTR,P... | 2,657 | 37.521739 | 111 | py |
3DG-STFM | 3DG-STFM-master/test_rgb.py | import pytorch_lightning as pl
import argparse
import pprint
from loguru import logger as loguru_logger
from src.config.default import get_cfg_defaults
from src.utils.profiler import build_profiler
from src.lightning.data import RGBDataModule
from src.lightning.lightning_loftr import PL_LoFTR_RGB
def parse_args():
... | 2,622 | 37.014493 | 111 | py |
3DG-STFM | 3DG-STFM-master/demo.py | import os
import torch
import cv2
import numpy as np
import matplotlib.cm as cm
import matplotlib.colors
from src.loftr import default_cfg, LoFTR_RGBD, LoFTR_RGB
import matplotlib.pyplot as plt
def make_matching_figure(
img0, img1, mkpts0, mkpts1, color,
kpts0=None, kpts1=None, text=[], dpi=75, path=... | 4,874 | 33.574468 | 106 | py |
3DG-STFM | 3DG-STFM-master/train_rgbd.py | import math
import argparse
import pprint
from distutils.util import strtobool
from pathlib import Path
from loguru import logger as loguru_logger
import pytorch_lightning as pl
from pytorch_lightning.utilities import rank_zero_only
from pytorch_lightning.loggers import TensorBoardLogger
from pytorch_lightning.callbac... | 5,134 | 40.41129 | 111 | py |
3DG-STFM | 3DG-STFM-master/src/config/default.py | from yacs.config import CfgNode as CN
_CN = CN()
############## ↓ LoFTR Pipeline ↓ ##############
_CN.LOFTR = CN()
_CN.LOFTR.BACKBONE_TYPE = 'ResNetFPN'
_CN.LOFTR.RESOLUTION = (8, 2) # options: [(8, 2), (16, 4)]
_CN.LOFTR.FINE_WINDOW_SIZE = 5 # window_size in fine_level, must be odd
_CN.LOFTR.FINE_CONCAT_COARSE_... | 7,068 | 40.339181 | 133 | py |
3DG-STFM | 3DG-STFM-master/src/datasets/sampler.py | import torch
from torch.utils.data import Sampler, ConcatDataset
class RandomConcatSampler(Sampler):
""" Random sampler for ConcatDataset. At each epoch, `n_samples_per_subset` samples will be draw from each subset
in the ConcatDataset. If `subset_replacement` is ``True``, sampling within each subset will be ... | 4,293 | 54.051282 | 164 | py |
3DG-STFM | 3DG-STFM-master/src/datasets/megadepth.py | import os.path as osp
import numpy as np
import torch
import torch.nn.functional as F
from torch.utils.data import Dataset
from loguru import logger
import cv2
from src.utils.dataset import read_megadepth_gray, read_megadepth_depth, read_megadepth_rgb
class MegaDepth_RGB_Dataset(Dataset):
def __init__(self,
... | 12,808 | 46.6171 | 129 | py |
3DG-STFM | 3DG-STFM-master/src/datasets/scannet.py | from os import path as osp
from typing import Dict
from unicodedata import name
import numpy as np
import torch
import torch.utils as utils
from numpy.linalg import inv
from src.utils.dataset import (
read_scannet_rgb,
read_scannet_gray,
read_scannet_depth,
read_scannet_pose,
read_scannet_intrinsic... | 11,203 | 43.995984 | 130 | py |
3DG-STFM | 3DG-STFM-master/src/lightning/lightning_loftr.py |
from collections import defaultdict
import pprint
from loguru import logger
from pathlib import Path
import torch
import numpy as np
import pytorch_lightning as pl
from matplotlib import pyplot as plt
from src.loftr import LoFTR_RGB,LoFTR_RGBD,LoFTR_RGBD_teacher,LoFTR_RGB_student
from src.loftr.utils.supervision imp... | 40,636 | 45.021518 | 129 | py |
3DG-STFM | 3DG-STFM-master/src/lightning/data.py | import os
import math
from collections import abc
from loguru import logger
from torch.utils.data.dataset import Dataset
from tqdm import tqdm
from os import path as osp
from pathlib import Path
from joblib import Parallel, delayed
import pytorch_lightning as pl
from torch import distributed as dist
from torch.utils.d... | 27,968 | 44.626427 | 132 | py |
3DG-STFM | 3DG-STFM-master/src/loftr/loftr.py | import torch
import torch.nn as nn
import torch.nn.functional as F
from einops.einops import rearrange, repeat
from .backbone import build_backbone_rgb,build_backbone_rgbd
from .utils.position_encoding import PositionEncodingSine
from .loftr_module import LocalFeatureTransformer, FinePreprocess
from .utils.coarse_matc... | 14,794 | 45.671924 | 154 | py |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.