repo
stringlengths
3
91
file
stringlengths
16
152
code
stringlengths
0
3.77M
file_length
int64
0
3.77M
avg_line_length
float64
0
16k
max_line_length
int64
0
273k
extension_type
stringclasses
1 value
DCASE2022-TASK3
DCASE2022-TASK3-main/code/methods/utils/dense_block.py
import torch import torch.nn as nn import torch.nn.functional as F from torch import Tensor class _DenseLayer(nn.Module): def __init__(self, num_input_features, growth_rate, bn_size, drop_rate, dilation): super(_DenseLayer, self).__init__() self.add_module('norm1', nn.BatchNorm2d(num_input_feature...
4,940
40.175
95
py
DCASE2022-TASK3
DCASE2022-TASK3-main/code/methods/utils/SELD_metrics.py
# Implements the localization and detection metrics proposed in [1] with extensions to support multi-instance of the same class from [2]. # # [1] Joint Measurement of Localization and Detection of Sound Events # Annamaria Mesaros, Sharath Adavanne, Archontis Politis, Toni Heittola, Tuomas Virtanen # WASPAA 2019 # # [2]...
13,628
48.923077
215
py
DCASE2022-TASK3
DCASE2022-TASK3-main/code/methods/utils/__init__.py
0
0
0
py
DCASE2022-TASK3
DCASE2022-TASK3-main/code/methods/utils/data_utilities.py
import numpy as np import pandas as pd import torch def _segment_index(x, chunklen, hoplen, last_frame_always_paddding=False): """Segment input x with chunklen, hoplen parameters. Return Args: x: input, time domain or feature domain (channels, time) chunklen: hoplen: last_fram...
15,990
46.734328
157
py
DCASE2022-TASK3
DCASE2022-TASK3-main/code/methods/utils/conformer/embedding.py
# Copyright (c) 2021, Soohwan Kim. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable la...
1,861
41.318182
98
py
DCASE2022-TASK3
DCASE2022-TASK3-main/code/methods/utils/conformer/activation.py
# Copyright (c) 2021, Soohwan Kim. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable la...
1,588
35.113636
119
py
DCASE2022-TASK3
DCASE2022-TASK3-main/code/methods/utils/conformer/modules.py
# Copyright (c) 2021, Soohwan Kim. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable la...
2,540
32.434211
97
py
DCASE2022-TASK3
DCASE2022-TASK3-main/code/methods/utils/conformer/model.py
# Copyright (c) 2021, Soohwan Kim. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable la...
9,594
41.268722
119
py
DCASE2022-TASK3
DCASE2022-TASK3-main/code/methods/utils/conformer/encoder.py
# Copyright (c) 2021, Soohwan Kim. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable la...
10,007
40.7
118
py
DCASE2022-TASK3
DCASE2022-TASK3-main/code/methods/utils/conformer/convolution.py
# Copyright (c) 2021, Soohwan Kim. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable la...
7,029
36.195767
115
py
DCASE2022-TASK3
DCASE2022-TASK3-main/code/methods/utils/conformer/feed_forward.py
# Copyright (c) 2021, Soohwan Kim. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable la...
2,117
34.3
119
py
DCASE2022-TASK3
DCASE2022-TASK3-main/code/methods/utils/conformer/decoder.py
# Copyright (c) 2021, Soohwan Kim. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable la...
5,064
37.664122
119
py
DCASE2022-TASK3
DCASE2022-TASK3-main/code/methods/utils/conformer/__init__.py
# Copyright (c) 2021, Soohwan Kim. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable la...
667
40.75
74
py
DCASE2022-TASK3
DCASE2022-TASK3-main/code/methods/utils/conformer/attention.py
# Copyright (c) 2021, Soohwan Kim. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable la...
6,428
40.746753
117
py
DCASE2022-TASK3
DCASE2022-TASK3-main/code/methods/ein_seld/inference.py
from pathlib import Path import h5py import numpy as np import torch from tqdm import tqdm from methods.inference import BaseInferer from methods.utils.data_utilities import * class Inferer(BaseInferer): def __init__(self, cfg, dataset, af_extractor, model, cuda, test_set=None): super().__init__() ...
5,046
40.710744
137
py
DCASE2022-TASK3
DCASE2022-TASK3-main/code/methods/ein_seld/losses.py
import numpy as np import torch import sys from methods.utils.loss_utilities import BCEWithLogitsLoss, MSELoss from torch import linalg as LA from itertools import permutations class Losses: def __init__(self, cfg): self.cfg = cfg self.beta = cfg['training']['loss_beta'] self.losses = [BCEW...
3,138
41.418919
114
py
DCASE2022-TASK3
DCASE2022-TASK3-main/code/methods/ein_seld/training.py
from pathlib import Path import random import sys from timeit import default_timer as timer import h5py import numpy as np import torch from methods.training import BaseTrainer from utils.ddp_init import reduce_value, gather_value, get_rank, get_world_size from methods.utils.data_utilities import track_to_dcase_format...
8,056
41.856383
141
py
DCASE2022-TASK3
DCASE2022-TASK3-main/code/methods/ein_seld/data.py
from pathlib import Path import pandas as pd from timeit import default_timer as timer import h5py import numpy as np import torch from methods.utils.data_utilities import load_output_format_file, to_metrics_format from torch.utils.data import Dataset, Sampler from utils.common import int16_samples_to_float32 from ut...
12,771
44.29078
130
py
DCASE2022-TASK3
DCASE2022-TASK3-main/code/methods/ein_seld/__init__.py
from .. import metrics from . import data, losses, models, training, inference
78
38.5
55
py
DCASE2022-TASK3
DCASE2022-TASK3-main/code/methods/ein_seld/models/__init__.py
from .ConvConformer import * from .DenseConformer import * from .ConvTransformer import *
91
17.4
30
py
DCASE2022-TASK3
DCASE2022-TASK3-main/code/methods/ein_seld/models/ConvConformer.py
import torch import torch.nn as nn from methods.utils.model_utilities import (DoubleConv, init_layer) from methods.utils.conformer.encoder import ConformerBlocks class ConvConformer(nn.Module): def __init__(self, cfg, dataset): super().__init__() self.cfg = cfg self.num_classes = dataset.n...
7,746
44.840237
85
py
DCASE2022-TASK3
DCASE2022-TASK3-main/code/methods/ein_seld/models/ConvTransformer.py
import torch import torch.nn as nn from methods.utils.model_utilities import (DoubleConv, PositionalEncoding, init_layer) class ConvTransformer(nn.Module): def __init__(self, cfg, dataset): super().__init__() self.pe_enable = False # Ture | False ...
8,566
46.594444
110
py
DCASE2022-TASK3
DCASE2022-TASK3-main/code/methods/ein_seld/models/DenseConformer.py
import torch import torch.nn as nn from methods.utils.model_utilities import init_layer from methods.utils.conformer.encoder import ConformerBlocks from methods.utils.dense_block import _DenseBlock, _Transition class DenseConformer(nn.Module): def __init__(self, cfg, dataset): super().__init__() se...
9,821
50.968254
128
py
DCASE2022-TASK3
DCASE2022-TASK3-main/code/learning/checkpoint.py
import logging import random import numpy as np import pandas as pd import torch from utils.ddp_init import get_rank, get_world_size class CheckpointIO: """CheckpointIO class. It handles saving and loading checkpoints. """ def __init__(self, checkpoints_dir, model, optimizer, batch_sampler, metric...
7,008
40.97006
124
py
DCASE2022-TASK3
DCASE2022-TASK3-main/code/learning/initialize.py
import logging import random import shutil import socket from datetime import datetime from pathlib import Path import numpy as np import torch import torch.distributed as dist import torch.optim as optim from torch.backends import cudnn from torch.nn.parallel import DistributedDataParallel as DDP from torch.utils.ten...
7,430
37.304124
140
py
DCASE2022-TASK3
DCASE2022-TASK3-main/code/learning/__init__.py
0
0
0
py
DCASE2022-TASK3
DCASE2022-TASK3-main/code/learning/infer.py
import torch from utils.config import get_afextractor, get_inferer, get_models def infer(cfg, dataset, **infer_initializer): """ Infer, only save the testset predictions """ submissions_dir = infer_initializer['submissions_dir'] predictions_dir = infer_initializer['predictions_dir'] ckpts_paths_...
1,270
38.71875
80
py
DCASE2022-TASK3
DCASE2022-TASK3-main/code/learning/train.py
import logging from timeit import default_timer as timer from tqdm import tqdm from utils.common import print_metrics from utils.ddp_init import reduce_value, get_rank, get_world_size, rank_barrier def train(cfg, **initializer): """Train """ writer = initializer['writer'] train_generator = initializer...
4,676
45.306931
145
py
DCASE2022-TASK3
DCASE2022-TASK3-main/code/learning/preprocess.py
import shutil import sys from functools import reduce from pathlib import Path from timeit import default_timer as timer import h5py import librosa import numpy as np import pandas as pd import torch from sklearn import preprocessing from torch.utils.data import DataLoader from tqdm import tqdm from methods.data impo...
28,736
55.90495
158
py
DCASE2022-TASK3
DCASE2022-TASK3-main/code/utils/ddp_init.py
import torch import torch.distributed as dist from torch.nn.parallel import DistributedDataParallel as DDP import torch.multiprocessing as mp import os def get_world_size(): if dist.is_initialized(): return dist.get_world_size() else: return 1 def get_rank(): if dist.is_initialized(): ...
1,671
27.827586
73
py
DCASE2022-TASK3
DCASE2022-TASK3-main/code/utils/config.py
from utils.datasets import dacase2022_dask3 from methods import ein_seld from torch.utils.data import DataLoader import torch.distributed as dist from ruamel.yaml import YAML import logging from utils.common import convert_ordinal, count_parameters, move_model_to_gpu import methods.feature as feature import torch.optim...
6,513
33.104712
106
py
DCASE2022-TASK3
DCASE2022-TASK3-main/code/utils/datasets.py
from pathlib import Path class dacase2022_dask3: ''' DCASE 2022 Task 3 dataset ''' def __init__(self, root_dir, cfg, args): self.label_dic = {'Female speech, woman speaking': 0, 'Male speech, man speaking': 1, 'Clapping': 2, ...
3,132
49.532258
128
py
DCASE2022-TASK3
DCASE2022-TASK3-main/code/utils/common.py
import numpy as np import torch import logging from datetime import datetime from tqdm import tqdm import math import torch.distributed as dist import shutil from pathlib import Path from .ddp_init import get_rank, get_world_size def float_samples_to_int16(y): """Convert floating-point numpy array of audio samples ...
4,202
29.904412
90
py
DCASE2022-TASK3
DCASE2022-TASK3-main/code/utils/__init__.py
0
0
0
py
DCASE2022-TASK3
DCASE2022-TASK3-main/code/utils/cli_parser.py
import argparse import sys from pathlib import Path from ruamel.yaml import YAML from termcolor import cprint def parse_cli_overides(): """Parse the command-line arguments. Parse args from CLI and override config dictionary entries This function implements the command-line interface of the program. ...
3,260
42.48
130
py
OpenPSG
OpenPSG-main/setup.py
#!/usr/bin/env python # Copyright (c) OpenMMLab. All rights reserved. import os import os.path as osp import platform import shutil import sys import warnings from setuptools import find_packages, setup import torch from torch.utils.cpp_extension import (BuildExtension, CppExtension, ...
7,887
35.518519
125
py
OpenPSG
OpenPSG-main/predict.py
import os import tempfile import shutil from typing import List from cog import BasePredictor, Path, Input, BaseModel from openpsg.utils.utils import show_result from mmdet.apis import init_detector, inference_detector from mmcv import Config import mmcv class ModelOutput(BaseModel): image: Path class Predicto...
1,670
28.315789
89
py
OpenPSG
OpenPSG-main/ce7454/main.py
import argparse import os import time import torch from dataset import PSGClsDataset from evaluator import Evaluator from torch.utils.data import DataLoader from torchvision.models import resnet50 from trainer import BaseTrainer parser = argparse.ArgumentParser() parser.add_argument('--model_name', type=str, default=...
3,628
33.561905
116
py
OpenPSG
OpenPSG-main/ce7454/grade.py
import argparse import os import numpy as np def compute_recall(gt_list, pred_list): score_list = np.zeros([56, 2], dtype=int) for gt, pred in zip(gt_list, pred_list): for gt_id in gt: # pos 0 for counting all existing relations score_list[gt_id][0] += 1 if gt_id i...
1,891
30.016393
78
py
OpenPSG
OpenPSG-main/ce7454/dataset.py
import io import json import logging import os import torch import torchvision.transforms as trn from PIL import Image, ImageFile from torch.utils.data import Dataset # to fix "OSError: image file is truncated" ImageFile.LOAD_TRUNCATED_IMAGES = True class Convert: def __init__(self, mode='RGB'): self.mo...
2,352
26.682353
65
py
OpenPSG
OpenPSG-main/ce7454/evaluator.py
import numpy as np import torch import torch.nn as nn import torch.nn.functional as F from torch.utils.data import DataLoader class Evaluator: def __init__( self, net: nn.Module, k: int, ): self.net = net self.k = k def eval_recall( self, data_loade...
2,442
30.727273
76
py
OpenPSG
OpenPSG-main/ce7454/trainer.py
import numpy as np import torch import torch.nn as nn import torch.nn.functional as F from torch.utils.data import DataLoader from tqdm import tqdm def cosine_annealing(step, total_steps, lr_max, lr_min): return lr_min + (lr_max - lr_min) * 0.5 * (1 + np.cos(step / total_steps * np.pi)) cla...
2,273
30.150685
77
py
OpenPSG
OpenPSG-main/tools/vis_results.py
# Copyright (c) OpenMMLab. All rights reserved. import argparse import os.path as osp import mmcv from mmcv import Config, DictAction from mmdet.datasets import build_dataset, replace_ImageToTensor from openpsg.utils.utils import show_result def parse_args(): parser = argparse.ArgumentParser( descripti...
3,698
35.99
78
py
OpenPSG
OpenPSG-main/tools/test.py
# Copyright (c) OpenMMLab. All rights reserved. import argparse import os import os.path as osp import time import warnings import mmcv import torch from grade import save_results from mmcv import Config, DictAction from mmcv.cnn import fuse_conv_bn from mmcv.parallel import MMDataParallel, MMDistributedDataParallel f...
9,830
39.126531
112
py
OpenPSG
OpenPSG-main/tools/grade.py
# Copyright (c) OpenMMLab. All rights reserved. import argparse import json import os import random import numpy as np import PIL from mmcv import Config from mmdet.datasets.coco_panoptic import INSTANCE_OFFSET from panopticapi.utils import rgb2id from PIL import Image from tqdm import tqdm from openpsg.datasets impo...
4,814
31.979452
77
py
OpenPSG
OpenPSG-main/tools/train.py
# Copyright (c) OpenMMLab. All rights reserved. import argparse import copy import os import os.path as osp import time import warnings import mmcv import torch from mmcv import Config, DictAction from mmcv.runner import get_dist_info, init_dist from mmcv.utils import get_git_hash from mmdet import __version__ from mm...
8,188
35.234513
79
py
OpenPSG
OpenPSG-main/openpsg/version.py
# Copyright (c) OpenMMLab. All rights reserved. __version__ = '0.5.0' short_version = __version__ def parse_version_info(version_str): version_info = [] for x in version_str.split('.'): if x.isdigit(): version_info.append(int(x)) elif x.find('rc') != -1: patch_version ...
527
26.789474
56
py
OpenPSG
OpenPSG-main/openpsg/__init__.py
0
0
0
py
OpenPSG
OpenPSG-main/openpsg/evaluation/sgg_eval.py
# --------------------------------------------------------------- # vg_eval.py # Set-up time: 2020/5/18 上午9:48 # Copyright (c) 2020 ICT # Licensed under The MIT License [see LICENSE for details] # Written by Kenneth-Wong (Wenbin-Wang) @ VIPL.ICT # Contact: wenbin.wang@vipl.ict.ac.cn [OR] nkwangwenbin@gmail.com # ------...
11,583
33.47619
83
py
OpenPSG
OpenPSG-main/openpsg/evaluation/sgg_metrics.py
# --------------------------------------------------------------- # sgg_eval.py # Set-up time: 2020/5/18 上午9:49 # Copyright (c) 2020 ICT # Licensed under The MIT License [see LICENSE for details] # Written by Kenneth-Wong (Wenbin-Wang) @ VIPL.ICT # Contact: wenbin.wang@vipl.ict.ac.cn [OR] nkwangwenbin@gmail.com # -----...
43,520
39.826454
128
py
OpenPSG
OpenPSG-main/openpsg/evaluation/__init__.py
from .sgg_eval import sgg_evaluation
37
18
36
py
OpenPSG
OpenPSG-main/openpsg/evaluation/sgg_eval_util.py
# --------------------------------------------------------------- # sgg_eval_util.py # Set-up time: 2020/5/18 下午9:37 # Copyright (c) 2020 ICT # Licensed under The MIT License [see LICENSE for details] # Written by Kenneth-Wong (Wenbin-Wang) @ VIPL.ICT # Contact: wenbin.wang@vipl.ict.ac.cn [OR] nkwangwenbin@gmail.com # ...
1,383
35.421053
92
py
OpenPSG
OpenPSG-main/openpsg/models/registry.py
from mmdet.utils import Registry FRAMEWORK = Registry('framework')
68
16.25
33
py
OpenPSG
OpenPSG-main/openpsg/models/__init__.py
from .frameworks import * # noqa: F401,F403 from .losses import * # noqa: F401,F403 from .relation_heads import * # noqa: F401,F403 from .roi_extractors import * # noqa: F401,F403 from .roi_heads import * # noqa: F401,F403
228
37.166667
48
py
OpenPSG
OpenPSG-main/openpsg/models/roi_extractors/visual_spatial.py
# --------------------------------------------------------------- # visual_spatial.py # Set-up time: 2020/4/28 下午8:46 # Copyright (c) 2020 ICT # Licensed under The MIT License [see LICENSE for details] # Written by Kenneth-Wong (Wenbin-Wang) @ VIPL.ICT # Contact: wenbin.wang@vipl.ict.ac.cn [OR] nkwangwenbin@gmail.com #...
23,631
41.275492
84
py
OpenPSG
OpenPSG-main/openpsg/models/roi_extractors/__init__.py
from .visual_spatial import VisualSpatialExtractor
51
25
50
py
OpenPSG
OpenPSG-main/openpsg/models/relation_heads/motif_head.py
# --------------------------------------------------------------- # motif_head.py # Set-up time: 2020/4/27 下午8:08 # Copyright (c) 2020 ICT # Licensed under The MIT License [see LICENSE for details] # Written by Kenneth-Wong (Wenbin-Wang) @ VIPL.ICT # Contact: wenbin.wang@vipl.ict.ac.cn [OR] nkwangwenbin@gmail.com # ---...
6,943
38.908046
87
py
OpenPSG
OpenPSG-main/openpsg/models/relation_heads/gps_head.py
# --------------------------------------------------------------- # gps_head.py # Set-up time: 2021/3/31 17:13 # Copyright (c) 2020 ICT # Licensed under The MIT License [see LICENSE for details] # Written by Kenneth-Wong (Wenbin-Wang) @ VIPL.ICT # Contact: wenbin.wang@vipl.ict.ac.cn [OR] nkwangwenbin@gmail.com # ------...
6,890
41.801242
79
py
OpenPSG
OpenPSG-main/openpsg/models/relation_heads/imp_head.py
# --------------------------------------------------------------- # imp_head.py # Set-up time: 2020/5/21 下午11:22 # Copyright (c) 2020 ICT # Licensed under The MIT License [see LICENSE for details] # Written by Kenneth-Wong (Wenbin-Wang) @ VIPL.ICT # Contact: wenbin.wang@vipl.ict.ac.cn [OR] nkwangwenbin@gmail.com # ----...
3,996
40.635417
87
py
OpenPSG
OpenPSG-main/openpsg/models/relation_heads/__init__.py
from .gps_head import GPSHead from .imp_head import IMPHead from .motif_head import MotifHead from .vctree_head import VCTreeHead
130
25.2
35
py
OpenPSG
OpenPSG-main/openpsg/models/relation_heads/psgformer_head.py
# Copyright (c) OpenMMLab. All rights reserved. from collections import defaultdict import torch import torch.nn as nn import torch.nn.functional as F import torchvision from mmcv.cnn import Conv2d, Linear, build_activation_layer from mmcv.cnn.bricks.transformer import build_positional_encoding from mmcv.runner import...
59,405
44.979876
119
py
OpenPSG
OpenPSG-main/openpsg/models/relation_heads/relation_head.py
import copy import itertools import mmcv import numpy as np import torch import torch.nn.functional as F from mmcv.runner import BaseModule from mmdet.core import bbox2roi from mmdet.models import HEADS, builder from mmdet.models.losses import accuracy from .approaches import (FrequencyBias, PostProcessor, RelationSa...
18,539
41.136364
131
py
OpenPSG
OpenPSG-main/openpsg/models/relation_heads/vctree_head.py
# --------------------------------------------------------------- # vctree_head.py # Set-up time: 2020/6/4 上午9:35 # Copyright (c) 2020 ICT # Licensed under The MIT License [see LICENSE for details] # Written by Kenneth-Wong (Wenbin-Wang) @ VIPL.ICT # Contact: wenbin.wang@vipl.ict.ac.cn [OR] nkwangwenbin@gmail.com # ---...
7,052
40.005814
87
py
OpenPSG
OpenPSG-main/openpsg/models/relation_heads/psgtr_head.py
# Copyright (c) OpenMMLab. All rights reserved. import time from collections import defaultdict from inspect import signature import torch import torch.nn as nn import torch.nn.functional as F import torchvision from mmcv.cnn import Conv2d, Linear, build_activation_layer from mmcv.cnn.bricks.transformer import FFN, bu...
64,402
46.600148
189
py
OpenPSG
OpenPSG-main/openpsg/models/relation_heads/detr4seg_head.py
# Copyright (c) OpenMMLab. All rights reserved. import time from collections import defaultdict from inspect import signature import torch import torch.nn as nn import torch.nn.functional as F import torchvision from mmcv.cnn import Conv2d, Linear, build_activation_layer from mmcv.cnn.bricks.transformer import FFN, bu...
41,053
43.049356
108
py
OpenPSG
OpenPSG-main/openpsg/models/relation_heads/approaches/vctree_util.py
# --------------------------------------------------------------- # vctree_util.py # Set-up time: 2020/6/4 下午3:43 # Copyright (c) 2020 ICT # Licensed under The MIT License [see LICENSE for details] # Written by Kenneth-Wong (Wenbin-Wang) @ VIPL.ICT # Contact: wenbin.wang@vipl.ict.ac.cn [OR] nkwangwenbin@gmail.com # ---...
15,131
32.330396
105
py
OpenPSG
OpenPSG-main/openpsg/models/relation_heads/approaches/imp.py
# --------------------------------------------------------------- # imp.py # Set-up time: 2020/5/21 下午11:26 # Copyright (c) 2020 ICT # Licensed under The MIT License [see LICENSE for details] # Written by Kenneth-Wong (Wenbin-Wang) @ VIPL.ICT # Contact: wenbin.wang@vipl.ict.ac.cn [OR] nkwangwenbin@gmail.com # ---------...
5,667
38.915493
78
py
OpenPSG
OpenPSG-main/openpsg/models/relation_heads/approaches/pointnet.py
# --------------------------------------------------------------- # pointnet.py # Set-up time: 2020/10/6 23:24 # Copyright (c) 2020 ICT # Licensed under The MIT License [see LICENSE for details] # Written by Kenneth-Wong (Wenbin-Wang) @ VIPL.ICT # Contact: wenbin.wang@vipl.ict.ac.cn [OR] nkwangwenbin@gmail.com # ------...
7,176
33.671498
75
py
OpenPSG
OpenPSG-main/openpsg/models/relation_heads/approaches/dmp.py
# --------------------------------------------------------------- # dmp.py # Set-up time: 2020/10/7 22:23 # Copyright (c) 2020 ICT # Licensed under The MIT License [see LICENSE for details] # Written by Kenneth-Wong (Wenbin-Wang) @ VIPL.ICT # Contact: wenbin.wang@vipl.ict.ac.cn [OR] nkwangwenbin@gmail.com # -----------...
6,337
39.113924
76
py
OpenPSG
OpenPSG-main/openpsg/models/relation_heads/approaches/motif_util.py
# --------------------------------------------------------------- # motif_util.py # Set-up time: 2020/5/4 下午4:36 # Copyright (c) 2020 ICT # Licensed under The MIT License [see LICENSE for details] # Written by Kenneth-Wong (Wenbin-Wang) @ VIPL.ICT # Contact: wenbin.wang@vipl.ict.ac.cn [OR] nkwangwenbin@gmail.com # ----...
11,894
36.40566
79
py
OpenPSG
OpenPSG-main/openpsg/models/relation_heads/approaches/matcher.py
# Copyright (c) OpenMMLab. All rights reserved. import torch from mmdet.core import AssignResult, BaseAssigner, bbox_cxcywh_to_xyxy from mmdet.core.bbox.builder import BBOX_ASSIGNERS from mmdet.core.bbox.match_costs import build_match_cost try: from scipy.optimize import linear_sum_assignment except ImportError: ...
9,976
45.404651
78
py
OpenPSG
OpenPSG-main/openpsg/models/relation_heads/approaches/relation_ranker.py
# --------------------------------------------------------------- # relation_ranker.py # Set-up time: 2021/5/11 16:21 # Copyright (c) 2020 ICT # Licensed under The MIT License [see LICENSE for details] # Written by Kenneth-Wong (Wenbin-Wang) @ VIPL.ICT # Contact: wenbin.wang@vipl.ict.ac.cn [OR] nkwangwenbin@gmail.com #...
8,696
41.014493
126
py
OpenPSG
OpenPSG-main/openpsg/models/relation_heads/approaches/relation_util.py
# --------------------------------------------------------------- # relation_util.py # Set-up time: 2020/5/7 下午11:13 # Copyright (c) 2020 ICT # Licensed under The MIT License [see LICENSE for details] # Written by Kenneth-Wong (Wenbin-Wang) @ VIPL.ICT # Contact: wenbin.wang@vipl.ict.ac.cn [OR] nkwangwenbin@gmail.com # ...
28,570
41.707025
123
py
OpenPSG
OpenPSG-main/openpsg/models/relation_heads/approaches/sampling.py
# --------------------------------------------------------------- # sampling.py # Set-up time: 2020/5/7 下午4:31 # Copyright (c) 2020 ICT # Licensed under The MIT License [see LICENSE for details] # Written by Kenneth-Wong (Wenbin-Wang) @ VIPL.ICT # Contact: wenbin.wang@vipl.ict.ac.cn [OR] nkwangwenbin@gmail.com # ------...
18,035
46.968085
120
py
OpenPSG
OpenPSG-main/openpsg/models/relation_heads/approaches/motif.py
# --------------------------------------------------------------- # motif.py # Set-up time: 2020/5/4 下午4:31 # Copyright (c) 2020 ICT # Licensed under The MIT License [see LICENSE for details] # Written by Kenneth-Wong (Wenbin-Wang) @ VIPL.ICT # Contact: wenbin.wang@vipl.ict.ac.cn [OR] nkwangwenbin@gmail.com # ---------...
19,918
41.112051
102
py
OpenPSG
OpenPSG-main/openpsg/models/relation_heads/approaches/__init__.py
from .dmp import DirectionAwareMessagePassing from .imp import IMPContext from .motif import FrequencyBias, LSTMContext from .pointnet import PointNetFeat from .relation_ranker import get_weak_key_rel_labels from .relation_util import PostProcessor, Result from .sampling import RelationSampler from .vctree import VCTre...
333
36.111111
52
py
OpenPSG
OpenPSG-main/openpsg/models/relation_heads/approaches/treelstm_util.py
# --------------------------------------------------------------- # treelstm_util.py # Set-up time: 2020/6/4 下午4:42 # Copyright (c) 2020 ICT # Licensed under The MIT License [see LICENSE for details] # Written by Kenneth-Wong (Wenbin-Wang) @ VIPL.ICT # Contact: wenbin.wang@vipl.ict.ac.cn [OR] nkwangwenbin@gmail.com # -...
15,090
41.271709
99
py
OpenPSG
OpenPSG-main/openpsg/models/relation_heads/approaches/vctree.py
# --------------------------------------------------------------- # vctree.py # Set-up time: 2020/6/4 上午10:22 # Copyright (c) 2020 ICT # Licensed under The MIT License [see LICENSE for details] # Written by Kenneth-Wong (Wenbin-Wang) @ VIPL.ICT # Contact: wenbin.wang@vipl.ict.ac.cn [OR] nkwangwenbin@gmail.com # -------...
16,755
41.206549
79
py
OpenPSG
OpenPSG-main/openpsg/models/frameworks/dual_transformer.py
import torch from mmcv.cnn import xavier_init from mmcv.cnn.bricks.transformer import build_transformer_layer_sequence from mmcv.runner.base_module import BaseModule from mmdet.models.utils.builder import TRANSFORMER @TRANSFORMER.register_module() class DualTransformer(BaseModule): """Modify the DETR transformer ...
4,484
45.237113
79
py
OpenPSG
OpenPSG-main/openpsg/models/frameworks/psgtr.py
# Copyright (c) OpenMMLab. All rights reserved. import warnings import mmcv import numpy as np import torch import torch.nn.functional as F from detectron2.utils.visualizer import VisImage, Visualizer from mmdet.datasets.coco_panoptic import INSTANCE_OFFSET from mmdet.models import DETECTORS, SingleStageDetector from...
6,062
39.152318
104
py
OpenPSG
OpenPSG-main/openpsg/models/frameworks/detr4seg.py
# Copyright (c) OpenMMLab. All rights reserved. import imghdr import random import time import warnings from turtle import shape import cv2 import matplotlib.pyplot as plt import mmcv import numpy as np import torch import torch.nn.functional as F from detectron2.utils.visualizer import VisImage, Visualizer from mmdet...
11,322
35.525806
85
py
OpenPSG
OpenPSG-main/openpsg/models/frameworks/sg_panoptic_fpn.py
import mmcv import numpy as np import torch import torch.nn.functional as F from detectron2.utils.visualizer import VisImage, Visualizer from mmdet.core import BitmapMasks, bbox2roi, build_assigner, multiclass_nms from mmdet.datasets.coco_panoptic import INSTANCE_OFFSET from mmdet.models import DETECTORS, PanopticFPN f...
35,038
34.003996
88
py
OpenPSG
OpenPSG-main/openpsg/models/frameworks/sg_rcnn.py
import mmcv import numpy as np import torch import torch.nn.functional as F from detectron2.utils.visualizer import VisImage, Visualizer from mmdet.core import bbox2roi, build_assigner from mmdet.models import DETECTORS, TwoStageDetector from mmdet.models.builder import build_head from openpsg.models.relation_heads.ap...
23,736
35.462366
112
py
OpenPSG
OpenPSG-main/openpsg/models/frameworks/__init__.py
from .sg_panoptic_fpn import SceneGraphPanopticFPN from .sg_rcnn import SceneGraphRCNN
87
28.333333
50
py
OpenPSG
OpenPSG-main/openpsg/models/roi_heads/scene_graph_roi_head.py
""" See: https://mmdetection.readthedocs.io/en/v2.19.0/tutorials/customize_models.html """ from mmdet.models import HEADS, StandardRoIHead @HEADS.register_module() class SceneGraphRoIHead(StandardRoIHead): def __init__(self, param, **kwargs): super().__init__(**kwargs) self.param = self.param
316
25.416667
82
py
OpenPSG
OpenPSG-main/openpsg/models/roi_heads/__init__.py
from .bbox_heads import SceneGraphBBoxHead
43
21
42
py
OpenPSG
OpenPSG-main/openpsg/models/roi_heads/bbox_heads/__init__.py
from .sg_bbox_head import SceneGraphBBoxHead
45
22
44
py
OpenPSG
OpenPSG-main/openpsg/models/roi_heads/bbox_heads/sg_bbox_head.py
import torch.nn.functional as F from mmcv.runner import force_fp32 from mmdet.models import Shared2FCBBoxHead from mmdet.models.builder import HEADS from openpsg.utils.utils import multiclass_nms_alt @HEADS.register_module() class SceneGraphBBoxHead(Shared2FCBBoxHead): @force_fp32(apply_to=('cls_score', 'bbox_pr...
3,107
36.445783
78
py
OpenPSG
OpenPSG-main/openpsg/models/losses/seg_losses.py
import torch import torch.nn as nn import torch.nn.functional as F from mmdet.models.builder import LOSSES from mmdet.models.losses.utils import weighted_loss #@mmcv.jit(derivate=True, coderize=True) @weighted_loss def dice_loss(input, target, mask=None, eps=0.001): N, H, W = input.shape input = input.contig...
5,046
34.542254
79
py
OpenPSG
OpenPSG-main/openpsg/models/losses/__init__.py
from .seg_losses import BCEFocalLoss, dice_loss, psgtrDiceLoss __all__ = ['BCEFocalLoss', 'dice_loss', 'psgtrDiceLoss']
121
29.5
62
py
OpenPSG
OpenPSG-main/openpsg/datasets/psg.py
import os.path as osp import random from collections import defaultdict import mmcv import numpy as np import torch from detectron2.data.detection_utils import read_image from mmdet.datasets import DATASETS, CocoPanopticDataset from mmdet.datasets.coco_panoptic import COCOPanoptic from mmdet.datasets.pipelines import ...
15,541
34.083521
79
py
OpenPSG
OpenPSG-main/openpsg/datasets/sg.py
import os.path as osp import random from collections import defaultdict import mmcv import numpy as np from mmdet.datasets import DATASETS, CocoDataset from mmdet.datasets.api_wrappers import COCO from mmdet.datasets.pipelines import Compose from openpsg.evaluation import sgg_evaluation from openpsg.models.relation_h...
11,107
33.390093
105
py
OpenPSG
OpenPSG-main/openpsg/datasets/__init__.py
from .builder import DATASETS, PIPELINES, build_dataset from .pipelines import (LoadPanopticSceneGraphAnnotations, LoadSceneGraphAnnotations, PanopticSceneGraphFormatBundle, SceneGraphFormatBundle) from .psg import PanopticSceneGraphDataset from .sg import SceneGraphDatas...
571
39.857143
79
py
OpenPSG
OpenPSG-main/openpsg/datasets/builder.py
# Copyright (c) OpenMMLab. All rights reserved. import platform from mmcv.utils import Registry, build_from_cfg from mmdet.datasets import DATASETS as MMDET_DATASETS from mmdet.datasets.builder import _concat_dataset if platform.system() != 'Windows': # https://github.com/pytorch/pytorch/issues/973 import res...
1,841
40.863636
79
py
OpenPSG
OpenPSG-main/openpsg/datasets/pipelines/formatting.py
from mmcv.parallel import DataContainer as DC from mmdet.datasets import PIPELINES from mmdet.datasets.pipelines import DefaultFormatBundle, to_tensor @PIPELINES.register_module() class SceneGraphFormatBundle(DefaultFormatBundle): def __call__(self, results): results = super().__call__(results) i...
982
30.709677
70
py
OpenPSG
OpenPSG-main/openpsg/datasets/pipelines/loading.py
import os.path as osp import mmcv import numpy as np from mmcv.parallel import DataContainer as DC from mmdet.core import BitmapMasks from mmdet.datasets import PIPELINES from mmdet.datasets.pipelines import (DefaultFormatBundle, LoadAnnotations, to_tensor) from mmdet.datasets.pip...
5,278
29.33908
79
py
OpenPSG
OpenPSG-main/openpsg/datasets/pipelines/rel_randomcrop.py
import random import numpy as np from mmdet.datasets import PIPELINES from mmdet.datasets.pipelines import RandomCrop @PIPELINES.register_module() class RelRandomCrop(RandomCrop): """Random crop the image & bboxes & masks & scene relations.""" def _crop_data(self, results, crop_size, allow_negative_crop): ...
3,923
44.627907
92
py
OpenPSG
OpenPSG-main/openpsg/datasets/pipelines/__init__.py
from .formatting import PanopticSceneGraphFormatBundle, SceneGraphFormatBundle from .loading import (LoadPanopticSceneGraphAnnotations, LoadSceneGraphAnnotations) __all__ = [ 'PanopticSceneGraphFormatBundle', 'SceneGraphFormatBundle', 'LoadPanopticSceneGraphAnnotations', 'LoadSceneGraphAn...
333
36.111111
78
py
OpenPSG
OpenPSG-main/openpsg/utils/utils.py
from typing import Tuple import os.path as osp import PIL import mmcv import mmcv.ops as ops import numpy as np import torch from detectron2.utils.colormap import colormap from detectron2.utils.visualizer import VisImage, Visualizer from mmdet.datasets.coco_panoptic import INSTANCE_OFFSET import matplotlib.pyplot as pl...
16,860
31.676357
90
py
OpenPSG
OpenPSG-main/openpsg/utils/__init__.py
from .utils import * # noqa: F401,F403 from .vis_tools import * # noqa: F401,F403
85
20.5
43
py