repo
stringlengths
2
99
file
stringlengths
13
225
code
stringlengths
0
18.3M
file_length
int64
0
18.3M
avg_line_length
float64
0
1.36M
max_line_length
int64
0
4.26M
extension_type
stringclasses
1 value
mff
mff-master/mff/kernels/base.py
import os from abc import ABCMeta, abstractmethod from pathlib import Path path = Path(os.path.abspath(__file__)) Mffpath = path.parent.parent / "cache/" class Kernel(metaclass=ABCMeta): @abstractmethod def __init__(self, kernel_name, *args, **kwargs): super().__init__(*args, **kwargs) self.k...
345
23.714286
53
py
mff
mff-master/mff/kernels/twobodykernel.py
# -*- coding: utf-8 -*- import logging import os.path import pickle from abc import ABCMeta, abstractmethod import numpy as np from mff.kernels.base import Kernel, Mffpath logger = logging.getLogger(__name__) def dummy_calc_ff(data): """ Function used when multiprocessing. Args: data (list of obje...
36,239
39.995475
121
py
mff
mff-master/mff/kernels/threebodykernel.py
# -*- coding: utf-8 -*- import logging import os.path import pickle from abc import ABCMeta, abstractmethod import numpy as np from mff.kernels.base import Kernel, Mffpath logger = logging.getLogger(__name__) def dummy_calc_ff(data): """ Function used when multiprocessing. Args: data (list of obje...
40,850
39.728814
117
py
mff
mff-master/mff/kernels/eamkernel.py
# -*- coding: utf-8 -*- import logging import os.path import pickle from abc import ABCMeta, abstractmethod import numpy as np from mff.kernels.base import Kernel, Mffpath logger = logging.getLogger(__name__) def dummy_calc_ff(data): """ Function used when multiprocessing. Args: data (list of obje...
42,667
40.7087
134
py
mff
mff-master/mff/kernels/__init__.py
from .eamkernel import EamManySpeciesKernel, EamSingleSpeciesKernel from .manybodykernel import (ManyBodyManySpeciesKernel, ManyBodySingleSpeciesKernel) from .threebodykernel import (ThreeBodyManySpeciesKernel, ThreeBodySingleSpeciesKernel) from .twobodykernel ...
684
41.8125
79
py
mff
mff-master/mff/kernels/manybodykernel.py
# -*- coding: utf-8 -*- import logging import os.path import pickle from abc import ABCMeta, abstractmethod import numpy as np from mff.kernels.base import Kernel, Mffpath logger = logging.getLogger(__name__) def dummy_calc_ff(data): """ Function used when multiprocessing. Args: data (list of obje...
40,153
38.994024
114
py
T-Concord3D
T-Concord3D-master/test.py
# -*- coding:utf-8 -*- # author: Awet H. Gebrehiwot # --------------------------| import os import argparse import sys import matplotlib.pyplot as plt import numpy as np import torch import torch.optim as optim from tqdm import tqdm import math from utils.metric_util import per_class_iu, fast_hist_crop, fast_ups_crop...
16,515
44.750693
137
py
T-Concord3D
T-Concord3D-master/concordance_kitti.py
# -*- coding:utf-8 -*- # author: Awet H. Gebrehiwot # --------------------------| import os import time import argparse import sys import numpy as np import glob import os import shutil import random import math # https://github.com/ctu-vras/T-Concord3D.git def main(args): teacher_1 = args.teacher1 teache...
4,467
44.131313
114
py
T-Concord3D
T-Concord3D-master/train_tconcord3d.py
# -*- coding:utf-8 -*- # author: Awet import argparse import os import sys import time import warnings import numpy as np import torch import torch.optim as optim from torch.nn.parallel import DistributedDataParallel from tqdm import tqdm from builder import data_builder, model_builder, loss_builder from config.conf...
6,366
33.79235
112
py
T-Concord3D
T-Concord3D-master/train.py
# -*- coding:utf-8 -*- # author: Awet H. Gebrehiwot # --------------------------| import os import time import argparse import sys import numpy as np import torch import torch.nn as nn import torch.optim as optim from tqdm import tqdm from utils.metric_util import per_class_iu, fast_hist_crop from dataloader.pc_datas...
13,060
42.105611
120
py
T-Concord3D
T-Concord3D-master/tools/rename_kitti_train_pseudo.py
# -*- coding:utf-8 -*- # author: Awet H. Gebrehiwot # --------------------------| import os import time import argparse import sys import numpy as np import numpy as np import glob from multiprocessing import Pool import os import shutil import random import math def main(): #sequence = ["04"] #des_seq = ["3...
1,739
33.8
140
py
T-Concord3D
T-Concord3D-master/config/config.py
# -*- coding:utf-8 -*- from pathlib import Path from strictyaml import Bool, Float, Int, Map, Seq, Str, as_document, load model_params = Map( { "model_architecture": Str(), "output_shape": Seq(Int()), "fea_dim": Int(), "out_fea_dim": Int(), "num_class": Int(), "num_...
3,134
22.931298
90
py
T-Concord3D
T-Concord3D-master/config/__init__.py
# -*- coding:utf-8 -*-
23
11
22
py
T-Concord3D
T-Concord3D-master/builder/loss_builder.py
# -*- coding:utf-8 -*- # author: Awet H. Gebrehiwot # --------------------------| import torch from utils.lovasz_losses import lovasz_softmax, lovasz_softmax_lcw, cross_entropy_lcw from utils.loss_func import FocalLoss def build(wce=True, lovasz=True, num_class=20, ignore_label=None, weights=None, ssl=False, fl=False...
1,319
30.428571
101
py
T-Concord3D
T-Concord3D-master/builder/model_builder.py
# -*- coding:utf-8 -*- from model.cylinder_3d import get_model_class from model.segment_3d import Asymm_3d_spconv from model.cylinder_feature import cylinder_fea def build(model_config): output_shape = model_config['output_shape'] num_class = model_config['num_class'] num_input_features = model_config['n...
1,147
30.888889
64
py
T-Concord3D
T-Concord3D-master/builder/data_builder.py
# -*- coding:utf-8 -*- import torch from dataloader.dataset_semantickitti import get_model_class, collate_fn_BEV, collate_fn_BEV_tta from dataloader.pc_dataset import get_pc_model_class def build(dataset_config, train_dataloader_config, val_dataloader_config, test_dataloader_config=None...
8,112
48.469512
111
py
T-Concord3D
T-Concord3D-master/builder/__init__.py
# -*- coding:utf-8 -*- # author: Awet H. Gebrehiwot # --------------------------|
82
19.75
29
py
T-Concord3D
T-Concord3D-master/utils/trainer_function.py
# -*- coding:utf-8 -*- # author: Awet H. Gebrehiwot # at 8/10/22 # --------------------------| import argparse import os import sys import time import warnings import numpy as np import torch import torch.optim as optim from torch.nn.parallel import DistributedDataParallel from tqdm import tqdm from builder import da...
8,482
42.953368
116
py
T-Concord3D
T-Concord3D-master/utils/load_save_util.py
# -*- coding:utf-8 -*- import torch def load_checkpoint(model_load_path, model, map_location=None): my_model_dict = model.state_dict() if map_location is not None: pre_weight = torch.load(model_load_path, map_location=f'cuda:{map_location}') else: pre_weight = torch.load(model_load_path) ...
1,772
26.703125
92
py
T-Concord3D
T-Concord3D-master/utils/metric_util.py
# -*- coding:utf-8 -*- import numpy as np def fast_hist(pred, label, n): k = (label >= 0) & (label < n) bin_count = np.bincount( n * label[k].astype(int) + pred[k], minlength=n ** 2) return bin_count[:n ** 2].reshape(n, n) def per_class_iu(hist): return np.diag(hist) / (hist.sum(1) + hist.su...
868
27.966667
82
py
T-Concord3D
T-Concord3D-master/utils/__init__.py
# -*- coding:utf-8 -*- # author: Xinge # @file: __init__.py.py
64
15.25
24
py
T-Concord3D
T-Concord3D-master/utils/ups.py
# -*- coding:utf-8 -*- # author: Awet H. Gebrehiwot # --------------------------| def enable_dropout(model): for m in model.modules(): if m.__class__.__name__.startswith('Dropout'): m.train()
218
20.9
54
py
T-Concord3D
T-Concord3D-master/utils/lovasz_losses.py
# -*- coding:utf-8 -*- # author: Xinge """ Lovasz-Softmax and Jaccard hinge loss in PyTorch Maxim Berman 2018 ESAT-PSI KU Leuven (MIT License) """ from __future__ import print_function, division import torch from torch.autograd import Variable import torch.nn.functional as F import numpy as np try: from itertoo...
15,675
36.864734
131
py
T-Concord3D
T-Concord3D-master/utils/loss_func.py
# -*- coding:utf-8 -*- # author: Awet H. Gebrehiwot # --------------------------| import torch import torch.nn as nn import torch.nn.functional as F class FocalLoss(nn.Module): def __init__(self, weight=None, ignore_index=None, gamma=2., reduction='none', ssl=False): nn.Module.__init__(...
1,766
28.949153
69
py
T-Concord3D
T-Concord3D-master/utils/log_util.py
# -*- coding:utf-8 -*- def save_to_log(logdir, logfile, message): f = open(logdir + '/' + logfile, "a") f.write(message + '\n') f.close() return
160
25.833333
42
py
T-Concord3D
T-Concord3D-master/model/cylinder_3d.py
# -*- coding:utf-8 -*- import torch from torch import nn REGISTERED_MODELS_CLASSES = {} def register_model(cls, name=None): global REGISTERED_MODELS_CLASSES if name is None: name = cls.__name__ assert name not in REGISTERED_MODELS_CLASSES, f"exist class: {REGISTERED_MODELS_CLASSES}" REGISTERE...
1,901
31.793103
119
py
T-Concord3D
T-Concord3D-master/model/segment_3d.py
# -*- coding:utf-8 -*- import numpy as np #import spconv import spconv.pytorch as spconv import torch from torch import nn def conv3x3(in_planes, out_planes, stride=1, indice_key=None): return spconv.SubMConv3d(in_planes, out_planes, kernel_size=3, stride=stride, padding=1, bias=False...
13,253
41.07619
121
py
T-Concord3D
T-Concord3D-master/model/__init__.py
# -*- coding:utf-8 -*-
23
11
22
py
T-Concord3D
T-Concord3D-master/model/cylinder_feature.py
# -*- coding:utf-8 -*- import torch import torch.nn as nn import torch.nn.functional as F import numpy as np import numba as nb import multiprocessing import torch_scatter class cylinder_fea(nn.Module): def __init__(self, grid_size, fea_dim=3, out_pt_fea_dim=64, max_pt_per_encode=64, fea_compr...
2,812
30.965909
115
py
T-Concord3D
T-Concord3D-master/dataloader/dataset_semantickitti.py
# -*- coding:utf-8 -*- """ SemKITTI dataloader """ import os import numpy as np import torch import random import time import numba as nb import yaml from torch.utils import data import pickle REGISTERED_DATASET_CLASSES = {} def register_dataset(cls, name=None): global REGISTERED_DATASET_CLASSES if name is N...
29,622
40.372905
150
py
T-Concord3D
T-Concord3D-master/dataloader/augmentations.py
# -*- coding:utf-8 -*- # author: Awet H. Gebrehiwot # --------------------------| # from __future__ import ( # division, # absolute_import, # with_statement, # print_function, # unicode_literals, # ) import random import numpy as np import torch #from pointnet2.data.data_utils import angle_axis #...
11,680
27.079327
106
py
T-Concord3D
T-Concord3D-master/dataloader/pc_dataset.py
# -*- coding:utf-8 -*- # author: Xinge # @file: pc_dataset.py import glob import os import pickle from os.path import exists import numpy as np import yaml from torch.utils import data REGISTERED_PC_DATASET_CLASSES = {} # past and future frames global place holders past = 0 future = 0 T_past = 0 T_future = 0 ssl = ...
34,323
40.354217
130
py
T-Concord3D
T-Concord3D-master/dataloader/dataset_nuscenes.py
# -*- coding:utf-8 -*- # author: Xinge # @file: dataset_nuscenes.py import numpy as np import torch import numba as nb from torch.utils import data from dataloader.dataset_semantickitti import register_dataset def cart2polar(input_xyz): rho = np.sqrt(input_xyz[:, 0] ** 2 + input_xyz[:, 1] ** 2) phi = np.arct...
9,266
35.920319
114
py
T-Concord3D
T-Concord3D-master/dataloader/__init__.py
# -*- coding:utf-8 -*- # author: Xinge # @file: __init__.py.py from . import dataset_nuscenes
95
15
30
py
T-Concord3D
T-Concord3D-master/dataloader/preprocess.py
# -*- coding:utf-8 -*- # author: Awet H. Gebrehiwot # --------------------------| import torch import torchvision.transforms as transforms from augmentations import RandAugment3D def preprocessing(point_set, cls): pts_transform = transforms.Compose( [] ) pts_transform.transforms.insert(0, RandAugm...
397
23.875
59
py
darts
darts-master/cnn/test.py
import os import sys import glob import numpy as np import torch import utils import logging import argparse import torch.nn as nn import genotypes import torch.utils import torchvision.datasets as dset import torch.backends.cudnn as cudnn from torch.autograd import Variable from model import NetworkCIFAR as Network ...
3,593
33.228571
102
py
darts
darts-master/cnn/architect.py
import torch import numpy as np import torch.nn as nn from torch.autograd import Variable def _concat(xs): return torch.cat([x.view(-1) for x in xs]) class Architect(object): def __init__(self, model, args): self.network_momentum = args.momentum self.network_weight_decay = args.weight_decay self.mo...
3,429
35.88172
130
py
darts
darts-master/cnn/train_imagenet.py
import os import sys import numpy as np import time import torch import utils import glob import random import logging import argparse import torch.nn as nn import genotypes import torch.utils import torchvision.datasets as dset import torchvision.transforms as transforms import torch.backends.cudnn as cudnn from torc...
7,992
33.601732
106
py
darts
darts-master/cnn/utils.py
import os import numpy as np import torch import shutil import torchvision.transforms as transforms from torch.autograd import Variable class AvgrageMeter(object): def __init__(self): self.reset() def reset(self): self.avg = 0 self.sum = 0 self.cnt = 0 def update(self, val, n=1): self.sum...
3,080
24.254098
105
py
darts
darts-master/cnn/model.py
import torch import torch.nn as nn from operations import * from torch.autograd import Variable from utils import drop_path class Cell(nn.Module): def __init__(self, genotype, C_prev_prev, C_prev, C, reduction, reduction_prev): super(Cell, self).__init__() print(C_prev_prev, C_prev, C) if reduction_pr...
6,640
29.888372
89
py
darts
darts-master/cnn/model_search.py
import torch import torch.nn as nn import torch.nn.functional as F from operations import * from torch.autograd import Variable from genotypes import PRIMITIVES from genotypes import Genotype class MixedOp(nn.Module): def __init__(self, C, stride): super(MixedOp, self).__init__() self._ops = nn.ModuleList(...
5,009
29.54878
128
py
darts
darts-master/cnn/train_search.py
import os import sys import time import glob import numpy as np import torch import utils import logging import argparse import torch.nn as nn import torch.utils import torch.nn.functional as F import torchvision.datasets as dset import torch.backends.cudnn as cudnn from torch.autograd import Variable from model_searc...
7,212
35.80102
115
py
darts
darts-master/cnn/test_imagenet.py
import os import sys import numpy as np import torch import utils import glob import random import logging import argparse import torch.nn as nn import genotypes import torch.utils import torchvision.datasets as dset import torchvision.transforms as transforms import torch.backends.cudnn as cudnn from torch.autograd i...
3,785
32.504425
104
py
darts
darts-master/cnn/train.py
import os import sys import time import glob import numpy as np import torch import utils import logging import argparse import torch.nn as nn import genotypes import torch.utils import torchvision.datasets as dset import torch.backends.cudnn as cudnn from torch.autograd import Variable from model import NetworkCIFAR ...
6,251
35.561404
100
py
darts
darts-master/cnn/visualize.py
import sys import genotypes from graphviz import Digraph def plot(genotype, filename): g = Digraph( format='pdf', edge_attr=dict(fontsize='20', fontname="times"), node_attr=dict(style='filled', shape='rect', align='center', fontsize='20', height='0.5', width='0.5', penwidth='2', fontname="times"),...
1,419
24.357143
141
py
darts
darts-master/cnn/genotypes.py
from collections import namedtuple Genotype = namedtuple('Genotype', 'normal normal_concat reduce reduce_concat') PRIMITIVES = [ 'none', 'max_pool_3x3', 'avg_pool_3x3', 'skip_connect', 'sep_conv_3x3', 'sep_conv_5x5', 'dil_conv_3x3', 'dil_conv_5x5' ] NASNet = Genotype( normal = [ ...
2,410
29.518987
429
py
darts
darts-master/cnn/operations.py
import torch import torch.nn as nn OPS = { 'none' : lambda C, stride, affine: Zero(stride), 'avg_pool_3x3' : lambda C, stride, affine: nn.AvgPool2d(3, stride=stride, padding=1, count_include_pad=False), 'max_pool_3x3' : lambda C, stride, affine: nn.MaxPool2d(3, stride=stride, padding=1), 'skip_connect' : lambd...
3,717
34.075472
129
py
darts
darts-master/rnn/test.py
import argparse import os, sys import time import math import numpy as np import torch import torch.nn as nn import torch.backends.cudnn as cudnn import data import model from utils import batchify, get_batch, repackage_hidden, create_exp_dir, save_checkpoint parser = argparse.ArgumentParser(description='PyTorch Pen...
5,048
40.385246
118
py
darts
darts-master/rnn/architect.py
import torch import numpy as np import torch.nn as nn from torch.autograd import Variable def _concat(xs): return torch.cat([x.view(-1) for x in xs]) def _clip(grads, max_norm): total_norm = 0 for g in grads: param_norm = g.data.norm(2) total_norm += param_norm ** 2 total_norm = total_...
4,003
34.122807
132
py
darts
darts-master/rnn/utils.py
import torch import torch.nn as nn import os, shutil import numpy as np from torch.autograd import Variable def repackage_hidden(h): if type(h) == Variable: return Variable(h.data) else: return tuple(repackage_hidden(v) for v in h) def batchify(data, bsz, args): nbatch = data.size(0) // ...
2,955
30.446809
137
py
darts
darts-master/rnn/model.py
import math import torch import torch.nn as nn import torch.nn.functional as F from genotypes import STEPS from utils import mask2d from utils import LockedDropout from utils import embedded_dropout from torch.autograd import Variable INITRANGE = 0.04 class DARTSCell(nn.Module): def __init__(self, ninp, nhid, dro...
5,148
30.981366
102
py
darts
darts-master/rnn/data.py
import os import torch from collections import Counter class Dictionary(object): def __init__(self): self.word2idx = {} self.idx2word = [] self.counter = Counter() self.total = 0 def add_word(self, word): if word not in self.word2idx: self.idx2word.append(...
4,005
30.054264
80
py
darts
darts-master/rnn/model_search.py
import torch import torch.nn as nn import torch.nn.functional as F from genotypes import PRIMITIVES, STEPS, CONCAT, Genotype from torch.autograd import Variable from collections import namedtuple from model import DARTSCell, RNNModel class DARTSCellSearch(DARTSCell): def __init__(self, ninp, nhid, dropouth, dropou...
3,278
32.804124
125
py
darts
darts-master/rnn/train_search.py
import argparse import os, sys, glob import time import math import numpy as np import torch import logging import torch.nn as nn import torch.nn.functional as F import torch.backends.cudnn as cudnn from architect import Architect import gc import data import model_search as model from utils import batchify, get_bat...
12,639
43.041812
132
py
darts
darts-master/rnn/train.py
import os import gc import sys import glob import time import math import numpy as np import torch import torch.nn as nn import logging import argparse import genotypes import torch.nn.functional as F import torch.backends.cudnn as cudnn import data import model from torch.autograd import Variable from utils import ba...
13,900
42.037152
141
py
darts
darts-master/rnn/visualize.py
import sys import genotypes from graphviz import Digraph def plot(genotype, filename): g = Digraph( format='pdf', edge_attr=dict(fontsize='20', fontname="times"), node_attr=dict(style='filled', shape='rect', align='center', fontsize='20', height='0.5', width='0.5', penwidth='2', fontname="times"),...
1,327
26.666667
141
py
darts
darts-master/rnn/genotypes.py
from collections import namedtuple Genotype = namedtuple('Genotype', 'recurrent concat') PRIMITIVES = [ 'none', 'tanh', 'relu', 'sigmoid', 'identity' ] STEPS = 8 CONCAT = 8 ENAS = Genotype( recurrent = [ ('tanh', 0), ('tanh', 1), ('relu', 1), ('tanh', 3), ...
851
22.027027
165
py
MaskTextSpotterV3
MaskTextSpotterV3-master/setup.py
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. #!/usr/bin/env python import glob import os import torch from setuptools import find_packages from setuptools import setup from torch.utils.cpp_extension import CUDA_HOME from torch.utils.cpp_extension import CppExtension from torch.utils.cpp_ext...
2,068
28.140845
73
py
MaskTextSpotterV3
MaskTextSpotterV3-master/tools/convert_dataset.py
import os import numpy as np import cv2 from shapely.geometry import box, Polygon from shapely import affinity import math def _rect2quad(boxes): x_min, y_min, x_max, y_max = boxes[:, 0].reshape((-1, 1)), boxes[:, 1].reshape((-1, 1)), boxes[:, 2].reshape((-1, 1)), boxes[:, 3].reshape((-1, 1)) return np.hstac...
6,623
36.213483
200
py
MaskTextSpotterV3
MaskTextSpotterV3-master/tools/test_net.py
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. # Set up custom environment before nearly anything else is imported # NOTE: this should be the first import (no not reorder) from maskrcnn_benchmark.utils.env import setup_environment # noqa F401 isort:skip import argparse import os import torch...
3,686
34.451923
88
py
MaskTextSpotterV3
MaskTextSpotterV3-master/tools/demo.py
import os import cv2 import torch from torchvision import transforms as T from maskrcnn_benchmark.modeling.detector import build_detection_model from maskrcnn_benchmark.utils.checkpoint import DetectronCheckpointer from maskrcnn_benchmark.structures.image_list import to_image_list from maskrcnn_benchmark.config import...
9,628
39.288703
123
py
MaskTextSpotterV3
MaskTextSpotterV3-master/tools/train_net.py
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. r""" Basic training script for PyTorch """ # Set up custom environment before nearly anything else is imported # NOTE: this should be the first import (no not reorder) from maskrcnn_benchmark.utils.env import setup_environment # noqa F401 isort:s...
4,818
30.292208
89
py
MaskTextSpotterV3
MaskTextSpotterV3-master/maskrcnn_benchmark/solver/lr_scheduler.py
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. from bisect import bisect_right import torch # FIXME ideally this would be achieved with a CombinedLRScheduler, # separating MultiStepLR with WarmupLR # but the current LRScheduler design doesn't allow it class WarmupMultiStepLR(torch.optim.lr_s...
2,292
33.742424
93
py
MaskTextSpotterV3
MaskTextSpotterV3-master/maskrcnn_benchmark/solver/__init__.py
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. from .build import make_optimizer from .build import make_lr_scheduler from .lr_scheduler import WarmupMultiStepLR
187
36.6
71
py
MaskTextSpotterV3
MaskTextSpotterV3-master/maskrcnn_benchmark/solver/build.py
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. import torch from .lr_scheduler import WarmupMultiStepLR def make_optimizer(cfg, model): params = [] for key, value in model.named_parameters(): if not value.requires_grad: continue lr = cfg.SOLVER.BASE_LR ...
1,176
29.973684
79
py
MaskTextSpotterV3
MaskTextSpotterV3-master/maskrcnn_benchmark/config/defaults.py
#!/usr/bin/env python3 # Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. import os from yacs.config import CfgNode as CN # ----------------------------------------------------------------------------- # Convention about Training / Test specific parameters # -------------------------------------...
14,283
37.294906
83
py
MaskTextSpotterV3
MaskTextSpotterV3-master/maskrcnn_benchmark/config/__init__.py
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. from .defaults import _C as cfg
104
34
71
py
MaskTextSpotterV3
MaskTextSpotterV3-master/maskrcnn_benchmark/config/paths_catalog.py
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. """Centralized catalog of paths.""" import os class DatasetCatalog(object): DATA_DIR = "datasets" # DATA_DIR = "/share/mhliao/MaskTextSpotterV3/datasets/" DATASETS = { "coco_2014_train": ( "coco/train2014", ...
11,140
45.810924
121
py
MaskTextSpotterV3
MaskTextSpotterV3-master/maskrcnn_benchmark/layers/nms.py
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. # from ._utils import _C from maskrcnn_benchmark import _C # nms = _C.nms from apex import amp # Only valid with fp32 inputs - give AMP the hint nms = amp.float_function(_C.nms) # nms.__doc__ = """ # This function performs Non-maximum suppresion"...
323
26
71
py
MaskTextSpotterV3
MaskTextSpotterV3-master/maskrcnn_benchmark/layers/batch_norm.py
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. import torch from torch import nn class FrozenBatchNorm2d(nn.Module): """ BatchNorm2d where the batch statistics and the affine parameters are fixed """ def __init__(self, n): super(FrozenBatchNorm2d, self).__init__()...
1,093
34.290323
71
py
MaskTextSpotterV3
MaskTextSpotterV3-master/maskrcnn_benchmark/layers/roi_pool.py
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. import torch from torch import nn from torch.autograd import Function from torch.autograd.function import once_differentiable from torch.nn.modules.utils import _pair from maskrcnn_benchmark import _C from apex import amp class _ROIPool(Function)...
1,899
28.230769
74
py
MaskTextSpotterV3
MaskTextSpotterV3-master/maskrcnn_benchmark/layers/roi_align.py
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. import torch from torch import nn from torch.autograd import Function from torch.autograd.function import once_differentiable from torch.nn.modules.utils import _pair from maskrcnn_benchmark import _C from apex import amp class _ROIAlign(Function...
2,154
29.785714
85
py
MaskTextSpotterV3
MaskTextSpotterV3-master/maskrcnn_benchmark/layers/smooth_l1_loss.py
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. import torch # TODO maybe push this to nn? def smooth_l1_loss(input, target, beta=1. / 9, size_average=True): """ very similar to the smooth_l1_loss from pytorch, but with the extra beta parameter """ n = torch.abs(input - tar...
481
27.352941
71
py
MaskTextSpotterV3
MaskTextSpotterV3-master/maskrcnn_benchmark/layers/_utils.py
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. import glob import os.path import torch try: from torch.utils.cpp_extension import load as load_ext from torch.utils.cpp_extension import CUDA_HOME except ImportError: raise ImportError("The cpp layer extensions requires PyTorch 0.4 o...
1,165
28.15
80
py
MaskTextSpotterV3
MaskTextSpotterV3-master/maskrcnn_benchmark/layers/misc.py
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. """ helper class that supports empty tensors on some nn functions. Ideally, add support directly in PyTorch to empty tensors in those functions. This can be removed once https://github.com/pytorch/pytorch/issues/12013 is implemented """ import m...
6,035
31.451613
88
py
MaskTextSpotterV3
MaskTextSpotterV3-master/maskrcnn_benchmark/layers/__init__.py
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. import torch from .batch_norm import FrozenBatchNorm2d from .misc import Conv2d from .misc import DFConv2d from .misc import ConvTranspose2d from .misc import interpolate from .nms import nms from .roi_align import ROIAlign from .roi_align import ...
1,372
30.930233
150
py
MaskTextSpotterV3
MaskTextSpotterV3-master/maskrcnn_benchmark/layers/dcn/deform_conv_func.py
import torch from torch.autograd import Function from torch.autograd.function import once_differentiable from torch.nn.modules.utils import _pair from maskrcnn_benchmark import _C class DeformConvFunction(Function): @staticmethod def forward( ctx, input, offset, weight, ...
8,309
30.596958
83
py
MaskTextSpotterV3
MaskTextSpotterV3-master/maskrcnn_benchmark/layers/dcn/deform_pool_func.py
import torch from torch.autograd import Function from torch.autograd.function import once_differentiable from maskrcnn_benchmark import _C class DeformRoIPoolingFunction(Function): @staticmethod def forward( ctx, data, rois, offset, spatial_scale, out_size, ...
2,595
26.041667
99
py
MaskTextSpotterV3
MaskTextSpotterV3-master/maskrcnn_benchmark/layers/dcn/deform_pool_module.py
from torch import nn from .deform_pool_func import deform_roi_pooling class DeformRoIPooling(nn.Module): def __init__(self, spatial_scale, out_size, out_channels, no_trans, group_size=1, part_size=None, ...
6,307
40.774834
79
py
MaskTextSpotterV3
MaskTextSpotterV3-master/maskrcnn_benchmark/layers/dcn/__init__.py
# # Copied From [mmdetection](https://github.com/open-mmlab/mmdetection/tree/master/mmdet/ops/dcn) #
101
24.5
96
py
MaskTextSpotterV3
MaskTextSpotterV3-master/maskrcnn_benchmark/layers/dcn/deform_conv_module.py
import math import torch import torch.nn as nn from torch.nn.modules.utils import _pair from .deform_conv_func import deform_conv, modulated_deform_conv class DeformConv(nn.Module): def __init__( self, in_channels, out_channels, kernel_size, stride=1, padding=0, ...
5,802
31.601124
78
py
MaskTextSpotterV3
MaskTextSpotterV3-master/maskrcnn_benchmark/engine/text_inference.py
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. import datetime import logging import os import pickle import subprocess import time import cv2 import numpy as np import torch from maskrcnn_benchmark.utils.chars import char2num, get_tight_rect, getstr_grid from PIL import Image, ImageDraw from ...
23,471
40.839572
164
py
MaskTextSpotterV3
MaskTextSpotterV3-master/maskrcnn_benchmark/engine/trainer.py
#!/usr/bin/env python3 # Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. import datetime import logging import time import torch from maskrcnn_benchmark.utils.comm import get_world_size, is_main_process from maskrcnn_benchmark.utils.metric_logger import MetricLogger import torch.distributed as di...
4,397
34.184
105
py
MaskTextSpotterV3
MaskTextSpotterV3-master/maskrcnn_benchmark/utils/c2_model_loading.py
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. import logging import pickle from collections import OrderedDict import torch from maskrcnn_benchmark.utils.model_serialization import load_state_dict def _rename_basic_resnet_weights(layer_keys): layer_keys = [k.replace("_", ".") for k in ...
6,944
39.144509
129
py
MaskTextSpotterV3
MaskTextSpotterV3-master/maskrcnn_benchmark/utils/metric_logger.py
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. from collections import defaultdict from collections import deque import torch class SmoothedValue(object): """Track a series of values and provide access to smoothed values over a window or the global series average. """ def __...
1,714
25.796875
82
py
MaskTextSpotterV3
MaskTextSpotterV3-master/maskrcnn_benchmark/utils/checkpoint.py
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. import logging import os import torch from maskrcnn_benchmark.utils.model_serialization import load_state_dict from maskrcnn_benchmark.utils.c2_model_loading import load_c2_format from maskrcnn_benchmark.utils.imports import import_file from mask...
4,813
33.385714
87
py
MaskTextSpotterV3
MaskTextSpotterV3-master/maskrcnn_benchmark/utils/comm.py
# # Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. # """ # This file contains primitives for multi-gpu communication. # This is useful when doing distributed training. # """ # import os # import pickle # import tempfile # import time # import torch # import torch.distributed as dist # # def ...
11,687
29.83905
86
py
MaskTextSpotterV3
MaskTextSpotterV3-master/maskrcnn_benchmark/utils/registry.py
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. def _register_generic(module_dict, module_name, module): assert module_name not in module_dict module_dict[module_name] = module class Registry(dict): ''' A helper class for managing registering modules, it extends a dictionary ...
1,384
29.777778
76
py
MaskTextSpotterV3
MaskTextSpotterV3-master/maskrcnn_benchmark/utils/model_zoo.py
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. import os import sys try: from torch.hub import _download_url_to_file from torch.hub import urlparse from torch.hub import HASH_REGEX except ImportError: from torch.utils.model_zoo import _download_url_to_file from torch.utils....
3,044
48.918033
135
py
MaskTextSpotterV3
MaskTextSpotterV3-master/maskrcnn_benchmark/utils/logging.py
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. import logging import os import sys from tensorboardX import SummaryWriter def setup_logger(name, save_dir, distributed_rank=0): logger = logging.getLogger(name) logger.setLevel(logging.DEBUG) # don't log results for the non-master p...
1,252
28.833333
84
py
MaskTextSpotterV3
MaskTextSpotterV3-master/maskrcnn_benchmark/utils/collect_env.py
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. import PIL from torch.utils.collect_env import get_pretty_env_info def get_pil_version(): return "\n Pillow ({})".format(PIL.__version__) def collect_env_info(): env_str = get_pretty_env_info() env_str += get_pil_version() ...
338
21.6
71
py
MaskTextSpotterV3
MaskTextSpotterV3-master/maskrcnn_benchmark/utils/model_serialization.py
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. from collections import OrderedDict import logging import torch from maskrcnn_benchmark.utils.imports import import_file def align_and_update_state_dicts(model_state_dict, loaded_state_dict): """ Strategy: suppose that the models that w...
3,464
41.777778
91
py
MaskTextSpotterV3
MaskTextSpotterV3-master/maskrcnn_benchmark/utils/chars.py
import os import cv2 import numpy as np def char2num(char): if char in "0123456789": num = ord(char) - ord("0") + 1 elif char in "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ": num = ord(char.lower()) - ord("a") + 11 else: num = 0 return num def num2char(num): ch...
6,419
31.1
89
py
MaskTextSpotterV3
MaskTextSpotterV3-master/maskrcnn_benchmark/utils/__init__.py
0
0
0
py
MaskTextSpotterV3
MaskTextSpotterV3-master/maskrcnn_benchmark/utils/miscellaneous.py
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. import errno import os def mkdir(path): try: os.makedirs(path) except OSError as e: if e.errno != errno.EEXIST: raise
228
18.083333
71
py
MaskTextSpotterV3
MaskTextSpotterV3-master/maskrcnn_benchmark/utils/env.py
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. import os from maskrcnn_benchmark.utils.imports import import_file def setup_environment(): """Perform environment setup work. The default setup is a no-op, but this function allows the user to specify a Python source file that performs ...
1,249
31.894737
90
py
MaskTextSpotterV3
MaskTextSpotterV3-master/maskrcnn_benchmark/utils/imports.py
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. import importlib import importlib.util import sys # from https://stackoverflow.com/questions/67631/how-to-import-a-module-given-the-full-path?utm_medium=organic&utm_source=google_rich_qa&utm_campaign=google_rich_qa def import_file(module_name, fi...
598
38.933333
164
py
MaskTextSpotterV3
MaskTextSpotterV3-master/maskrcnn_benchmark/data/__init__.py
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. from .build import make_data_loader
108
35.333333
71
py
MaskTextSpotterV3
MaskTextSpotterV3-master/maskrcnn_benchmark/data/collate_batch.py
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. from maskrcnn_benchmark.structures.image_list import to_image_list, to_image_target_list class BatchCollator(object): """ From a list of samples from the dataset, returns the batched images and targets. This should be passed to th...
1,080
37.607143
115
py
MaskTextSpotterV3
MaskTextSpotterV3-master/maskrcnn_benchmark/data/build.py
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. import bisect import logging import torch.utils.data from maskrcnn_benchmark.utils.comm import get_world_size from maskrcnn_benchmark.utils.imports import import_file from . import datasets as D from . import samplers from .collate_batch import ...
6,740
37.301136
143
py