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 |
|---|---|---|---|---|---|---|
lm-evaluation-harness | lm-evaluation-harness-master/lm_eval/tasks/gem_wikilingua.py | """
WikiLingua: A New Benchmark Dataset for Cross-Lingual Abstractive Summarization
https://arxiv.org/pdf/2010.03093.pdf
Wikilingua is a large-scale (~770k article-summary pairs), multilingual dataset for the evaluation of cross-lingual abstractive systems.
It consists of parallel articles and summaries (article-summa... | 3,812 | 22.392638 | 150 | py |
lm-evaluation-harness | lm-evaluation-harness-master/lm_eval/tasks/gem_webnlg.py | """
The 2020 Bilingual, Bi-Directional WebNLG+ Shared Task:
Overview and Evaluation Results (WebNLG+ 2020)
https://aclanthology.org/2020.webnlg-1.7/
WebNLG+ offers two challenges: (i) mapping sets of RDF triples
to English or Russian text (generation) and (ii) converting
English or Russian text to sets of RDF triples ... | 3,777 | 28.515625 | 553 | py |
lm-evaluation-harness | lm-evaluation-harness-master/lm_eval/tasks/lama.py | """
https://arxiv.org/abs/1909.01066
https://arxiv.org/abs/2005.04611
LAMA is a prob dataset to test the factual and commonsense knowledge in language models. The dataset includes a subset of
Google_RE (https://code.google.com/archive/p/relation-extraction-corpus/), TRex (subset of wikidata triples),
Conceptnet (https:... | 6,809 | 25.192308 | 161 | py |
lm-evaluation-harness | lm-evaluation-harness-master/lm_eval/tasks/gem_xsum.py | """
Don't Give Me the Details, Just the Summary! Topic-Aware Convolutional Neural Networks for Extreme Summarization
https://arxiv.org/pdf/1808.08745.pdf
The dataset is for the task of abstractive summarization in its extreme form, its about summarizing a document in a single sentence. It introduces extreme summarizat... | 4,314 | 25.96875 | 411 | py |
lm-evaluation-harness | lm-evaluation-harness-master/lm_eval/tasks/e2e_nlg_cleaned.py | """
Semantic Noise Matters for Neural Natural Language Generation
http://arxiv.org/abs/1911.03905
A cleaned version of the dataset from the E2E NLG Challenge.
The dataset contains MR with restaurant attributes and corresponding descriptions.
Homepage: https://github.com/tuetschek/e2e-cleaning
"""
from lm_eval.api.tas... | 2,524 | 30.962025 | 113 | py |
lm-evaluation-harness | lm-evaluation-harness-master/lm_eval/tasks/huff_post.py | """
A dataset of approximately 200K news headlines from the year 2012 to 2018 collected from HuffPost.
Homepage: https://www.kaggle.com/datasets/rmisra/news-category-dataset
"""
from lm_eval.api.task import PromptSourceTask
_CITATION = """\
@book{book,
author = {Misra, Rishabh and Grover, Jigyasa},
year = {2021}... | 1,228 | 21.759259 | 98 | py |
lm-evaluation-harness | lm-evaluation-harness-master/lm_eval/tasks/amazon_reviews_multi.py | # It was based on gem_wikilingua.py
from lm_eval.api.task import PromptSourceTask
import typing
class AmazonReviewsMultiBase(PromptSourceTask):
VERSION = 0
DATASET_PATH = "amazon_reviews_multi"
DATASET_NAME = None
def has_training_docs(self):
return True
def has_validation_docs(self):
... | 1,512 | 22.640625 | 66 | py |
lm-evaluation-harness | lm-evaluation-harness-master/lm_eval/tasks/blimp.py | """
BLiMP: A Benchmark of Linguistic Minimal Pairs for English
https://arxiv.org/abs/1912.00582
BLiMP is a challenge set for evaluating what language models (LMs) know about
major grammatical phenomena in English. BLiMP consists of 67 sub-datasets, each
containing 1000 minimal pairs isolating specific contrasts in syn... | 9,157 | 27.708464 | 972 | py |
lm-evaluation-harness | lm-evaluation-harness-master/lm_eval/tasks/crd3.py | """
Storytelling with Dialogue: A Critical Role Dungeons and Dragons Dataset
https://aclanthology.org/2020.acl-main.459.pdf
Storytelling with Dialogue: A Critical Role Dungeons and Dragons Dataset. Critical Role is an unscripted, live-streamed show where a fixed group of people play Dungeons and Dragons, an open-ended... | 1,903 | 35.615385 | 713 | py |
lm-evaluation-harness | lm-evaluation-harness-master/lm_eval/tasks/crows_pairs_multilingual.py | """
French CrowS-Pairs: Extending a challenge dataset for measuring social bias in masked language models to a language other than English
https://hal.inria.fr/hal-03629677/file/ACLFinal.pdf
Measuring social biases in masked language models in English and French.
https://gitlab.inria.fr/french-crows-pairs/acl-2022-pape... | 1,797 | 25.835821 | 145 | py |
lm-evaluation-harness | lm-evaluation-harness-master/lm_eval/tasks/wino_bias.py | """
Gender Bias in Coreference Resolution: Evaluation and Debiasing Methods
https://arxiv.org/abs/1804.06876
Winograd-schema evaluation of gendered coreference resolution.
The dataset contains pro-stereotypical and anti-stereotypical parts. The difference in accuracy for those two subsets
quatnifies bias.
Homepage: h... | 3,648 | 34.77451 | 783 | py |
lm-evaluation-harness | lm-evaluation-harness-master/lm_eval/tasks/race.py | """
RACE: Large-scale ReAding Comprehension Dataset From Examinations
https://arxiv.org/pdf/1704.04683.pdf
RACE is a large-scale reading comprehension dataset with more than 28,000 passages
and nearly 100,000 questions. The dataset is collected from English examinations
in China, which are designed for middle school a... | 1,274 | 26.12766 | 91 | py |
lm-evaluation-harness | lm-evaluation-harness-master/lm_eval/tasks/xquad.py | """
On the cross-lingual transferability of monolingual representations
https://arxiv.org/abs/1910.11856
XQuAD (Cross-lingual Question Answering Dataset) is a benchmark dataset
for evaluating cross-lingual question answering performance. The dataset
consists of a subset of 240 paragraphs and 1190 question-answer pairs... | 11,937 | 38.39934 | 96 | py |
lm-evaluation-harness | lm-evaluation-harness-master/lm_eval/tasks/cnn_dailymail.py | """
CNN/Daily Mail is a dataset for text summarization. Human generated abstractive
summary bullets were generated from news stories in CNN and Daily Mail websites
as questions (with one of the entities hidden), and stories as the corresponding
passages from which the system is expected to answer the fill-in the-blank
... | 2,042 | 31.428571 | 81 | py |
lm-evaluation-harness | lm-evaluation-harness-master/lm_eval/tasks/gem_mlsum.py | """
MLSUM: The Multilingual Summarization Corpus
https://aclanthology.org/2020.emnlp-main.647/
This is the MLSUM subset of the GEM benchmark. MLSUM is the first large-scale MultiLingual SUMmarization dataset.
Obtained from online newspapers, it contains 1.5M+ article/summary pairs in five different languages -- namely... | 3,208 | 25.520661 | 211 | py |
lm-evaluation-harness | lm-evaluation-harness-master/lm_eval/tasks/schema_guided_dstc8.py | """
Towards Scalable Multi-domain Conversational Agents: The Schema-Guided Dialogue Dataset
https://arxiv.org/abs/1909.05855
Multi-domain, task-oriented conversations created for the DSTC8 challenge.
Here, the dataset is be used for evaluating response generation.
Homepage: https://github.com/google-research-datasets... | 1,483 | 26.481481 | 106 | py |
lm-evaluation-harness | lm-evaluation-harness-master/lm_eval/tasks/bias_shades.py | """
Multilingual dataset for measuring social biases in language models.
https://huggingface.co/datasets/BigScienceBiasEval/bias-shades/viewer/spanish/test
TODO: Add `arabic`, `german`, `russian`, and `tamil` subsets when `promptsource`
templates become available.
"""
from lm_eval.api.task import PromptSourceTask
_C... | 1,588 | 21.069444 | 82 | py |
lm-evaluation-harness | lm-evaluation-harness-master/lm_eval/tasks/tydiqa.py | """
TyDi QA: A Benchmark for Information-Seeking Question Answering in Typologically Diverse Languages
TyDi QA is a question answering dataset covering 11 typologically diverse languages with 200K question-answer pairs.
Paper: https://arxiv.org/abs/2003.05002
Homepage: https://ai.google.com/research/tydiqa
"""
from t... | 5,673 | 33.809816 | 173 | py |
lm-evaluation-harness | lm-evaluation-harness-master/lm_eval/tasks/diabla.py | """
DiaBLa: English-French Bilingual dialogue dataset for Machine Translation
https://link.springer.com/article/10.1007/s10579-020-09514-4
Rachel Bawden, Eric Bilinski, Thomas Lavergne and Sophie Rosset
(2021). DiaBLa: A Corpus of Bilingual Spontaneous Written Dialogues
for Machine Translation. Language Resources and ... | 11,833 | 40.377622 | 344 | py |
lm-evaluation-harness | lm-evaluation-harness-master/lm_eval/tasks/__init__.py | import logging
from typing import List, Mapping, Tuple, Type, Optional, Union
from promptsource.templates import DatasetTemplates
import lm_eval.api.utils
from lm_eval.api.task import Task
from . import amazon_reviews_multi
from . import anli
from . import bias_shades
from . import blimp
from . import diabla
from . i... | 16,649 | 42.359375 | 123 | py |
lm-evaluation-harness | lm-evaluation-harness-master/lm_eval/tasks/gem_asset_turk.py | """
ASSET: ASSET (Alva-Manchego et al., 2020) is multi-reference dataset
for the evaluation of sentence simplification in English. The dataset
uses the same 2,359 sentences from TurkCorpus (Xu et al., 2016)
and each sentence is associated with 10 crowdsourced simplifications.
Unlike previous simplification datasets, wh... | 4,616 | 27.325153 | 88 | py |
lm-evaluation-harness | lm-evaluation-harness-master/lm_eval/tasks/hans.py | """
Right for the Wrong Reasons: Diagnosing Syntactic Heuristics in Natural Language Inference
https://arxiv.org/abs/1902.01007
A controlled evaluation set called HANS (Heuristic Analysis for NLI Systems),
which contains many examples where the heuristics fail.
Homepage: https://github.com/tommccoy1/hans
"""
from lm_... | 2,756 | 42.761905 | 1,015 | py |
lm-evaluation-harness | lm-evaluation-harness-master/lm_eval/tasks/piaf.py | """
Project PIAF: Building a Native French Question-Answering Dataset
https://arxiv.org/pdf/2007.00968.pdf
Piaf is a reading comprehension dataset. This version, published in February 2020,
contains 3835 questions on French Wikipedia.
Homepage: https://huggingface.co/datasets/piaf
"""
import transformers.data.metrics... | 3,169 | 30.7 | 402 | py |
lm-evaluation-harness | lm-evaluation-harness-master/lm_eval/tasks/jigsaw_unintended_bias.py | """
Jigsaw unintended bias in toxicity classification
https://www.kaggle.com/c/jigsaw-unintended-bias-in-toxicity-classification
Jigsaw Toxicity is a dataset curated by Alphabet from the now-defunct Civil Comments platform. It is used
to measure bias in toxicity classification models, specifically with equalized odds.... | 7,010 | 36.693548 | 130 | py |
lm-evaluation-harness | lm-evaluation-harness-master/lm_eval/tasks/coqa.py | """
CoQA: A Conversational Question Answering Challenge
https://arxiv.org/pdf/1808.07042.pdf
CoQA is a large-scale dataset for building Conversational Question Answering
systems. The goal of the CoQA challenge is to measure the ability of machines to
understand a text passage and answer a series of interconnected ques... | 2,813 | 27.424242 | 86 | py |
lm-evaluation-harness | lm-evaluation-harness-master/lm_eval/tasks/drop.py | """
DROP: A Reading Comprehension Benchmark Requiring Discrete Reasoning Over Paragraphs
https://aclanthology.org/attachments/N19-1246.Supplementary.pdf
DROP is a QA dataset which tests comprehensive understanding of paragraphs. In
this crowdsourced, adversarially-created, 96k question-answering benchmark, a
system mu... | 6,973 | 33.019512 | 116 | py |
lm-evaluation-harness | lm-evaluation-harness-master/lm_eval/tasks/flores_101.py | """
The Flores-101 Evaluation Benchmark for Low-Resource and Multilingual Machine Translation
https://aclanthology.org/2022.tacl-1.30/
Naman Goyal, Cynthia Gao, Vishrav Chaudhary, Peng-Jen Chen, Guillaume Wenzek, Da Ju, Sanjana Krishnan,
Marc’Aurelio Ranzato, Francisco Guzmán, and Angela Fan. 2022. The Flores-101 Eval... | 20,271 | 36.750466 | 113 | py |
GradAug | GradAug-main/train_cifar.py | import os
import shutil
import time
import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.nn.parallel
import torch.backends.cudnn as cudnn
import torch.optim
import torch.utils.data
import torchvision.transforms as transforms
import torchvision.datasets as datasets
from models.wideresnet_ran... | 11,920 | 37.33119 | 131 | py |
GradAug | GradAug-main/train.py | import os
import shutil
import time
import importlib
import torch
import torch.nn as nn
import torch.nn.parallel
import torch.backends.cudnn as cudnn
import torch.nn.functional as F
import torch.optim
import torch.utils.data
import torch.utils.data.distributed
import torchvision.transforms as transforms
import torchvi... | 10,863 | 33.820513 | 125 | py |
GradAug | GradAug-main/models/randwidth_ops.py | # These operations are based on the implementation of https://github.com/JiahuiYu/slimmable_networks
import torch.nn as nn
from utils.config import FLAGS
def make_divisible(v, divisor=1, min_value=1):
if min_value is None:
min_value = divisor
new_v = max(min_value, int(v + divisor / 2) // divisor * d... | 5,110 | 34.992958 | 100 | py |
GradAug | GradAug-main/models/resnet_randwidth.py | import torch.nn as nn
import math
from models.randwidth_ops import RWConv2d, RWLinear, RWBatchNorm2d, make_divisible
from utils.config import FLAGS
class Block(nn.Module):
def __init__(self, inp, outp, stride, tmp_ratio=1.0):
super(Block, self).__init__()
assert stride in [1, 2]
# midp =... | 4,581 | 33.451128 | 95 | py |
GradAug | GradAug-main/models/wideresnet_randwidth.py | import math
import torch
import torch.nn as nn
import torch.nn.functional as F
from models.randwidth_ops import RWConv2d, RWLinear, RWBatchNorm2d
class BasicBlock(nn.Module):
def __init__(self, in_planes, out_planes, stride, dropRate=0.0):
super(BasicBlock, self).__init__()
self.bn1 = RWBatchNorm2... | 3,864 | 43.425287 | 115 | py |
GradAug | GradAug-main/models/resnet_randdepth.py | '''
resnet for cifar in pytorch
Reference:
[1] K. He, X. Zhang, S. Ren, and J. Sun. Deep residual learning for image recognition. In CVPR, 2016.
[2] K. He, X. Zhang, S. Ren, and J. Sun. Identity mappings in deep residual networks. In ECCV, 2016.
'''
import torch
import torch.nn as nn
import math
import numpy as np
... | 4,787 | 29.113208 | 109 | py |
GradAug | GradAug-main/models/pyramidnet_randwidth.py | import torch
import torch.nn as nn
import math
from models.randwidth_ops import RWLinear, RWConv2d, RWBatchNorm2d
def conv3x3(in_planes, out_planes, stride=1):
"3x3 convolution with padding"
return nn.Conv2d(in_planes, out_planes, kernel_size=3, stride=stride,
padding=1, bias=False)
cla... | 9,184 | 37.919492 | 129 | py |
GradAug | GradAug-main/utils/mytransforms.py | import torch
import numpy as np
from PIL import Image
from torchvision import transforms
import random
imagenet_pca = {
'eigval': np.asarray([0.2175, 0.0188, 0.0045]),
'eigvec': np.asarray([
[-0.5675, 0.7192, 0.4009],
[-0.5808, -0.0045, -0.8140],
[-0.5836, -0.6948, 0.4203],
])
}
... | 2,934 | 33.127907 | 102 | py |
GradAug | GradAug-main/utils/setlogger.py | import logging
def get_logger(file_path):
""" Make python logger """
# [!] Since tensorboardX use default logger (e.g. logging.info()), we should use custom logger
logger = logging.getLogger('USNet')
log_format = '%(asctime)s | %(message)s'
formatter = logging.Formatter(log_format, datefmt='%m/%d %... | 639 | 34.555556 | 98 | py |
GradAug | GradAug-main/utils/config.py | """config utilities for yml file."""
import os
import sys
import yaml
# singletone
FLAGS = None
class LoaderMeta(type):
"""Constructor for supporting `!include`.
"""
def __new__(mcs, __name__, __bases__, __dict__):
"""Add include constructer to class."""
# register the include constructor... | 5,181 | 29.482353 | 78 | py |
HDN | HDN-master/setup.py | from distutils.core import setup
from distutils.extension import Extension
from Cython.Build import cythonize
ext_modules = [
Extension(
name='toolkit.utils.region',
sources=[
'toolkit/utils/region.pyx',
'toolkit/utils/src/region.c',
],
include_dirs=[
... | 458 | 18.956522 | 41 | py |
HDN | HDN-master/tools/test.py | #Copyright 2021, XinruiZhan
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
import argparse
import os
import cv2
import torch
import numpy as np
from hdn.core.config import cfg
from hdn.tracker.tracker_builder import... | 10,757 | 42.032 | 176 | py |
HDN | HDN-master/tools/demo.py | #Copyright 2021, XinruiZhan
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
import os
import argparse
import cv2
import torch
import numpy as np
from glob import glob
from hdn.core.config import cfg
from hdn.models.m... | 11,417 | 41.764045 | 149 | py |
HDN | HDN-master/tools/eval.py | #Copyright 2021, XinruiZhan
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
import os
import argparse
from glob import glob
from tqdm import tqdm
from multiprocessing import Pool
from toolkit.datasets import OTBDatase... | 10,821 | 47.097778 | 123 | py |
HDN | HDN-master/tools/train.py | #Copyright 2021, XinruiZhan
# A distribute version of training
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
import argparse
import logging
import os
import time
import math
import json
import random
import numpy as ... | 14,895 | 37.293059 | 185 | py |
HDN | HDN-master/hdn/__init__.py | 0 | 0 | 0 | py | |
HDN | HDN-master/hdn/tracker/base_tracker.py | # Copyright (c) SenseTime. All Rights Reserved.
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
import cv2
import numpy as np
import torch
from hdn.core.config import cfg
from hdn.models.logpolar import getPolarImg, ... | 10,345 | 35.95 | 147 | py |
HDN | HDN-master/hdn/tracker/tracker_builder.py | #Copyright 2021, XinruiZhan
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
from hdn.core.config import cfg
from hdn.tracker.hdn_tracker import hdnTracker
from hdn.tracker.hdn_tracker_proj_e2e import hdnTrackerHomo as ... | 524 | 25.25 | 84 | py |
HDN | HDN-master/hdn/tracker/__init__.py | 0 | 0 | 0 | py | |
HDN | HDN-master/hdn/tracker/hdn_tracker_proj_e2e.py | #Copyright 2021, XinruiZhan
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
import numpy as np
import torch
import math
from hdn.tracker.hdn_tracker import hdnTracker
from hdn.core.config import cfg
from hdn.utils.bbo... | 14,392 | 49.149826 | 180 | py |
HDN | HDN-master/hdn/tracker/hdn_tracker.py | #Copyright 2021, XinruiZhan
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
import numpy as np
import torch
import math
from hdn.core.config import cfg
from hdn.tracker.base_tracker import SiameseTracker
from hdn.util... | 12,537 | 40.379538 | 162 | py |
HDN | HDN-master/hdn/core/config.py | from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
from yacs.config import CfgNode as CN
__C = CN()
cfg = __C
__C.META_ARC = "hdn_r50_l234"
__C.CUDA = True
#-----------------------------------------------------------... | 14,606 | 25.318919 | 160 | py |
HDN | HDN-master/hdn/core/xcorr.py | from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
import torch
import torch.nn.functional as F
def xcorr_slow(x, kernel):
"""for loop to calculate cross correlation, slow version
"""
batch = x.size()[0]
... | 2,109 | 33.032258 | 120 | py |
HDN | HDN-master/hdn/core/__init__.py | 0 | 0 | 0 | py | |
HDN | HDN-master/hdn/models/iou_loss.py | import torch
from torch import nn
class IOULoss(nn.Module):
def __init__(self, loc_loss_type):
super(IOULoss, self).__init__()
self.loc_loss_type = loc_loss_type
def forward(self, pred, target, weight=None):
pred_left = pred[:, 0]
pred_top = pred[:, 1]
pred_right = pre... | 1,855 | 35.392157 | 95 | py |
HDN | HDN-master/hdn/models/model_builder_e2e_unconstrained_v2.py | #Copyright 2021, XinruiZhan
'''
Designed for end-to-end homo-estimation.
unconstrained means we whether dataset give us label we can train the model.
'''
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
import torch
impo... | 26,131 | 45.415631 | 262 | py |
HDN | HDN-master/hdn/models/init_weight.py | import torch.nn as nn
def init_weights(model):
for m in model.modules():
if isinstance(m, nn.Conv2d):
nn.init.kaiming_normal_(m.weight.data,
mode='fan_out',
nonlinearity='relu')
elif isinstance(m, nn.BatchNorm2d):
... | 386 | 31.25 | 56 | py |
HDN | HDN-master/hdn/models/loss.py | #Copyright 2021, XinruiZhan
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
import torch
import torch.nn as nn
import torch.nn.functional as F
import numpy as np
from hdn.core.config import cfg
from hdn.models.iou_los... | 8,330 | 38.112676 | 111 | py |
HDN | HDN-master/hdn/models/logpolar.py | import cv2
import numpy as np
import math
import torch.nn as nn
import torch.nn.functional as F
import torch
import matplotlib.pyplot as plt
from hdn.core.config import cfg
def getPolarImg(img, original = None):
"""
some assumption that img W==H
:param img: image
:return: polar image
"""
sz = ... | 11,196 | 33.558642 | 102 | py |
HDN | HDN-master/hdn/models/__init__.py | 0 | 0 | 0 | py | |
HDN | HDN-master/hdn/models/backbone/resnet_atrous.py | import math
import torch.nn as nn
import torch
__all__ = ['ResNet', 'resnet18', 'resnet34', 'resnet50']
def conv3x3(in_planes, out_planes, stride=1, dilation=1):
"3x3 convolution with padding"
return nn.Conv2d(in_planes, out_planes, kernel_size=3, stride=stride,
padding=dilation, bias=... | 7,286 | 29.746835 | 78 | py |
HDN | HDN-master/hdn/models/backbone/__init__.py |
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
from hdn.models.backbone.alexnet import alexnetlegacy, alexnet
from hdn.models.backbone.mobile_v2 import mobilenetv2
from hdn.models.backbone.resnet_atrous import resnet... | 677 | 26.12 | 74 | py |
HDN | HDN-master/hdn/models/backbone/mobile_v2.py | from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
import torch
import torch.nn as nn
def conv_bn(inp, oup, stride, padding=1):
return nn.Sequential(
nn.Conv2d(inp, oup, 3, stride, padding, bias=False),
... | 4,315 | 27.20915 | 77 | py |
HDN | HDN-master/hdn/models/backbone/alexnet.py | from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
import torch.nn as nn
class AlexNetLegacy(nn.Module):
configs = [3, 96, 256, 384, 384, 256]
def __init__(self, width_mult=1):
configs = list(map(lambda... | 2,991 | 31.521739 | 72 | py |
HDN | HDN-master/hdn/models/neck/neck.py | # Copyright (c) SenseTime. All Rights Reserved.
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
import torch.nn as nn
class AdjustLayer(nn.Module):
def __init__(self, in_channels, out_channels, cut=True, cut_lef... | 1,709 | 31.884615 | 101 | py |
HDN | HDN-master/hdn/models/neck/__init__.py |
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
import torch
import torch.nn as nn
import torch.nn.functional as F
from hdn.models.neck.neck import AdjustLayer, AdjustAllLayer
NECKS = {
'AdjustLayer': Adjus... | 445 | 21.3 | 60 | py |
HDN | HDN-master/hdn/models/head/ban.py | from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
import torch
import torch.nn as nn
import torch.nn.functional as F
from hdn.core.xcorr import xcorr_fast, xcorr_depthwise
class BAN(nn.Module):
def __init__(self):
... | 4,392 | 33.054264 | 107 | py |
HDN | HDN-master/hdn/models/head/ban_lp.py | from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
import torch
import torch.nn as nn
import torch.nn.functional as F
from hdn.core.xcorr import xcorr_fast, xcorr_depthwise, xcorr_depthwise_circular
from hdn.models.head.... | 3,288 | 34.365591 | 111 | py |
HDN | HDN-master/hdn/models/head/__init__.py | from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
from hdn.models.head.ban import UPChannelBAN, DepthwiseBAN, MultiBAN
from hdn.models.head.ban_lp import DepthwiseCircBAN, MultiCircBAN
BANS = {
'UPChannelBAN': U... | 563 | 25.857143 | 68 | py |
HDN | HDN-master/hdn/datasets/custom_transforms.py | import torch
import numpy as np
import cv2
class Normalize(object):
def __init__(self):
self.mean = np.array([0.485, 0.456, 0.406], dtype=np.float32)
self.std = np.array([0.229, 0.224, 0.225], dtype=np.float32)
def __call__(self, sample):
return (sample / 255. - self.mean) / self.std
... | 478 | 27.176471 | 69 | py |
HDN | HDN-master/hdn/datasets/__init__.py | 2 | 0 | 0 | py | |
HDN | HDN-master/hdn/datasets/point_target/__init__.py | 0 | 0 | 0 | py | |
HDN | HDN-master/hdn/datasets/point_target/point_target.py | from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
import numpy as np
from hdn.core.config import cfg
from hdn.utils.bbox import corner2center
from hdn.utils.point import Point
import math
import cv2
import matplotlib.py... | 11,733 | 43.279245 | 165 | py |
HDN | HDN-master/hdn/datasets/dataset/unconstrained_v2_dataset.py | #Copyright 2021, XinruiZhan
"""
this file implements the perspective transforma augmentation on template image as search, or just use sampled two images from video as template and search.
we just need to adjust the interval, if there is interval we use unsupervised, if not, then use supervised
"""
from __future__ impo... | 19,251 | 46.535802 | 156 | py |
HDN | HDN-master/hdn/datasets/dataset/dataset.py | #Copyright 2021, XinruiZhan
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
import torchvision.transforms as transforms
from hdn.datasets.custom_transforms import Normalize, ToTensor
import orjson as json
import loggi... | 15,007 | 39.128342 | 146 | py |
HDN | HDN-master/hdn/datasets/dataset/__init__.py | #Copyright 2021, XinruiZhan
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
# from hdn.datasets.dataset.dataset import BANDataset as simi_aug_dataset# similarity augmentation on objects that nothing changed
from hdn.dat... | 726 | 37.263158 | 146 | py |
HDN | HDN-master/hdn/datasets/augmentation/__init__.py | 0 | 0 | 0 | py | |
HDN | HDN-master/hdn/datasets/augmentation/homo_augmentation_e2e.py | #Copyright 2021, XinruiZhan
"""
This class is designed to augment the non-homo-dataset
it's augmentation is composed by parameters not move the 4pts.
"""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
import numpy as ... | 12,941 | 38.944444 | 182 | py |
HDN | HDN-master/hdn/utils/utils_geo.py | """
* This file is part of PYSLAM
*
* Copyright (C) 2016-present Luigi Freda <luigi dot freda at gmail dot com>
*
* PYSLAM is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* ... | 10,701 | 35.155405 | 182 | py |
HDN | HDN-master/hdn/utils/image_aug.py | import cv2
import numpy as np
import random
from scipy.stats import norm
import matplotlib.pyplot as plt
def generate_spot_light_mask(mask_size,
position=None,
max_brightness=255,
min_brightness=0,
mode="... | 5,069 | 42.706897 | 117 | py |
HDN | HDN-master/hdn/utils/lr_scheduler.py | # Copyright (c) SenseTime. All Rights Reserved.
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
import math
import numpy as np
from torch.optim.lr_scheduler import _LRScheduler
from hdn.core.config import cfg
clas... | 7,253 | 31.097345 | 107 | py |
HDN | HDN-master/hdn/utils/model_load.py | # Copyright (c) SenseTime. All Rights Reserved.
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
import logging
import torch
from memory_profiler import profile
logger = logging.getLogger('global')
def check_keys(... | 4,183 | 36.026549 | 108 | py |
HDN | HDN-master/hdn/utils/camera.py | """
* This file is part of PYSLAM
*
* Copyright (C) 2016-present Luigi Freda <luigi dot freda at gmail dot com>
*
* PYSLAM is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* ... | 4,837 | 39.655462 | 204 | py |
HDN | HDN-master/hdn/utils/mplot_thread.py | """
* This file is part of PYSLAM
*
* Copyright (C) 2016-present Luigi Freda <luigi dot freda at gmail dot com>
*
* PYSLAM is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* ... | 11,129 | 32.423423 | 118 | py |
HDN | HDN-master/hdn/utils/point.py | from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
import numpy as np
import torch
"""
cpu version
"""
#generate grid for NM
def generate_points(stride, size):
ori = - (size // 2) * stride # -96
x, y = np.meshgr... | 3,894 | 37.186275 | 106 | py |
HDN | HDN-master/hdn/utils/homo_utils.py | import torch
import numpy as np
import cv2
def DLT_solve(src_p, off_set):
# src_p: shape=(bs, n, 4, 2)
# off_set: shape=(bs, n, 4, 2)
# can be used to compute mesh points (multi-H)
bs, _ = src_p.shape
divide = int(np.sqrt(len(src_p[0]) / 2) - 1)
row_num = (divide + 1) * 2
for i in range(d... | 12,410 | 35.183673 | 119 | py |
HDN | HDN-master/hdn/utils/transform.py | #Copyright 2021, XinruiZhan
import cv2
import matplotlib.pyplot as plt
import math
import numpy as np
import torch
def img_padding(img, sx, sy):
"""
add padding to an image [w,h] => [w+sx*2, h+sy*2]
:param img:
:param sx:
:param sy:
:return:
"""
padd_w = img.shape[1] + sx*2
padd_h = ... | 19,034 | 35.326336 | 147 | py |
HDN | HDN-master/hdn/utils/average_meter.py | # Copyright (c) SenseTime. All Rights Reserved.
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
class Meter(object):
def __init__(self, name, val, avg):
self.name = name
self.val = val
sel... | 2,907 | 26.695238 | 65 | py |
HDN | HDN-master/hdn/utils/misc.py | # Copyright (c) SenseTime. All Rights Reserved.
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
import os
from colorama import Fore, Style
__all__ = ['commit', 'describe']
def _exec(cmd):
f = os.popen(cmd, 'r... | 1,665 | 23.5 | 77 | py |
HDN | HDN-master/hdn/utils/bbox.py | # Copyright (c) SenseTime. All Rights Reserved.
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
from collections import namedtuple
import numpy as np
import math
import cv2
Corner = namedtuple('Corner', 'x1 y1 x2 y... | 8,638 | 26.689103 | 108 | py |
HDN | HDN-master/hdn/utils/basic_trackers.py | import cv2
import matplotlib.pyplot as plt
import math
import numpy as np
import torch
from math import sin, cos, atan2, sqrt, degrees
from hdn.core.config import cfg
sift = cv2.xfeatures2d.SIFT_create()
def find_homo_by_imgs_opencv_ORB_ransac(im1, im2):
MAX_FEATURES = 500
GOOD_MATCH_PERCENT = 0.15
# Con... | 4,807 | 32.158621 | 98 | py |
HDN | HDN-master/hdn/utils/ground_truth.py | """
* This file is part of PYSLAM
*
* Copyright (C) 2016-present Luigi Freda <luigi dot freda at gmail dot com>
*
* PYSLAM is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* ... | 8,622 | 39.483568 | 143 | py |
HDN | HDN-master/hdn/utils/log_helper.py | # Copyright (c) SenseTime. All Rights Reserved.
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
import os
import logging
import math
import sys
if hasattr(sys, 'frozen'): # support for py2exe
_srcfile = "loggin... | 4,805 | 25.406593 | 92 | py |
HDN | HDN-master/hdn/utils/distributed.py | """
distriebuted training method
"""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
import os
import socket
import logging
import torch
import torch.nn as nn
import torch.distributed as dist
from hdn.utils.log_helpe... | 3,606 | 23.705479 | 78 | py |
HDN | HDN-master/hdn/utils/__init__.py | 0 | 0 | 0 | py | |
HDN | HDN-master/hdn/utils/general.py | # coding: utf-8
import argparse
import torch
from torch.utils.data import DataLoader
import torch.nn as nn
import imageio
import os
import numpy as np
import matplotlib.pyplot as plt
def geometricDistance(correspondence, h):
"""
Correspondence err
:param correspondence: Coordinate
:param h: Homography
... | 983 | 23.6 | 81 | py |
HDN | HDN-master/toolkit/__init__.py | 0 | 0 | 0 | py | |
HDN | HDN-master/toolkit/evaluation/ar_benchmark.py | """
@author
"""
import warnings
import itertools
import numpy as np
from colorama import Style, Fore
from ..utils import calculate_failures, calculate_accuracy
class AccuracyRobustnessBenchmark:
"""
Args:
dataset:
burnin:
"""
def __init__(self, dataset, burnin=10):
self.da... | 5,903 | 40.577465 | 121 | py |
HDN | HDN-master/toolkit/evaluation/f1_benchmark.py | import os
import numpy as np
from glob import glob
from tqdm import tqdm
from colorama import Style, Fore
from ..utils import determine_thresholds, calculate_accuracy, calculate_f1
class F1Benchmark:
def __init__(self, dataset):
"""
Args:
result_path:
"""
self.dataset ... | 5,862 | 40.288732 | 104 | py |
HDN | HDN-master/toolkit/evaluation/ope_benchmark.py | import numpy as np
from colorama import Style, Fore
from ..utils import overlap_ratio, success_overlap, success_error
class OPEBenchmark:
"""
Args:
result_path: result path of your tracker
should the same format like VOT
"""
def __init__(self, dataset):
self.dataset = ... | 8,480 | 42.270408 | 99 | py |
HDN | HDN-master/toolkit/evaluation/eao_benchmark.py | import os
import time
import numpy as np
from glob import glob
from ..utils import calculate_failures, calculate_accuracy, calculate_expected_overlap
class EAOBenchmark:
"""
Args:
dataset:
"""
def __init__(self, dataset, skipping=5, tags=['all']):
self.dataset = dataset
self.s... | 7,164 | 42.689024 | 110 | py |
HDN | HDN-master/toolkit/evaluation/__init__.py | from .ar_benchmark import AccuracyRobustnessBenchmark
from .eao_benchmark import EAOBenchmark
from .ope_benchmark import OPEBenchmark
from .f1_benchmark import F1Benchmark
from .homo_benchmark import HomoBenchmark | 213 | 41.8 | 53 | py |
HDN | HDN-master/toolkit/evaluation/homo_benchmark.py | import numpy as np
from colorama import Style, Fore
from ..utils import overlap_ratio, success_overlap, success_error,success_4pts_error, success_poly_overlap, success_centroid_error, robust_poly_overlap
class HomoBenchmark:
"""
Args:
result_path: result path of your tracker
should th... | 15,597 | 44.741935 | 154 | py |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.