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
Fanoos
Fanoos-master/experimentInfulstructure/randomlyGenerateQueriesToRun.py
# Fanoos: Multi-Resolution, Multi-Strength, Interactive Explanations for Learned Systems ; David Bayani and Stefan Mitsch ; paper at https://arxiv.org/abs/2006.12453 # Copyright (C) 2021 David Bayani # # This file is part of Fanoos. # # Fanoos is free software: you can redistribute it and/or modify # it under the te...
21,502
82.023166
2,828
py
Fanoos
Fanoos-master/utils/getPathToThisDirectory.py
# Fanoos: Multi-Resolution, Multi-Strength, Interactive Explanations for Learned Systems ; David Bayani and Stefan Mitsch ; paper at https://arxiv.org/abs/2006.12453 # Copyright (C) 2021 David Bayani # # This file is part of Fanoos. # # Fanoos is free software: you can redistribute it and/or modify # it under the te...
4,143
85.333333
2,781
py
Fanoos
Fanoos-master/utils/getGitCommitHash.py
# Fanoos: Multi-Resolution, Multi-Strength, Interactive Explanations for Learned Systems ; David Bayani and Stefan Mitsch ; paper at https://arxiv.org/abs/2006.12453 # Copyright (C) 2021 David Bayani # # This file is part of Fanoos. # # Fanoos is free software: you can redistribute it and/or modify # it under the te...
6,249
65.489362
2,781
py
Fanoos
Fanoos-master/utils/contracts.py
# Fanoos: Multi-Resolution, Multi-Strength, Interactive Explanations for Learned Systems ; David Bayani and Stefan Mitsch ; paper at https://arxiv.org/abs/2006.12453 # Copyright (C) 2021 David Bayani # # This file is part of Fanoos. # # Fanoos is free software: you can redistribute it and/or modify # it under the te...
6,865
66.313725
2,781
py
Fanoos
Fanoos-master/utils/getStringTimeNow.py
# Fanoos: Multi-Resolution, Multi-Strength, Interactive Explanations for Learned Systems ; David Bayani and Stefan Mitsch ; paper at https://arxiv.org/abs/2006.12453 # Copyright (C) 2021 David Bayani # # This file is part of Fanoos. # # Fanoos is free software: you can redistribute it and/or modify # it under the te...
4,390
85.098039
2,781
py
Fanoos
Fanoos-master/utils/distributionStatics.py
# Fanoos: Multi-Resolution, Multi-Strength, Interactive Explanations for Learned Systems ; David Bayani and Stefan Mitsch ; paper at https://arxiv.org/abs/2006.12453 # Copyright (C) 2021 David Bayani # # This file is part of Fanoos. # # Fanoos is free software: you can redistribute it and/or modify # it under the te...
5,309
73.788732
2,789
py
Fanoos
Fanoos-master/utils/__init__.py
# Fanoos: Multi-Resolution, Multi-Strength, Interactive Explanations for Learned Systems ; David Bayani and Stefan Mitsch ; paper at https://arxiv.org/abs/2006.12453 # Copyright (C) 2021 David Bayani # # This file is part of Fanoos. # # Fanoos is free software: you can redistribute it and/or modify # it under the te...
1,154
28.615385
165
py
Fanoos
Fanoos-master/CEGARLikeAnalysis/labelsForBoxes.py
# Fanoos: Multi-Resolution, Multi-Strength, Interactive Explanations for Learned Systems ; David Bayani and Stefan Mitsch ; paper at https://arxiv.org/abs/2006.12453 # Copyright (C) 2021 David Bayani # # This file is part of Fanoos. # # Fanoos is free software: you can redistribute it and/or modify # it under the te...
4,392
92.468085
2,783
py
Fanoos
Fanoos-master/CEGARLikeAnalysis/CEGARLikeAnalysisMain.py
# Fanoos: Multi-Resolution, Multi-Strength, Interactive Explanations for Learned Systems ; David Bayani and Stefan Mitsch ; paper at https://arxiv.org/abs/2006.12453 # Copyright (C) 2021 David Bayani # # This file is part of Fanoos. # # Fanoos is free software: you can redistribute it and/or modify # it under the te...
11,844
63.375
2,781
py
Fanoos
Fanoos-master/CEGARLikeAnalysis/__init__.py
# Fanoos: Multi-Resolution, Multi-Strength, Interactive Explanations for Learned Systems ; David Bayani and Stefan Mitsch ; paper at https://arxiv.org/abs/2006.12453 # Copyright (C) 2021 David Bayani # # This file is part of Fanoos. # # Fanoos is free software: you can redistribute it and/or modify # it under the te...
1,154
28.615385
165
py
IJCAI2016
IJCAI2016-master/ConfusionMatrix.py
import numpy as np class ConfusionMatrix: """ Simple confusion matrix class row is the true class, column is the predicted class """ def __init__(self, n_classes): self.n_classes = n_classes self.mat = np.zeros((n_classes,n_classes),dtype='int') def __str__(self): ...
3,077
28.596154
112
py
noelle
noelle-master/external/autotuner/src/autotuner.py
#!/usr/bin/env python import os import sys import json import traceback import opentuner from opentuner import ConfigurationManipulator from opentuner import IntegerParameter from opentuner.search.manipulator import BooleanParameter from opentuner import LogIntegerParameter from opentuner import SwitchParameter from ...
8,849
29.308219
111
py
noelle
noelle-master/external/autotuner/scripts/filter.py
#!/usr/bin/env python import os import sys import json import traceback thisPath = os.path.dirname(os.path.abspath(__file__)) sys.path.append(thisPath + "/../utils") import utils class Filter: spaceFile = None confFile = None executionTimeFile = None baselineTimeFile = None baselineTime = None ranges = ...
2,279
24.333333
88
py
noelle
noelle-master/external/autotuner/utils/compileAndRunBaseline.py
#!/usr/bin/env python import os import sys thisPath = os.path.dirname(os.path.abspath(__file__)) sys.path.append(thisPath) import utils def writeExecutionTimeFile(pathToFile, time): with open(str(pathToFile), 'w') as f: f.write(str(time)) f.close() return def compileAndRunBaseline(): spaceFile = o...
1,109
19.943396
59
py
noelle
noelle-master/external/autotuner/utils/utils.py
#!/usr/bin/env python import os import sys from enum import Enum # Risky. It works because autotuner.py and filter.py are at the same level in the directoy tree. thisPath = os.path.dirname(os.path.abspath(__file__)) class Technique(Enum): DOALL = 4 HELIX = 5 DSWP = 6 def readExecutionTimeFile(pathToFile): ...
1,509
19.972222
102
py
noelle
noelle-master/external/autotuner/utils/genSeedConf.py
import os import sys import json import tempfile thisPath = os.path.dirname(os.path.abspath(__file__)) sys.path.append(thisPath + "/../utils") import utils # DOALL index is 4 reverseIndex = 4 # We should consider all permutations, but they can grow quickly, and we can't spend all autotuner time running seed configu...
2,592
31.012346
471
py
noelle
noelle-master/tests/condor/scripts/generateCondorScript.py
import os import sys import getpass ## Process the command line arguments # # def getArgs(): numOfArgs = len(sys.argv) args = {} args['fromFile'] = str(sys.argv[1]) args['toFile'] = str(sys.argv[2]) args['testsPath'] = str(sys.argv[3]) args['noelleOptions'] = str(sys.argv[4]) args['parOptions'] = str(sy...
2,115
30.117647
85
py
ppgn
ppgn-master/settings.py
# Set this to the path to Caffe installation on your system caffe_root = "/path/to/your/caffe/python" gpu = True # ------------------------------------- # The following are hard-coded and hardly change unless we change to use a different generator. # ------------------------------------- # Generator G generator_weigh...
777
32.826087
95
py
ppgn
ppgn-master/sampling_caption.py
#!/usr/bin/env python ''' Anh Nguyen <[email protected]> 2016 ''' import os, sys os.environ['GLOG_minloglevel'] = '2' # suprress Caffe verbose prints import settings sys.path.insert(0, settings.caffe_root) import caffe import numpy as np from numpy.linalg import norm import scipy.misc, scipy.io import argparse i...
9,371
41.6
157
py
ppgn
ppgn-master/sampler.py
#!/usr/bin/env python ''' Anh Nguyen <[email protected]> 2017 ''' import os, sys os.environ['GLOG_minloglevel'] = '2' # suprress Caffe verbose prints import settings sys.path.insert(0, settings.caffe_root) import caffe import numpy as np from numpy.linalg import norm import scipy.misc, scipy.io import util class...
8,319
41.020202
174
py
ppgn
ppgn-master/sampling_class.py
#!/usr/bin/env python ''' Anh Nguyen <[email protected]> 2016 ''' import os, sys os.environ['GLOG_minloglevel'] = '2' # suprress Caffe verbose prints import settings sys.path.insert(0, settings.caffe_root) import caffe import numpy as np from numpy.linalg import norm import scipy.misc, scipy.io import argparse i...
11,251
40.216117
165
py
ppgn
ppgn-master/util.py
import numpy as np import scipy.misc import subprocess def normalize(img, out_range=(0.,1.), in_range=None): if not in_range: min_val = np.min(img) max_val = np.max(img) else: min_val = in_range[0] max_val = in_range[1] result = np.copy(img) result[result > max_val] = m...
4,035
27.422535
112
py
gcnn-survey-paper
gcnn-survey-paper-master/best_model.py
#Copyright 2018 Google LLC # #Licensed under the Apache License, Version 2.0 (the "License"); #you may not use this file except in compliance with the License. #You may obtain a copy of the License at # # https://www.apache.org/licenses/LICENSE-2.0 # #Unless required by applicable law or agreed to in writing, softwa...
4,070
40.540816
80
py
gcnn-survey-paper
gcnn-survey-paper-master/launch.py
#Copyright 2018 Google LLC # #Licensed under the Apache License, Version 2.0 (the "License"); #you may not use this file except in compliance with the License. #You may obtain a copy of the License at # # https://www.apache.org/licenses/LICENSE-2.0 # #Unless required by applicable law or agreed to in writing, softwa...
3,950
32.769231
79
py
gcnn-survey-paper
gcnn-survey-paper-master/__init__.py
#Copyright 2018 Google LLC # #Licensed under the Apache License, Version 2.0 (the "License"); #you may not use this file except in compliance with the License. #You may obtain a copy of the License at # # https://www.apache.org/licenses/LICENSE-2.0 # #Unless required by applicable law or agreed to in writing, softwa...
565
39.428571
73
py
gcnn-survey-paper
gcnn-survey-paper-master/train.py
#Copyright 2018 Google LLC # #Licensed under the Apache License, Version 2.0 (the "License"); #you may not use this file except in compliance with the License. #You may obtain a copy of the License at # # https://www.apache.org/licenses/LICENSE-2.0 # #Unless required by applicable law or agreed to in writing, softwa...
16,343
38.669903
80
py
gcnn-survey-paper
gcnn-survey-paper-master/third_party/__init__.py
0
0
0
py
gcnn-survey-paper
gcnn-survey-paper-master/third_party/gcn/setup.py
from setuptools import setup from setuptools import find_packages setup(name='gcn', version='1.0', description='Graph Convolutional Networks in Tensorflow', author='Thomas Kipf', author_email='[email protected]', url='https://tkipf.github.io', download_url='https://github.com/tk...
591
31.888889
63
py
gcnn-survey-paper
gcnn-survey-paper-master/third_party/gcn/__init__.py
0
0
0
py
gcnn-survey-paper
gcnn-survey-paper-master/third_party/gcn/gcn/inits.py
import tensorflow as tf import numpy as np def uniform(shape, scale=0.05, name=None): """Uniform init.""" initial = tf.random_uniform(shape, minval=-scale, maxval=scale, dtype=tf.float32) return tf.Variable(initial, name=name) def glorot(shape, name=None): """Glorot & Bengio (AISTATS 2010) init.""" ...
791
28.333333
95
py
gcnn-survey-paper
gcnn-survey-paper-master/third_party/gcn/gcn/utils.py
import numpy as np import pickle as pkl import networkx as nx import scipy.sparse as sp from scipy.sparse.linalg.eigen.arpack import eigsh import sys def parse_index_file(filename): """Parse index file.""" index = [] for line in open(filename): index.append(int(line.strip())) return index de...
6,500
37.241176
115
py
gcnn-survey-paper
gcnn-survey-paper-master/third_party/gcn/gcn/layers.py
from gcn.inits import * import tensorflow as tf flags = tf.app.flags FLAGS = flags.FLAGS # global unique layer ID dictionary for layer name assignment _LAYER_UIDS = {} def get_layer_uid(layer_name=''): """Helper function, assigns unique layer IDs.""" if layer_name not in _LAYER_UIDS: _LAYER_UIDS[lay...
5,886
30.148148
92
py
gcnn-survey-paper
gcnn-survey-paper-master/third_party/gcn/gcn/models.py
from gcn.layers import * from gcn.metrics import * flags = tf.app.flags FLAGS = flags.FLAGS class Model(object): def __init__(self, **kwargs): allowed_kwargs = {'name', 'logging'} for kwarg in kwargs.keys(): assert kwarg in allowed_kwargs, 'Invalid keyword argument: ' + kwarg ...
6,264
34.196629
112
py
gcnn-survey-paper
gcnn-survey-paper-master/third_party/gcn/gcn/metrics.py
import tensorflow as tf def masked_softmax_cross_entropy(preds, labels, mask): """Softmax cross-entropy loss with masking.""" loss = tf.nn.softmax_cross_entropy_with_logits(logits=preds, labels=labels) mask = tf.cast(mask, dtype=tf.float32) mask /= tf.reduce_mean(mask) loss *= mask return tf.r...
691
31.952381
79
py
gcnn-survey-paper
gcnn-survey-paper-master/third_party/gcn/gcn/__init__.py
from __future__ import print_function from __future__ import division
70
22.666667
37
py
gcnn-survey-paper
gcnn-survey-paper-master/third_party/gcn/gcn/train.py
from __future__ import division from __future__ import print_function import time import tensorflow as tf from gcn.utils import * from gcn.models import GCN, MLP # Set random seed seed = 123 np.random.seed(seed) tf.set_random_seed(seed) # Settings flags = tf.app.flags FLAGS = flags.FLAGS flags.DEFINE_string('datase...
3,891
35.037037
103
py
gcnn-survey-paper
gcnn-survey-paper-master/models/node_edge_models.py
#Copyright 2018 Google LLC # #Licensed under the Apache License, Version 2.0 (the "License"); #you may not use this file except in compliance with the License. #You may obtain a copy of the License at # # https://www.apache.org/licenses/LICENSE-2.0 # #Unless required by applicable law or agreed to in writing, softwa...
8,619
36.155172
80
py
gcnn-survey-paper
gcnn-survey-paper-master/models/edge_models.py
#Copyright 2018 Google LLC # #Licensed under the Apache License, Version 2.0 (the "License"); #you may not use this file except in compliance with the License. #You may obtain a copy of the License at # # https://www.apache.org/licenses/LICENSE-2.0 # #Unless required by applicable law or agreed to in writing, softwa...
5,060
34.640845
79
py
gcnn-survey-paper
gcnn-survey-paper-master/models/node_models.py
#Copyright 2018 Google LLC # #Licensed under the Apache License, Version 2.0 (the "License"); #you may not use this file except in compliance with the License. #You may obtain a copy of the License at # # https://www.apache.org/licenses/LICENSE-2.0 # #Unless required by applicable law or agreed to in writing, softwa...
7,409
36.236181
80
py
gcnn-survey-paper
gcnn-survey-paper-master/models/__init__.py
#Copyright 2018 Google LLC # #Licensed under the Apache License, Version 2.0 (the "License"); #you may not use this file except in compliance with the License. #You may obtain a copy of the License at # # https://www.apache.org/licenses/LICENSE-2.0 # #Unless required by applicable law or agreed to in writing, softwa...
565
39.428571
73
py
gcnn-survey-paper
gcnn-survey-paper-master/models/base_models.py
#Copyright 2018 Google LLC # #Licensed under the Apache License, Version 2.0 (the "License"); #you may not use this file except in compliance with the License. #You may obtain a copy of the License at # # https://www.apache.org/licenses/LICENSE-2.0 # #Unless required by applicable law or agreed to in writing, softwa...
15,593
38.180905
80
py
gcnn-survey-paper
gcnn-survey-paper-master/utils/model_utils.py
#Copyright 2018 Google LLC # #Licensed under the Apache License, Version 2.0 (the "License"); #you may not use this file except in compliance with the License. #You may obtain a copy of the License at # # https://www.apache.org/licenses/LICENSE-2.0 # #Unless required by applicable law or agreed to in writing, softwa...
19,241
35.033708
80
py
gcnn-survey-paper
gcnn-survey-paper-master/utils/data_utils.py
#Copyright 2018 Google LLC # #Licensed under the Apache License, Version 2.0 (the "License"); #you may not use this file except in compliance with the License. #You may obtain a copy of the License at # # https://www.apache.org/licenses/LICENSE-2.0 # #Unless required by applicable law or agreed to in writing, softwa...
12,831
33.775068
80
py
gcnn-survey-paper
gcnn-survey-paper-master/utils/link_prediction_utils.py
#Copyright 2018 Google LLC # #Licensed under the Apache License, Version 2.0 (the "License"); #you may not use this file except in compliance with the License. #You may obtain a copy of the License at # # https://www.apache.org/licenses/LICENSE-2.0 # #Unless required by applicable law or agreed to in writing, softwa...
3,591
32.259259
80
py
gcnn-survey-paper
gcnn-survey-paper-master/utils/train_utils.py
#Copyright 2018 Google LLC # #Licensed under the Apache License, Version 2.0 (the "License"); #you may not use this file except in compliance with the License. #You may obtain a copy of the License at # # https://www.apache.org/licenses/LICENSE-2.0 # #Unless required by applicable law or agreed to in writing, softwa...
1,447
27.392157
78
py
gcnn-survey-paper
gcnn-survey-paper-master/utils/__init__.py
#Copyright 2018 Google LLC # #Licensed under the Apache License, Version 2.0 (the "License"); #you may not use this file except in compliance with the License. #You may obtain a copy of the License at # # https://www.apache.org/licenses/LICENSE-2.0 # #Unless required by applicable law or agreed to in writing, softwa...
565
39.428571
73
py
nervaluate
nervaluate-main/examples/example_no_loader.py
import nltk import sklearn_crfsuite from sklearn.metrics import classification_report from nervaluate import collect_named_entities, summary_report_ent, summary_report_overall from nervaluate import Evaluator def word2features(sent, i): word = sent[i][0] postag = sent[i][1] features = { "bias": ...
3,759
30.07438
115
py
nervaluate
nervaluate-main/src/nervaluate/evaluate.py
import logging from copy import deepcopy from typing import List, Dict, Union, Tuple from .utils import conll_to_spans, find_overlap, list_to_spans class Evaluator: # pylint: disable=too-many-instance-attributes, too-few-public-methods def __init__( self, true: Union[List[List[str]], List[str], ...
18,400
38.829004
118
py
nervaluate
nervaluate-main/src/nervaluate/utils.py
from typing import List, Dict, Optional def split_list(token: List[str], split_chars: Optional[List[str]] = None) -> List[List[str]]: if split_chars is None: split_chars = [""] out = [] chunk = [] for i, item in enumerate(token): if item not in split_chars: chunk.append(ite...
2,951
27.114286
100
py
nervaluate
nervaluate-main/src/nervaluate/__init__.py
from .evaluate import ( Evaluator, compute_actual_possible, compute_metrics, compute_precision_recall, compute_precision_recall_wrapper, find_overlap, summary_report_ent, summary_report_overall, ) from .utils import collect_named_entities, conll_to_spans, list_to_spans, split_list
314
25.25
84
py
nervaluate
nervaluate-main/tests/test_evaluator.py
from nervaluate import Evaluator def test_evaluator_simple_case(): true = [ [{"label": "PER", "start": 2, "end": 4}], [ {"label": "LOC", "start": 1, "end": 2}, {"label": "LOC", "start": 3, "end": 4}, ], ] pred = [ [{"label": "PER", "start": 2, "end":...
22,589
26.616137
85
py
nervaluate
nervaluate-main/tests/test_loaders.py
from nervaluate import Evaluator def test_loaders_produce_the_same_results(): true_list = [ ["O", "O", "O", "O", "O", "O"], ["O", "O", "B-ORG", "I-ORG", "O", "O"], ["O", "O", "B-MISC", "I-MISC", "O", "O"], ["B-MISC", "I-MISC", "I-MISC", "I-MISC", "I-MISC", "I-MISC"], ] pre...
2,210
36.474576
100
py
nervaluate
nervaluate-main/tests/__init__.py
import sys sys.path.append("../src/nervaluate")
49
11.5
36
py
nervaluate
nervaluate-main/tests/test_nervaluate.py
from nervaluate import ( compute_actual_possible, compute_metrics, compute_precision_recall, compute_precision_recall_wrapper, ) def test_compute_metrics_case_1(): true_named_entities = [ {"label": "PER", "start": 59, "end": 69}, {"label": "LOC", "start": 127, "end": 134}, ...
23,628
27.851038
98
py
nervaluate
nervaluate-main/tests/test_utils.py
from nervaluate import ( collect_named_entities, conll_to_spans, find_overlap, list_to_spans, split_list, ) def test_list_to_spans(): before = [ ["O", "B-LOC", "I-LOC", "B-LOC", "I-LOC", "O"], ["O", "B-GPE", "I-GPE", "B-GPE", "I-GPE", "O"], ] expected = [ [ ...
4,946
24.111675
74
py
STTS
STTS-main/MViT/setup.py
#!/usr/bin/env python3 # Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. from setuptools import find_packages, setup setup( name="slowfast", version="1.0", author="FAIR", url="unknown", description="SlowFast Video Understanding", install_requires=[ "yacs>=0.1.6", ...
794
23.090909
71
py
STTS
STTS-main/MViT/tools/run_net.py
#!/usr/bin/env python3 # Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. """Wrapper to train and test a video classification model.""" from slowfast.config.defaults import assert_and_infer_cfg from slowfast.utils.misc import launch_job from slowfast.utils.parser import load_config, parse_args fr...
1,303
24.568627
73
py
STTS
STTS-main/MViT/tools/visualization.py
#!/usr/bin/env python3 # Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. import numpy as np import pickle import torch import tqdm import slowfast.datasets.utils as data_utils import slowfast.utils.checkpoint as cu import slowfast.utils.distributed as du import slowfast.utils.logging as logging ...
14,000
39.465318
126
py
STTS
STTS-main/MViT/tools/benchmark.py
#!/usr/bin/env python3 # Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved """ A script to benchmark data loading. """ import slowfast.utils.logging as logging from slowfast.utils.benchmark import benchmark_data_loading from slowfast.utils.misc import launch_job from slowfast.utils.parser import loa...
584
21.5
74
py
STTS
STTS-main/MViT/tools/test_net.py
#!/usr/bin/env python3 # Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. """Multi-view test a video classification model.""" import numpy as np import os import pickle import torch import torch.nn.functional as F from einops import rearrange import slowfast.utils.checkpoint as cu import slowfast...
7,234
34.816832
84
py
STTS
STTS-main/MViT/tools/demo_net.py
#!/usr/bin/env python3 # Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. import numpy as np import time import torch import tqdm from slowfast.utils import logging from slowfast.visualization.async_predictor import AsyncDemo, AsyncVis from slowfast.visualization.ava_demo_precomputed_boxes import...
3,683
29.7
93
py
STTS
STTS-main/MViT/tools/submit.py
import argparse import os from pathlib import Path import submitit import torch from slowfast.utils.misc import launch_job from slowfast.utils.parser import load_config from run_net import get_func def parse_args(): parser = argparse.ArgumentParser( "Submitit for onestage training", add_help=False )...
6,114
30.040609
102
py
STTS
STTS-main/MViT/tools/train_net.py
#!/usr/bin/env python3 # Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. """Train a video classification model.""" import numpy as np import torch from fvcore.nn.precise_bn import get_bn_modules, update_bn_stats import copy import slowfast.models.losses as losses import slowfast.models.optimize...
21,443
34.562189
116
py
STTS
STTS-main/MViT/slowfast/__init__.py
#!/usr/bin/env python3 # Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. from slowfast.utils.env import setup_environment setup_environment()
166
22.857143
71
py
STTS
STTS-main/MViT/slowfast/config/custom_config.py
#!/usr/bin/env python3 # Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. """Add custom configs and default values""" def add_custom_config(_C): # Add your own customized configs. pass
217
20.8
71
py
STTS
STTS-main/MViT/slowfast/config/defaults.py
#!/usr/bin/env python3 # Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. """Configs.""" from fvcore.common.config import CfgNode from . import custom_config # ----------------------------------------------------------------------------- # Config definition # ------------------------------------...
31,843
31.230769
115
py
STTS
STTS-main/MViT/slowfast/config/__init__.py
#!/usr/bin/env python3 # Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
95
31
71
py
STTS
STTS-main/MViT/slowfast/models/operators.py
#!/usr/bin/env python3 # Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. """Custom operators.""" import torch import torch.nn as nn class Swish(nn.Module): """Swish activation function: x * sigmoid(x).""" def __init__(self): super(Swish, self).__init__() def forward(self,...
2,552
29.759036
86
py
STTS
STTS-main/MViT/slowfast/models/custom_video_model_builder.py
#!/usr/bin/env python3 # Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. """A More Flexible Video models."""
133
21.333333
71
py
STTS
STTS-main/MViT/slowfast/models/losses.py
#!/usr/bin/env python3 # Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. """Loss functions.""" import torch import torch.nn as nn import torch.nn.functional as F from slowfast.models.topk import batched_index_select class SoftTargetCrossEntropy(nn.Module): """ Cross entropy loss with so...
2,960
28.61
110
py
STTS
STTS-main/MViT/slowfast/models/batchnorm_helper.py
#!/usr/bin/env python3 # Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. """BatchNorm (BN) utility functions and custom batch-size BN implementations""" from functools import partial import torch import torch.distributed as dist import torch.nn as nn from torch.autograd.function import Function ...
7,424
32.90411
82
py
STTS
STTS-main/MViT/slowfast/models/mvit.py
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. """Video models.""" import math from functools import partial import torch import torch.nn as nn from torch.nn.init import trunc_normal_ from einops import rearrange from math import sqrt import slowfast.utils.weight_init_helper as init_helper f...
14,098
35.058824
111
py
STTS
STTS-main/MViT/slowfast/models/ptv_model_builder.py
#!/usr/bin/env python3 # Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. """Video models using PyTorchVideo model builder.""" from functools import partial import torch.nn as nn from detectron2.layers import ROIAlign from slowfast.models.batchnorm_helper import get_norm from slowfast.models.vi...
26,986
33.777062
89
py
STTS
STTS-main/MViT/slowfast/models/topk.py
import torch import torch.nn as nn import torch.nn.functional as F import numpy as np import einops from einops import rearrange from math import sqrt import time class PredictorLG(nn.Module): """ Image to Patch Embedding """ def __init__(self, embed_dim=384): super().__init__() self.in_con...
8,512
32.916335
101
py
STTS
STTS-main/MViT/slowfast/models/utils.py
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. from logging import NOTSET import slowfast.utils.logging as logging import numpy as np import torch.nn.functional as F from einops import rearrange logger = logging.get_logger(__name__) def round_width(width, multiplier, min_width=1, divisor=1,...
1,017
28.941176
77
py
STTS
STTS-main/MViT/slowfast/models/nonlocal_helper.py
#!/usr/bin/env python3 # Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. """Non-local helper""" import torch import torch.nn as nn class Nonlocal(nn.Module): """ Builds Non-local Neural Networks as a generic family of building blocks for capturing long-range dependencies. Non-local...
5,418
35.369128
80
py
STTS
STTS-main/MViT/slowfast/models/video_model_builder.py
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. """Video models.""" import math from functools import partial import torch import torch.nn as nn from torch.nn.init import trunc_normal_ import slowfast.utils.weight_init_helper as init_helper from slowfast.models.attention import MultiScaleBlo...
28,931
36.044814
96
py
STTS
STTS-main/MViT/slowfast/models/common.py
# Copyright (c) Facebook, Inc. and its affiliates. import torch import torch.nn as nn class Mlp(nn.Module): def __init__( self, in_features, hidden_features=None, out_features=None, act_layer=nn.GELU, drop_rate=0.0, ): super().__init__() self.dr...
1,900
25.774648
99
py
STTS
STTS-main/MViT/slowfast/models/head_helper.py
#!/usr/bin/env python3 # Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. """ResNe(X)t Head helper.""" import torch import torch.nn as nn from detectron2.layers import ROIAlign class ResNetRoIHead(nn.Module): """ ResNe(X)t RoI head. """ def __init__( self, dim_i...
14,978
35.623472
81
py
STTS
STTS-main/MViT/slowfast/models/stem_helper.py
#!/usr/bin/env python3 # Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. """ResNe(X)t 3D stem helper.""" import torch.nn as nn def get_stem_func(name): """ Retrieves the stem module by name. """ trans_funcs = {"x3d_stem": X3DStem, "basic_stem": ResNetBasicStem} assert ( ...
10,775
32.362229
102
py
STTS
STTS-main/MViT/slowfast/models/__init__.py
#!/usr/bin/env python3 # Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. from .build import MODEL_REGISTRY, build_model # noqa from .custom_video_model_builder import * # noqa from .video_model_builder import ResNet, SlowFast # noqa from .mvit import MViT try: from .ptv_model_builder imp...
513
24.7
71
py
STTS
STTS-main/MViT/slowfast/models/resnet_helper.py
#!/usr/bin/env python3 # Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. """Video models.""" import torch import torch.nn as nn from slowfast.models.common import drop_path from slowfast.models.nonlocal_helper import Nonlocal from slowfast.models.operators import SE, Swish def get_trans_func(...
24,795
33.15427
83
py
STTS
STTS-main/MViT/slowfast/models/attention.py
#!/usr/bin/env python3 # Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. import numpy import torch import torch.nn as nn from einops import rearrange from slowfast.models.common import DropPath, Mlp def attention_pool(tensor, pool, thw_shape, has_cls_embed=True, norm=None): if pool is None...
8,875
29.712803
80
py
STTS
STTS-main/MViT/slowfast/models/build.py
#!/usr/bin/env python3 # Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. """Model construction functions.""" import torch from fvcore.common.registry import Registry MODEL_REGISTRY = Registry("MODEL") MODEL_REGISTRY.__doc__ = """ Registry for video model. The registered object will be called w...
1,725
30.962963
80
py
STTS
STTS-main/MViT/slowfast/models/optimizer.py
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. """Optimizer.""" import torch import slowfast.utils.lr_policy as lr_policy def construct_optimizer(model, cfg): """ Construct a stochastic gradient descent or ADAM optimizer with momentum. Details can be found in: Herbert Robbi...
4,155
30.484848
101
py
STTS
STTS-main/MViT/slowfast/datasets/video_container.py
#!/usr/bin/env python3 # Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. import av def get_video_container(path_to_vid, multi_thread_decode=False, backend="pyav"): """ Given the path to the video, return the pyav video container. Args: path_to_vid (str): path to the video. ...
1,033
33.466667
80
py
STTS
STTS-main/MViT/slowfast/datasets/transform.py
#!/usr/bin/env python3 # Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. import math import numpy as np # import cv2 import random import torch import torchvision.transforms.functional as F from PIL import Image from torchvision import transforms from .rand_augment import rand_augment_transform...
30,520
33.101676
90
py
STTS
STTS-main/MViT/slowfast/datasets/utils.py
#!/usr/bin/env python3 import logging import numpy as np import os import random import time from collections import defaultdict import cv2 import torch from torch.utils.data.distributed import DistributedSampler from slowfast.utils.env import pathmgr from . import transform as transform logger = logging.getLogger(...
11,739
32.638968
90
py
STTS
STTS-main/MViT/slowfast/datasets/mixup.py
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. """ This implementation is based on https://github.com/rwightman/pytorch-image-models/blob/master/timm/data/mixup.py, published under an Apache License 2.0. COMMENT FROM ORIGINAL: Mixup and Cutmix Papers: mixup: Beyond Empirical Risk Minimization...
6,659
34.052632
127
py
STTS
STTS-main/MViT/slowfast/datasets/ava_dataset.py
#!/usr/bin/env python3 # Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. import logging import numpy as np import torch from . import ava_helper as ava_helper from . import cv2_transform as cv2_transform from . import transform as transform from . import utils as utils from .build import DATASET...
14,963
33.881119
82
py
STTS
STTS-main/MViT/slowfast/datasets/ptv_datasets.py
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. import functools import os from typing import Dict import torch from torch.utils.data import ( DistributedSampler, RandomSampler, SequentialSampler, ) from torchvision.transforms import Compose, Lambda from torchvision.transforms._tran...
19,371
31.557983
84
py
STTS
STTS-main/MViT/slowfast/datasets/charades.py
#!/usr/bin/env python3 # Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. import os import random from itertools import chain as chain import torch import torch.utils.data import slowfast.utils.logging as logging from slowfast.utils.env import pathmgr from . import utils as utils from .build imp...
9,677
36.366795
82
py
STTS
STTS-main/MViT/slowfast/datasets/multigrid_helper.py
#!/usr/bin/env python3 # Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. """Helper functions for multigrid training.""" import numpy as np import torch from torch.utils.data.sampler import Sampler TORCH_MAJOR = int(torch.__version__.split(".")[0]) TORCH_MINOR = int(torch.__version__.split(".")[...
2,753
30.295455
78
py
STTS
STTS-main/MViT/slowfast/datasets/decoder.py
#!/usr/bin/env python3 # Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. import math import numpy as np import random import torch import torchvision.io as io def temporal_sampling(frames, start_idx, end_idx, num_samples): """ Given the start and end frame index, sample num_samples fram...
15,165
37.787724
80
py
STTS
STTS-main/MViT/slowfast/datasets/ava_helper.py
#!/usr/bin/env python3 # Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. import logging import os from collections import defaultdict from slowfast.utils.env import pathmgr logger = logging.getLogger(__name__) FPS = 30 AVA_VALID_FRAMES = range(902, 1799) def load_image_lists(cfg, is_train): ...
8,177
33.361345
102
py
STTS
STTS-main/MViT/slowfast/datasets/__init__.py
#!/usr/bin/env python3 # Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. from .ava_dataset import Ava # noqa from .build import DATASET_REGISTRY, build_dataset # noqa from .charades import Charades # noqa from .imagenet import Imagenet # noqa from .kinetics import Kinetics # noqa from .ssv2 ...
498
32.266667
71
py
STTS
STTS-main/MViT/slowfast/datasets/ssv2.py
#!/usr/bin/env python3 # Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. import json import numpy as np import os import random from itertools import chain as chain import torch import torch.utils.data import slowfast.utils.logging as logging from slowfast.utils.env import pathmgr from . import...
10,293
35.246479
82
py
STTS
STTS-main/MViT/slowfast/datasets/random_erasing.py
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. """ This implementation is based on https://github.com/rwightman/pytorch-image-models/blob/master/timm/data/random_erasing.py pulished under an Apache License 2.0. COMMENT FROM ORIGINAL: Originally inspired by impl at https://github.com/zhunzhong...
6,887
37.055249
95
py
STTS
STTS-main/MViT/slowfast/datasets/cv2_transform.py
#!/usr/bin/env python3 # Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. import math import numpy as np import cv2 def clip_boxes_to_image(boxes, height, width): """ Clip the boxes with the height and width of the image size. Args: boxes (ndarray): bounding boxes to peform c...
26,476
32.179198
80
py
STTS
STTS-main/MViT/slowfast/datasets/kinetics.py
#!/usr/bin/env python3 # Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. import os import random import torch import torch.utils.data import numpy as np from torchvision import transforms import slowfast.utils.logging as logging from slowfast.utils.env import pathmgr from . import decoder as de...
16,469
37.661972
87
py