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
herculens
herculens-main/herculens/Util/util.py
# Utility functions # # Copyright (c) 2021, herculens developers and contributors # Copyright (c) 2018, Simon Birrer & lenstronomy contributors # based on the Util module from lenstronomy (version 1.9.3) __author__ = 'sibirrer', 'austinpeel', 'aymgal' import math import numpy as np import jax.numpy as jnp import js...
11,904
38.290429
119
py
herculens
herculens-main/herculens/Util/model_util.py
# Utility functions # # Copyright (c) 2021, herculens developers and contributors __author__ = 'aymgal' import copy import numpy as np import jax.numpy as jnp from scipy.ndimage import morphology from scipy import ndimage def mask_from_source_area(lens_image, parameters): src_idx = lens_image.SourceModel.pixe...
6,506
46.152174
146
py
herculens
herculens-main/herculens/Util/image_util.py
# Utility functions # # Copyright (c) 2021, herculens developers and contributors # Copyright (c) 2018, Simon Birrer & lenstronomy contributors # based on the Util module from lenstronomy (version 1.9.3) __author__ = 'sibirrer', 'dangilman', 'aymgal' import numpy as np from scipy import interpolate #, ndimage from s...
6,392
38.708075
148
py
herculens
herculens-main/herculens/Util/jax_util.py
# Classes and functions to use with JAX # # Copyright (c) 2021, herculens developers and contributors __author__ = 'austinpeel', 'aymgal', 'duxfrederic' from functools import partial from copy import deepcopy import numpy as np import jax.numpy as jnp from jax import jit, vmap, lax from jax.scipy.special import gam...
3,482
33.485149
100
py
herculens
herculens-main/herculens/Inference/sensitivity_mapping.py
# Gradient-based sensitivity mapping # # Copyright (c) 2021, herculens developers and contributors __author__ = 'aymgal' import copy import time import numpy as np from skimage import feature from functools import partial from jax import grad from jax import jit import jax.numpy as jnp from herculens.LightModel.l...
11,006
43.028
128
py
herculens
herculens-main/herculens/Inference/loss.py
# Defines the full loss function, from likelihood, prior and regularization terms # # Copyright (c) 2021, herculens developers and contributors __author__ = 'aymgal', 'austinpeel' import numpy as np import jax.numpy as jnp from jax import jit import warnings from herculens.Inference.base_differentiable import Diff...
1,274
30.875
81
py
herculens
herculens-main/herculens/Inference/base_differentiable.py
# Defines a general fully differentiable scalar function # # Copyright (c) 2022, herculens developers and contributors __author__ = 'aymgal' from functools import partial from jax import jit, grad, jacfwd, jacrev, jvp, value_and_grad __all__ = ['Differentiable'] class Differentiable(object): """Abstract cl...
1,536
29.137255
162
py
herculens
herculens-main/herculens/Inference/Sampling/sampling.py
# Handles different method to sample the posterior distribution of parameters # # Copyright (c) 2021, herculens developers and contributors __author__ = 'aymgal', 'austinpeel' import time import numpy as np from functools import partial import jax from herculens.Inference.Sampling.base_inference import Inference ...
9,177
43.125
132
py
herculens
herculens-main/herculens/Inference/Sampling/base_inference.py
# Defines a general fully differentiable probability function for inference purposes # # Copyright (c) 2022, herculens developers and contributors __author__ = 'aymgal' from functools import partial from jax import jit __all__ = ['Inference'] class Inference(object): """Abstract class that defines wraps th...
1,116
30.914286
107
py
herculens
herculens-main/herculens/Inference/Optimization/base_optim.py
# Defines a general fully differentiable probability function for inference purposes # # Copyright (c) 2022, herculens developers and contributors __author__ = 'aymgal' from functools import partial import jax.numpy as jnp from jax import jit, grad, value_and_grad from tqdm import tqdm __all__ = ['BaseOptimizer']...
1,582
28.867925
110
py
herculens
herculens-main/herculens/Inference/Optimization/jaxopt.py
# Handles different method to optimize a loss function # # Copyright (c) 2021, herculens developers and contributors __author__ = 'aymgal', 'austinpeel' import time import warnings import numpy as np from copy import deepcopy import jax import jaxopt from herculens.Inference.Optimization.base_optim import BaseOpti...
5,014
36.148148
123
py
herculens
herculens-main/herculens/Inference/Optimization/optax.py
# Handles different method to optimize a loss function # # Copyright (c) 2021, herculens developers and contributors __author__ = 'aymgal', 'austinpeel' import time import numpy as np from copy import deepcopy from functools import partial from jax import jit import optax from herculens.Inference.Optimization.base...
4,633
40.747748
134
py
herculens
herculens-main/herculens/Inference/ProbModel/numpyro_util.py
# Set of utilities that extends some of numpyro functionalities # In the future, these may be incorporated within numpyro import jax.numpy as jnp from functools import partial import numpyro from numpyro import handlers from numpyro.distributions import transforms, constraints from numpyro.distributions.util import...
4,837
38.983471
106
py
herculens
herculens-main/herculens/Inference/ProbModel/numpyro.py
# Defines the model of a strong lens # # Copyright (c) 2022, herculens developers and contributors __author__ = 'aymgal' import jax import jax.numpy as jnp import numpyro from numpyro import handlers from numpyro.infer import util from herculens.Inference.ProbModel.base_model import BaseProbModel from herculens.I...
2,638
33.272727
109
py
herculens
herculens-main/herculens/Inference/legacy/optimization.py
# Handles different method to optimize a loss function # # Copyright (c) 2021, herculens developers and contributors __author__ = 'aymgal', 'austinpeel' import time import warnings import numpy as np import jax import optax from scipy import optimize from scipy.optimize import Bounds from tqdm import tqdm from copy...
13,140
44.787456
134
py
herculens
herculens-main/herculens/Inference/legacy/loss.py
# Defines the full loss function, from likelihood, prior and regularization terms # # Copyright (c) 2021, herculens developers and contributors __author__ = 'aymgal', 'austinpeel' import numpy as np import jax.numpy as jnp from jax import jit from herculens.Inference.legacy.base_differentiable import Differentiabl...
24,921
54.629464
158
py
herculens
herculens-main/herculens/Inference/legacy/sampling.py
# Handles different method to sample the posterior distribution of parameters # # Copyright (c) 2021, herculens developers and contributors __author__ = 'aymgal', 'austinpeel' import time import numpy as np from functools import partial import jax from herculens.Inference.legacy.base_inference import Inference #...
9,368
42.985915
132
py
herculens
herculens-main/herculens/Inference/legacy/base_differentiable.py
# Defines a general fully differentiable scalar function # # Copyright (c) 2022, herculens developers and contributors __author__ = 'aymgal' from functools import partial from jax import jit, grad, jacfwd, jacrev, jvp, value_and_grad __all__ = ['Differentiable'] class Differentiable(object): """Abstract cl...
1,474
29.729167
162
py
herculens
herculens-main/herculens/Inference/legacy/parameters.py
# Estimation of model parameters storage and manipulation # # Copyright (c) 2021, herculens developers and contributors __author__ = 'aymgal' from copy import deepcopy import numpy as np import jax.numpy as jnp from jax import lax, jit from functools import partial from herculens.MassModel.Profiles import pixelate...
31,937
48.135385
186
py
herculens
herculens-main/herculens/Inference/legacy/base_inference.py
# Defines a general fully differentiable probability function for inference purposes # # Copyright (c) 2022, herculens developers and contributors __author__ = 'aymgal' from functools import partial from jax import jit __all__ = ['Inference'] class Inference(object): """Abstract class that defines wraps th...
1,163
31.333333
107
py
herculens
herculens-main/herculens/Instrument/noise.py
# Defines the data noise model # # Copyright (c) 2021, herculens developers and contributors # Copyright (c) 2018, Simon Birrer & lenstronomy contributors # based on the Data module from lenstronomy (version 1.9.3) __author__ = 'sibirrer', 'austinpeel', 'aymgal' import numpy as np import jax.numpy as jnp from jax i...
6,709
39.421687
129
py
herculens
herculens-main/herculens/LensImage/lens_image.py
# Defines the model of a strong lens # # Copyright (c) 2023, herculens developers and contributors # Copyright (c) 2018, Simon Birrer & lenstronomy contributors # based on the ImSim module from lenstronomy (version 1.9.3) __author__ = 'sibirrer', 'austinpeel', 'aymgal' import copy import numpy as np import jax.numpy...
15,267
54.722628
156
py
herculens
herculens-main/herculens/LensImage/lensing_operator.py
# Defines the model of a strong lens # # Copyright (c) 2023, herculens developers and contributors # Copyright (c) 2020, Austin Peel and Aymeric Galan # based on the LensingOperator class from slitronomy (https://github.com/aymgal/SLITronomy) __author__ = 'austinpeel', 'aymgal' import copy import numpy as np import...
13,789
37.093923
113
py
herculens
herculens-main/herculens/LensImage/Numerics/numerics.py
# Handles coordinate grids and convolutions # # Copyright (c) 2021, herculens developers and contributors # Copyright (c) 2018, Simon Birrer & lenstronomy contributors # based on the ImSim.Numerics module from lenstronomy (version 1.9.3) __author__ = 'sibirrer', 'austinpeel', 'aymgal' import numpy as np from hercul...
6,653
44.575342
135
py
herculens
herculens-main/herculens/LensImage/Numerics/convolution.py
# Handles different convolution methods # # Copyright (c) 2021, herculens developers and contributors # Copyright (c) 2018, Simon Birrer & lenstronomy contributors # based on the ImSim.Numerics module from lenstronomy (version 1.9.3) __author__ = 'sibirrer', 'austinpeel', 'aymgal' import numpy as np import jax.nump...
7,248
37.558511
118
py
herculens
herculens-main/herculens/LensImage/Numerics/grid.py
# Handles coordinate grid on which ray-tracing and convolution are performed # # Copyright (c) 2021, herculens developers and contributors # Copyright (c) 2018, Simon Birrer & lenstronomy contributors # based on the ImSim.Numerics module from lenstronomy (version 1.9.3) __author__ = 'sibirrer', 'austinpeel', 'aymgal'...
4,533
39.123894
122
py
herculens
herculens-main/herculens/MassModel/mass_model.py
# High-level interface to a mass model # # Copyright (c) 2021, herculens developers and contributors # Copyright (c) 2018, Simon Birrer & lenstronomy contributors # based on the LensModel module from lenstronomy (version 1.9.3) __author__ = 'sibirrer', 'austinpeel', 'aymgal' import numpy as np import jax.numpy as jn...
8,131
37.358491
121
py
herculens
herculens-main/herculens/MassModel/Profiles/point_mass.py
# Defines a point mass # # Copyright (c) 2021, herculens developers and contributors __author__ = 'aymgal' import numpy as np import jax.numpy as jnp __all__ = ['PointMass'] class PointMass(object): """ class to compute the physical deflection angle of a point mass, given as an Einstein radius """ ...
2,139
27.533333
95
py
herculens
herculens-main/herculens/MassModel/Profiles/nie.py
# Defines a non-singular isothermal ellipsoid # # Copyright (c) 2021, herculens developers and contributors # Copyright (c) 2018, Simon Birrer & lenstronomy contributors # based on the LensModel.Profiles module from lenstronomy (version 1.9.3) __author__ = 'sibirrer', 'austinpeel', 'aymgal' import numpy as np impor...
7,891
34.710407
114
py
herculens
herculens-main/herculens/MassModel/Profiles/pixelated.py
# Defines a pixelated profile in the lens potential # # Copyright (c) 2021, herculens developers and contributors __author__ = 'austinpeel', 'aymgal' import numpy as np import jax import jax.numpy as jnp from jax import grad, jacfwd, jacrev, vmap # from functools import partial from utax.interpolation import Bicub...
9,422
38.426778
113
py
herculens
herculens-main/herculens/MassModel/Profiles/multipole.py
# Defines a multipole in the potential # # Copyright (c) 2021, herculens developers and contributors # Copyright (c) 2018, Simon Birrer & lenstronomy contributors # based on the LensModel.Profiles module from lenstronomy (version 1.9.3) __author__ = 'sibirrer', 'lynevdv', 'austinpeel', 'aymgal' import numpy as np i...
3,589
42.253012
117
py
herculens
herculens-main/herculens/MassModel/Profiles/gaussian_potential.py
# Defines a gaussian profile # # Copyright (c) 2021, herculens developers and contributors # Copyright (c) 2018, Simon Birrer & lenstronomy contributors # based on the LensModel.Profiles module from lenstronomy (version 1.9.3) __author__ = 'sibirrer', 'austinpeel', 'aymgal' import numpy as np import jax.numpy as jn...
1,971
36.923077
114
py
herculens
herculens-main/herculens/MassModel/Profiles/epl.py
# Defines en elliptical power law profile # # Copyright (c) 2021, herculens developers and contributors # Copyright (c) 2018, Simon Birrer & lenstronomy contributors # based on the LensModel.Profiles module from lenstronomy (version 1.9.3) __author__ = 'sibirrer', 'dangilman', 'ntessore', 'austinpeel', 'aymgal' imp...
7,348
32.404545
112
py
herculens
herculens-main/herculens/MassModel/Profiles/sersic_utils.py
# Utility methods for Sersic profiles # # Copyright (c) 2021, herculens developers and contributors # Copyright (c) 2018, Simon Birrer & lenstronomy contributors # based on the LensModel.Profiles module from lenstronomy (version 1.9.3) __author__ = 'sibirrer', 'jiwoncpark', 'austinpeel', 'aymgal' import scipy.speci...
7,028
32.15566
150
py
herculens
herculens-main/herculens/Analysis/plot.py
# Class to plot a lens model # # Copyright (c) 2021, herculens developers and contributors __author__ = 'aymgal' import copy import warnings import numpy as np import jax.numpy as jnp import matplotlib.pyplot as plt from scipy import ndimage from matplotlib.colors import Normalize, LogNorm, TwoSlopeNorm from hercu...
20,805
46.940092
130
py
herculens
herculens-main/herculens/RegulModel/regul_util.py
# Utility functions for regularization methods # # Copyright (c) 2021, herculens developers and contributors __author__ = 'aymgal' import copy import numpy as np import time from scipy import signal from scipy.interpolate import griddata import warnings import jax import jax.numpy as jnp from jax import lax, jit, ...
14,258
42.340426
118
py
herculens
herculens-main/herculens/RegulModel/Methods/sparsity.py
# Defines regularization choices # # Copyright (c) 2023, herculens developers and contributors __author__ = 'aymgal' import jax.numpy as jnp from herculens.RegulModel.Methods.base import BaseRegularization from herculens.RegulModel import regul_util __all__ = [ 'SparsityStarlet', 'SparsityBLWavelet', ] ...
3,871
36.960784
110
py
herculens
herculens-main/herculens/RegulModel/Methods/constraints.py
# Defines regularization choices # # Copyright (c) 2023, herculens developers and contributors __author__ = 'aymgal' import jax.numpy as jnp from herculens.RegulModel.Methods.base import BaseRegularization __all__ = [ 'Positivity', 'Negativity', ] class Positivity(BaseRegularization): param_names...
1,600
24.822581
73
py
herculens
herculens-main/herculens/Standard/coolest_util.py
# Handles coordinate systems # # Copyright (c) 2022, herculens developers and contributors __author__ = 'aymgal' import os import shutil import math import numpy as np from astropy.io import fits import logging from herculens.Inference.legacy.parameters import Parameters as HerculensParameters from herculens.Util ...
26,903
42.533981
126
py
GFCS
GFCS-main/plot_results.py
# (LB plotting/stat code) import configargparse from pathlib import Path from os import listdir from os.path import isdir, isfile, join, splitext import torch import matplotlib.pyplot as plt import json from ours_util import stats_summary, bootstrap_sampling, MAX_QUERIES def process_result_file(result, args): in...
4,796
36.771654
119
py
GFCS
GFCS-main/generate_results_summary.py
# (LB plotting/stat code) # This consumes the results output by plot_results so that multiple PDF/CDFs can be plotted together. import configargparse from pathlib import Path import json import matplotlib import matplotlib.pyplot as plt from cycler import cycler import torch plt.rcParams.update({ "text.usetex": T...
7,651
38.854167
120
py
GFCS
GFCS-main/gfcs_util.py
import torch import torchvision.transforms as transforms from random import randint imagenet_mean = [0.485, 0.456, 0.406] imagenet_std = [0.229, 0.224, 0.225] class Interpolate(torch.nn.Module): def __init__(self, size, mode): super(Interpolate, self).__init__() self.interp = torch.nn.functional...
2,032
29.343284
109
py
GFCS
GFCS-main/rgf_variants_pytorch.py
# This is a PyTorch port of the main P-RGF attack file originally released and documented in this repo: # https://github.com/thu-ml/Prior-Guided-RGF. This implements the method described in "Improving Black-box # Adversarial Attacks with a Transfer-based Prior" (https://arxiv.org/abs/1906.06919). Note that this por...
27,796
54.043564
120
py
GFCS
GFCS-main/GFCS_main.py
# This implements the GFCS method of the paper "Attacking deep networks with surrogate-based adversarial black-box # methods is easy" (https://arxiv.org/abs/2203.08725). # The code is a heavily adapted version of the implementation of SimBA-ODS (https://github.com/ermongroup/ODS) from the # paper "Diversity can be...
14,015
49.057143
120
py
sgnmt
sgnmt-master/cam/sgnmt/ui.py
# -*- coding: utf-8 -*- # coding=utf-8 # Copyright 2019 The SGNMT Authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless requir...
86,353
61.12518
88
py
sgnmt
sgnmt-master/cam/sgnmt/decode_utils.py
# -*- coding: utf-8 -*- # coding=utf-8 # Copyright 2019 The SGNMT Authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless requir...
47,661
48.544699
84
py
sgnmt
sgnmt-master/cam/sgnmt/predictors/pytorch_fairseq.py
# -*- coding: utf-8 -*- # coding=utf-8 # Copyright 2019 The SGNMT Authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless requir...
5,450
34.396104
75
py
BayesProcess
BayesProcess-master/JV_surrogate.py
""" JV surrogate model filneame: JV_surrogate.py version: 1.0 Surrogate model for denoising experimental JV curves and predicting JV curves from materail descriptors @authors: Danny Zekun Ren and Felipe Oviedo MIT Photovoltaics Laboratory / Singapore and MIT Alliance for Research and Tehcnology All code is under ...
6,508
31.708543
110
py
BayesProcess
BayesProcess-master/Bayes.py
""" Baesian network filneame: Bayes.py version: 1.0 Two step Bayesian inference(Bayesian network) to map process conditions to materaal properties @authors: Danny Zekun Ren and Felipe Oviedo MIT Photovoltaics Laboratory / Singapore and MIT Alliance for Research and Tehcnology All code is under Apache 2.0 license, ...
6,270
27.766055
94
py
pytorch-nested-unet
pytorch-nested-unet-master/losses.py
import torch import torch.nn as nn import torch.nn.functional as F try: from LovaszSoftmax.pytorch.lovasz_losses import lovasz_hinge except ImportError: pass __all__ = ['BCEDiceLoss', 'LovaszHingeLoss'] class BCEDiceLoss(nn.Module): def __init__(self): super().__init__() def forward(self, i...
1,036
24.925
92
py
pytorch-nested-unet
pytorch-nested-unet-master/val.py
import argparse import os from glob import glob import cv2 import torch import torch.backends.cudnn as cudnn import yaml from albumentations.augmentations import transforms from albumentations.core.composition import Compose from sklearn.model_selection import train_test_split from tqdm import tqdm import archs from ...
3,331
28.22807
108
py
pytorch-nested-unet
pytorch-nested-unet-master/archs.py
import torch from torch import nn __all__ = ['UNet', 'NestedUNet'] class VGGBlock(nn.Module): def __init__(self, in_channels, middle_channels, out_channels): super().__init__() self.relu = nn.ReLU(inplace=True) self.conv1 = nn.Conv2d(in_channels, middle_channels, 3, padding=1) sel...
5,702
40.627737
88
py
pytorch-nested-unet
pytorch-nested-unet-master/dataset.py
import os import cv2 import numpy as np import torch import torch.utils.data class Dataset(torch.utils.data.Dataset): def __init__(self, img_ids, img_dir, mask_dir, img_ext, mask_ext, num_classes, transform=None): """ Args: img_ids (list): Image ids. img_dir: Image file di...
2,361
29.675325
99
py
pytorch-nested-unet
pytorch-nested-unet-master/metrics.py
import numpy as np import torch import torch.nn.functional as F def iou_score(output, target): smooth = 1e-5 if torch.is_tensor(output): output = torch.sigmoid(output).data.cpu().numpy() if torch.is_tensor(target): target = target.data.cpu().numpy() output_ = output > 0.5 target_ ...
771
24.733333
62
py
pytorch-nested-unet
pytorch-nested-unet-master/train.py
import argparse import os from collections import OrderedDict from glob import glob import pandas as pd import torch import torch.backends.cudnn as cudnn import torch.nn as nn import torch.optim as optim import yaml from albumentations.augmentations import transforms from albumentations.core.composition import Compose...
12,595
34.48169
140
py
AGSR-Net
AGSR-Net-master/preprocessing.py
import torch import numpy as np import os import scipy.io path = 'drive/My Drive/BRAIN_DATASET' roi_str = 'ROI_FC.mat' def pad_HR_adj(label, split): label = np.pad(label, ((split, split), (split, split)), mode="constant") np.fill_diagonal(label, 1) return label def normalize_adj_torch(mx): rowsum ...
2,459
26.954545
76
py
AGSR-Net
AGSR-Net-master/model.py
import torch import torch.nn as nn from layers import * from ops import * from preprocessing import normalize_adj_torch import torch.nn.functional as F class AGSRNet(nn.Module): def __init__(self, ks, args): super(AGSRNet, self).__init__() self.lr_dim = args.lr_dim self.hr_dim = args.hr_...
2,730
30.034091
79
py
AGSR-Net
AGSR-Net-master/layers.py
import torch import torch.nn as nn import numpy as np import torch.nn.functional as F import matplotlib.pyplot as plt from initializations import * from preprocessing import normalize_adj_torch class GSRLayer(nn.Module): def __init__(self, hr_dim): super(GSRLayer, self).__init__() self.weights =...
2,087
29.26087
78
py
AGSR-Net
AGSR-Net-master/ops.py
import torch import torch.nn as nn import numpy as np class GraphUnpool(nn.Module): def __init__(self): super(GraphUnpool, self).__init__() def forward(self, A, X, idx): new_X = torch.zeros([A.shape[0], X.shape[1]]) new_X[idx] = X return A, new_X class GraphPool(nn.Module):...
2,688
25.623762
63
py
AGSR-Net
AGSR-Net-master/train.py
import torch import torch.nn as nn import numpy as np import matplotlib.pyplot as plt from preprocessing import * from model import * import torch.optim as optim criterion = nn.MSELoss() def train(model, subjects_adj, subjects_labels, args): bce_loss = nn.BCELoss() netD = Discriminator(args) print(netD)...
4,608
35.872
88
py
Q16
Q16-main/main/clip_classifier/classify/utils.py
import torch import clip import pickle class ClipWrapper(torch.nn.Module): def __init__(self, device, model_name='ViT-B/16'): super(ClipWrapper, self).__init__() self.clip_model, self.preprocess = clip.load(model_name, device, jit=False) self.clip_model.eval() def forward(self, x): ...
1,368
32.390244
86
py
Q16
Q16-main/main/models/clip.py
import torch import clip class ClipVisionModel(torch.nn.Module): def __init__(self, language_model, num_classes, device, fine_tune=False): super(ClipVisionModel, self).__init__() self.MMM, self.preprocess = clip.load(language_model.split('_')[1], device, jit=False) self.MMM.to(device) ...
4,122
40.23
114
py
Q16
Q16-main/main/models/baseline.py
from __future__ import print_function from __future__ import division import torch import torch.nn as nn import torchvision from torchvision import datasets, models, transforms import clip print("PyTorch Version: ", torch.__version__) print("Torchvision Version: ", torchvision.__version__) resnet_transforms = { '...
2,501
34.742857
108
py
Q16
Q16-main/main/wordclouds/utils.py
import os import matplotlib.pyplot as plt from wordcloud import WordCloud import re import copy import multidict as multidict import scipy.io import pickle import pandas as pd import numpy as np from tqdm import tqdm import torch import PIL import glob from numpy import genfromtxt import multiprocessing import itertool...
21,974
39.769944
119
py
Q16
Q16-main/main/paper_experiments/experiments.py
import argparse import torch from PIL import Image from matplotlib.colors import LinearSegmentedColormap from torchvision.transforms import Normalize import os from tqdm import tqdm import glob import pickle from main.models.clip import ClipSimModel_Infer parser = argparse.ArgumentParser() parser.add_argument('-g', '-...
5,380
41.706349
120
py
Q16
Q16-main/main/paper_experiments/smid_utils.py
import torch import matplotlib.pyplot as plt import seaborn as sns import torchmetrics sns.set_style("whitegrid") def accuracy(y_pred, y_gt, cm): y_pred_tag = torch.argmax(y_pred, dim=-1) for i in range(len(cm)): for j in range(len(cm)): cm[i][j] += (y_pred_tag[y_gt == i] == j).sum().int(...
1,290
25.895833
74
py
Q16
Q16-main/main/paper_experiments/check_datasets/eval_openimages_train.py
from main.paper_experiments.experiments import torch, parser from main.paper_experiments.experiments import run_model_imagefolder torch.set_num_threads(6) parser.add_argument('--dir_name', type=str, default='/workspace/datasets/openimagesv6/train') args = parser.parse_args() dir_name = args.dir_name save_dir = 'openi...
400
32.416667
93
py
Q16
Q16-main/main/paper_experiments/check_datasets/eval_imagenet.py
from main.paper_experiments.experiments import torch, parser from main.paper_experiments.experiments import run_model_imagefolder torch.set_num_threads(6) parser.add_argument('--dir_name', type=str, default='/workspace/datasets/imagenet1k/train') args = parser.parse_args() dir_name = args.dir_name save_dir = 'imagen...
381
28.384615
91
py
Q16
Q16-main/main/paper_experiments/check_datasets/eval_openimages_test.py
from main.paper_experiments.experiments import torch, parser from main.paper_experiments.experiments import run_model_imagefolder torch.set_num_threads(6) parser.add_argument('--dir_name', type=str, default='/workspace/datasets/openimagesv6/test') args = parser.parse_args() dir_name = args.dir_name save_dir = 'openi...
399
29.769231
92
py
Q16
Q16-main/main/paper_experiments/check_datasets/eval_imagenet_val.py
from main.paper_experiments.experiments import torch, parser from main.paper_experiments.experiments import run_model_imagefolder torch.set_num_threads(6) parser.add_argument('--dir_name', type=str, default='/workspace/datasets/imagenet1k/val') args = parser.parse_args() dir_name = args.dir_name save_dir = 'imagenet1...
376
30.416667
89
py
Q16
Q16-main/main/paper_experiments/check_datasets/eval_openimages_val.py
from main.paper_experiments.experiments import torch, parser from main.paper_experiments.experiments import run_model_imagefolder torch.set_num_threads(6) parser.add_argument('--dir_name', type=str, default='/workspace/datasets/openimagesv6/validation') args = parser.parse_args() dir_name = args.dir_name save_dir = '...
403
32.666667
98
py
nerfuser
nerfuser-main/nerfuser/view_blender.py
import shutil from collections import defaultdict from types import MethodType import imageio import numpy as np import torch from nerfstudio.cameras.cameras import Cameras from nerfstudio.data.scene_box import SceneBox from nerfstudio.models.nerfacto import NerfactoModelConfig from tqdm import trange from nerfuser.c...
11,896
50.502165
182
py
nerfuser
nerfuser-main/nerfuser/components.py
import torch from jaxtyping import Float from nerfstudio.cameras.rays import RayBundle from nerfstudio.field_components.field_heads import FieldHeadNames from nerfstudio.model_components.renderers import RGBRenderer from torch import Tensor def get_nerfacto_outputs(self, ray_bundle: RayBundle): ray_samples = self...
2,785
39.970588
157
py
nerfuser
nerfuser-main/nerfuser/registration.py
import json import re import shutil from collections import defaultdict from dataclasses import dataclass, field from datetime import datetime from itertools import cycle from pathlib import Path from time import time from typing import Literal, Optional, Union import matplotlib.pyplot as plt import numpy as np import...
14,861
50.248276
309
py
nerfuser
nerfuser-main/nerfuser/view_renderer.py
import torch from nerfuser.view_blender import ViewBlender class ViewRenderer(ViewBlender): def __init__(self, model_method, model_name, load_dir, transform=None, load_step=None, chunk_size=None, device='cuda') -> None: if transform is None: transform = torch.eye(4) super().__init__(m...
651
45.571429
148
py
nerfuser
nerfuser-main/nerfuser/blending.py
import json from collections import defaultdict from dataclasses import dataclass, field from datetime import datetime from pathlib import Path from time import time from typing import Literal, Optional, Union import cv2 import imageio import numpy as np import torch import tyro from torchmetrics import PeakSignalNois...
11,822
52.017937
331
py
nerfuser
nerfuser-main/nerfuser/utils/utils.py
import json import numpy as np import torch from nerfstudio.process_data.colmap_utils import qvec2rotmat from scipy.spatial.transform import Rotation def ch_pose_spec(T, src, tgt, pose_type='c2w'): """ pose_spec: 0: x->right, y->front, z->up 1: x->right, y->down, z->front 2: x...
4,947
33.124138
146
py
DALL-E
DALL-E-master/dall_e/utils.py
import attr import math import torch import torch.nn as nn import torch.nn.functional as F logit_laplace_eps: float = 0.1 @attr.s(eq=False) class Conv2d(nn.Module): n_in: int = attr.ib(validator=lambda i, a, x: x >= 1) n_out: int = attr.ib(validator=lambda i, a, x: x >= 1) kw: int = attr.ib(validator=lambda i...
1,840
29.683333
81
py
DALL-E
DALL-E-master/dall_e/encoder.py
import attr import numpy as np import torch import torch.nn as nn import torch.nn.functional as F from collections import OrderedDict from functools import partial from dall_e.utils import Conv2d @attr.s(eq=False, repr=False) class EncoderBlock(nn.Module): n_in: int = attr.ib(validator=lambda i, a, x: x >= ...
3,775
39.170213
117
py
DALL-E
DALL-E-master/dall_e/decoder.py
import attr import numpy as np import torch import torch.nn as nn import torch.nn.functional as F from collections import OrderedDict from functools import partial from dall_e.utils import Conv2d @attr.s(eq=False, repr=False) class DecoderBlock(nn.Module): n_in: int = attr.ib(validator=lambda i, a, x: x >= ...
3,936
40.442105
117
py
DALL-E
DALL-E-master/dall_e/__init__.py
import io, requests import torch import torch.nn as nn from dall_e.encoder import Encoder from dall_e.decoder import Decoder from dall_e.utils import map_pixels, unmap_pixels def load_model(path: str, device: torch.device = None) -> nn.Module: if path.startswith('http://') or path.startswith('https://'): ...
595
30.368421
68
py
biomedical
biomedical-main/streamlit_demo/vis_data_card.py
# from matplotlib_venn import venn2, venn3 import json import numpy as np import pandas as pd import plotly.graph_objects as go import plotly.io as pio from datasets import load_dataset from plotly.subplots import make_subplots from rich import print as rprint from collections import Counter from ngram import get_tu...
13,350
31.80344
110
py
Stark
Stark-main/external/AR/ltr/run_training.py
import os import sys import argparse import importlib import multiprocessing import cv2 as cv import torch.backends.cudnn env_path = os.path.join(os.path.dirname(__file__), '..') if env_path not in sys.path: sys.path.append(env_path) import ltr.admin.settings as ws_settings def run_training(train_module, train_...
1,817
31.464286
132
py
Stark
Stark-main/external/AR/ltr/train_settings/bbreg/atom_prob_ml.py
import torch.optim as optim from ltr.dataset import Lasot, TrackingNet, MSCOCOSeq, Got10k from ltr.data import processing, sampler, LTRLoader import ltr.models.bbreg.atom as atom_models import ltr.models.loss.kl_regression as klreg_losses import ltr.actors.bbreg as bbreg_actors from ltr.trainers import LTRTrainer impor...
5,470
54.826531
133
py
Stark
Stark-main/external/AR/ltr/train_settings/bbreg/atom.py
import torch.nn as nn import torch.optim as optim from ltr.dataset import Lasot, TrackingNet, MSCOCOSeq, Got10k from ltr.data import processing, sampler, LTRLoader import ltr.models.bbreg.atom as atom_models from ltr import actors from ltr.trainers import LTRTrainer import ltr.data.transforms as tfm def run(settings)...
5,194
53.114583
133
py
Stark
Stark-main/external/AR/ltr/train_settings/bbreg/atom_paper.py
import torch.nn as nn import torch.optim as optim from ltr.dataset import Lasot, TrackingNet, MSCOCOSeq from ltr.data import processing, sampler, LTRLoader import ltr.models.bbreg.atom as atom_models from ltr import actors from ltr.trainers import LTRTrainer import ltr.data.transforms as tfm def run(settings): # ...
5,105
52.747368
133
py
Stark
Stark-main/external/AR/ltr/train_settings/bbreg/atom_gmm_sampl.py
import torch.nn as nn import torch.optim as optim from ltr.dataset import Lasot, TrackingNet, MSCOCOSeq, Got10k from ltr.data import processing, sampler, LTRLoader import ltr.models.bbreg.atom as atom_models from ltr import actors from ltr.trainers import LTRTrainer import ltr.data.transforms as tfm def run(settings)...
5,339
54.051546
133
py
Stark
Stark-main/external/AR/ltr/train_settings/dimp/prdimp50.py
import torch.optim as optim from ltr.dataset import Lasot, Got10k, TrackingNet, MSCOCOSeq from ltr.data import processing, sampler, LTRLoader from ltr.models.tracking import dimpnet import ltr.models.loss as ltr_losses import ltr.models.loss.kl_regression as klreg_losses import ltr.actors.tracking as tracking_actors fr...
6,832
55.471074
151
py
Stark
Stark-main/external/AR/ltr/train_settings/dimp/dimp18.py
import torch.nn as nn import torch.optim as optim from ltr.dataset import Lasot, Got10k, TrackingNet, MSCOCOSeq from ltr.data import processing, sampler, LTRLoader from ltr.models.tracking import dimpnet import ltr.models.loss as ltr_losses from ltr import actors from ltr.trainers import LTRTrainer import ltr.data.tran...
6,584
54.336134
133
py
Stark
Stark-main/external/AR/ltr/train_settings/dimp/dimp50.py
import torch.nn as nn import torch.optim as optim from ltr.dataset import Lasot, Got10k, TrackingNet, MSCOCOSeq from ltr.data import processing, sampler, LTRLoader from ltr.models.tracking import dimpnet import ltr.models.loss as ltr_losses from ltr import actors from ltr.trainers import LTRTrainer import ltr.data.tran...
6,649
54.416667
133
py
Stark
Stark-main/external/AR/ltr/train_settings/dimp/prdimp18.py
import torch.optim as optim from ltr.dataset import Lasot, Got10k, TrackingNet, MSCOCOSeq from ltr.data import processing, sampler, LTRLoader from ltr.models.tracking import dimpnet import ltr.models.loss as ltr_losses import ltr.models.loss.kl_regression as klreg_losses import ltr.actors.tracking as tracking_actors fr...
6,740
55.175
151
py
Stark
Stark-main/external/AR/ltr/train_settings/dimp/super_dimp.py
import torch.optim as optim from ltr.dataset import Lasot, Got10k, TrackingNet, MSCOCOSeq from ltr.data import processing, sampler, LTRLoader from ltr.models.tracking import dimpnet import ltr.models.loss as ltr_losses import ltr.models.loss.kl_regression as klreg_losses import ltr.actors.tracking as tracking_actors fr...
7,949
58.774436
133
py
Stark
Stark-main/external/AR/ltr/dataset/base_image_dataset.py
import torch.utils.data from ltr.data.image_loader import jpeg4py_loader class BaseImageDataset(torch.utils.data.Dataset): """ Base class for image datasets """ def __init__(self, name, root, image_loader=jpeg4py_loader): """ args: root - The root path to the dataset i...
2,421
25.043011
121
py
Stark
Stark-main/external/AR/ltr/dataset/ecssd.py
import os from .base_image_dataset import BaseImageDataset from ltr.data.image_loader import jpeg4py_loader, opencv_loader, imread_indexed import torch from collections import OrderedDict from ltr.admin.environment import env_settings from ltr.data.bounding_box_utils import masks_to_bboxes class ECSSD(BaseImageDatase...
3,059
35
120
py
Stark
Stark-main/external/AR/ltr/dataset/tracking_net.py
import torch import os import os.path import numpy as np import pandas import random from collections import OrderedDict from ltr.data.image_loader import jpeg4py_loader from .base_video_dataset import BaseVideoDataset from ltr.admin.environment import env_settings def list_sequences(root, set_ids): """ Lists al...
5,878
37.677632
169
py
Stark
Stark-main/external/AR/ltr/dataset/imagenetvid.py
import os from .base_video_dataset import BaseVideoDataset from ltr.data.image_loader import default_image_loader import xml.etree.ElementTree as ET import json import torch import random from collections import OrderedDict from ltr.admin.environment import env_settings def get_target_to_image_ratio(seq): anno = ...
7,174
43.290123
120
py
Stark
Stark-main/external/AR/ltr/dataset/vos_base.py
import torch from pathlib import Path from collections import OrderedDict, defaultdict import json import numpy as np import os from .base_video_dataset import BaseVideoDataset from ltr.data.image_loader import jpeg4py_loader, imread_indexed from ltr.data.bounding_box_utils import masks_to_bboxes class VOSMeta: ...
16,000
39.102757
137
py
Stark
Stark-main/external/AR/ltr/dataset/lasot.py
import os import os.path import torch import numpy as np import pandas import csv import random from collections import OrderedDict from .base_video_dataset import BaseVideoDataset from ltr.data.image_loader import jpeg4py_loader from ltr.admin.environment import env_settings class Lasot(BaseVideoDataset): """ La...
6,537
37.686391
130
py
Stark
Stark-main/external/AR/ltr/dataset/synthetic_video_blend.py
from collections import OrderedDict from .base_video_dataset import BaseVideoDataset from ltr.data.bounding_box_utils import masks_to_bboxes import random import torch class SyntheticVideoBlend(BaseVideoDataset): """ Create a synthetic video by applying random transformations to an object (foreground) and pas...
6,943
41.601227
113
py
Stark
Stark-main/external/AR/ltr/dataset/hku_is.py
import os from .base_image_dataset import BaseImageDataset from ltr.data.image_loader import jpeg4py_loader, opencv_loader, imread_indexed import torch from collections import OrderedDict from ltr.admin.environment import env_settings from ltr.data.bounding_box_utils import masks_to_bboxes class HKUIS(BaseImageDatase...
3,080
32.857143
120
py