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 |
|---|---|---|---|---|---|---|
adversarial_ntk_evolution | adversarial_ntk_evolution-master/data.py | import torch
import numpy as np
import torchvision
transform_train = torchvision.transforms.Compose([
torchvision.transforms.ToTensor(),
])
def get_loader(dataset_name, train = True, batch_size = 128, shuffle = True):
if dataset_name == 'cifar10':
dataset = torchvision.datasets.CIFAR10(root='./data', ... | 1,368 | 41.78125 | 117 | py |
adversarial_ntk_evolution | adversarial_ntk_evolution-master/eval_and_make_adv.py | import jax
import haiku as hk
import jax.numpy as jnp
from jax.example_libraries import optimizers
import torch
import torchvision
import torchvision.transforms as transforms
from torch.utils.data import Dataset
import numpy as np
import neural_tangents as nt
import functools
import operator
import optax
import copy
im... | 5,638 | 43.401575 | 381 | py |
adversarial_ntk_evolution | adversarial_ntk_evolution-master/models.py | import jax
import haiku as hk
import jax.numpy as jnp
from jax.example_libraries import optimizers
import torch
import torchvision
import torchvision.transforms as transforms
from torch.utils.data import Dataset
import numpy as np
import neural_tangents as nt
import functools
import operator
import optax
import copy
im... | 2,491 | 29.024096 | 145 | py |
adversarial_ntk_evolution | adversarial_ntk_evolution-master/modified_resnets.py | #Copied from Deepmind Haiku library
"""Resnet."""
import types
from typing import Mapping, Optional, Sequence, Union, Any
from haiku._src import basic
from haiku._src import batch_norm
from haiku._src import conv
from haiku._src import module
from haiku._src import pool
import jax
import jax.numpy as jnp
# If forkin... | 22,689 | 34.676101 | 167 | py |
big_transfer | big_transfer-master/bit_jax/models.py | # Copyright 2020 Google LLC
#
# 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 required by applicable law or agreed to in writing, ... | 4,397 | 25.493976 | 75 | py |
big_transfer | big_transfer-master/bit_jax/train.py | # Copyright 2020 Google LLC
#
# 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 required by applicable law or agreed to in writing, ... | 5,183 | 32.662338 | 79 | py |
big_transfer | big_transfer-master/bit_pytorch/models.py | # Copyright 2020 Google LLC
#
# 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 required by applicable law or agreed to in writing, ... | 7,962 | 40.691099 | 132 | py |
big_transfer | big_transfer-master/bit_pytorch/fewshot.py | # Copyright 2020 Google LLC
#
# 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 required by applicable law or agreed to in writing, ... | 2,508 | 31.584416 | 93 | py |
big_transfer | big_transfer-master/bit_pytorch/train.py | # Copyright 2020 Google LLC
#
# 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 required by applicable law or agreed to in writing, ... | 10,239 | 34.555556 | 124 | py |
big_transfer | big_transfer-master/bit_tf2/models.py | # Copyright 2020 Google LLC
#
# 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 required by applicable law or agreed to in writing, ... | 9,000 | 31.261649 | 79 | py |
big_transfer | big_transfer-master/bit_tf2/normalization.py | # Copyright 2020 Google LLC
#
# 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 required by applicable law or agreed to in writing, ... | 5,692 | 39.664286 | 80 | py |
big_transfer | big_transfer-master/bit_tf2/train.py | # Copyright 2020 Google LLC
#
# 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 required by applicable law or agreed to in writing, ... | 5,417 | 34.181818 | 90 | py |
tirg | tirg-master/main.py | # Copyright 2019 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
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agree... | 10,540 | 34.372483 | 97 | py |
tirg | tirg-master/test_retrieval.py | # Copyright 2018 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
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agree... | 4,735 | 34.343284 | 80 | py |
tirg | tirg-master/text_model.py | # Copyright 2018 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
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agree... | 4,013 | 30.359375 | 80 | py |
tirg | tirg-master/img_text_composition_models.py | # Copyright 2019 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
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agree... | 8,478 | 32.121094 | 80 | py |
tirg | tirg-master/torch_functions.py |
# TODO(lujiang): put it into the third-party
# MIT License
# Copyright (c) 2018 Nam Vo
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the... | 4,133 | 31.046512 | 80 | py |
tirg | tirg-master/datasets.py | # Copyright 2019 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
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agree... | 16,642 | 30.520833 | 84 | py |
tirg | tirg-master/third_party/torch_functions.py | # Copyright (c) 2018 Nam Vo
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, s... | 4,072 | 31.584 | 80 | py |
2s-AGCN | 2s-AGCN-master/main.py | #!/usr/bin/env python
from __future__ import print_function
import argparse
import inspect
import os
import pickle
import random
import shutil
import time
from collections import OrderedDict
import numpy as np
# torch
import torch
import torch.backends.cudnn as cudnn
import torch.nn as nn
import torch.optim as optim
... | 22,084 | 37.143351 | 120 | py |
2s-AGCN | 2s-AGCN-master/model/agcn.py | import math
import numpy as np
import torch
import torch.nn as nn
from torch.autograd import Variable
def import_class(name):
components = name.split('.')
mod = __import__(components[0])
for comp in components[1:]:
mod = getattr(mod, comp)
return mod
def conv_branch_init(conv, branches):
... | 5,882 | 30.972826 | 111 | py |
2s-AGCN | 2s-AGCN-master/model/aagcn.py | import math
import numpy as np
import torch
import torch.nn as nn
from torch.autograd import Variable
def import_class(name):
components = name.split('.')
mod = __import__(components[0])
for comp in components[1:]:
mod = getattr(mod, comp)
return mod
def conv_branch_init(conv, branches):
... | 13,013 | 36.504323 | 116 | py |
2s-AGCN | 2s-AGCN-master/data_gen/kinetics_gendata.py | import argparse
import os
import numpy as np
import json
from torch.utils.data import Dataset
import pickle
from tqdm import tqdm
num_joint = 18
max_frame = 300
num_person_out = 2
num_person_in = 5
class Feeder_kinetics(Dataset):
""" Feeder for skeleton-based action recognition in kinetics-skeleton dataset
#... | 6,090 | 32.467033 | 96 | py |
2s-AGCN | 2s-AGCN-master/feeders/feeder.py | import numpy as np
import pickle
import torch
from torch.utils.data import Dataset
import sys
sys.path.extend(['../'])
from feeders import tools
class Feeder(Dataset):
def __init__(self, data_path, label_path,
random_choose=False, random_shift=False, random_move=False,
window_si... | 7,161 | 34.81 | 116 | py |
GA_CARS_2020 | GA_CARS_2020-master/GA_Family_Selection.py | from typing import List
import tensorflow as tf
import numpy as np
import os
from deap import base
from deap import creator
from deap import tools
from keras.callbacks import EarlyStopping, ModelCheckpoint
from sklearn.model_selection import train_test_split
from tqdm import tqdm
import time
from sklearn.metrics import... | 26,115 | 34.196765 | 118 | py |
GA_CARS_2020 | GA_CARS_2020-master/Feature_Selection_Baselines.py | import os
import tensorflow as tf
import numpy as np
import random
from keras import Sequential
from keras.layers import Dense
from keras.callbacks import EarlyStopping, ModelCheckpoint
from keras.models import load_model
from sklearn.metrics import roc_auc_score
from tqdm import tqdm
from sklearn.model_selection impor... | 8,391 | 33.821577 | 118 | py |
GA_CARS_2020 | GA_CARS_2020-master/base_solution.py | import gc
import json
import os
import random
import time
from operator import attrgetter
from typing import List
import keras.backend as K
import numpy as np
import tensorflow as tf
from deap import base
from deap import creator
from deap import tools
from keras.callbacks import EarlyStopping, ModelCheckpoint
from ke... | 23,227 | 34.462595 | 115 | py |
GRAND-plus | GRAND-plus-main/model_mag.py | from __future__ import division
from __future__ import print_function
import sys
import time
import argparse
import numpy as np
import scipy.sparse as sp
from precompute import propagation
import torch
import torch.nn.functional as F
import torch.nn as nn
import torch.optim as optim
from torch_scatter import scatter
fr... | 17,036 | 39.954327 | 147 | py |
GRAND-plus | GRAND-plus-main/model.py | from __future__ import division
from __future__ import print_function
import sys
sys.path.append("..")
import time
import argparse
import numpy as np
import scipy.sparse as sp
from precompute import propagation
import torch
import torch.nn.functional as F
import torch.nn as nn
import torch.optim as optim
from torch_sca... | 15,190 | 39.401596 | 147 | py |
GRAND-plus | GRAND-plus-main/utils/data_loader.py | import sys
import pickle as pkl
import networkx as nx
import numpy as np
import scipy.sparse as sp
from sklearn.preprocessing import StandardScaler
import torch
from utils.make_dataset import get_dataset, get_train_val_test_split
import os
from sklearn import metrics
def load_data(dataset_str='cora', split_seed=0, ... | 7,494 | 39.295699 | 141 | py |
BiGCN | BiGCN-master/tools/earlystopping2class.py | import numpy as np
import torch
class EarlyStopping:
"""Early stops the training if validation loss doesn't improve after a given patience."""
def __init__(self, patience=7, verbose=False):
"""
Args:
patience (int): How long to wait after last time validation loss improved.
... | 2,599 | 36.681159 | 134 | py |
BiGCN | BiGCN-master/tools/earlystopping.py | import numpy as np
import torch
class EarlyStopping:
"""Early stops the training if validation loss doesn't improve after a given patience."""
def __init__(self, patience=7, verbose=False):
"""
Args:
patience (int): How long to wait after last time validation loss improved.
... | 2,208 | 35.816667 | 122 | py |
BiGCN | BiGCN-master/Process/dataset.py | import os
import numpy as np
import torch
import random
from torch.utils.data import Dataset
from torch_geometric.data import Data
class GraphDataset(Dataset):
def __init__(self, fold_x, treeDic,lower=2, upper=100000, droprate=0,
data_path=os.path.join('..','..', 'data', 'Weibograph')):
se... | 4,936 | 40.141667 | 128 | py |
BiGCN | BiGCN-master/model/Weibo/BiGCN_Weibo.py | import sys,os
sys.path.append(os.getcwd())
from Process.process import *
import torch as th
from torch_scatter import scatter_mean
import torch.nn.functional as F
import numpy as np
from tools.earlystopping2class import EarlyStopping
from torch_geometric.data import DataLoader
from tqdm import tqdm
from Process.rand5fo... | 16,447 | 58.379061 | 168 | py |
BiGCN | BiGCN-master/model/Twitter/BiGCN_Twitter.py | import sys,os
sys.path.append(os.getcwd())
from Process.process import *
import torch as th
from torch_scatter import scatter_mean
import torch.nn.functional as F
import numpy as np
from tools.earlystopping import EarlyStopping
from torch_geometric.data import DataLoader
from tqdm import tqdm
from Process.rand5fold imp... | 15,749 | 54.65371 | 139 | py |
segodsidb | segodsidb-main/setup.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import setuptools
import unittest
# Read the contents of the README file
from os import path
this_directory = path.abspath(path.dirname(__file__))
with open(path.join(this_directory, 'README.md'), encoding='utf-8') as f:
long_description = f.read()
setuptools.setup(na... | 1,699 | 28.310345 | 73 | py |
segodsidb | segodsidb-main/src/generate_odsi_db_split.py | """
@brief Script that generates a convenient split of training and testing
images for the ODSI-DB dataset. Then you can split the training fold
into training and validation however you want, but this is expected to
be done in your dataloader.
@details A convenient dataset must have at le... | 16,274 | 34.927152 | 82 | py |
segodsidb | segodsidb-main/src/test.py | """
@brief Main script to launch the testing process.
@author Luis Carlos Garcia Peraza Herrera (luiscarlos.gph@gmail.com).
@date 5 Jun 2021.
"""
import argparse
import collections
import torch
import numpy as np
import tqdm
import json
import cv2
import skimage.color
# My imports
import torchseg.config.parser
imp... | 13,865 | 34.92228 | 100 | py |
segodsidb | segodsidb-main/src/generate_rgb_recon.py | """
@brief Script that reconstructs the RGB images of the ODSI-DB dataset and
saves them in output folders, one per camera.
- Nuance EX (1392x1040 pixels, 450-950nm, 10nm steps).
- Specim IQ (512x512 pixels, 400-1000nm, 3nm steps).
@author Luis Carlos Garcia Peraza Herrera (luiscarlos.gp... | 4,659 | 32.52518 | 93 | py |
segodsidb | segodsidb-main/src/compute_specim_iq_mean.py | """
@brief Compute the channel mean of the Specim IQ images.
@author Luis Carlos Garcia Peraza Herrera (luiscarlos.gph@gmail.com).
@date 16 Feb 2022.
"""
import argparse
import numpy as np
import os
import ntpath
import shutil
import tqdm
import cv2
import sys
# My imports
import torchseg.data_loader as dl
imp... | 3,733 | 26.659259 | 80 | py |
segodsidb | segodsidb-main/src/validate_dataset.py | """
@brief Script to validate the hyperspectral data of ODSI-DB along with the
generation of RGB images from hyperspectral data.
@author Luis Carlos Garcia Peraza Herrera (luiscarlos.gph@gmail.com).
@date 27 Sep 2021.
"""
import argparse
import numpy as np
import os
import tqdm
import random
import pan... | 4,126 | 29.57037 | 82 | py |
segodsidb | segodsidb-main/src/compute_all_hyper_450_950_51_mean.py | """
@brief Compute the channel mean of the 51 interpolated bands from
450-950nm.
@author Luis Carlos Garcia Peraza Herrera (luiscarlos.gph@gmail.com).
@date 21 Jun 2022.
"""
import argparse
import numpy as np
import os
import ntpath
import shutil
import tqdm
import cv2
import sys
# My imports
import ... | 3,960 | 27.912409 | 80 | py |
segodsidb | segodsidb-main/src/compute_all_hyper_450_950_170_mean.py | """
@brief Compute the channel mean of the 170 interpolated bands from
450-950nm.
@author Luis Carlos Garcia Peraza Herrera (luiscarlos.gph@gmail.com).
@date 21 Jun 2022.
"""
import argparse
import numpy as np
import os
import ntpath
import shutil
import tqdm
import cv2
import sys
# My imports
import... | 3,964 | 27.941606 | 80 | py |
segodsidb | segodsidb-main/src/generate_tsne.py | """
@brief Script that generates a t-SNE of all the pixels in the ODSI-DB dataset,
comparing RGB pixels with hyperspectral pixels.
@author Luis Carlos Garcia Peraza Herrera (luiscarlos.gph@gmail.com).
@date 27 Sep 2021.
"""
import argparse
import numpy as np
import os
import tqdm
import random
import p... | 20,785 | 42.668067 | 102 | py |
segodsidb | segodsidb-main/src/generate_results_latex.py | """
@brief Script that generates a Latex table where every row represents a class
and every column represents a cross-validation fold. The cells will
contain the metric, which for ODSI-DB we have decided will be balanced
accuracy.
@author Luis Carlos Garcia Peraza Herrera (luiscarlos.gph@... | 5,686 | 30.41989 | 98 | py |
segodsidb | segodsidb-main/src/split_images_per_camera_model.py | """
@brief Script that splits ODSI-DB dataset into two parts: images generated
by the Nuance EX (1392x1040 pixels, 450-950nm, 10nm steps) and the
Specim IQ (512x512 pixels, 400-1000nm, 3nm steps).
@author Luis Carlos Garcia Peraza Herrera (luiscarlos.gph@gmail.com).
@date 27 Sep 2021.
"""
imp... | 3,860 | 30.137097 | 82 | py |
segodsidb | segodsidb-main/src/compute_all_hyper_400_1000_204_std.py | """
@brief Compute the channel std of the 204 interpolated bands from
400-1000nm.
@author Luis Carlos Garcia Peraza Herrera (luiscarlos.gph@gmail.com).
@date 8 Jul 2022.
"""
import argparse
import numpy as np
import os
import ntpath
import shutil
import tqdm
import cv2
import sys
# My imports
import t... | 5,487 | 29.831461 | 78 | py |
segodsidb | segodsidb-main/src/compute_specim_iq_std.py | """
@brief Compute the channel std of the Specim IQ images.
@author Luis Carlos Garcia Peraza Herrera (luiscarlos.gph@gmail.com).
@date 16 Feb 2022.
"""
import argparse
import numpy as np
import os
import ntpath
import shutil
import tqdm
import cv2
import sys
# My imports
import torchseg.data_loader as dl
impo... | 4,105 | 27.713287 | 80 | py |
segodsidb | segodsidb-main/src/compute_all_hyper_400_1000_204_mean.py | """
@brief Compute the channel mean of the 204 interpolated bands from
400-1000nm. This script handles hyperspectral images from both
cameras, Nuance EX (450-950nm) and Specim IQ (400-1000nm).
@details The channels of both cameras are interpolated to a fixed range
define as:
np... | 5,821 | 30.989011 | 80 | py |
segodsidb | segodsidb-main/src/odsi_db_stats.py | """
@brief Script that show some ODSI-DB stats that are relevant for the paper:
- Number of images of 51 bands
- Number of images of 204 bands
- Number of pixels per class
- Number of images in which a class is annotated
@author Luis Carlos Garcia Peraza Herrera (luiscarlos.gph@g... | 5,669 | 31.4 | 97 | py |
segodsidb | segodsidb-main/src/compute_class_loss_weights.py | """
@brief Compute the weights for each class of the ODSI-DB dataset based on the
number of pixels of each class.
@author Luis Carlos Garcia Peraza Herrera (luiscarlos.gph@gmail.com).
@date 21 Jun 2022.
"""
# My imports
import torchseg.data_loader as dl
pixels_per_class = {
u'Skin': ... | 3,193 | 32.621053 | 90 | py |
segodsidb | segodsidb-main/src/compute_all_hyper_450_950_51_std.py | """
@brief Compute the channel std of the 51 interpolated bands from
450-950nm.
@author Luis Carlos Garcia Peraza Herrera (luiscarlos.gph@gmail.com).
@date 21 Jun 2022.
"""
import argparse
import numpy as np
import os
import ntpath
import shutil
import tqdm
import cv2
import sys
# My imports
import to... | 4,314 | 28.353741 | 78 | py |
segodsidb | segodsidb-main/src/compute_rgb_mean.py | """
@brief Compute the RGB channel mean of the ODSI-DB reconstructed images.
@author Luis Carlos Garcia Peraza Herrera (luiscarlos.gph@gmail.com).
@date 16 Feb 2022.
"""
import argparse
import numpy as np
import os
import ntpath
import shutil
import tqdm
import cv2
# My imports
import torchseg.data_loader as d... | 3,891 | 27.617647 | 80 | py |
segodsidb | segodsidb-main/src/compute_all_hyper_450_950_170_std.py | """
@brief Compute the channel std of the 170 interpolated bands from
450-950nm.
@author Luis Carlos Garcia Peraza Herrera (luiscarlos.gph@gmail.com).
@date 21 Jun 2022.
"""
import argparse
import numpy as np
import os
import ntpath
import shutil
import tqdm
import cv2
import sys
# My imports
import t... | 4,318 | 28.380952 | 78 | py |
segodsidb | segodsidb-main/src/compute_nuance_ex_mean.py | """
@brief Compute the channel mean of the Nuance EX images.
@author Luis Carlos Garcia Peraza Herrera (luiscarlos.gph@gmail.com).
@date 16 Feb 2022.
"""
import argparse
import numpy as np
import os
import ntpath
import shutil
import tqdm
import cv2
import sys
# My imports
import torchseg.data_loader as dl
imp... | 3,875 | 27.086957 | 80 | py |
segodsidb | segodsidb-main/src/compute_nuance_ex_std.py | """
@brief Compute the channel std of the Nuance EX images.
@author Luis Carlos Garcia Peraza Herrera (luiscarlos.gph@gmail.com).
@date 16 Feb 2022.
"""
import argparse
import numpy as np
import os
import ntpath
import shutil
import tqdm
import cv2
import sys
# My imports
import torchseg.data_loader as dl
impo... | 4,104 | 27.706294 | 80 | py |
segodsidb | segodsidb-main/src/compute_rgb_std.py | """
@brief Compute the std of the RGB images in the ODSI-DB dataset,
normalised to the range [0, 1].
@author Luis Carlos Garcia Peraza Herrera (luiscarlos.gph@gmail.com).
@date 16 Feb 2022.
"""
import argparse
import numpy as np
import os
import ntpath
import shutil
import tqdm
import cv2
# My imports... | 4,390 | 29.282759 | 80 | py |
segodsidb | segodsidb-main/src/validate_class_presence.py | """
@brief We want to use image-level annotations to learn the segmentation.
Therefore, we need to make sure that there is at least one image
(ideally more) where each of the classes is not present.
The opposite is not a concern, as we know that all the classes are
presen... | 4,147 | 30.664122 | 93 | py |
segodsidb | segodsidb-main/src/produce_cmf_plot.py | #!/usr/bin/env python3
#
# @brief Script to produce HSI to XYZ conversion colour matching function.
#
# @author Luis C. Garcia Peraza Herrera (luiscarlos.gph@gmail.com).
# @date 23 Aug 2022.
import numpy as np
import seaborn as sns
import matplotlib.pyplot as plt
# My imports
import torchseg.data_loader as dl
... | 4,371 | 31.626866 | 135 | py |
segodsidb | segodsidb-main/src/train.py | """
@brief Main script to kick off the training.
@author Luis Carlos Garcia Peraza Herrera (luiscarlos.gph@gmail.com).
@date 1 Jun 2021.
"""
import argparse
import collections
import torch
import numpy as np
# My imports
import torchseg.config.parser
import torchseg.data_loader
import torchseg.model
import torchs... | 4,439 | 34.238095 | 95 | py |
segodsidb | segodsidb-main/src/compute_pixel_stats.py | """
@brief Script that computes iteratively the mean and unbiased sample
standard deviation.
@author Luis Carlos Garcia Peraza Herrera (luiscarlos.gph@gmail.com).
@date 15 Dec 2021.
"""
import argparse
import numpy as np
import os
import copy
import tqdm
#import random
#import pandas as pd
#import sea... | 4,349 | 28.794521 | 80 | py |
segodsidb | segodsidb-main/src/data_loader/data_loader.py | """
@brief Collection of data loaders for different datasets.
@author Luis Carlos Garcia Peraza Herrera (luiscarlos.gph@gmail.com).
@date 2 Jun 2021.
"""
import os
import torch
import torchvision
import PIL
import numpy as np
import random
import colour
import scipy
import matplotlib.pyplot as plt
# My imports
imp... | 68,696 | 49.773836 | 120 | py |
segodsidb | segodsidb-main/src/config/parser.py | """
@brief Module that contains the ConfigParser class. It is a lightweight module
to read the configuration file and the command line parameters and
combine them into a single place.
@details The code in this module was inspired by:
https://github.com/victoresque/pytorch-template
@autho... | 7,569 | 35.570048 | 82 | py |
segodsidb | segodsidb-main/src/logger/logger.py | """
@brief Module to setup and maintain the logging abilities of the training and
validation scripts.
@author Luis Carlos Garcia Peraza Herrera (luiscarlos.gph@gmail.com).
@date 1 Jun 2021.
"""
import logging
import logging.config
import pathlib
import torchseg.utils
class LoggerSetup():
def __init__(... | 1,055 | 33.064516 | 79 | py |
segodsidb | segodsidb-main/src/visualization/visualization.py | """
@brief Module with classes for displaying, drawing and plotting information.
@author Luis Carlos Garcia Peraza Herrera (luiscarlos.gph@gmail.com).
@date 2 Jun 2021.
"""
import numpy as np
import importlib
import datetime
class TensorboardWriter():
def __init__(self, log_dir, logger, enabled):
self... | 3,424 | 35.827957 | 113 | py |
segodsidb | segodsidb-main/src/base/base_model.py | """
@brief Base class for deep learning models.
@author Luis Carlos Garcia Peraza Herrera (luiscarlos.gph@gmail.com).
@date 1 Jun 2021.
"""
import torch
import numpy as np
import abc
class BaseModel(torch.nn.Module):
"""
@brief Base class for all models.
"""
def from_file():
# TODO
... | 977 | 24.736842 | 79 | py |
segodsidb | segodsidb-main/src/base/base_data_loader.py | """
@brief Module with the definition of the base data loader.
@author Luis Carlos Garcia Peraza Herrera (luiscarlos.gph@gmail.com).
@date 1 Jun 2021.
"""
import numpy as np
import torch
class BaseDataLoader(torch.utils.data.DataLoader):
def __init__(self, dataset, batch_size, shuffle, validation_split... | 3,185 | 32.893617 | 82 | py |
segodsidb | segodsidb-main/src/base/base_machine.py | """
@brief Module with base learning machine. This class is meant to control the
training and validation processes for a particular problem or task.
@author Luis Carlos Garcia Peraza Herrera (luiscarlos.gph@gmail.com).
@date 2 Jun 2021.
"""
import torch
import abc
import numpy as np
# My imports
import tor... | 6,879 | 37.651685 | 90 | py |
segodsidb | segodsidb-main/src/utils/utils.py | """
@brief Collection of functions for general purpose use.
@author Luis Carlos Garcia Peraza Herrera (luiscarlos.gph@gmail.com).
@date 1 Jun 2021.
"""
import os
import re
import pathlib
import json
import collections
import torch
import pandas as pd
## ----- Functions ----- ##
def read_json(fname):
"""@b... | 3,464 | 29.9375 | 82 | py |
segodsidb | segodsidb-main/src/model/loss.py | """
@brief Module that contains loss functions.
@author Luis Carlos Garcia Peraza Herrera (luiscarlos.gph@gmail.com).
@date 1 Jun 2021.
"""
import numpy as np
import sys
import torch
import monai.losses
def nll_loss(pred, gt):
"""
@brief Negative log-likelihood loss (also called multi-class cross entropy... | 6,327 | 37.120482 | 89 | py |
segodsidb | segodsidb-main/src/model/model.py | """
@brief Collection of deep learning models.
@author Luis C. Garcia Peraza Herrera (luiscarlos.gph@gmail.com).
@date 4 Jun 2021.
"""
import torch
import torch.nn.functional as F
import torch.utils.model_zoo
import numpy as np
import monai.networks
import torchvision.models
import collections
import math
import u... | 23,154 | 38.446337 | 111 | py |
segodsidb | segodsidb-main/src/model/metric.py | """
@brief Module of evaluation measures or metrics.
@author Luis Carlos Garcia Peraza Herrera (luiscarlos.gph@gmail.com).
@date 2 Jun 2021.
"""
import torch
import numpy as np
import monai.metrics
import torchvision
# My imports
import torchseg.data_loader as dl
def accuracy(pred, gt):
"""
@brief Given... | 17,446 | 37.944196 | 82 | py |
segodsidb | segodsidb-main/src/machine/machine.py | """
@brief Module that contains the learning machine for each problem/task.
@author Luis Carlos Garcia Peraza Herrera (luiscarlos.gph@gmail.com).
@date 2 Jun 2021.
"""
import numpy as np
import torch
import torchvision.utils
# My imports
import torchseg.base
import torchseg.utils
class GenericMachine(torchseg.ba... | 8,241 | 38.435407 | 96 | py |
segodsidb | segodsidb-main/test/test_hyper2rgb.py | """
@brief Unit tests for the reconstruction of RGB images from hyperspectral data.
@author Luis Carlos Garcia Peraza Herrera (luiscarlos.gph@gmail.com).
@date 9 Feb 2022.
"""
import unittest
import numpy as np
import colour
import scipy
# My imports
import torchseg.data_loader
class TestReconstructionMethods(uni... | 1,182 | 27.166667 | 98 | py |
segodsidb | segodsidb-main/test/test_metric.py | """
@brief Unit tests for the reconstruction of RGB images from hyperspectral data.
@author Luis Carlos Garcia Peraza Herrera (luiscarlos.gph@gmail.com).
@date 9 Feb 2022.
"""
import unittest
import numpy as np
import colour
import scipy
# My imports
import torchseg.data_loader
class TestReconstructionMethods(uni... | 1,182 | 27.166667 | 98 | py |
DiffProxy | DiffProxy-main/generate.py | import os
import os.path as pth
import json
import numpy as np
import torch
from sbs_generators import generator_lookup_table
from differentiable_generator import StyleGANCond
from utils import read_image, write_image
sat_dir = 'C:/Program Files/Allegorithmic/Substance Automation Toolkit'
def compare2real():
gen... | 1,856 | 33.388889 | 101 | py |
DiffProxy | DiffProxy-main/sbs_generators.py | import os
import os.path as pth
import numbers
import shutil
import glob
import random
import torch
import numpy as np
from abc import ABC, abstractmethod
import xml.etree.ElementTree as ET
import json
import subprocess
from collections import OrderedDict
from utils import Timer, read_image, write_image
class SimpleS... | 19,510 | 37.107422 | 119 | py |
DiffProxy | DiffProxy-main/vgg.py | import os
import torch
import torch.nn as nn
import torch.nn.functional as F
vgg_path = 'pretrained/vgg_conv.pt'
# vgg definition that conveniently let's you grab the outputs from any layer
class VGG(nn.Module):
def __init__(self, pool='max'):
super(VGG, self).__init__()
# vgg modules
self... | 6,808 | 40.266667 | 109 | py |
DiffProxy | DiffProxy-main/loss.py | import torch.nn as nn
import vgg
from training.loss import *
class ProxyLoss:
def __init__(self, device, G, D, augment_pipe=None, r1_gamma=10, style_mixing_prob=0, pl_weight=0, pl_batch_shrink=2, pl_decay=0.01, pl_no_weight_grad=False, blur_init_sigma=0, blur_fade_kimg=0):
super().__init__()
self.... | 9,171 | 50.52809 | 199 | py |
DiffProxy | DiffProxy-main/differentiable_generator.py | import sys
import os.path as pth
import torch.nn as nn
import torch
import pickle
import cv2
from utils import read_image
from sbs_generators import generator_lookup_table, SBSGenerators
sys.path.append('stylegan')
sat_dir = 'C:/Program Files/Allegorithmic/Substance Automation Toolkit'
sbs_lib = {'arc_pavement': './da... | 5,747 | 32.811765 | 129 | py |
DiffProxy | DiffProxy-main/stylegan/legacy.py | # Copyright (c) 2021, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
#
# NVIDIA CORPORATION and its licensors retain all intellectual property
# and proprietary rights in and to this software, related documentation
# and any modifications thereto. Any use, reproduction, disclosure or
# distribution of this sof... | 16,561 | 50.117284 | 154 | py |
DiffProxy | DiffProxy-main/stylegan/train.py | # Copyright (c) 2021, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
#
# NVIDIA CORPORATION and its licensors retain all intellectual property
# and proprietary rights in and to this software, related documentation
# and any modifications thereto. Any use, reproduction, disclosure or
# distribution of this sof... | 16,998 | 53.483974 | 210 | py |
DiffProxy | DiffProxy-main/stylegan/training/loss.py | # Copyright (c) 2021, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
#
# NVIDIA CORPORATION and its licensors retain all intellectual property
# and proprietary rights in and to this software, related documentation
# and any modifications thereto. Any use, reproduction, disclosure or
# distribution of this sof... | 7,998 | 56.135714 | 199 | py |
DiffProxy | DiffProxy-main/stylegan/training/augment.py | # Copyright (c) 2021, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
#
# NVIDIA CORPORATION and its licensors retain all intellectual property
# and proprietary rights in and to this software, related documentation
# and any modifications thereto. Any use, reproduction, disclosure or
# distribution of this sof... | 26,617 | 59.910755 | 366 | py |
DiffProxy | DiffProxy-main/stylegan/training/dataset.py | # Copyright (c) 2021, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
#
# NVIDIA CORPORATION and its licensors retain all intellectual property
# and proprietary rights in and to this software, related documentation
# and any modifications thereto. Any use, reproduction, disclosure or
# distribution of this sof... | 8,642 | 35.16318 | 158 | py |
DiffProxy | DiffProxy-main/stylegan/training/training_loop_gan.py | # Copyright (c) 2021, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
#
# NVIDIA CORPORATION and its licensors retain all intellectual property
# and proprietary rights in and to this software, related documentation
# and any modifications thereto. Any use, reproduction, disclosure or
# distribution of this sof... | 21,150 | 49.239905 | 168 | py |
DiffProxy | DiffProxy-main/stylegan/training/training_loop_nogan.py | # Copyright (c) 2021, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
#
# NVIDIA CORPORATION and its licensors retain all intellectual property
# and proprietary rights in and to this software, related documentation
# and any modifications thereto. Any use, reproduction, disclosure or
# distribution of this sof... | 19,024 | 48.160207 | 168 | py |
DiffProxy | DiffProxy-main/stylegan/training/networks_stylegan2.py | # Copyright (c) 2021, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
#
# NVIDIA CORPORATION and its licensors retain all intellectual property
# and proprietary rights in and to this software, related documentation
# and any modifications thereto. Any use, reproduction, disclosure or
# distribution of this sof... | 40,302 | 49.695597 | 164 | py |
DiffProxy | DiffProxy-main/stylegan/training/networks_stylegan3.py | # Copyright (c) 2021, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
#
# NVIDIA CORPORATION and its licensors retain all intellectual property
# and proprietary rights in and to this software, related documentation
# and any modifications thereto. Any use, reproduction, disclosure or
# distribution of this sof... | 26,208 | 49.792636 | 141 | py |
DiffProxy | DiffProxy-main/stylegan/torch_utils/custom_ops.py | # Copyright (c) 2021, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
#
# NVIDIA CORPORATION and its licensors retain all intellectual property
# and proprietary rights in and to this software, related documentation
# and any modifications thereto. Any use, reproduction, disclosure or
# distribution of this sof... | 6,666 | 41.196203 | 146 | py |
DiffProxy | DiffProxy-main/stylegan/torch_utils/training_stats.py | # Copyright (c) 2021, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
#
# NVIDIA CORPORATION and its licensors retain all intellectual property
# and proprietary rights in and to this software, related documentation
# and any modifications thereto. Any use, reproduction, disclosure or
# distribution of this sof... | 10,720 | 38.855019 | 118 | py |
DiffProxy | DiffProxy-main/stylegan/torch_utils/persistence.py | # Copyright (c) 2021, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
#
# NVIDIA CORPORATION and its licensors retain all intellectual property
# and proprietary rights in and to this software, related documentation
# and any modifications thereto. Any use, reproduction, disclosure or
# distribution of this sof... | 9,752 | 37.702381 | 144 | py |
DiffProxy | DiffProxy-main/stylegan/torch_utils/misc.py | # Copyright (c) 2021, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
#
# NVIDIA CORPORATION and its licensors retain all intellectual property
# and proprietary rights in and to this software, related documentation
# and any modifications thereto. Any use, reproduction, disclosure or
# distribution of this sof... | 11,106 | 40.599251 | 133 | py |
DiffProxy | DiffProxy-main/stylegan/torch_utils/ops/bias_act.py | # Copyright (c) 2021, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
#
# NVIDIA CORPORATION and its licensors retain all intellectual property
# and proprietary rights in and to this software, related documentation
# and any modifications thereto. Any use, reproduction, disclosure or
# distribution of this sof... | 9,813 | 45.733333 | 185 | py |
DiffProxy | DiffProxy-main/stylegan/torch_utils/ops/grid_sample_gradfix.py | # Copyright (c) 2021, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
#
# NVIDIA CORPORATION and its licensors retain all intellectual property
# and proprietary rights in and to this software, related documentation
# and any modifications thereto. Any use, reproduction, disclosure or
# distribution of this sof... | 3,020 | 37.730769 | 132 | py |
DiffProxy | DiffProxy-main/stylegan/torch_utils/ops/conv2d_gradfix.py | # Copyright (c) 2021, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
#
# NVIDIA CORPORATION and its licensors retain all intellectual property
# and proprietary rights in and to this software, related documentation
# and any modifications thereto. Any use, reproduction, disclosure or
# distribution of this sof... | 9,465 | 46.567839 | 197 | py |
DiffProxy | DiffProxy-main/stylegan/torch_utils/ops/upfirdn2d.py | # Copyright (c) 2021, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
#
# NVIDIA CORPORATION and its licensors retain all intellectual property
# and proprietary rights in and to this software, related documentation
# and any modifications thereto. Any use, reproduction, disclosure or
# distribution of this sof... | 16,392 | 41.033333 | 120 | py |
DiffProxy | DiffProxy-main/stylegan/torch_utils/ops/filtered_lrelu.py | # Copyright (c) 2021, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
#
# NVIDIA CORPORATION and its licensors retain all intellectual property
# and proprietary rights in and to this software, related documentation
# and any modifications thereto. Any use, reproduction, disclosure or
# distribution of this sof... | 12,884 | 45.854545 | 164 | py |
DiffProxy | DiffProxy-main/stylegan/torch_utils/ops/conv2d_resample.py | # Copyright (c) 2021, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
#
# NVIDIA CORPORATION and its licensors retain all intellectual property
# and proprietary rights in and to this software, related documentation
# and any modifications thereto. Any use, reproduction, disclosure or
# distribution of this sof... | 6,765 | 45.986111 | 130 | py |
DiffProxy | DiffProxy-main/stylegan/torch_utils/ops/fma.py | # Copyright (c) 2021, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
#
# NVIDIA CORPORATION and its licensors retain all intellectual property
# and proprietary rights in and to this software, related documentation
# and any modifications thereto. Any use, reproduction, disclosure or
# distribution of this sof... | 2,047 | 32.57377 | 105 | py |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.