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
saliency-faithfulness-eval
saliency-faithfulness-eval-main/src/classes/tasks/ccc/singleframe/data/ColorChecker.py
import os from typing import Tuple import cv2 import scipy.io import torch from src.classes.tasks.ccc.core.DatasetCCC import DatasetCCC # ------------------------------------------------------------------------------------------ from src.functional.image_processing import hwc_to_chw, linear_to_nonlinear, bgr_to_rgb, ...
2,711
33.329114
98
py
saliency-faithfulness-eval
saliency-faithfulness-eval-main/src/classes/tasks/ccc/core/TrainerCCC.py
import os from typing import Dict import pandas as pd from torch.utils.data import DataLoader from src.auxiliary.settings import DEFAULT_METRICS_FILE from src.classes.core.Trainer import Trainer from src.classes.tasks.ccc.core.MetricsTrackerCCC import MetricsTrackerCCC from src.classes.tasks.ccc.core.ModelCCC import ...
2,507
46.320755
115
py
saliency-faithfulness-eval
saliency-faithfulness-eval-main/src/classes/tasks/ccc/core/NetworkCCCFactory.py
from torch import nn from src.classes.tasks.ccc.multiframe.modules.saliency_tccnet.modules.AttTCCNet import AttTCCNet from src.classes.tasks.ccc.multiframe.modules.saliency_tccnet.modules.ConfAttTCCNet import ConfAttTCCNet from src.classes.tasks.ccc.multiframe.modules.saliency_tccnet.modules.ConfTCCNet import ConfTCCN...
1,028
40.16
118
py
saliency-faithfulness-eval
saliency-faithfulness-eval-main/src/classes/tasks/ccc/core/TesterCCC.py
import os from typing import Dict import numpy as np import pandas as pd from torch import Tensor from torch.utils.data import DataLoader from src.auxiliary.settings import DEFAULT_METRICS_FILE from src.classes.core.Model import Model from src.classes.core.Tester import Tester from src.classes.tasks.ccc.core.MetricsT...
2,022
37.169811
109
py
saliency-faithfulness-eval
saliency-faithfulness-eval-main/src/classes/tasks/ccc/core/DatasetCCC.py
from abc import ABC import numpy as np import torch.utils.data as data from src.auxiliary.settings import PATH_TO_DATASET from src.classes.tasks.ccc.core.DataAugmenter import DataAugmenter class DatasetCCC(data.Dataset, ABC): def __init__(self, train: bool = True, fold_num: int = 0, augment: bool = True): ...
630
27.681818
84
py
saliency-faithfulness-eval
saliency-faithfulness-eval-main/src/classes/tasks/ccc/multiframe/modules/saliency_tccnet/modules/AttTCCNet.py
from typing import Tuple import torch from torch import Tensor from src.auxiliary.utils import overloads from src.classes.tasks.ccc.multiframe.modules.saliency_tccnet.core.SaliencyTCCNet import SaliencyTCCNet from src.classes.tasks.ccc.submodules.attention.SpatialAttention import SpatialAttention from src.classes.tas...
2,364
44.480769
105
py
saliency-faithfulness-eval
saliency-faithfulness-eval-main/src/classes/tasks/ccc/multiframe/modules/saliency_tccnet/modules/ConfTCCNet.py
from abc import ABC from typing import Tuple import torch import torch.nn.functional as F from torch import Tensor from torch.nn.functional import normalize from src.auxiliary.utils import overloads from src.classes.tasks.ccc.multiframe.modules.saliency_tccnet.core.SaliencyTCCNet import SaliencyTCCNet from src.classe...
3,045
39.613333
104
py
saliency-faithfulness-eval
saliency-faithfulness-eval-main/src/classes/tasks/ccc/multiframe/modules/saliency_tccnet/modules/ConfAttTCCNet.py
from typing import Tuple import torch from torch import Tensor from src.auxiliary.utils import overloads from src.classes.tasks.ccc.multiframe.modules.saliency_tccnet.core.SaliencyTCCNet import SaliencyTCCNet from src.classes.tasks.ccc.singleframe.fc4.FC4 import FC4 from src.classes.tasks.ccc.submodules.attention.Tem...
2,449
44.37037
105
py
saliency-faithfulness-eval
saliency-faithfulness-eval-main/src/classes/tasks/ccc/multiframe/modules/saliency_tccnet/core/SaliencyTCCNet.py
from abc import ABC, abstractmethod from typing import Tuple, Union import torch from torch import Tensor from torch.nn.functional import normalize from src.auxiliary.utils import overload from src.classes.tasks.ccc.multiframe.modules.tccnet.TCCNet import TCCNet from src.functional.error_handling import check_sal_dim...
3,843
35.264151
117
py
saliency-faithfulness-eval
saliency-faithfulness-eval-main/src/classes/tasks/ccc/multiframe/modules/saliency_tccnet/core/ModelSaliencyTCCNet.py
from typing import Union, Tuple from torch import Tensor from src.classes.tasks.ccc.core.ModelCCC import ModelCCC from src.classes.tasks.ccc.core.NetworkCCCFactory import NetworkCCCFactory from src.functional.error_handling import check_sal_type_support, check_sal_dim_support class ModelSaliencyTCCNet(ModelCCC): ...
931
37.833333
103
py
saliency-faithfulness-eval
saliency-faithfulness-eval-main/src/classes/tasks/ccc/multiframe/modules/saliency_tccnet/core/TesterSaliencyTCCNet.py
import csv import os from typing import Tuple import numpy as np from torch import Tensor from torch.utils.data import DataLoader from src.classes.core.Model import Model from src.classes.tasks.ccc.multiframe.core.TesterTCCNet import TesterTCCNet from src.functional.error_handling import check_sal_dim_support class...
3,120
44.231884
118
py
saliency-faithfulness-eval
saliency-faithfulness-eval-main/src/classes/tasks/ccc/multiframe/modules/tccnet/TCCNet.py
from abc import ABC from typing import Tuple import torch from torch import nn, Tensor from torch.nn.functional import normalize from src.auxiliary.settings import DEVICE from src.auxiliary.utils import overload from src.classes.eval.ers.core.EMultiSWModule import EMultiSWModule from src.classes.tasks.ccc.submodules....
2,829
40.617647
100
py
saliency-faithfulness-eval
saliency-faithfulness-eval-main/src/classes/tasks/ccc/multiframe/modules/tccnet/ModelTCCNet.py
from torch import Tensor from src.classes.tasks.ccc.core.ModelCCC import ModelCCC from src.classes.tasks.ccc.core.NetworkCCCFactory import NetworkCCCFactory class ModelTCCNet(ModelCCC): def __init__(self, hidden_size: int, kernel_size: int): super().__init__() network = NetworkCCCFactory().get("...
517
31.375
82
py
saliency-faithfulness-eval
saliency-faithfulness-eval-main/src/classes/tasks/ccc/multiframe/core/TesterTCCNet.py
import os from torch.utils.data import DataLoader from src.classes.core.Model import Model from src.classes.tasks.ccc.core.TesterCCC import TesterCCC class TesterTCCNet(TesterCCC): def __init__(self, path_to_log: str, log_frequency: int, save_pred: bool): super().__init__(path_to_log, log_frequency, sa...
984
32.965517
91
py
saliency-faithfulness-eval
saliency-faithfulness-eval-main/src/classes/tasks/ccc/multiframe/core/TrainerTCCNet.py
import os from torch.utils.data import DataLoader from src.classes.tasks.ccc.core.ModelCCC import ModelCCC from src.classes.tasks.ccc.core.TrainerCCC import TrainerCCC class TrainerTCCNet(TrainerCCC): def __init__(self, path_to_log: str, val_frequency: int = 5): super().__init__(path_to_log, val_frequen...
1,315
42.866667
112
py
saliency-faithfulness-eval
saliency-faithfulness-eval-main/src/classes/tasks/ccc/multiframe/data/DataHandlerTCC.py
from multiprocessing import cpu_count from typing import Tuple from torch.utils.data import DataLoader from src.classes.tasks.ccc.multiframe.data.TCC import TCC from src.classes.tasks.ccc.multiframe.data.TemporalDataset import TemporalDataset class DataHandlerTCC: def __init__(self): self._dataset = TCC...
1,214
39.5
104
py
saliency-faithfulness-eval
saliency-faithfulness-eval-main/src/classes/tasks/ccc/multiframe/data/TemporalDataset.py
from typing import Tuple import numpy as np import torch from src.classes.tasks.ccc.core.DatasetCCC import DatasetCCC from src.classes.tasks.ccc.multiframe.data.TemporalDataAugmenter import TemporalDataAugmenter from src.functional.image_processing import hwc_to_chw, linear_to_nonlinear, bgr_to_rgb, normalize class...
2,100
38.641509
115
py
saliency-faithfulness-eval
saliency-faithfulness-eval-main/src/classes/tasks/ccc/submodules/squeezenet/Fire.py
import torch import torch.nn as nn from torch import Tensor class Fire(nn.Module): def __init__(self, inplanes: int, squeeze_planes: int, expand1x1_planes: int, expand3x3_planes: int): super(Fire, self).__init__() self.inplanes = inplanes self.squeeze = nn.Conv2d(inplanes, squeeze_planes,...
933
41.454545
105
py
saliency-faithfulness-eval
saliency-faithfulness-eval-main/src/classes/tasks/ccc/submodules/squeezenet/SqueezeNetLoader.py
import os from torch.utils import model_zoo from src.classes.tasks.ccc.submodules.squeezenet.SqueezeNet import SqueezeNet model_urls = { 1.0: 'https://download.pytorch.org/models/squeezenet1_0-a815701f.pth', 1.1: 'https://download.pytorch.org/models/squeezenet1_1-f364aa15.pth', } class SqueezeNetLoader: ...
994
33.310345
88
py
saliency-faithfulness-eval
saliency-faithfulness-eval-main/src/classes/tasks/ccc/submodules/squeezenet/SqueezeNet.py
import torch import torch.nn as nn import torch.nn.init as init from src.classes.tasks.ccc.submodules.squeezenet.Fire import Fire """ This is the standard SqueezeNet implementation included in PyTorch at: https://github.com/pytorch/vision/blob/072d8b2280569a2d13b91d3ed51546d201a57366/torchvision/models/squeezenet.py...
3,246
38.120482
140
py
saliency-faithfulness-eval
saliency-faithfulness-eval-main/src/classes/tasks/ccc/submodules/conv_lstm/ConvLSTMCell.py
from typing import Tuple import torch import torch.nn as nn from torch import Tensor from torch.autograd import Variable from src.auxiliary.settings import DEVICE class ConvLSTMCell(nn.Module): def __init__(self, input_channels, hidden_channels, kernel_size): super().__init__() self.device = D...
2,488
45.092593
119
py
saliency-faithfulness-eval
saliency-faithfulness-eval-main/src/classes/tasks/ccc/submodules/conv_lstm/ConvLSTM.py
from typing import Tuple import torch.nn as nn from torch import Tensor from ConvLSTMCell import ConvLSTMCell """ A multi-layer convolutional LSTM module based on: https://arxiv.org/abs/1506.04214, "Convolutional LSTM Network: A Machine Learning Approach for Precipitation Nowcasting" """ class ConvLSTM(nn.Module)...
2,194
32.769231
102
py
saliency-faithfulness-eval
saliency-faithfulness-eval-main/src/classes/tasks/ccc/submodules/attention/SpatialAttention.py
from torch import nn, Tensor class SpatialAttention(nn.Module): def __init__(self, input_size: int): super().__init__() self.conv1 = nn.Sequential( nn.Conv2d(input_size, input_size // 2, kernel_size=(3, 3), stride=(1, 1), padding=1), nn.BatchNorm2d(input_size // 2), ...
963
29.125
102
py
saliency-faithfulness-eval
saliency-faithfulness-eval-main/src/classes/tasks/ccc/submodules/attention/TemporalAttention.py
import torch from torch import nn, Tensor class TemporalAttention(nn.Module): def __init__(self, features_size: int = 512, hidden_size: int = 128): super().__init__() self.phi_x = nn.Linear(features_size, 1, bias=False) self.phi_h = nn.Linear(hidden_size, 1, bias=False) self.softm...
1,487
40.333333
97
py
saliency-faithfulness-eval
saliency-faithfulness-eval-main/src/classes/losses/MSELoss.py
import torch from torch import Tensor from src.classes.core.Loss import Loss from src.functional.image_processing import scale class MSELoss(Loss): def __init__(self, device: torch.device): super().__init__(device) self.__mse_loss = torch.nn.MSELoss(size_average=None, reduce=None, reduction='sum'...
468
30.266667
108
py
saliency-faithfulness-eval
saliency-faithfulness-eval-main/src/classes/losses/KLDivLoss.py
import torch from torch import Tensor from src.classes.core.Loss import Loss class KLDivLoss(Loss): def __init__(self, device: torch.device): super().__init__(device) self.__kl_loss = torch.nn.KLDivLoss(size_average=None, reduce=None, reduction='sum').to(self._device) def _compute(self, a1: ...
412
28.5
109
py
saliency-faithfulness-eval
saliency-faithfulness-eval-main/src/classes/losses/BCELoss.py
import torch from torch import Tensor from src.classes.core.Loss import Loss class BCELoss(Loss): def __init__(self, device: torch.device): super().__init__(device) self.__bce_loss = torch.nn.BCELoss().to(self._device) def _compute(self, a1: Tensor, a2: Tensor) -> Tensor: return self...
370
25.5
68
py
saliency-faithfulness-eval
saliency-faithfulness-eval-main/src/classes/losses/BlockSparsityLoss.py
import torch from torch import Tensor from torch.linalg import norm from torch.nn.functional import unfold from src.classes.core.Loss import Loss """ https://www.sciencedirect.com/science/article/abs/pii/S1077314218301954 """ class BlockSparsityLoss(Loss): def __init__(self, device: torch.device): super...
1,029
40.2
120
py
saliency-faithfulness-eval
saliency-faithfulness-eval-main/src/classes/losses/AngularLoss.py
import math import torch from torch import Tensor from torch.nn.functional import normalize from src.classes.core.Loss import Loss class AngularLoss(Loss): def __init__(self, device: torch.device): super().__init__(device) def _compute(self, pred: Tensor, label: Tensor, safe_v: float = 0.999999) ->...
543
27.631579
110
py
saliency-faithfulness-eval
saliency-faithfulness-eval-main/src/classes/losses/StructComplLoss.py
from typing import Dict import torch from torch import Tensor from src.classes.core.Loss import Loss from src.classes.losses.BCELoss import BCELoss from src.classes.losses.ComplLoss import ComplLoss from src.classes.losses.IoULoss import IoULoss from src.classes.losses.SSIMLoss import SSIMLoss """ Inspired by the l...
1,433
32.348837
113
py
saliency-faithfulness-eval
saliency-faithfulness-eval-main/src/classes/losses/IoULoss.py
import torch from torch import Tensor from src.classes.core.Loss import Loss class IoULoss(Loss): def __init__(self, device: torch.device): super().__init__(device) def _compute(self, a1: Tensor, a2: Tensor) -> Tensor: a1, a2 = a1.int(), a2.int() intersection = (a1 & a2).float().sum(...
499
30.25
90
py
saliency-faithfulness-eval
saliency-faithfulness-eval-main/src/classes/losses/TotalVariationLoss.py
import torch from torch import Tensor from src.classes.core.Loss import Loss class TotalVariationLoss(Loss): def __init__(self, device: torch.device): super().__init__(device) def _compute(self, x: Tensor) -> Tensor: """ Computes the total variation regularization (anisotropic versio...
787
36.52381
119
py
saliency-faithfulness-eval
saliency-faithfulness-eval-main/src/classes/losses/ComplLoss.py
import torch from torch import Tensor from torch import linalg as LA from src.classes.core.Loss import Loss class ComplLoss(Loss): def __init__(self, device: torch.device): super().__init__(device) def _compute(self, img1: Tensor, img2: Tensor) -> Tensor: one = torch.ones_like(img1).to(self....
447
27
62
py
saliency-faithfulness-eval
saliency-faithfulness-eval-main/src/classes/losses/SSIMLoss.py
import torch from pytorch_msssim import SSIM from torch import Tensor from src.classes.core.Loss import Loss from src.functional.image_processing import scale """ https://github.com/VainF/pytorch-msssim """ class SSIMLoss(Loss): def __init__(self, device: torch.device): super().__init__(device) ...
519
27.888889
86
py
saliency-faithfulness-eval
saliency-faithfulness-eval-main/src/auxiliary/utils.py
import argparse import functools import gc import json import os import random import re import numpy as np import torch SEPARATOR = {"stars": "".join(["*"] * 100), "dashes": "".join(["-"] * 100), "dots": "".join(["."] * 100)} def get_device(device_type: str) -> torch.device: if device_type == "cpu": pr...
2,244
27.782051
116
py
saliency-faithfulness-eval
saliency-faithfulness-eval-main/src/functional/vis.py
import os from math import floor import matplotlib.pyplot as plt import seaborn import torch import torch.nn.functional as F from torch import Tensor from torchvision.transforms import transforms from src.functional.image_processing import chw_to_hwc, correct, resample, scale from src.functional.metrics import angula...
5,004
37.5
114
py
saliency-faithfulness-eval
saliency-faithfulness-eval-main/src/functional/utils.py
import os import numpy as np import torch from torch import Tensor, softmax from src.auxiliary.settings import DEVICE def rand_uniform(x: Tensor, apply_softmax=True) -> Tensor: x = torch.rand(size=x.shape, device=DEVICE, requires_grad=True) return softmax(x, dim=0) if apply_softmax else x def load_from_fi...
475
25.444444
67
py
saliency-faithfulness-eval
saliency-faithfulness-eval-main/src/functional/image_processing.py
from typing import Union, Tuple import numpy as np import torch import torchvision.transforms.functional as F from PIL.Image import Image from torch import Tensor from torch.nn.functional import interpolate from src.auxiliary.settings import DEVICE def correct(img: Image, illuminant: Tensor) -> Image: """ C...
3,866
36.182692
115
py
saliency-faithfulness-eval
saliency-faithfulness-eval-main/src/functional/metrics.py
import math from typing import List, Dict import numpy as np import torch from pytorch_msssim import SSIM from scipy.spatial.distance import jensenshannon from scipy.stats import entropy from torch import Tensor from torch import linalg as LA from torch.nn.functional import interpolate, binary_cross_entropy from src....
3,324
36.359551
113
py
prose
prose-main/prose/blocks/centroids.py
import warnings from os import path import numpy as np from astropy.utils.exceptions import AstropyUserWarning from photutils.centroids import ( centroid_2dg, centroid_com, centroid_quadratic, centroid_sources, ) from prose import CONFIG, Block from .geometry import Cutouts __all__ = [ "Centroid...
8,794
31.216117
86
py
prose
prose-main/prose/blocks/psf.py
import numpy as np from prose import Block, Image try: from jax.config import config config.update("jax_enable_x64", True) import jax import jax.numpy as jnp from jaxopt import ScipyMinimize except ModuleNotFoundError: pass from astropy.stats import gaussian_sigma_to_fwhm from scipy.optimize...
14,031
30.674944
89
py
prose
prose-main/tests/test_blocks.py
import inspect import sys import numpy as np import pytest from prose import Block, Sequence, blocks, example_image from prose.blocks.centroids import _PhotutilsCentroid from prose.blocks.detection import _SourceDetection from prose.blocks.psf import _PSFModelBase image = blocks.PointSourceDetection()(example_image(...
6,153
24.325103
88
py
prose
prose-main/docs/conf.py
# Configuration file for the Sphinx documentation builder. # # This file only contains a selection of the most common options. For a full # list see the documentation: # https://www.sphinx-doc.org/en/master/usage/configuration.html # -- Path setup -------------------------------------------------------------- # If ex...
4,847
26.083799
99
py
experiment-impact-tracker
experiment-impact-tracker-master/examples/my_experiment.py
import sys import tempfile import torch from experiment_impact_tracker.compute_tracker import ImpactTracker class Experiment: def __init__(self): device = torch.device("cpu") # device = torch.device('cuda') # Uncomment this to run on GPU # N is batch size; D_in is input dimension; ...
2,236
30.507042
122
py
experiment-impact-tracker
experiment-impact-tracker-master/tests/test_relative_validity.py
# Code in file tensor/two_layer_net_tensor.py import tempfile import torch from experiment_impact_tracker.compute_tracker import ImpactTracker from experiment_impact_tracker.cpu.intel import is_intel_compatible from experiment_impact_tracker.data_interface import DataInterface def _helper_function(epochs=50): ...
2,349
30.333333
97
py
experiment-impact-tracker
experiment-impact-tracker-master/tests/test_context.py
# Code in file tensor/two_layer_net_tensor.py import tempfile import torch from experiment_impact_tracker.compute_tracker import ImpactTracker from experiment_impact_tracker.cpu.intel import is_intel_compatible from experiment_impact_tracker.data_interface import DataInterface def _helper_function(epochs=50): ...
3,180
29.883495
97
py
experiment-impact-tracker
experiment-impact-tracker-master/tests/test_powercap.py
# Code in file tensor/two_layer_net_tensor.py import time import torch from experiment_impact_tracker.cpu.powercap import (PowerGadget, is_powercap_compatible) def _helper_function(): device = torch.device("cuda" if torch.cuda.is_available() else "cpu") #...
1,793
30.473684
85
py
experiment-impact-tracker
experiment-impact-tracker-master/tests/scripts/myapp.py
# code from pytorch tutorials # https://github.com/pytorch/tutorials/blob/master/beginner_source/examples_tensor/two_layer_net_tensor.py import os import sys import tempfile import torch from experiment_impact_tracker.compute_tracker import ImpactTracker def train( d: str = "cpu", log_dir: str = tempfile.mk...
2,019
26.297297
106
py
MLGeometry
MLGeometry-master/training/bihomoNN_train.py
import os #os.environ['CUDA_VISIBLE_DEVICES'] = '0' os.environ['TF_CPP_MIN_LOG_LEVEL'] = '2' import sys sys.path.append("..") import tensorflow as tf import tensorflow_probability as tfp import tensorflow.python.keras.backend as K import numpy as np import sympy as sp import time import math import argparse import ML...
14,566
41.223188
213
py
MLGeometry
MLGeometry-master/training/models.py
import tensorflow as tf from MLGeometry import bihomoNN as bnn __all__ = ['zerolayer', 'onelayer', 'twolayers', 'threelayers', 'fourlayers', 'fivelayers','OuterProductNN_k2','OuterProductNN_k3','OuterProductNN_k4', 'k2_twolayers', 'k2_threelayers','k4_onelayer','k4_twolayers'] class zerolayer(...
7,376
30.935065
84
py
MLGeometry
MLGeometry-master/MLGeometry/lbfgs.py
#! /usr/bin/env python # -*- coding: utf-8 -*- # vim:fenc=utf-8 # # Distributed under terms of the MIT license. """An example of using tfp.optimizer.lbfgs_minimize to optimize a TensorFlow model. This code shows a naive way to wrap a tf.keras.Model and optimize it with the L-BFGS optimizer from TensorFlow Probability...
4,925
33.93617
128
py
MLGeometry
MLGeometry-master/MLGeometry/loss.py
import tensorflow as tf import tensorflow.python.keras.backend as K __all__ = ['weighted_MAPE','weighted_MSE','max_error','MAPE_plus_max_error'] def weighted_MAPE(y_true, y_pred, mass): weights = mass / K.sum(mass) return K.sum(K.abs(y_true - y_pred) / y_true * weights) def weighted_MSE(y_true, y_pred, mass)...
647
31.4
82
py
MLGeometry
MLGeometry-master/MLGeometry/bihomoNN.py
from tensorflow import keras from tensorflow.python.keras import activations import numpy as np import tensorflow as tf __all__ = ['Bihomogeneous','Bihomogeneous_k2','Bihomogeneous_k3', 'Bihomogeneous_k4','Dense','WidthOneDense'] class Bihomogeneous(keras.layers.Layer): '''A layer transform zi to zi*z...
5,441
40.227273
106
py
UniControl
UniControl-main/tool_add_control_sd21.py
''' * Copyright (c) 2023 Salesforce, Inc. * All rights reserved. * SPDX-License-Identifier: Apache License 2.0 * For full license text, see LICENSE.txt file in the repo root or http://www.apache.org/licenses/ * By Can Qin * Modified from ControlNet repo: https://github.com/lllyasviel/ControlNet * Copyright (c) 2...
1,744
27.606557
98
py
UniControl
UniControl-main/dataset_eval.py
''' * Copyright (c) 2023 Salesforce, Inc. * All rights reserved. * SPDX-License-Identifier: Apache License 2.0 * For full license text, see LICENSE.txt file in the repo root or http://www.apache.org/licenses/ * By Can Qin ''' import json import cv2 import numpy as np from torch.utils.data import Dataset from an...
4,014
39.555556
591
py
UniControl
UniControl-main/inference_demo.py
''' * Copyright (c) 2023 Salesforce, Inc. * All rights reserved. * SPDX-License-Identifier: Apache License 2.0 * For full license text, see LICENSE.txt file in the repo root or http://www.apache.org/licenses/ * By Can Qin ''' import torch import pytorch_lightning as pl from pytorch_lightning import seed_everythin...
5,862
41.485507
239
py
UniControl
UniControl-main/train_unicontrol.py
''' * Copyright (c) 2023 Salesforce, Inc. * All rights reserved. * SPDX-License-Identifier: Apache License 2.0 * For full license text, see LICENSE.txt file in the repo root or http://www.apache.org/licenses/ * By Can Qin ''' from share import * from torch.utils.data.dataset import ConcatDataset import pytorch_l...
3,019
40.369863
234
py
UniControl
UniControl-main/tool_add_control.py
''' * Copyright (c) 2023 Salesforce, Inc. * All rights reserved. * SPDX-License-Identifier: Apache License 2.0 * For full license text, see LICENSE.txt file in the repo root or http://www.apache.org/licenses/ * By Can Qin * Modified from ControlNet repo: https://github.com/lllyasviel/ControlNet * Copyright (c) 2...
1,744
27.606557
98
py
UniControl
UniControl-main/cldm/hack.py
''' * Copyright (c) 2023 Salesforce, Inc. * All rights reserved. * SPDX-License-Identifier: Apache License 2.0 * For full license text, see LICENSE.txt file in the repo root or http://www.apache.org/licenses/ * By Can Qin * Modified from ControlNet repo: https://github.com/lllyasviel/ControlNet * Copyright (c) 2...
3,929
31.213115
100
py
UniControl
UniControl-main/cldm/cldm_unicontrol_v11.py
''' * Copyright (c) 2023 Salesforce, Inc. * All rights reserved. * SPDX-License-Identifier: Apache License 2.0 * For full license text, see LICENSE.txt file in the repo root or http://www.apache.org/licenses/ * By Can Qin * Modified from ControlNet repo: https://github.com/lllyasviel/ControlNet * Copyright (c) 2...
27,744
44.859504
584
py
UniControl
UniControl-main/cldm/ddim_hacked.py
''' * Copyright (c) 2023 Salesforce, Inc. * All rights reserved. * SPDX-License-Identifier: Apache License 2.0 * For full license text, see LICENSE.txt file in the repo root or http://www.apache.org/licenses/ * By Can Qin * Modified from ControlNet repo: https://github.com/lllyasviel/ControlNet * Copyright (c) 2...
16,796
50.210366
136
py
UniControl
UniControl-main/cldm/model.py
''' * Copyright (c) 2023 Salesforce, Inc. * All rights reserved. * SPDX-License-Identifier: Apache License 2.0 * For full license text, see LICENSE.txt file in the repo root or http://www.apache.org/licenses/ * By Can Qin * Modified from ControlNet repo: https://github.com/lllyasviel/ControlNet * Copyright (c) 2...
1,198
29.74359
98
py
UniControl
UniControl-main/cldm/logger.py
''' * Copyright (c) 2023 Salesforce, Inc. * All rights reserved. * SPDX-License-Identifier: Apache License 2.0 * For full license text, see LICENSE.txt file in the repo root or http://www.apache.org/licenses/ * By Can Qin * Modified from ControlNet repo: https://github.com/lllyasviel/ControlNet * Copyright (c) 2...
5,004
40.02459
105
py
UniControl
UniControl-main/cldm/cldm.py
''' * Copyright (c) 2023 Salesforce, Inc. * All rights reserved. * SPDX-License-Identifier: Apache License 2.0 * For full license text, see LICENSE.txt file in the repo root or http://www.apache.org/licenses/ * By Can Qin * Modified from ControlNet repo: https://github.com/lllyasviel/ControlNet * Copyright (c) 2...
19,342
42.369955
135
py
UniControl
UniControl-main/cldm/cldm_unicontrol.py
''' * Copyright (c) 2023 Salesforce, Inc. * All rights reserved. * SPDX-License-Identifier: Apache License 2.0 * For full license text, see LICENSE.txt file in the repo root or http://www.apache.org/licenses/ * By Can Qin * Modified from ControlNet repo: https://github.com/lllyasviel/ControlNet * Copyright (c) 2...
27,425
44.332231
584
py
UniControl
UniControl-main/cldm/ddim_unicontrol_hacked.py
''' * Copyright (c) 2023 Salesforce, Inc. * All rights reserved. * SPDX-License-Identifier: Apache License 2.0 * For full license text, see LICENSE.txt file in the repo root or http://www.apache.org/licenses/ * By Can Qin * Modified from ControlNet repo: https://github.com/lllyasviel/ControlNet * Copyright (c) 2...
17,819
49.769231
136
py
UniControl
UniControl-main/annotator/midas/utils.py
''' * Copyright (c) 2023 Salesforce, Inc. * All rights reserved. * SPDX-License-Identifier: Apache License 2.0 * For full license text, see LICENSE.txt file in the repo root or http://www.apache.org/licenses/ * By Can Qin * Modified from ControlNet repo: https://github.com/lllyasviel/ControlNet * Copyright (c) 2...
4,944
23.725
98
py
UniControl
UniControl-main/annotator/midas/api.py
''' * Copyright (c) 2023 Salesforce, Inc. * All rights reserved. * SPDX-License-Identifier: Apache License 2.0 * For full license text, see LICENSE.txt file in the repo root or http://www.apache.org/licenses/ * By Can Qin * Modified from ControlNet repo: https://github.com/lllyasviel/ControlNet * Copyright (c) 2...
5,905
31.097826
126
py
UniControl
UniControl-main/annotator/midas/__init__.py
''' * Copyright (c) 2023 Salesforce, Inc. * All rights reserved. * SPDX-License-Identifier: Apache License 2.0 * For full license text, see LICENSE.txt file in the repo root or http://www.apache.org/licenses/ * By Can Qin * Modified from ControlNet repo: https://github.com/lllyasviel/ControlNet * Copyright (c) 2...
1,842
33.773585
98
py
UniControl
UniControl-main/annotator/midas/midas/base_model.py
''' * Copyright (c) 2023 Salesforce, Inc. * All rights reserved. * SPDX-License-Identifier: Apache License 2.0 * For full license text, see LICENSE.txt file in the repo root or http://www.apache.org/licenses/ * By Can Qin * Modified from ControlNet repo: https://github.com/lllyasviel/ControlNet * Copyright (c) 2...
729
26.037037
98
py
UniControl
UniControl-main/annotator/midas/midas/midas_net.py
''' * Copyright (c) 2023 Salesforce, Inc. * All rights reserved. * SPDX-License-Identifier: Apache License 2.0 * For full license text, see LICENSE.txt file in the repo root or http://www.apache.org/licenses/ * By Can Qin * Modified from ControlNet repo: https://github.com/lllyasviel/ControlNet * Copyright (c) 2...
3,071
34.310345
130
py
UniControl
UniControl-main/annotator/midas/midas/vit.py
''' * Copyright (c) 2023 Salesforce, Inc. * All rights reserved. * SPDX-License-Identifier: Apache License 2.0 * For full license text, see LICENSE.txt file in the repo root or http://www.apache.org/licenses/ * By Can Qin * Modified from ControlNet repo: https://github.com/lllyasviel/ControlNet * Copyright (c) 2...
14,987
28.856574
98
py
UniControl
UniControl-main/annotator/midas/midas/dpt_depth.py
''' * Copyright (c) 2023 Salesforce, Inc. * All rights reserved. * SPDX-License-Identifier: Apache License 2.0 * For full license text, see LICENSE.txt file in the repo root or http://www.apache.org/licenses/ * By Can Qin * Modified from ControlNet repo: https://github.com/lllyasviel/ControlNet * Copyright (c) 2...
3,516
28.308333
98
py
UniControl
UniControl-main/annotator/midas/midas/midas_net_custom.py
''' * Copyright (c) 2023 Salesforce, Inc. * All rights reserved. * SPDX-License-Identifier: Apache License 2.0 * For full license text, see LICENSE.txt file in the repo root or http://www.apache.org/licenses/ * By Can Qin * Modified from ControlNet repo: https://github.com/lllyasviel/ControlNet * Copyright (c) 2...
5,569
39.362319
168
py
UniControl
UniControl-main/annotator/midas/midas/blocks.py
''' * Copyright (c) 2023 Salesforce, Inc. * All rights reserved. * SPDX-License-Identifier: Apache License 2.0 * For full license text, see LICENSE.txt file in the repo root or http://www.apache.org/licenses/ * By Can Qin * Modified from ControlNet repo: https://github.com/lllyasviel/ControlNet * Copyright (c) 2...
9,604
26.209632
150
py
UniControl
UniControl-main/annotator/mlsd/utils.py
''' * Copyright (c) 2023 Salesforce, Inc. * All rights reserved. * SPDX-License-Identifier: Apache License 2.0 * For full license text, see LICENSE.txt file in the repo root or http://www.apache.org/licenses/ * By Can Qin * Modified from ControlNet repo: https://github.com/lllyasviel/ControlNet * Copyright (c) 2...
24,411
40.306261
150
py
UniControl
UniControl-main/annotator/mlsd/__init__.py
''' * Copyright (c) 2023 Salesforce, Inc. * All rights reserved. * SPDX-License-Identifier: Apache License 2.0 * For full license text, see LICENSE.txt file in the repo root or http://www.apache.org/licenses/ * By Can Qin * Modified from ControlNet repo: https://github.com/lllyasviel/ControlNet * Copyright (c) 2...
1,907
34.333333
119
py
UniControl
UniControl-main/annotator/mlsd/models/mbv2_mlsd_tiny.py
''' * Copyright (c) 2023 Salesforce, Inc. * All rights reserved. * SPDX-License-Identifier: Apache License 2.0 * For full license text, see LICENSE.txt file in the repo root or http://www.apache.org/licenses/ * By Can Qin * Modified from ControlNet repo: https://github.com/lllyasviel/ControlNet * Copyright (c) 2...
9,542
32.484211
107
py
UniControl
UniControl-main/annotator/mlsd/models/mbv2_mlsd_large.py
''' * Copyright (c) 2023 Salesforce, Inc. * All rights reserved. * SPDX-License-Identifier: Apache License 2.0 * For full license text, see LICENSE.txt file in the repo root or http://www.apache.org/licenses/ * By Can Qin * Modified from ControlNet repo: https://github.com/lllyasviel/ControlNet * Copyright (c) 2...
10,040
32.248344
107
py
UniControl
UniControl-main/annotator/hed/__init__.py
''' * Copyright (c) 2023 Salesforce, Inc. * All rights reserved. * SPDX-License-Identifier: Apache License 2.0 * For full license text, see LICENSE.txt file in the repo root or http://www.apache.org/licenses/ * By Can Qin * Modified from ControlNet repo: https://github.com/lllyasviel/ControlNet * Copyright (c) 2...
4,841
44.252336
149
py
UniControl
UniControl-main/annotator/uniformer_base/mmcv_custom/checkpoint.py
''' * Copyright (c) 2023 Salesforce, Inc. * All rights reserved. * SPDX-License-Identifier: Apache License 2.0 * For full license text, see LICENSE.txt file in the repo root or http://www.apache.org/licenses/ * By Can Qin * Modified from ControlNet repo: https://github.com/lllyasviel/ControlNet * Copyright (c) 2...
19,570
37.224609
110
py
UniControl
UniControl-main/annotator/uniformer_base/mmseg/apis/inference.py
import matplotlib.pyplot as plt import annotator.uniformer.mmcv as mmcv import torch from annotator.uniformer.mmcv.parallel import collate, scatter from annotator.uniformer.mmcv.runner import load_checkpoint from annotator.uniformer.mmseg.datasets.pipelines import Compose from annotator.uniformer.mmseg.models import b...
4,729
33.525547
79
py
UniControl
UniControl-main/annotator/uniformer_base/mmseg/apis/test.py
import os.path as osp import pickle import shutil import tempfile import annotator.uniformer.mmcv as mmcv import numpy as np import torch import torch.distributed as dist from annotator.uniformer.mmcv.image import tensor2imgs from annotator.uniformer.mmcv.runner import get_dist_info def np2tmp(array, temp_file_name=...
8,288
33.682008
79
py
UniControl
UniControl-main/annotator/uniformer_base/mmseg/apis/train.py
import random import warnings import numpy as np import torch from annotator.uniformer.mmcv.parallel import MMDataParallel, MMDistributedDataParallel from annotator.uniformer.mmcv.runner import build_optimizer, build_runner from annotator.uniformer.mmseg.core import DistEvalHook, EvalHook from annotator.uniformer.mms...
4,035
33.495726
87
py
UniControl
UniControl-main/annotator/uniformer_base/mmseg/core/evaluation/metrics.py
from collections import OrderedDict import annotator.uniformer.mmcv as mmcv import numpy as np import torch def f_score(precision, recall, beta=1): """calcuate the f-score value. Args: precision (float | torch.Tensor): The precision value. recall (float | torch.Tensor): The recall value. ...
13,079
39
79
py
UniControl
UniControl-main/annotator/uniformer_base/mmseg/core/seg/sampler/ohem_pixel_sampler.py
import torch import torch.nn.functional as F from ..builder import PIXEL_SAMPLERS from .base_pixel_sampler import BasePixelSampler @PIXEL_SAMPLERS.register_module() class OHEMPixelSampler(BasePixelSampler): """Online Hard Example Mining Sampler for segmentation. Args: context (nn.Module): The contex...
3,155
39.987013
103
py
UniControl
UniControl-main/annotator/uniformer_base/mmseg/models/necks/multilevel_neck.py
''' * Copyright (c) 2023 Salesforce, Inc. * All rights reserved. * SPDX-License-Identifier: Apache License 2.0 * For full license text, see LICENSE.txt file in the repo root or http://www.apache.org/licenses/ * By Can Qin * Modified from ControlNet repo: https://github.com/lllyasviel/ControlNet * Copyright (c) 2...
2,933
34.349398
98
py
UniControl
UniControl-main/annotator/uniformer_base/mmseg/models/necks/fpn.py
''' * Copyright (c) 2023 Salesforce, Inc. * All rights reserved. * SPDX-License-Identifier: Apache License 2.0 * For full license text, see LICENSE.txt file in the repo root or http://www.apache.org/licenses/ * By Can Qin * Modified from ControlNet repo: https://github.com/lllyasviel/ControlNet * Copyright (c) 2...
9,638
41.84
98
py
UniControl
UniControl-main/annotator/uniformer_base/mmseg/models/decode_heads/fcn_head.py
''' * Copyright (c) 2023 Salesforce, Inc. * All rights reserved. * SPDX-License-Identifier: Apache License 2.0 * For full license text, see LICENSE.txt file in the repo root or http://www.apache.org/licenses/ * By Can Qin * Modified from ControlNet repo: https://github.com/lllyasviel/ControlNet * Copyright (c) 2...
3,296
34.074468
98
py
UniControl
UniControl-main/annotator/uniformer_base/mmseg/models/decode_heads/sep_aspp_head.py
''' * Copyright (c) 2023 Salesforce, Inc. * All rights reserved. * SPDX-License-Identifier: Apache License 2.0 * For full license text, see LICENSE.txt file in the repo root or http://www.apache.org/licenses/ * By Can Qin * Modified from ControlNet repo: https://github.com/lllyasviel/ControlNet * Copyright (c) 2...
4,006
34.149123
98
py
UniControl
UniControl-main/annotator/uniformer_base/mmseg/models/decode_heads/ann_head.py
''' * Copyright (c) 2023 Salesforce, Inc. * All rights reserved. * SPDX-License-Identifier: Apache License 2.0 * For full license text, see LICENSE.txt file in the repo root or http://www.apache.org/licenses/ * By Can Qin * Modified from ControlNet repo: https://github.com/lllyasviel/ControlNet * Copyright (c) 2...
9,673
36.496124
98
py
UniControl
UniControl-main/annotator/uniformer_base/mmseg/models/decode_heads/apc_head.py
''' * Copyright (c) 2023 Salesforce, Inc. * All rights reserved. * SPDX-License-Identifier: Apache License 2.0 * For full license text, see LICENSE.txt file in the repo root or http://www.apache.org/licenses/ * By Can Qin * Modified from ControlNet repo: https://github.com/lllyasviel/ControlNet * Copyright (c) 2...
6,051
34.391813
98
py
UniControl
UniControl-main/annotator/uniformer_base/mmseg/models/decode_heads/ocr_head.py
''' * Copyright (c) 2023 Salesforce, Inc. * All rights reserved. * SPDX-License-Identifier: Apache License 2.0 * For full license text, see LICENSE.txt file in the repo root or http://www.apache.org/licenses/ * By Can Qin * Modified from ControlNet repo: https://github.com/lllyasviel/ControlNet * Copyright (c) 2...
4,798
33.278571
98
py
UniControl
UniControl-main/annotator/uniformer_base/mmseg/models/decode_heads/dm_head.py
''' * Copyright (c) 2023 Salesforce, Inc. * All rights reserved. * SPDX-License-Identifier: Apache License 2.0 * For full license text, see LICENSE.txt file in the repo root or http://www.apache.org/licenses/ * By Can Qin * Modified from ControlNet repo: https://github.com/lllyasviel/ControlNet * Copyright (c) 2...
5,483
34.843137
98
py
UniControl
UniControl-main/annotator/uniformer_base/mmseg/models/decode_heads/ema_head.py
''' * Copyright (c) 2023 Salesforce, Inc. * All rights reserved. * SPDX-License-Identifier: Apache License 2.0 * For full license text, see LICENSE.txt file in the repo root or http://www.apache.org/licenses/ * By Can Qin * Modified from ControlNet repo: https://github.com/lllyasviel/ControlNet * Copyright (c) 2...
6,275
33.674033
98
py
UniControl
UniControl-main/annotator/uniformer_base/mmseg/models/decode_heads/da_head.py
''' * Copyright (c) 2023 Salesforce, Inc. * All rights reserved. * SPDX-License-Identifier: Apache License 2.0 * For full license text, see LICENSE.txt file in the repo root or http://www.apache.org/licenses/ * By Can Qin * Modified from ControlNet repo: https://github.com/lllyasviel/ControlNet * Copyright (c) 2...
6,064
30.753927
98
py
UniControl
UniControl-main/annotator/uniformer_base/mmseg/models/decode_heads/psp_head.py
''' * Copyright (c) 2023 Salesforce, Inc. * All rights reserved. * SPDX-License-Identifier: Apache License 2.0 * For full license text, see LICENSE.txt file in the repo root or http://www.apache.org/licenses/ * By Can Qin * Modified from ControlNet repo: https://github.com/lllyasviel/ControlNet * Copyright (c) 2...
3,831
32.614035
98
py
UniControl
UniControl-main/annotator/uniformer_base/mmseg/models/decode_heads/cc_head.py
''' * Copyright (c) 2023 Salesforce, Inc. * All rights reserved. * SPDX-License-Identifier: Apache License 2.0 * For full license text, see LICENSE.txt file in the repo root or http://www.apache.org/licenses/ * By Can Qin * Modified from ControlNet repo: https://github.com/lllyasviel/ControlNet * Copyright (c) 2...
1,782
31.418182
98
py
UniControl
UniControl-main/annotator/uniformer_base/mmseg/models/decode_heads/enc_head.py
''' * Copyright (c) 2023 Salesforce, Inc. * All rights reserved. * SPDX-License-Identifier: Apache License 2.0 * For full license text, see LICENSE.txt file in the repo root or http://www.apache.org/licenses/ * By Can Qin * Modified from ControlNet repo: https://github.com/lllyasviel/ControlNet * Copyright (c) 2...
7,263
35.32
98
py
UniControl
UniControl-main/annotator/uniformer_base/mmseg/models/decode_heads/fpn_head.py
''' * Copyright (c) 2023 Salesforce, Inc. * All rights reserved. * SPDX-License-Identifier: Apache License 2.0 * For full license text, see LICENSE.txt file in the repo root or http://www.apache.org/licenses/ * By Can Qin * Modified from ControlNet repo: https://github.com/lllyasviel/ControlNet * Copyright (c) 2...
2,901
34.82716
98
py