repo stringlengths 1 99 | file stringlengths 13 215 | code stringlengths 12 59.2M | file_length int64 12 59.2M | avg_line_length float64 3.82 1.48M | max_line_length int64 12 2.51M | extension_type stringclasses 1
value |
|---|---|---|---|---|---|---|
RSP | RSP-main/Semantic Segmentation/configs/_base_/models/ocrnet_r50-d8.py | # model settings
norm_cfg = dict(type='SyncBN', requires_grad=True)
model = dict(
type='CascadeEncoderDecoder',
num_stages=2,
pretrained='open-mmlab://resnet50_v1c',
backbone=dict(
type='ResNetV1c',
depth=50,
num_stages=4,
out_indices=(0, 1, 2, 3),
dilations=(1, 1... | 1,385 | 27.875 | 78 | py |
RSP | RSP-main/Semantic Segmentation/configs/_base_/models/isanet_r50-d8.py | # model settings
norm_cfg = dict(type='SyncBN', requires_grad=True)
model = dict(
type='EncoderDecoder',
pretrained='open-mmlab://resnet50_v1c',
backbone=dict(
type='ResNetV1c',
depth=50,
num_stages=4,
out_indices=(0, 1, 2, 3),
dilations=(1, 1, 2, 4),
strides=... | 1,291 | 27.086957 | 74 | py |
RSP | RSP-main/Semantic Segmentation/configs/_base_/models/nonlocal_r50-d8.py | # model settings
norm_cfg = dict(type='SyncBN', requires_grad=True)
model = dict(
type='EncoderDecoder',
pretrained='open-mmlab://resnet50_v1c',
backbone=dict(
type='ResNetV1c',
depth=50,
num_stages=4,
out_indices=(0, 1, 2, 3),
dilations=(1, 1, 2, 4),
strides=... | 1,315 | 27 | 74 | py |
RSP | RSP-main/Semantic Segmentation/configs/_base_/models/fcn_r50-d8.py | # model settings
norm_cfg = dict(type='SyncBN', requires_grad=True)
model = dict(
type='EncoderDecoder',
pretrained='open-mmlab://resnet50_v1c',
backbone=dict(
type='ResNetV1c',
depth=50,
num_stages=4,
out_indices=(0, 1, 2, 3),
dilations=(1, 1, 2, 4),
strides=... | 1,285 | 26.956522 | 74 | py |
RSP | RSP-main/Semantic Segmentation/configs/deeplabv3plus/deeplabv3plus_r101b-d8_512x1024_80k_cityscapes.py | _base_ = './deeplabv3plus_r50-d8_512x1024_80k_cityscapes.py'
model = dict(
pretrained='torchvision://resnet101',
backbone=dict(type='ResNet', depth=101))
| 162 | 31.6 | 60 | py |
RSP | RSP-main/Semantic Segmentation/configs/deeplabv3plus/deeplabv3plus_r18b-d8_512x1024_80k_cityscapes.py | _base_ = './deeplabv3plus_r50-d8_512x1024_80k_cityscapes.py'
model = dict(
pretrained='torchvision://resnet18',
backbone=dict(type='ResNet', depth=18),
decode_head=dict(
c1_in_channels=64,
c1_channels=12,
in_channels=512,
channels=128,
),
auxiliary_head=dict(in_channe... | 342 | 27.583333 | 60 | py |
RSP | RSP-main/Semantic Segmentation/configs/deeplabv3plus/deeplabv3plus_r18b-d8_769x769_80k_cityscapes.py | _base_ = './deeplabv3plus_r50-d8_769x769_80k_cityscapes.py'
model = dict(
pretrained='torchvision://resnet18',
backbone=dict(type='ResNet', depth=18),
decode_head=dict(
c1_in_channels=64,
c1_channels=12,
in_channels=512,
channels=128,
),
auxiliary_head=dict(in_channel... | 341 | 27.5 | 59 | py |
RSP | RSP-main/Semantic Segmentation/configs/deeplabv3plus/deeplabv3plus_r50b-d8_769x769_80k_cityscapes.py | _base_ = './deeplabv3plus_r50-d8_769x769_80k_cityscapes.py'
model = dict(pretrained='torchvision://resnet50', backbone=dict(type='ResNet'))
| 140 | 46 | 79 | py |
RSP | RSP-main/Semantic Segmentation/configs/deeplabv3plus/deeplabv3plus_r101b-d8_769x769_80k_cityscapes.py | _base_ = './deeplabv3plus_r50-d8_769x769_80k_cityscapes.py'
model = dict(
pretrained='torchvision://resnet101',
backbone=dict(type='ResNet', depth=101))
| 161 | 31.4 | 59 | py |
RSP | RSP-main/Semantic Segmentation/configs/deeplabv3plus/deeplabv3plus_r50b-d8_512x1024_80k_cityscapes.py | _base_ = './deeplabv3plus_r50-d8_512x1024_80k_cityscapes.py'
model = dict(pretrained='torchvision://resnet50', backbone=dict(type='ResNet'))
| 141 | 46.333333 | 79 | py |
RSP | RSP-main/Semantic Segmentation/configs/deeplabv3/deeplabv3_r18b-d8_769x769_80k_cityscapes.py | _base_ = './deeplabv3_r50-d8_769x769_80k_cityscapes.py'
model = dict(
pretrained='torchvision://resnet18',
backbone=dict(type='ResNet', depth=18),
decode_head=dict(
in_channels=512,
channels=128,
),
auxiliary_head=dict(in_channels=256, channels=64))
| 286 | 27.7 | 55 | py |
RSP | RSP-main/Semantic Segmentation/configs/deeplabv3/deeplabv3_r101b-d8_769x769_80k_cityscapes.py | _base_ = './deeplabv3_r50-d8_769x769_80k_cityscapes.py'
model = dict(
pretrained='torchvision://resnet101',
backbone=dict(type='ResNet', depth=101))
| 157 | 30.6 | 55 | py |
RSP | RSP-main/Semantic Segmentation/configs/deeplabv3/deeplabv3_r101b-d8_512x1024_80k_cityscapes.py | _base_ = './deeplabv3_r50-d8_512x1024_80k_cityscapes.py'
model = dict(
pretrained='torchvision://resnet101',
backbone=dict(type='ResNet', depth=101))
| 158 | 30.8 | 56 | py |
RSP | RSP-main/Semantic Segmentation/configs/deeplabv3/deeplabv3_r50b-d8_769x769_80k_cityscapes.py | _base_ = './deeplabv3_r50-d8_769x769_80k_cityscapes.py'
model = dict(pretrained='torchvision://resnet50', backbone=dict(type='ResNet'))
| 136 | 44.666667 | 79 | py |
RSP | RSP-main/Semantic Segmentation/configs/deeplabv3/deeplabv3_r50b-d8_512x1024_80k_cityscapes.py | _base_ = './deeplabv3_r50-d8_512x1024_80k_cityscapes.py'
model = dict(pretrained='torchvision://resnet50', backbone=dict(type='ResNet'))
| 137 | 45 | 79 | py |
RSP | RSP-main/Semantic Segmentation/configs/deeplabv3/deeplabv3_r18b-d8_512x1024_80k_cityscapes.py | _base_ = './deeplabv3_r50-d8_512x1024_80k_cityscapes.py'
model = dict(
pretrained='torchvision://resnet18',
backbone=dict(type='ResNet', depth=18),
decode_head=dict(
in_channels=512,
channels=128,
),
auxiliary_head=dict(in_channels=256, channels=64))
| 287 | 27.8 | 56 | py |
RSP | RSP-main/Semantic Segmentation/docs/en/conf.py | # Copyright (c) OpenMMLab. All rights reserved.
# Configuration file for the Sphinx documentation builder.
#
# This file only contains a selection of the most common options. For a full
# list see the documentation:
# https://www.sphinx-doc.org/en/master/usage/configuration.html
# -- Path setup -----------------------... | 3,995 | 28.820896 | 79 | py |
RSP | RSP-main/Semantic Segmentation/docs/zh_cn/conf.py | # Copyright (c) OpenMMLab. All rights reserved.
# Configuration file for the Sphinx documentation builder.
#
# This file only contains a selection of the most common options. For a full
# list see the documentation:
# https://www.sphinx-doc.org/en/master/usage/configuration.html
# -- Path setup -----------------------... | 3,956 | 28.529851 | 79 | py |
RSP | RSP-main/Semantic Segmentation/custom/checkpoint.py | # Copyright (c) Open-MMLab. All rights reserved.
import io
import os
import os.path as osp
import pkgutil
import time
import warnings
from collections import OrderedDict
from importlib import import_module
from tempfile import TemporaryDirectory
import torch
import torchvision
from torch.optim import Optimizer
from to... | 21,203 | 37.906422 | 117 | py |
RSP | RSP-main/Semantic Segmentation/.dev/gather_models.py | # Copyright (c) OpenMMLab. All rights reserved.
import argparse
import glob
import hashlib
import json
import os
import os.path as osp
import shutil
import mmcv
import torch
# build schedule look-up table to automatically find the final model
RESULTS_LUT = ['mIoU', 'mAcc', 'aAcc']
def calculate_file_sha256(file_pat... | 7,406 | 33.938679 | 78 | py |
RSP | RSP-main/Scene Recognition/main.py | # --------------------------------------------------------
# Swin Transformer
# Copyright (c) 2021 Microsoft
# Licensed under The MIT License [see LICENSE for details]
# Written by Ze Liu
# --------------------------------------------------------
import os
import time
import random
import argparse
import datetime
impo... | 19,524 | 41.724289 | 146 | py |
RSP | RSP-main/Scene Recognition/lr_scheduler.py | # --------------------------------------------------------
# Swin Transformer
# Copyright (c) 2021 Microsoft
# Licensed under The MIT License [see LICENSE for details]
# Written by Ze Liu
# --------------------------------------------------------
import torch
from timm.scheduler.cosine_lr import CosineLRScheduler
from... | 3,547 | 33.446602 | 105 | py |
RSP | RSP-main/Scene Recognition/utils.py | # --------------------------------------------------------
# Swin Transformer
# Copyright (c) 2021 Microsoft
# Licensed under The MIT License [see LICENSE for details]
# Written by Ze Liu
# --------------------------------------------------------
import os
import torch
import torch.distributed as dist
try:
# noin... | 9,944 | 43.596413 | 117 | py |
RSP | RSP-main/Scene Recognition/optimizer.py | # --------------------------------------------------------
# Swin Transformer
# Copyright (c) 2021 Microsoft
# Licensed under The MIT License [see LICENSE for details]
# Written by Ze Liu
# --------------------------------------------------------
from torch import optim as optim
def build_optimizer(config, model):
... | 2,014 | 33.741379 | 111 | py |
RSP | RSP-main/Scene Recognition/models/swin_transformer.py | # --------------------------------------------------------
# Swin Transformer
# Copyright (c) 2021 Microsoft
# Licensed under The MIT License [see LICENSE for details]
# Written by Ze Liu
# --------------------------------------------------------
import torch
import torch.nn as nn
import torch.utils.checkpoint as chec... | 26,751 | 40.8 | 119 | py |
RSP | RSP-main/Scene Recognition/models/resnet.py | import math
import torch
import torch.nn as nn
import torch.utils.model_zoo as model_zoo
import os
import torchvision
torchvision.models.resnext50_32x4d()
__model_file = {
18: 'https://download.pytorch.org/models/resnet18-5c106cde.pth',
34: 'https://download.pytorch.org/models/resnet34-333f7ec4.pth',
50: ... | 13,037 | 37.688427 | 107 | py |
RSP | RSP-main/Scene Recognition/models/ViTAE_Window_NoShift/base_model.py | from functools import partial
import torch
import torch.nn as nn
from timm.models.layers import trunc_normal_
import numpy as np
from torch.nn.functional import instance_norm
from torch.nn.modules.batchnorm import BatchNorm2d
from .NormalCell import NormalCell
from .ReductionCell import ReductionCell
class PatchEmbedd... | 10,877 | 47.346667 | 199 | py |
RSP | RSP-main/Scene Recognition/models/ViTAE_Window_NoShift/swin.py | # --------------------------------------------------------
# Swin Transformer
# Copyright (c) 2021 Microsoft
# Licensed under The MIT License [see LICENSE for details]
# Written by Ze Liu
# --------------------------------------------------------
import torch
import torch.nn as nn
import torch.utils.checkpoint as chec... | 24,643 | 40.628378 | 142 | py |
RSP | RSP-main/Scene Recognition/models/ViTAE_Window_NoShift/ReductionCell.py | import math
from numpy.core.fromnumeric import resize, shape
import torch
import torch.nn as nn
import torch.nn.functional as F
from timm.models.layers import DropPath, to_2tuple, trunc_normal_
import numpy as np
from .token_transformer import Token_transformer
from .token_performer import Token_performer
from .SELayer... | 9,746 | 48.227273 | 179 | py |
RSP | RSP-main/Scene Recognition/models/ViTAE_Window_NoShift/NormalCell.py | # Copyright (c) [2012]-[2021] Shanghai Yitu Technology Co., Ltd.
#
# This source code is licensed under the Clear BSD License
# LICENSE file in the root directory of this file
# All rights reserved.
"""
Borrow from timm(https://github.com/rwightman/pytorch-image-models)
"""
import torch
import torch.nn as nn
import num... | 11,254 | 43.840637 | 177 | py |
RSP | RSP-main/Scene Recognition/models/ViTAE_Window_NoShift/token_performer.py | """
Take Performer as T2T Transformer
"""
import math
import torch
import torch.nn as nn
import numpy as np
class Token_performer(nn.Module):
def __init__(self, dim, in_dim, head_cnt=1, kernel_ratio=0.5, dp1=0.1, dp2 = 0.1, gamma=False, init_values=1e-4):
super().__init__()
self.head_dim = in_dim ... | 3,112 | 36.059524 | 128 | py |
RSP | RSP-main/Scene Recognition/models/ViTAE_Window_NoShift/SELayer.py | import torch
import torch.nn as nn
class SELayer(nn.Module):
def __init__(self, channel, reduction=16):
super(SELayer, self).__init__()
self.avg_pool = nn.AdaptiveAvgPool1d(1)
self.fc = nn.Sequential(
nn.Linear(channel, channel // reduction, bias=False),
nn.ReLU(inpl... | 726 | 32.045455 | 65 | py |
RSP | RSP-main/Scene Recognition/models/ViTAE_Window_NoShift/token_transformer.py | # Copyright (c) [2012]-[2021] Shanghai Yitu Technology Co., Ltd.
#
# This source code is licensed under the Clear BSD License
# LICENSE file in the root directory of this file
# All rights reserved.
"""
Take the standard Transformer as T2T Transformer
"""
import torch
import torch.nn as nn
from timm.models.layers impor... | 2,703 | 39.358209 | 165 | py |
RSP | RSP-main/Scene Recognition/models/ViTAE_Window_NoShift/models.py | # Copyright (c) [2012]-[2021] Shanghai Yitu Technology Co., Ltd.
#
# This source code is licensed under the Clear BSD License
# LICENSE file in the root directory of this file
# All rights reserved.
"""
T2T-ViT
"""
from math import gamma
import torch
import torch.nn as nn
from timm.models.helpers import load_pretraine... | 1,657 | 38.47619 | 269 | py |
RSP | RSP-main/Scene Recognition/data/samplers.py | # --------------------------------------------------------
# Swin Transformer
# Copyright (c) 2021 Microsoft
# Licensed under The MIT License [see LICENSE for details]
# Written by Ze Liu
# --------------------------------------------------------
import torch
class SubsetRandomSampler(torch.utils.data.Sampler):
... | 781 | 25.066667 | 84 | py |
RSP | RSP-main/Scene Recognition/data/build.py | # --------------------------------------------------------
# Swin Transformer
# Copyright (c) 2021 Microsoft
# Licensed under The MIT License [see LICENSE for details]
# Written by Ze Liu
# --------------------------------------------------------
import os
import torch
import numpy as np
import torch.distributed as di... | 12,919 | 33 | 123 | py |
RSP | RSP-main/Scene Recognition/data/cached_image_folder.py | # --------------------------------------------------------
# Swin Transformer
# Copyright (c) 2021 Microsoft
# Licensed under The MIT License [see LICENSE for details]
# Written by Ze Liu
# --------------------------------------------------------
import io
import os
import time
import torch.distributed as dist
import ... | 9,026 | 34.679842 | 115 | py |
RSP | RSP-main/Object Detection/setup.py | #!/usr/bin/env python
import os
import subprocess
import time
from setuptools import find_packages, setup
import torch
from torch.utils.cpp_extension import (BuildExtension, CppExtension,
CUDAExtension)
def readme():
with open('README.md', encoding='utf-8') as f:
co... | 11,146 | 33.943574 | 125 | py |
RSP | RSP-main/Object Detection/tools/test.py | import argparse
import os
import mmcv
import torch
from mmcv import Config, DictAction
from mmcv.parallel import MMDataParallel, MMDistributedDataParallel
from mmcv.runner import get_dist_info, init_dist, load_checkpoint
from tools.fuse_conv_bn import fuse_module
from mmdet.apis import multi_gpu_test, single_gpu_test... | 5,668 | 35.811688 | 79 | py |
RSP | RSP-main/Object Detection/tools/benchmark.py | import argparse
import time
import torch
from mmcv import Config
from mmcv.parallel import MMDataParallel
from mmcv.runner import load_checkpoint
from tools.fuse_conv_bn import fuse_module
from mmdet.core import wrap_fp16_model
from mmdet.datasets import build_dataloader, build_dataset
from mmdet.models import build_... | 2,802 | 28.819149 | 79 | py |
RSP | RSP-main/Object Detection/tools/fuse_conv_bn.py | import argparse
import torch
import torch.nn as nn
from mmcv.runner import save_checkpoint
from mmdet.apis import init_detector
def fuse_conv_bn(conv, bn):
""" During inference, the functionary of batch norm layers is turned off
but only the mean and var alone channels are used, which exposes the
chance... | 2,200 | 30.898551 | 77 | py |
RSP | RSP-main/Object Detection/tools/get_flops.py | import argparse
import torch
from mmcv import Config
from mmdet.models import build_detector
try:
from mmcv.cnn import get_model_complexity_info
except ImportError:
raise ImportError('Please upgrade mmcv to >0.6.2')
def parse_args():
parser = argparse.ArgumentParser(description='Train a detector')
... | 1,732 | 26.507937 | 79 | py |
RSP | RSP-main/Object Detection/tools/publish_model.py | import argparse
import subprocess
import torch
def parse_args():
parser = argparse.ArgumentParser(
description='Process a checkpoint to be published')
parser.add_argument('in_file', help='input checkpoint filename')
parser.add_argument('out_file', help='output checkpoint filename')
args = par... | 1,072 | 27.236842 | 77 | py |
RSP | RSP-main/Object Detection/tools/regnet2mmdet.py | import argparse
from collections import OrderedDict
import torch
def convert_stem(model_key, model_weight, state_dict, converted_names):
new_key = model_key.replace('stem.conv', 'conv1')
new_key = new_key.replace('stem.bn', 'bn1')
state_dict[new_key] = model_weight
converted_names.add(model_key)
... | 3,015 | 32.511111 | 77 | py |
RSP | RSP-main/Object Detection/tools/pytorch2onnx.py | import argparse
import io
import mmcv
import onnx
import torch
from mmcv.runner import load_checkpoint
from onnx import optimizer
from torch.onnx import OperatorExportTypes
from mmdet.models import build_detector
from mmdet.ops import RoIAlign, RoIPool
def export_onnx_model(model, inputs, passes):
"""
Trace... | 3,996 | 30.722222 | 76 | py |
RSP | RSP-main/Object Detection/tools/upgrade_model_version.py | import argparse
import re
import tempfile
from collections import OrderedDict
import torch
from mmcv import Config
def is_head(key):
valid_head_list = [
'bbox_head', 'mask_head', 'semantic_head', 'grid_head', 'mask_iou_head'
]
return any(key.startswith(h) for h in valid_head_list)
def parse_co... | 6,215 | 31.041237 | 79 | py |
RSP | RSP-main/Object Detection/tools/test_robustness.py | import argparse
import copy
import os
import os.path as osp
import shutil
import tempfile
import mmcv
import torch
import torch.distributed as dist
from mmcv.parallel import MMDataParallel, MMDistributedDataParallel
from mmcv.runner import get_dist_info, init_dist, load_checkpoint
from pycocotools.coco import COCO
fro... | 17,153 | 36.372549 | 79 | py |
RSP | RSP-main/Object Detection/tools/train.py | import argparse
import copy
import os
import os.path as osp
import time
import mmcv
import torch
from mmcv import Config, DictAction
from mmcv.runner import init_dist
from mmdet import __version__
from mmdet.apis import set_random_seed, train_detector
from mmdet.datasets import build_dataset
from mmdet.models import ... | 5,386 | 33.980519 | 87 | py |
RSP | RSP-main/Object Detection/tools/detectron2pytorch.py | import argparse
from collections import OrderedDict
import mmcv
import torch
arch_settings = {50: (3, 4, 6, 3), 101: (3, 4, 23, 3)}
def convert_bn(blobs, state_dict, caffe_name, torch_name, converted_names):
# detectron replace bn with affine channel layer
state_dict[torch_name + '.bias'] = torch.from_numpy... | 3,530 | 41.542169 | 78 | py |
RSP | RSP-main/Object Detection/mmcv_custom/checkpoint.py | # Copyright (c) Open-MMLab. All rights reserved.
import io
import os
import os.path as osp
import pkgutil
import time
import warnings
from collections import OrderedDict
from importlib import import_module
from tempfile import TemporaryDirectory
import torch
import torchvision
from torch.optim import Optimizer
from to... | 19,104 | 36.534381 | 110 | py |
RSP | RSP-main/Object Detection/tests/async_benchmark.py | import asyncio
import os
import shutil
import urllib
import mmcv
import torch
from mmdet.apis import (async_inference_detector, inference_detector,
init_detector, show_result)
from mmdet.utils.contextmanagers import concurrent
from mmdet.utils.profiling import profile_time
async def main():
... | 3,124 | 29.048077 | 79 | py |
RSP | RSP-main/Object Detection/tests/test_roi_extractor.py | import pytest
import torch
from mmdet.models.roi_heads.roi_extractors import GenericRoIExtractor
def test_groie():
# test with pre/post
cfg = dict(
roi_layer=dict(type='RoIAlign', out_size=7, sample_num=2),
out_channels=256,
featmap_strides=[4, 8, 16, 32],
pre_cfg=dict(
... | 3,174 | 26.850877 | 74 | py |
RSP | RSP-main/Object Detection/tests/test_anchor.py | """
CommandLine:
pytest tests/test_anchor.py
xdoctest tests/test_anchor.py zero
"""
import torch
def test_standard_anchor_generator():
from mmdet.core.anchor import build_anchor_generator
anchor_generator_cfg = dict(
type='AnchorGenerator',
scales=[8],
ratios=[0.5, 1.0, 2.0],
... | 16,127 | 42.826087 | 79 | py |
RSP | RSP-main/Object Detection/tests/test_forward.py | """
pytest tests/test_forward.py
"""
import copy
from os.path import dirname, exists, join
import numpy as np
import pytest
import torch
def _get_config_directory():
""" Find the predefined detector config directory """
try:
# Assume we are running in the source mmdetection repo
repo_dpath = ... | 10,828 | 30.388406 | 79 | py |
RSP | RSP-main/Object Detection/tests/test_async.py | """Tests for async interface."""
import asyncio
import os
import sys
import asynctest
import mmcv
import torch
from mmdet.apis import async_inference_detector, init_detector
if sys.version_info >= (3, 7):
from mmdet.utils.contextmanagers import concurrent
class AsyncTestCase(asynctest.TestCase):
use_defau... | 2,560 | 29.855422 | 75 | py |
RSP | RSP-main/Object Detection/tests/test_config.py | from os.path import dirname, exists, join, relpath
import torch
from mmcv.runner import build_optimizer
from mmdet.core import BitmapMasks, PolygonMasks
def _get_config_directory():
""" Find the predefined detector config directory """
try:
# Assume we are running in the source mmdetection repo
... | 14,223 | 38.62117 | 79 | py |
RSP | RSP-main/Object Detection/tests/test_necks.py | import pytest
import torch
from torch.nn.modules.batchnorm import _BatchNorm
from mmdet.models.necks import FPN
def test_fpn():
"""Tests fpn """
s = 64
in_channels = [8, 16, 32, 64]
feat_sizes = [s // 2**i for i in range(4)] # [64, 32, 16, 8]
out_channels = 8
# `num_outs` is not equal to len... | 6,570 | 31.529703 | 79 | py |
RSP | RSP-main/Object Detection/tests/test_sampler.py | import torch
from mmdet.core.bbox.assigners import MaxIoUAssigner
from mmdet.core.bbox.samplers import (OHEMSampler, RandomSampler,
ScoreHLRSampler)
def test_random_sampler():
assigner = MaxIoUAssigner(
pos_iou_thr=0.5,
neg_iou_thr=0.5,
ignore_iof_thr... | 9,906 | 28.750751 | 79 | py |
RSP | RSP-main/Object Detection/tests/test_heads.py | import mmcv
import torch
from mmdet.core import bbox2roi, build_assigner, build_sampler
from mmdet.models.dense_heads import (AnchorHead, FCOSHead, FSAFHead,
GuidedAnchorHead)
from mmdet.models.roi_heads.bbox_heads import BBoxHead
from mmdet.models.roi_heads.mask_heads import FCNM... | 21,883 | 33.51735 | 79 | py |
RSP | RSP-main/Object Detection/tests/test_pisa_heads.py | import mmcv
import torch
from mmdet.models.dense_heads import PISARetinaHead, PISASSDHead
from mmdet.models.roi_heads import PISARoIHead
def test_pisa_retinanet_head_loss():
"""
Tests pisa retinanet head loss when truth is empty and non-empty
"""
s = 256
img_metas = [{
'img_shape': (s, s,... | 8,777 | 33.972112 | 79 | py |
RSP | RSP-main/Object Detection/tests/test_losses.py | import pytest
import torch
def test_ce_loss():
from mmdet.models import build_loss
# use_mask and use_sigmoid cannot be true at the same time
with pytest.raises(AssertionError):
loss_cfg = dict(
type='CrossEntropyLoss',
use_mask=True,
use_sigmoid=True,
... | 967 | 29.25 | 78 | py |
RSP | RSP-main/Object Detection/tests/test_masks.py | import numpy as np
import pytest
import torch
from mmdet.core import BitmapMasks, PolygonMasks
def dummy_raw_bitmap_masks(size):
"""
Args:
size (tuple): expected shape of dummy masks, (H, W) or (N, H, W)
Return:
ndarray: dummy mask
"""
return np.random.randint(0, 2, size, dtype=n... | 23,708 | 37.995066 | 79 | py |
RSP | RSP-main/Object Detection/tests/test_backbone.py | import pytest
import torch
from torch.nn.modules import AvgPool2d, GroupNorm
from torch.nn.modules.batchnorm import _BatchNorm
from mmdet.models.backbones import RegNet, Res2Net, ResNet, ResNetV1d, ResNeXt
from mmdet.models.backbones.hourglass import HourglassNet
from mmdet.models.backbones.res2net import Bottle2neck
... | 28,580 | 33.643636 | 79 | py |
RSP | RSP-main/Object Detection/tests/test_assigner.py | """
Tests the Assigner objects.
CommandLine:
pytest tests/test_assigner.py
xdoctest tests/test_assigner.py zero
"""
import torch
from mmdet.core.bbox.assigners import (ApproxMaxIoUAssigner,
CenterRegionAssigner, MaxIoUAssigner,
P... | 12,014 | 28.813896 | 79 | py |
RSP | RSP-main/Object Detection/tests/test_fp16.py | import numpy as np
import pytest
import torch
import torch.nn as nn
from mmdet.core import auto_fp16, force_fp32
from mmdet.core.fp16.utils import cast_tensor_type
def test_cast_tensor_type():
inputs = torch.FloatTensor([5.])
src_type = torch.float32
dst_type = torch.int32
outputs = cast_tensor_type(... | 9,713 | 31.165563 | 75 | py |
RSP | RSP-main/Object Detection/tests/test_pipelines/test_transform.py | import copy
import os.path as osp
import mmcv
import numpy as np
import pytest
import torch
from mmcv.utils import build_from_cfg
from mmdet.core.evaluation.bbox_overlaps import bbox_overlaps
from mmdet.datasets.builder import PIPELINES
def test_resize():
# test assertion if img_scale is a list
with pytest.... | 20,178 | 35.822993 | 79 | py |
RSP | RSP-main/Object Detection/tests/test_pipelines/test_models_aug_test.py | import os.path as osp
import mmcv
import torch
from mmcv.parallel import collate
from mmcv.utils import build_from_cfg
from mmdet.datasets.builder import PIPELINES
from mmdet.models import build_detector
def model_aug_test_template(cfg_file):
# get config
cfg = mmcv.Config.fromfile(cfg_file)
# init mode... | 1,909 | 29.806452 | 79 | py |
RSP | RSP-main/Object Detection/tests/test_ops/test_merge_cells.py | """
CommandLine:
pytest tests/test_merge_cells.py
"""
import torch
import torch.nn.functional as F
from mmdet.ops.merge_cells import (BaseMergeCell, ConcatCell,
GlobalPoolingCell, SumCell)
def test_sum_cell():
inputs_x = torch.randn([2, 256, 32, 32])
inputs_y = torch.ra... | 2,504 | 36.954545 | 75 | py |
RSP | RSP-main/Object Detection/tests/test_ops/test_soft_nms.py | """
CommandLine:
pytest tests/test_soft_nms.py
"""
import numpy as np
import torch
from mmdet.ops.nms.nms_wrapper import soft_nms
def test_soft_nms_device_and_dtypes_cpu():
"""
CommandLine:
xdoctest -m tests/test_soft_nms.py test_soft_nms_device_and_dtypes_cpu
"""
iou_thr = 0.7
base_d... | 1,257 | 28.952381 | 78 | py |
RSP | RSP-main/Object Detection/tests/test_ops/test_nms.py | """
CommandLine:
pytest tests/test_nms.py
"""
import numpy as np
import pytest
import torch
from mmdet.ops.nms.nms_wrapper import nms, nms_match
def test_nms_device_and_dtypes_cpu():
"""
CommandLine:
xdoctest -m tests/test_nms.py test_nms_device_and_dtypes_cpu
"""
iou_thr = 0.6
base_d... | 4,220 | 36.026316 | 79 | py |
RSP | RSP-main/Object Detection/tests/test_ops/test_wrappers.py | from collections import OrderedDict
from itertools import product
from unittest.mock import patch
import torch
import torch.nn as nn
from mmdet.ops import Conv2d, ConvTranspose2d, Linear, MaxPool2d
torch.__version__ = '1.1' # force test
def test_conv2d():
"""
CommandLine:
xdoctest -m tests/test_wr... | 6,705 | 32.698492 | 79 | py |
RSP | RSP-main/Object Detection/tests/test_ops/test_corner_pool.py | """
CommandLine:
pytest tests/test_corner_pool.py
"""
import pytest
import torch
from mmdet.ops import CornerPool
def test_corner_pool_device_and_dtypes_cpu():
"""
CommandLine:
xdoctest -m tests/test_corner_pool.py \
test_corner_pool_device_and_dtypes_cpu
"""
with pytest.raise... | 2,301 | 38.016949 | 69 | py |
RSP | RSP-main/Object Detection/demo/webcam_demo.py | import argparse
import cv2
import torch
from mmdet.apis import inference_detector, init_detector
def parse_args():
parser = argparse.ArgumentParser(description='MMDetection webcam demo')
parser.add_argument('config', help='test config file path')
parser.add_argument('checkpoint', help='checkpoint file')... | 1,260 | 25.829787 | 78 | py |
RSP | RSP-main/Object Detection/configs/ghm/retinanet_ghm_x101_32x4d_fpn_1x_coco.py | _base_ = './retinanet_ghm_r50_fpn_1x_coco.py'
model = dict(
pretrained='open-mmlab://resnext101_32x4d',
backbone=dict(
type='ResNeXt',
depth=101,
groups=32,
base_width=4,
num_stages=4,
out_indices=(0, 1, 2, 3),
frozen_stages=1,
norm_cfg=dict(type='... | 372 | 25.642857 | 53 | py |
RSP | RSP-main/Object Detection/configs/ghm/retinanet_ghm_r101_fpn_1x_coco.py | _base_ = './retinanet_ghm_r50_fpn_1x_coco.py'
model = dict(pretrained='torchvision://resnet101', backbone=dict(depth=101))
| 123 | 40.333333 | 76 | py |
RSP | RSP-main/Object Detection/configs/ghm/retinanet_ghm_x101_64x4d_fpn_1x_coco.py | _base_ = './retinanet_ghm_r50_fpn_1x_coco.py'
model = dict(
pretrained='open-mmlab://resnext101_64x4d',
backbone=dict(
type='ResNeXt',
depth=101,
groups=64,
base_width=4,
num_stages=4,
out_indices=(0, 1, 2, 3),
frozen_stages=1,
norm_cfg=dict(type='... | 372 | 25.642857 | 53 | py |
RSP | RSP-main/Object Detection/configs/dcn/faster_rcnn_x101_32x4d_fpn_dconv_c3-c5_1x_coco.py | _base_ = '../faster_rcnn/faster_rcnn_r50_fpn_1x_coco.py'
model = dict(
pretrained='open-mmlab://resnext101_32x4d',
backbone=dict(
type='ResNeXt',
depth=101,
groups=32,
base_width=4,
num_stages=4,
out_indices=(0, 1, 2, 3),
frozen_stages=1,
norm_cfg=... | 510 | 30.9375 | 76 | py |
RSP | RSP-main/Object Detection/configs/htc/htc_x101_64x4d_fpn_16x1_20e_coco.py | _base_ = './htc_r50_fpn_1x_coco.py'
model = dict(
pretrained='open-mmlab://resnext101_64x4d',
backbone=dict(
type='ResNeXt',
depth=101,
groups=64,
base_width=4,
num_stages=4,
out_indices=(0, 1, 2, 3),
frozen_stages=1,
norm_cfg=dict(type='BN', requi... | 504 | 25.578947 | 53 | py |
RSP | RSP-main/Object Detection/configs/htc/htc_without_semantic_r50_fpn_1x_coco.py | _base_ = [
'../_base_/datasets/coco_instance.py',
'../_base_/schedules/schedule_1x.py', '../_base_/default_runtime.py'
]
# model settings
model = dict(
type='HybridTaskCascade',
pretrained='torchvision://resnet50',
backbone=dict(
type='ResNet',
depth=50,
num_stages=4,
... | 7,989 | 32.153527 | 79 | py |
RSP | RSP-main/Object Detection/configs/htc/htc_x101_32x4d_fpn_16x1_20e_coco.py | _base_ = './htc_r50_fpn_1x_coco.py'
model = dict(
pretrained='open-mmlab://resnext101_32x4d',
backbone=dict(
type='ResNeXt',
depth=101,
groups=32,
base_width=4,
num_stages=4,
out_indices=(0, 1, 2, 3),
frozen_stages=1,
norm_cfg=dict(type='BN', requi... | 504 | 25.578947 | 53 | py |
RSP | RSP-main/Object Detection/configs/htc/htc_x101_64x4d_fpn_dconv_c3-c5_mstrain_400_1400_16x1_20e_coco.py | _base_ = './htc_r50_fpn_1x_coco.py'
model = dict(
pretrained='open-mmlab://resnext101_64x4d',
backbone=dict(
type='ResNeXt',
depth=101,
groups=64,
base_width=4,
num_stages=4,
out_indices=(0, 1, 2, 3),
frozen_stages=1,
norm_cfg=dict(type='BN', requi... | 1,406 | 31.72093 | 79 | py |
RSP | RSP-main/Object Detection/configs/htc/htc_r101_fpn_20e_coco.py | _base_ = './htc_r50_fpn_1x_coco.py'
model = dict(pretrained='torchvision://resnet101', backbone=dict(depth=101))
# learning policy
lr_config = dict(step=[16, 19])
total_epochs = 20
| 181 | 29.333333 | 76 | py |
RSP | RSP-main/Object Detection/configs/reppoints/reppoints_moment_r101_fpn_dconv_c3-c5_gn-neck+head_2x_coco.py | _base_ = './reppoints_moment_r50_fpn_gn-neck+head_2x_coco.py'
model = dict(
pretrained='torchvision://resnet101',
backbone=dict(
depth=101,
dcn=dict(type='DCN', deformable_groups=1, fallback_on_stride=False),
stage_with_dcn=(False, True, True, True)))
| 284 | 34.625 | 76 | py |
RSP | RSP-main/Object Detection/configs/reppoints/reppoints_moment_r101_fpn_gn-neck+head_2x_coco.py | _base_ = './reppoints_moment_r50_fpn_gn-neck+head_2x_coco.py'
model = dict(pretrained='torchvision://resnet101', backbone=dict(depth=101))
| 139 | 45.666667 | 76 | py |
RSP | RSP-main/Object Detection/configs/reppoints/reppoints_moment_r50_fpn_1x_coco.py | _base_ = [
'../_base_/datasets/coco_detection.py',
'../_base_/schedules/schedule_1x.py', '../_base_/default_runtime.py'
]
model = dict(
type='RepPointsDetector',
pretrained='torchvision://resnet50',
backbone=dict(
type='ResNet',
depth=50,
num_stages=4,
out_indices=(0,... | 1,931 | 27.411765 | 79 | py |
RSP | RSP-main/Object Detection/configs/reppoints/reppoints_moment_x101_fpn_dconv_c3-c5_gn-neck+head_2x_coco.py | _base_ = './reppoints_moment_r50_fpn_gn-neck+head_2x_coco.py'
model = dict(
pretrained='open-mmlab://resnext101_32x4d',
backbone=dict(
type='ResNeXt',
depth=101,
groups=32,
base_width=4,
num_stages=4,
out_indices=(0, 1, 2, 3),
frozen_stages=1,
norm... | 515 | 31.25 | 76 | py |
RSP | RSP-main/Object Detection/configs/gfl/gfl_x101_32x4d_fpn_dconv_c4-c5_mstrain_2x_coco.py | _base_ = './gfl_r50_fpn_mstrain_2x_coco.py'
model = dict(
type='GFL',
pretrained='open-mmlab://resnext101_32x4d',
backbone=dict(
type='ResNeXt',
depth=101,
groups=32,
base_width=4,
num_stages=4,
out_indices=(0, 1, 2, 3),
frozen_stages=1,
norm_c... | 538 | 28.944444 | 76 | py |
RSP | RSP-main/Object Detection/configs/gfl/gfl_x101_32x4d_fpn_mstrain_2x_coco.py | _base_ = './gfl_r50_fpn_mstrain_2x_coco.py'
model = dict(
type='GFL',
pretrained='open-mmlab://resnext101_32x4d',
backbone=dict(
type='ResNeXt',
depth=101,
groups=32,
base_width=4,
num_stages=4,
out_indices=(0, 1, 2, 3),
frozen_stages=1,
norm_c... | 410 | 24.6875 | 53 | py |
RSP | RSP-main/Object Detection/configs/gfl/gfl_r101_fpn_mstrain_2x_coco.py | _base_ = './gfl_r50_fpn_mstrain_2x_coco.py'
model = dict(
pretrained='torchvision://resnet101',
backbone=dict(
type='ResNet',
depth=101,
num_stages=4,
out_indices=(0, 1, 2, 3),
frozen_stages=1,
norm_cfg=dict(type='BN', requires_grad=True),
norm_eval=True,
... | 346 | 25.692308 | 53 | py |
RSP | RSP-main/Object Detection/configs/gfl/gfl_r50_fpn_1x_coco.py | _base_ = [
'../_base_/datasets/coco_detection.py',
'../_base_/schedules/schedule_1x.py', '../_base_/default_runtime.py'
]
model = dict(
type='GFL',
pretrained='torchvision://resnet50',
backbone=dict(
type='ResNet',
depth=50,
num_stages=4,
out_indices=(0, 1, 2, 3),
... | 1,649 | 27.448276 | 72 | py |
RSP | RSP-main/Object Detection/configs/gfl/gfl_r101_fpn_dconv_c3-c5_mstrain_2x_coco.py | _base_ = './gfl_r50_fpn_mstrain_2x_coco.py'
model = dict(
pretrained='torchvision://resnet101',
backbone=dict(
type='ResNet',
depth=101,
num_stages=4,
out_indices=(0, 1, 2, 3),
frozen_stages=1,
norm_cfg=dict(type='BN', requires_grad=True),
dcn=dict(type='D... | 473 | 30.6 | 76 | py |
RSP | RSP-main/Object Detection/configs/nas_fpn/retinanet_r50_fpn_crop640_50e_coco.py | _base_ = [
'../_base_/models/retinanet_r50_fpn.py',
'../_base_/datasets/coco_detection.py', '../_base_/default_runtime.py'
]
cudnn_benchmark = True
norm_cfg = dict(type='BN', requires_grad=True)
model = dict(
pretrained='torchvision://resnet50',
backbone=dict(
type='ResNet',
depth=50,
... | 2,407 | 28.728395 | 77 | py |
RSP | RSP-main/Object Detection/configs/nas_fpn/retinanet_r50_nasfpn_crop640_50e_coco.py | _base_ = [
'../_base_/models/retinanet_r50_fpn.py',
'../_base_/datasets/coco_detection.py', '../_base_/default_runtime.py'
]
cudnn_benchmark = True
# model settings
norm_cfg = dict(type='BN', requires_grad=True)
model = dict(
type='RetinaNet',
pretrained='torchvision://resnet50',
backbone=dict(
... | 2,397 | 28.975 | 77 | py |
RSP | RSP-main/Object Detection/configs/point_rend/point_rend_r50_caffe_fpn_mstrain_1x_coco.py | _base_ = '../mask_rcnn/mask_rcnn_r50_caffe_fpn_mstrain_1x_coco.py'
# model settings
model = dict(
type='PointRend',
roi_head=dict(
type='PointRendRoIHead',
mask_roi_extractor=dict(
type='GenericRoIExtractor',
aggregation='concat',
roi_layer=dict(_delete_=True,... | 1,371 | 31.666667 | 78 | py |
RSP | RSP-main/Object Detection/configs/point_rend/point_rend_r50_caffe_fpn_mstrain_3x_coco.py | _base_ = './point_rend_r50_caffe_fpn_mstrain_1x_coco.py'
# learning policy
lr_config = dict(step=[28, 34])
total_epochs = 36
| 125 | 24.2 | 56 | py |
RSP | RSP-main/Object Detection/configs/detectors/detectors_cascade_rcnn_r50_1x_coco.py | _base_ = [
'../_base_/models/cascade_rcnn_r50_fpn.py',
'../_base_/datasets/coco_detection.py',
'../_base_/schedules/schedule_1x.py', '../_base_/default_runtime.py'
]
model = dict(
backbone=dict(
type='DetectoRS_ResNet',
conv_cfg=dict(type='ConvAWS'),
sac=dict(type='SAC', use_def... | 1,053 | 30.939394 | 72 | py |
RSP | RSP-main/Object Detection/configs/detectors/detectors_htc_r50_1x_coco.py | _base_ = '../htc/htc_r50_fpn_1x_coco.py'
model = dict(
backbone=dict(
type='DetectoRS_ResNet',
conv_cfg=dict(type='ConvAWS'),
sac=dict(type='SAC', use_deform=True),
stage_with_sac=(False, True, True, True),
output_img=True),
neck=dict(
type='RFP',
rfp_ste... | 916 | 30.62069 | 57 | py |
RSP | RSP-main/Object Detection/configs/detectors/cascade_rcnn_r50_rfp_1x_coco.py | _base_ = [
'../_base_/models/cascade_rcnn_r50_fpn.py',
'../_base_/datasets/coco_detection.py',
'../_base_/schedules/schedule_1x.py', '../_base_/default_runtime.py'
]
model = dict(
backbone=dict(
type='DetectoRS_ResNet',
conv_cfg=dict(type='ConvAWS'),
output_img=True),
neck=d... | 851 | 28.37931 | 72 | py |
RSP | RSP-main/Object Detection/configs/detectors/htc_r50_rfp_1x_coco.py | _base_ = '../htc/htc_r50_fpn_1x_coco.py'
model = dict(
backbone=dict(
type='DetectoRS_ResNet',
conv_cfg=dict(type='ConvAWS'),
output_img=True),
neck=dict(
type='RFP',
rfp_steps=2,
aspp_out_channels=64,
aspp_dilations=(1, 3, 6, 1),
rfp_backbone=dic... | 714 | 27.6 | 57 | py |
RSP | RSP-main/Object Detection/configs/fcos/fcos_center-normbbox-centeronreg-giou_r50_caffe_fpn_gn-head_4x4_1x_coco.py | _base_ = 'fcos_r50_caffe_fpn_gn-head_4x4_1x_coco.py'
model = dict(
pretrained='open-mmlab://detectron2/resnet50_caffe',
bbox_head=dict(
norm_on_bbox=True,
centerness_on_reg=True,
dcn_on_last_conv=False,
center_sampling=True,
conv_bias=True,
loss_bbox=dict(type='G... | 1,688 | 31.480769 | 72 | py |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.