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 |
|---|---|---|---|---|---|---|
fl-analysis | fl-analysis-master/src/subspace/keras_ext/engine_topology.py | # Copyright (c) 2018 Uber Technologies, Inc.
#
# 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, pub... | 3,056 | 45.318182 | 119 | py |
fl-analysis | fl-analysis-master/src/subspace/keras_ext/util.py | # Copyright (c) 2018 Uber Technologies, Inc.
#
# 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, pub... | 6,451 | 38.10303 | 109 | py |
fl-analysis | fl-analysis-master/src/subspace/keras_ext/regularizers.py | # Copyright (c) 2018 Uber Technologies, Inc.
#
# 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, pub... | 3,830 | 30.925 | 80 | py |
fl-analysis | fl-analysis-master/src/subspace/keras_ext/rproj_layers.py | # Copyright (c) 2018 Uber Technologies, Inc.
#
# 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, pub... | 33,100 | 41.491656 | 116 | py |
fl-analysis | fl-analysis-master/src/data/emnist.py | import os
import h5py
import tensorflow as tf
import numpy as np
def load_data(only_digits=True, cache_dir=None):
"""Loads the Federated EMNIST dataset.
Downloads and caches the dataset locally. If previously downloaded, tries to
load the dataset from cache.
This dataset is derived from the Leaf repository
... | 3,842 | 43.172414 | 99 | py |
fl-analysis | fl-analysis-master/src/data/tf_data.py | import itertools
import math
import numpy as np
import tensorflow as tf
from tensorflow.python.keras.preprocessing.image import ImageDataGenerator
from src.data import image_augmentation
from src.data import emnist
class Dataset:
def __init__(self, x_train, y_train, batch_size=50, x_test=None, y_test=None):
... | 18,878 | 42.802784 | 135 | py |
fl-analysis | fl-analysis-master/src/data/image_augmentation.py |
import tensorflow as tf
import numpy as np
from tensorflow.keras.preprocessing.image import apply_affine_transform
def augment(image,label):
image = tf.image.random_flip_left_right(image)
image = tf.numpy_function(shift, [image], tf.float32)
image = normalize(image)
# debug(image, label)
return i... | 3,414 | 28.695652 | 88 | py |
fl-analysis | fl-analysis-master/src/data/tf_data_global.py | from collections import defaultdict
import numpy as np
from tensorflow.python.keras.preprocessing.image import ImageDataGenerator
import tensorflow as tf
from src.data import image_augmentation
import logging
class GlobalDataset:
"""
A GlobalDataset represents a dataset as a whole. It has two purposes.
-... | 10,891 | 41.054054 | 146 | py |
fl-analysis | fl-analysis-master/src/model/resnet.py | from __future__ import print_function
import tensorflow as tf
from tensorflow.keras.layers import Dense, Conv2D, BatchNormalization, Activation
from tensorflow.keras.layers import AveragePooling2D, Input, Flatten
from tensorflow.keras.optimizers import Adam
from tensorflow.keras.callbacks import ModelCheckpoint, Learni... | 15,635 | 36.317422 | 81 | py |
fl-analysis | fl-analysis-master/src/model/modelc.py |
import tensorflow.keras as keras
from tensorflow.keras.regularizers import l2
from tensorflow.keras import layers
def build_modelc(l2_reg):
do = 0.2
model = keras.Sequential()
# model.add(layers.Dropout(0.2, noise_shape=(32, 32, 3)))
model.add(layers.Conv2D(filters=96, kernel_size=3, strides=1, ker... | 2,230 | 73.366667 | 218 | py |
fl-analysis | fl-analysis-master/src/model/lenet.py |
import tensorflow.keras as keras
from tensorflow.keras import layers
from tensorflow.keras.regularizers import l2
def build_lenet5(input_shape=(32, 32, 3), l2_reg=None):
do = 0.0
regularizer = l2(l2_reg) if l2_reg is not None else None
model = keras.Sequential()
model.add(layers.Conv2D(filters=6, ... | 1,288 | 46.740741 | 220 | py |
fl-analysis | fl-analysis-master/src/model/test_model.py |
import tensorflow.keras as keras
from tensorflow.keras import layers
from tensorflow.keras.regularizers import l2
def build_test_model(input_shape=(32, 32, 3), l2_reg=None):
do = 0.0
regularizer = l2(l2_reg) if l2_reg is not None else None
model = keras.Sequential()
model.add(layers.Conv2D(filters... | 848 | 37.590909 | 220 | py |
fl-analysis | fl-analysis-master/src/model/mobilenet.py | # Implementation by https://github.com/ruchi15/CNN-MobileNetV2-Cifar10
import tensorflow as tf
import os
import warnings
import numpy as np
from tensorflow.keras.layers import Input, Activation, Conv2D, Dense, Dropout, BatchNormalization, ReLU, \
DepthwiseConv2D, GlobalAveragePooling2D, GlobalMaxPooling2D, Add
f... | 6,395 | 41.357616 | 129 | py |
fl-analysis | fl-analysis-master/src/model/stacked_lstm.py |
import tensorflow as tf
# class StackedLSTM(tf.keras.Model):
# def __init__(self, vocab_size, embedding_dim, n_hidden):
# super().__init__(self)
# self.embedding = tf.keras.layers.Embedding(vocab_size, embedding_dim)
#
# rnn_cells = [tf.keras.layers.LSTMCell(n_hidden) for _ in range(2)]
# stacked_l... | 1,762 | 31.054545 | 77 | py |
houghnet | houghnet-master/src/main.py | from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import sys
import os
sys.path.append(os.path.dirname(os.path.dirname(os.path.dirname(__file__))))
import src._init_paths
import os
import torch
import torch.utils.data
from src.lib.opts import opts
from src.... | 3,606 | 32.398148 | 78 | py |
houghnet | houghnet-master/src/test.py | from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import sys
import os
sys.path.append(os.path.dirname(os.path.dirname(os.path.dirname(__file__))))
import src._init_paths
import os
import json
import cv2
import numpy as np
import time
from progress.bar impor... | 4,351 | 32.476923 | 79 | py |
houghnet | houghnet-master/src/tools/convert_hourglass_weight.py | from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
MODEL_PATH = '../../models/ExtremeNet_500000.pkl'
OUT_PATH = '../../models/ExtremeNet_500000.pth'
import torch
state_dict = torch.load(MODEL_PATH)
key_map = {'t_heats': 'hm_t', 'l_heats': 'hm_l', 'b_heats': 'h... | 905 | 28.225806 | 69 | py |
houghnet | houghnet-master/src/tools/voc_eval_lib/model/config.py | from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import os
import os.path as osp
import numpy as np
# `pip install easydict` if you don't have it
from easydict import EasyDict as edict
__C = edict()
# Consumers can get config by:
# from fast_rcnn_config im... | 11,010 | 27.378866 | 91 | py |
houghnet | houghnet-master/src/lib/logger.py | from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
# Code referenced from https://gist.github.com/gyglim/1f8dfb1b5c82627ae3efcfbbadb9f514
import os
import time
import sys
import torch
USE_TENSORBOARD = True
try:
import tensorboardX
print('Using tensorboardX... | 2,228 | 29.534247 | 86 | py |
houghnet | houghnet-master/src/lib/detectors/exdet.py | from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import src._init_paths
import os
import cv2
import numpy as np
from progress.bar import Bar
import time
import torch
from src.lib.external.nms import soft_nms
from src.lib.models.decode import exct_decode, a... | 5,149 | 37.721805 | 80 | py |
houghnet | houghnet-master/src/lib/detectors/ctdet.py | from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import cv2
import numpy as np
from progress.bar import Bar
import time
import torch
from src.lib.external.nms import soft_nms
from src.lib.models.decode import ctdet_decode
from src.lib.models.utils import fli... | 3,566 | 37.771739 | 78 | py |
houghnet | houghnet-master/src/lib/detectors/ddd.py | from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import cv2
import numpy as np
from progress.bar import Bar
import time
import torch
from src.lib.external.nms import soft_nms
from src.lib.models.decode import ddd_decode
from src.lib.models.utils import flip_... | 4,110 | 37.783019 | 81 | py |
houghnet | houghnet-master/src/lib/detectors/multi_pose.py | from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import cv2
import numpy as np
from progress.bar import Bar
import time
import torch
from src.lib.external.nms import soft_nms_39
from src.lib.models.decode import multi_pose_decode
from src.lib.models.utils im... | 3,850 | 37.89899 | 79 | py |
houghnet | houghnet-master/src/lib/detectors/base_detector.py | from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import cv2
import numpy as np
from progress.bar import Bar
import time
import torch
from src.lib.models.model import create_model, load_model
from src.lib.utils.image import get_affine_transform
from src.lib.u... | 5,206 | 34.910345 | 116 | py |
houghnet | houghnet-master/src/lib/detectors/ctseg.py | from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import cv2
import numpy as np
from progress.bar import Bar
import time
import torch
from pycocotools import mask as mask_utils
try:
from external.nms import soft_nms
except:
print('NMS not imported! If... | 3,141 | 38.275 | 127 | py |
houghnet | houghnet-master/src/lib/models/decode.py | from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import torch
import torch.nn as nn
from .utils import _gather_feat, _tranpose_and_gather_feat
from detectron2.structures import Boxes # Each row is (x1, y1, x2, y2).
from detectron2.layers import paste_masks_i... | 24,358 | 36.824534 | 96 | py |
houghnet | houghnet-master/src/lib/models/losses.py | # ------------------------------------------------------------------------------
# Portions of this code are from
# CornerNet (https://github.com/princeton-vl/CornerNet)
# Copyright (c) 2018, University of Michigan
# Licensed under the BSD 3-Clause License
# -------------------------------------------------------------... | 12,420 | 35.212828 | 103 | py |
houghnet | houghnet-master/src/lib/models/data_parallel.py | import torch
from torch.nn.modules import Module
from torch.nn.parallel.scatter_gather import gather
from torch.nn.parallel.replicate import replicate
from torch.nn.parallel.parallel_apply import parallel_apply
from .scatter_gather import scatter_kwargs
class _DataParallel(Module):
r"""Implements data parallelis... | 5,176 | 39.445313 | 101 | py |
houghnet | houghnet-master/src/lib/models/utils.py | from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import torch
import torch.nn as nn
def _sigmoid(x):
y = torch.clamp(x.sigmoid_(), min=1e-4, max=1-1e-4)
return y
def _gather_feat(feat, ind, mask=None):
dim = feat.size(2)
ind = ind.unsqueeze(2)... | 1,570 | 30.42 | 65 | py |
houghnet | houghnet-master/src/lib/models/model.py | from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import torch
import torch.nn as nn
from .networks.msra_resnet import get_pose_net
from .networks.resnet_dcn import get_pose_net as get_pose_net_dcn
from .networks.large_hourglass import get_large_hourglass_net... | 3,752 | 37.295918 | 96 | py |
houghnet | houghnet-master/src/lib/models/scatter_gather.py | import torch
from torch.autograd import Variable
from torch.nn.parallel._functions import Scatter, Gather
def scatter(inputs, target_gpus, dim=0, chunk_sizes=None):
r"""
Slices variables into approximately equal chunks and
distributes them across given GPUs. Duplicates
references to objects that are n... | 1,535 | 38.384615 | 77 | py |
houghnet | houghnet-master/src/lib/models/networks/resnet_dcn.py | # ------------------------------------------------------------------------------
# Copyright (c) Microsoft
# Licensed under the MIT License.
# Written by Bin Xiao (Bin.Xiao@microsoft.com)
# Modified by Dequan Wang and Xingyi Zhou
# ------------------------------------------------------------------------------
from __f... | 10,495 | 34.221477 | 80 | py |
houghnet | houghnet-master/src/lib/models/networks/houghnet_large_hourglass.py | # ------------------------------------------------------------------------------
# This code is base on
# CornerNet (https://github.com/princeton-vl/CornerNet)
# Copyright (c) 2018, University of Michigan
# Licensed under the BSD 3-Clause License
# ----------------------------------------------------------------------... | 11,454 | 34.030581 | 118 | py |
houghnet | houghnet-master/src/lib/models/networks/houghnet_dcn.py | # ------------------------------------------------------------------------------
# Copyright (c) Microsoft
# Licensed under the MIT License.
# Written by Bin Xiao (Bin.Xiao@microsoft.com)
# Modified by Dequan Wang and Xingyi Zhou
# ------------------------------------------------------------------------------
from __f... | 11,486 | 34.673913 | 112 | py |
houghnet | houghnet-master/src/lib/models/networks/pose_dla_dcn.py | from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import os
import math
import logging
import numpy as np
from os.path import join
import torch
from torch import nn
import torch.nn.functional as F
import torch.utils.model_zoo as model_zoo
from .DCNv2.dcn_v2 ... | 17,594 | 34.617409 | 106 | py |
houghnet | houghnet-master/src/lib/models/networks/msra_resnet.py | # ------------------------------------------------------------------------------
# Copyright (c) Microsoft
# Licensed under the MIT License.
# Written by Bin Xiao (Bin.Xiao@microsoft.com)
# Modified by Xingyi Zhou
# ------------------------------------------------------------------------------
from __future__ import a... | 10,167 | 35.185053 | 94 | py |
houghnet | houghnet-master/src/lib/models/networks/large_hourglass.py | # ------------------------------------------------------------------------------
# This code is base on
# CornerNet (https://github.com/princeton-vl/CornerNet)
# Copyright (c) 2018, University of Michigan
# Licensed under the BSD 3-Clause License
# ----------------------------------------------------------------------... | 9,942 | 32.033223 | 118 | py |
houghnet | houghnet-master/src/lib/models/networks/houghnet_resnet.py | # ------------------------------------------------------------------------------
# Copyright (c) Microsoft
# Licensed under the MIT License.
# Written by Bin Xiao (Bin.Xiao@microsoft.com)
# Modified by Xingyi Zhou
# ------------------------------------------------------------------------------
from __future__ import a... | 13,125 | 36.289773 | 113 | py |
houghnet | houghnet-master/src/lib/models/networks/pose_dla_dcn_hough.py | from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import math
import logging
import numpy as np
from os.path import join
import torch
from torch import nn
import torch.nn.functional as F
import torch.utils.model_zoo as model_zoo
from src.lib.models.networks.... | 19,013 | 35.28626 | 111 | py |
houghnet | houghnet-master/src/lib/models/networks/dlav0.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import math
from os.path import join
import torch
from torch import nn
import torch.utils.model_zoo as model_zoo
import numpy as np
BatchNorm = nn.BatchNorm2d
d... | 22,681 | 34.003086 | 86 | py |
houghnet | houghnet-master/src/lib/models/networks/hough_module.py |
import torch
import torch.nn as nn
import numpy as np
PI = np.pi
class Hough(nn.Module):
def __init__(self, angle=90, R2_list=[4, 64, 256, 1024],
num_classes=80, region_num=9, vote_field_size=17,
voting_map_size_w=128, voting_map_size_h=128, model_v1=False):
super(Hough... | 4,491 | 34.370079 | 113 | py |
houghnet | houghnet-master/src/lib/models/networks/DCNv2/test.py | #!/usr/bin/env python
from __future__ import absolute_import
from __future__ import print_function
from __future__ import division
import time
import torch
import torch.nn as nn
from torch.autograd import gradcheck
from dcn_v2 import dcn_v2_conv, DCNv2, DCN
from dcn_v2 import dcn_v2_pooling, DCNv2Pooling, DCNPooling
... | 8,506 | 30.391144 | 81 | py |
houghnet | houghnet-master/src/lib/models/networks/DCNv2/setup.py | #!/usr/bin/env python
import os
import glob
import torch
from torch.utils.cpp_extension import CUDA_HOME
from torch.utils.cpp_extension import CppExtension
from torch.utils.cpp_extension import CUDAExtension
from setuptools import find_packages
from setuptools import setup
requirements = ["torch", "torchvision"]
... | 1,977 | 28.969697 | 73 | py |
houghnet | houghnet-master/src/lib/models/networks/DCNv2/dcn_v2.py | #!/usr/bin/env python
from __future__ import absolute_import
from __future__ import print_function
from __future__ import division
import math
import torch
from torch import nn
from torch.autograd import Function
from torch.nn.modules.utils import _pair
from torch.autograd.function import once_differentiable
import _... | 12,081 | 38.743421 | 92 | py |
houghnet | houghnet-master/src/lib/trains/exdet.py | from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import torch
import numpy as np
import cv2
import sys
import time
from src.lib.utils.debugger import Debugger
from src.lib.models.data_parallel import DataParallel
from src.lib.models.losses import FocalLoss, R... | 3,645 | 41.395349 | 79 | py |
houghnet | houghnet-master/src/lib/trains/ctdet.py | from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import torch
import numpy as np
from src.lib.models.losses import FocalLoss
from src.lib.models.losses import RegL1Loss, RegLoss, NormRegL1Loss, RegWeightedL1Loss
from src.lib.models.decode import ctdet_decode... | 5,574 | 41.234848 | 86 | py |
houghnet | houghnet-master/src/lib/trains/ddd.py | from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import torch
import numpy as np
from src.lib.models.losses import FocalLoss, L1Loss, BinRotLoss
from src.lib.models.decode import ddd_decode
from src.lib.models.utils import _sigmoid
from src.lib.utils.debugge... | 6,967 | 43.954839 | 80 | py |
houghnet | houghnet-master/src/lib/trains/multi_pose.py | from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import torch
import numpy as np
from src.lib.models.losses import FocalLoss, RegL1Loss, RegLoss, RegWeightedL1Loss
from src.lib.models.decode import multi_pose_decode
from src.lib.models.utils import _sigmoid,... | 7,300 | 44.347826 | 82 | py |
houghnet | houghnet-master/src/lib/trains/base_trainer.py | from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import time
import torch
from progress.bar import Bar
from src.lib.models.data_parallel import DataParallel
from src.lib.utils.utils import AverageMeter
class ModleWithLoss(torch.nn.Module):
def __init__(se... | 3,929 | 32.02521 | 80 | py |
houghnet | houghnet-master/src/lib/trains/ctseg.py | from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import torch
import numpy as np
from src.lib.models.losses import FocalLoss,SegLoss
from src.lib.models.losses import RegL1Loss, RegLoss, NormRegL1Loss, RegWeightedL1Loss
from src.lib.models.decode import ctde... | 6,685 | 47.100719 | 97 | py |
houghnet | houghnet-master/src/lib/datasets/sample/exdet.py | from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import torch.utils.data as data
import pycocotools.coco as coco
import numpy as np
import torch
import json
import cv2
import os
from utils.image import flip, color_aug
from utils.image import get_affine_transf... | 5,722 | 40.773723 | 81 | py |
houghnet | houghnet-master/src/lib/datasets/sample/ctdet.py | from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import torch.utils.data as data
import numpy as np
import torch
import json
import cv2
import os
from src.lib.utils.image import flip, color_aug
from src.lib.utils.image import get_affine_transform, affine_tran... | 5,835 | 39.248276 | 88 | py |
houghnet | houghnet-master/src/lib/datasets/sample/ddd.py | from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import torch.utils.data as data
import pycocotools.coco as coco
import numpy as np
import torch
import json
import cv2
import os
import math
from src.lib.utils.image import flip, color_aug
from src.lib.utils.im... | 6,825 | 38.918129 | 90 | py |
houghnet | houghnet-master/src/lib/datasets/sample/multi_pose.py | from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import torch.utils.data as data
import numpy as np
import torch
import json
import cv2
import os
from utils.image import flip, color_aug
from utils.image import get_affine_transform, affine_transform
from utils... | 7,913 | 42.01087 | 81 | py |
houghnet | houghnet-master/src/lib/datasets/sample/ctseg.py | from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import torch.utils.data as data
import numpy as np
import torch
import json
import cv2
import os
from src.lib.utils.image import flip, color_aug
from src.lib.utils.image import get_affine_transform, affine_tran... | 7,112 | 43.735849 | 97 | py |
houghnet | houghnet-master/src/lib/datasets/dataset/kitti.py | from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import torch.utils.data as data
import pycocotools.coco as coco
import numpy as np
import torch
import json
import cv2
import os
import math
import torch.utils.data as data
class KITTI(data.Dataset):
num_c... | 3,060 | 33.011111 | 79 | py |
houghnet | houghnet-master/src/lib/datasets/dataset/coco_hp.py | from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import pycocotools.coco as coco
from pycocotools.cocoeval import COCOeval
import numpy as np
import json
import os
import torch.utils.data as data
class COCOHP(data.Dataset):
num_classes = 1
num_joints = ... | 4,244 | 34.375 | 80 | py |
houghnet | houghnet-master/src/lib/datasets/dataset/pascal.py | from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import pycocotools.coco as coco
import numpy as np
import torch
import json
import os
import torch.utils.data as data
class PascalVOC(data.Dataset):
num_classes = 20
default_resolution = [384, 384]
mean... | 3,032 | 35.542169 | 80 | py |
houghnet | houghnet-master/src/lib/datasets/dataset/coco_seg.py | from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import pycocotools.coco as coco
from pycocotools.cocoeval import COCOeval
import numpy as np
import json
import os
import torch.utils.data as data
class COCOSEG(data.Dataset):
num_classes = 80
default_res... | 6,004 | 38.768212 | 82 | py |
houghnet | houghnet-master/src/lib/datasets/dataset/coco.py | from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import pycocotools.coco as coco
from pycocotools.cocoeval import COCOeval
import numpy as np
import json
import os
import torch.utils.data as data
class COCO(data.Dataset):
num_classes = 80
default_resolu... | 5,426 | 39.2 | 82 | py |
houghnet | houghnet-master/src/lib/utils/image.py | # ------------------------------------------------------------------------------
# Copyright (c) Microsoft
# Licensed under the MIT License.
# Written by Bin Xiao (Bin.Xiao@microsoft.com)
# Modified by Xingyi Zhou
# ------------------------------------------------------------------------------
from __future__ import a... | 7,720 | 31.305439 | 88 | py |
houghnet | houghnet-master/src/lib/utils/utils.py | from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import torch
class AverageMeter(object):
"""Computes and stores the average and current value"""
def __init__(self):
self.reset()
def reset(self):
self.val = 0
self.avg = 0... | 542 | 22.608696 | 59 | py |
GaitForeMer | GaitForeMer-main/training/transformer_model_fn.py | ###############################################################################
# Pose Transformers (POTR): Human Motion Prediction with Non-Autoregressive
# Transformers
#
# Copyright (c) 2021 Idiap Research Institute, http://www.idiap.ch/
# Written by
# Angel Martinez <angel.martinez@idiap.ch>,
#
# This file is p... | 11,607 | 37.059016 | 119 | py |
GaitForeMer | GaitForeMer-main/training/seq2seq_model_fn.py | ###############################################################################
# Pose Transformers (POTR): Human Motion Prediction with Non-Autoregressive
# Transformers
#
# Copyright (c) 2021 Idiap Research Institute, http://www.idiap.ch/
# Written by
# Angel Martinez <angel.martinez@idiap.ch>,
#
# This file is p... | 24,065 | 36.024615 | 179 | py |
GaitForeMer | GaitForeMer-main/training/pose_classifier_fn.py | ###############################################################################
# Pose Transformers (POTR): Human Motion Prediction with Non-Autoregressive
# Transformers
#
# Copyright (c) 2021 Idiap Research Institute, http://www.idiap.ch/
# Written by
# Angel Martinez <angel.martinez@idiap.ch>,
#
# This file is p... | 7,534 | 34.21028 | 139 | py |
GaitForeMer | GaitForeMer-main/models/Conv1DEncoder.py | ###############################################################################
# Pose Transformers (POTR): Human Motion Prediction with Non-Autoregressive
# Transformers
#
# Copyright (c) 2021 Idiap Research Institute, http://www.idiap.ch/
# Written by
# Angel Martinez <angel.martinez@idiap.ch>,
#
# This file is p... | 5,262 | 32.954839 | 114 | py |
GaitForeMer | GaitForeMer-main/models/Transformer.py | ###############################################################################
# Pose Transformers (POTR): Human Motion Prediction with Non-Autoregressive
# Transformers
#
# Copyright (c) 2021 Idiap Research Institute, http://www.idiap.ch/
# Written by
# Angel Martinez <angel.martinez@idiap.ch>,
#
# This file is p... | 6,581 | 33.103627 | 85 | py |
GaitForeMer | GaitForeMer-main/models/PoseTransformer.py | ###############################################################################
# Pose Transformers (POTR): Human Motion Prediction with Non-Autoregressive
# Transformers
#
# Copyright (c) 2021 Idiap Research Institute, http://www.idiap.ch/
# Written by
# Angel Martinez <angel.martinez@idiap.ch>,
#
# This file is p... | 19,154 | 38.658385 | 120 | py |
GaitForeMer | GaitForeMer-main/models/seq2seq_model.py | ###############################################################################
# Pose Transformers (POTR): Human Motion Prediction with Non-Autoregressive
# Transformers
#
# Copyright (c) 2021 Idiap Research Institute, http://www.idiap.ch/
# Written by
# Angel Martinez <angel.martinez@idiap.ch>,
#
# This file is p... | 5,425 | 34.697368 | 89 | py |
GaitForeMer | GaitForeMer-main/models/PoseEncoderDecoder.py | ###############################################################################
# Pose Transformers (POTR): Human Motion Prediction with Non-Autoregressive
# Transformers
#
# Copyright (c) 2021 Idiap Research Institute, http://www.idiap.ch/
# Written by
# Angel Martinez <angel.martinez@idiap.ch>,
#
# This file is p... | 4,120 | 32.504065 | 87 | py |
GaitForeMer | GaitForeMer-main/models/TransformerEncoder.py | ###############################################################################
# Pose Transformers (POTR): Human Motion Prediction with Non-Autoregressive
# Transformers
#
# Copyright (c) 2021 Idiap Research Institute, http://www.idiap.ch/
# Written by
# Angel Martinez <angel.martinez@idiap.ch>,
#
# This file is p... | 7,169 | 28.628099 | 79 | py |
GaitForeMer | GaitForeMer-main/models/TransformerDecoder.py | ###############################################################################
# Pose Transformers (POTR): Human Motion Prediction with Non-Autoregressive
# Transformers
#
# Copyright (c) 2021 Idiap Research Institute, http://www.idiap.ch/
# Written by
# Angel Martinez <angel.martinez@idiap.ch>,
#
# This file is p... | 11,059 | 31.818991 | 87 | py |
GaitForeMer | GaitForeMer-main/models/PoseGCN.py | ###############################################################################
# Pose Transformers (POTR): Human Motion Prediction with Non-Autoregressive
# Transformers
#
# Copyright (c) 2021 Idiap Research Institute, http://www.idiap.ch/
# Written by
# Angel Martinez <angel.martinez@idiap.ch>,
#
# This file is p... | 11,945 | 26.976581 | 97 | py |
GaitForeMer | GaitForeMer-main/models/potr_fn.py | ###############################################################################
# Pose Transformers (POTR): Human Motion Prediction with Non-Autoregressive
# Transformers
#
# Copyright (c) 2021 Idiap Research Institute, http://www.idiap.ch/
# Written by
# Angel Martinez <angel.martinez@idiap.ch>,
#
# This file is p... | 14,622 | 30.245726 | 110 | py |
GaitForeMer | GaitForeMer-main/utils/WarmUpScheduler.py | ###############################################################################
# Pose Transformers (POTR): Human Motion Prediction with Non-Autoregressive
# Transformers
#
# Copyright (c) 2021 Idiap Research Institute, http://www.idiap.ch/
# Written by
# Angel Martinez <angel.martinez@idiap.ch>,
#
# This file is p... | 4,280 | 39.771429 | 108 | py |
GaitForeMer | GaitForeMer-main/utils/utils.py | ###############################################################################
# Pose Transformers (POTR): Human Motion Prediction with Non-Autoregressive
# Transformers
#
# Copyright (c) 2021 Idiap Research Institute, http://www.idiap.ch/
# Written by
# Angel Martinez <angel.martinez@idiap.ch>,
#
# This file is p... | 19,278 | 30.708882 | 161 | py |
GaitForeMer | GaitForeMer-main/utils/visualize_attention_weights.py | ###############################################################################
# Pose Transformers (POTR): Human Motion Prediction with Non-Autoregressive
# Transformers
#
# Copyright (c) 2021 Idiap Research Institute, http://www.idiap.ch/
# Written by
# Angel Martinez <angel.martinez@idiap.ch>,
#
# This file is p... | 6,648 | 33.630208 | 632 | py |
GaitForeMer | GaitForeMer-main/utils/PositionEncodings.py | ###############################################################################
# Pose Transformers (POTR): Human Motion Prediction with Non-Autoregressive
# Transformers
#
# Copyright (c) 2021 Idiap Research Institute, http://www.idiap.ch/
# Written by
# Angel Martinez <angel.martinez@idiap.ch>,
#
# This file is p... | 6,337 | 32.712766 | 81 | py |
GaitForeMer | GaitForeMer-main/data/GaitJointsDataset.py | import os
import sys
import numpy as np
import torch
import argparse
import tqdm
import pickle
import random
_TOTAL_ACTIONS = 4
# Mapping from 1-base of NTU to vibe 49 joints
# hip, thorax,
_MAJOR_JOINTS = [39, 41, 37, 43, 34, 35, 36, 33, 32, 31, 28, 29, 30, 27, 26, 25, 40]
# 1, 2, 3, 4, 5, 6, ... | 6,232 | 31.128866 | 137 | py |
GaitForeMer | GaitForeMer-main/data/NTURGDDataset.py | ###############################################################################
# Pose Transformers (POTR): Human Motion Prediction with Non-Autoregressive
# Transformers
#
# Copyright (c) 2021 Idiap Research Institute, http://www.idiap.ch/
# Written by
# Angel Martinez <angel.martinez@idiap.ch>,
#
# This file is p... | 15,284 | 32.084416 | 110 | py |
CPFN | CPFN-master/training_PatchSelection.py | # Importation of packages
import os
import sys
import torch
import argparse
import numpy as np
# Importing the Dataset file
from Dataset import dataloaders
# Importing the Network file
from PointNet2 import pn2_network
# Importing the Utils files
from Utils import config_loader, training_utils, training_visualisation
... | 4,812 | 54.321839 | 193 | py |
CPFN | CPFN-master/evaluation_globalSPFN.py | # Importation of packages
import os
import sys
import torch
import argparse
import numpy as np
import pandas as pd
# Importing the Dataset files
from Dataset import dataloaders
# Importing the Network files
from SPFN import fitter_factory, metric_implementation, losses_implementation
from PointNet2 import pn2_network
... | 7,235 | 63.607143 | 321 | py |
CPFN | CPFN-master/evaluation_baselineSPFN.py | # Importation of packages
import os
import sys
import torch
import argparse
import numpy as np
import pandas as pd
# Importing the Dataset files
from Dataset import dataloaders
# Importing the Network files
from SPFN import fitter_factory, metric_implementation, losses_implementation
from PointNet2 import pn2_network
... | 7,131 | 60.482759 | 197 | py |
CPFN | CPFN-master/evaluation_PatchSelection.py | # Importation of packages
import os
import sys
import h5py
import torch
import argparse
import numpy as np
# Importing the Dataset file
from Dataset import dataloaders
# Importing the Network file
from PointNet2 import pn2_network
# Importing the Utils files
from Utils import config_loader, sampling_utils
if __name__... | 5,095 | 54.391304 | 158 | py |
CPFN | CPFN-master/evaluation_localSPFN.py | # Importation of packages
import os
import sys
import torch
import argparse
import numpy as np
import pandas as pd
# Importing the Dataset files
from Dataset import dataloaders
# Importing the Network files
from SPFN import fitter_factory, metric_implementation, losses_implementation
from PointNet2 import pn2_network
... | 10,606 | 63.284848 | 197 | py |
CPFN | CPFN-master/training_SPFN.py | # Importation of packages
import os
import sys
import torch
import argparse
import numpy as np
# Importing the Dataset files
from Dataset import dataloaders
# Importing the Network files
from SPFN import fitter_factory, losses_implementation
from PointNet2 import pn2_network
# Importing Utils files
from Utils import c... | 6,960 | 59.530435 | 198 | py |
CPFN | CPFN-master/SPFN/sphere_fitter.py | # Importatiomn of packages
import torch
import numpy as np
if __name__ == '__main__':
import tensorflow as tf
from SPFN.primitives import Sphere
from SPFN.geometry_utils import weighted_sphere_fitting, weighted_sphere_fitting_tensorflow
def compute_parameters(P, W):
batch_size, n_points, _ = P.size()
_, _,... | 5,084 | 44.810811 | 129 | py |
CPFN | CPFN-master/SPFN/plane_fitter.py | # Importatiomn of packages
import torch
import numpy as np
if __name__ == '__main__':
import tensorflow as tf
from SPFN.primitives import Plane
from SPFN.geometry_utils import weighted_plane_fitting, weighted_plane_fitting_tensorflow
def compute_parameters(P, W):
batch_size, n_points, _ = P.size()
_, _, n_... | 8,518 | 43.369792 | 194 | py |
CPFN | CPFN-master/SPFN/metric_implementation.py | # Importation of packages
import torch
import numpy as np
from scipy.optimize import linear_sum_assignment
from SPFN import plane_fitter, sphere_fitter, cylinder_fitter, cone_fitter
from SPFN import losses_implementation
def hungarian_matching(W_pred, I_gt):
# This non-tf function does not backprob gradient, only... | 36,132 | 59.121464 | 304 | py |
CPFN | CPFN-master/SPFN/geometry_utils.py | # Importing packages
import torch
import numpy as np
if __name__ == '__main__':
import tensorflow as tf
from SPFN.differentiable_tls import solve_weighted_tls, solve_weighted_tls_tensorflow
def compute_consistent_plane_frame(normal):
# Input: normal is Bx3
# Returns: x_axis, y_axis, both of dimension Bx3
... | 12,490 | 46.494297 | 148 | py |
CPFN | CPFN-master/SPFN/differentiable_tls.py | # Importation of packages
import torch
import numpy as np
if __name__ == '__main__':
import tensorflow as tf
from torch.autograd import gradcheck
def guard_one_over_matrix(M, min_abs_value=1e-10):
_, row, _ = M.size()
device = M.get_device()
up = torch.triu(torch.clamp(M, min=min_abs_value, max=None), ... | 8,960 | 36.493724 | 113 | py |
CPFN | CPFN-master/SPFN/cylinder_fitter.py | # Importation of pqckqges
import torch
import numpy as np
if __name__ == '__main__':
import tensorflow as tf
from SPFN.primitives import Cylinder
from SPFN.differentiable_tls import solve_weighted_tls, solve_weighted_tls_tensorflow
from SPFN.geometry_utils import compute_consistent_plane_frame, compute_consistent_p... | 11,804 | 51.234513 | 166 | py |
CPFN | CPFN-master/SPFN/losses_implementation.py | # Importation of packages
import torch
import numpy as np
if __name__ == '__main__':
import tensorflow as tf
from scipy.optimize import linear_sum_assignment
from SPFN import plane_fitter, sphere_fitter, cylinder_fitter, cone_fitter
# Segmentation Loss
def hungarian_matching(W_pred, I_gt):
# This non-tf funct... | 55,650 | 62.819954 | 319 | py |
CPFN | CPFN-master/SPFN/cone_fitter.py | # Importation of packages
import torch
import numpy as np
if __name__ == '__main__':
import tensorflow as tf
from SPFN.primitives import Cone
from SPFN.geometry_utils import guarded_matrix_solve_ls, guarded_matrix_solve_ls_tensorflow, weighted_plane_fitting, weighted_plane_fitting_tensorflow
def acos_safe(x):
... | 12,047 | 49.835443 | 172 | py |
CPFN | CPFN-master/Utils/training_utils.py | # Importation of packages
import sys
import torch
import numpy as np
from SPFN import losses_implementation
# BN Decay
def get_batch_norm_decay(global_step, batch_size, bn_decay_step, staircase=True):
BN_INIT_DECAY = 0.5
BN_DECAY_RATE = 0.5
BN_DECAY_CLIP = 0.99
p = global_step * batch_size / bn_decay_... | 8,974 | 49.994318 | 166 | py |
CPFN | CPFN-master/Utils/training_visualisation.py | import torch
import numpy as np
from torch import nn
from visdom import Visdom
ORANGE = np.array([[255, 105, 0]])
BLUE = np.array([[40, 40, 255]])
RED = np.array([[255, 40, 40]])
class Visualiser(object):
def __init__(self, plotting_interval, port=8097):
self.vis = Visdom(port=port)
self.line_plot... | 2,658 | 38.102941 | 118 | py |
CPFN | CPFN-master/Utils/merging_utils.py | # Importation of packages
import torch
import numba
import numpy as np
def similarity_soft(spfn_labels, predicted_labels, point_indices):
num_points_per_object, max_label_per_object = spfn_labels.size()
nb_patches, num_points_per_patch, max_label_per_patch = predicted_labels.size()
point2primitive_predicti... | 3,371 | 62.622642 | 165 | py |
CPFN | CPFN-master/Dataset/dataloaders.py | # Importation of packages
import os
import re
import h5py
import torch
import pickle
import random
import numpy as np
import pandas as pd
from tqdm import tqdm
import torch.utils.data as data
# Importing Utils files
from Utils import dataset_utils
class Dataset_PatchSelection(data.Dataset):
def __init__(self, csv... | 19,560 | 54.729345 | 318 | py |
CPFN | CPFN-master/PointNet2/pn2_network.py | # Importation of packages
import os
import sys
import torch
import numpy as np
from SPFN.losses_implementation import compute_all_losses
from PointNet2.pointnet2_ops.modules.pointset_abstraction import PointsetAbstraction
from PointNet2.pointnet2_ops.modules.pointset_feature_propagation import PointsetFeaturePropagatio... | 3,692 | 49.589041 | 183 | py |
CPFN | CPFN-master/PointNet2/pointnet2_ops/setup.py | import os
import glob
import setuptools
from torch.utils.cpp_extension import BuildExtension, CUDAExtension
sources = glob.glob("cuda_ops/src/*.cpp") + glob.glob("cuda_ops/src/*.cu")
headers = os.path.join(os.path.dirname(os.path.abspath(__file__)), 'cuda_ops/include')
setuptools.setup(
name="pointnet2_ops",
... | 915 | 28.548387 | 86 | py |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.