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 |
|---|---|---|---|---|---|---|
ttfnet | ttfnet-master/configs/empirical_attention/faster_rcnn_r50_fpn_attention_1111_dcn_1x.py | # model settings
model = dict(
type='FasterRCNN',
pretrained='torchvision://resnet50',
backbone=dict(
type='ResNet',
depth=50,
num_stages=4,
out_indices=(0, 1, 2, 3),
frozen_stages=1,
style='pytorch',
gen_attention=dict(
spatial_range=-1, n... | 5,680 | 30.214286 | 79 | py |
ttfnet | ttfnet-master/configs/empirical_attention/faster_rcnn_r50_fpn_attention_1111_1x.py | # model settings
model = dict(
type='FasterRCNN',
pretrained='torchvision://resnet50',
backbone=dict(
type='ResNet',
depth=50,
num_stages=4,
out_indices=(0, 1, 2, 3),
frozen_stages=1,
style='pytorch',
gen_attention=dict(
spatial_range=-1, n... | 5,531 | 29.905028 | 79 | py |
ttfnet | ttfnet-master/configs/empirical_attention/faster_rcnn_r50_fpn_attention_0010_1x.py | # model settings
model = dict(
type='FasterRCNN',
pretrained='torchvision://resnet50',
backbone=dict(
type='ResNet',
depth=50,
num_stages=4,
out_indices=(0, 1, 2, 3),
frozen_stages=1,
style='pytorch',
gen_attention=dict(
spatial_range=-1, n... | 5,531 | 29.905028 | 79 | py |
ttfnet | ttfnet-master/configs/empirical_attention/faster_rcnn_r50_fpn_attention_0010_dcn_1x.py | # model settings
model = dict(
type='FasterRCNN',
pretrained='torchvision://resnet50',
backbone=dict(
type='ResNet',
depth=50,
num_stages=4,
out_indices=(0, 1, 2, 3),
frozen_stages=1,
style='pytorch',
gen_attention=dict(
spatial_range=-1, n... | 5,680 | 30.214286 | 79 | py |
ttfnet | ttfnet-master/configs/foveabox/fovea_align_gn_r101_fpn_4gpu_2x.py | # model settings
model = dict(
type='FOVEA',
pretrained='torchvision://resnet101',
backbone=dict(
type='ResNet',
depth=101,
num_stages=4,
out_indices=(0, 1, 2, 3),
frozen_stages=1,
style='pytorch'),
neck=dict(
type='FPN',
in_channels=[256, ... | 3,633 | 29.283333 | 78 | py |
ttfnet | ttfnet-master/configs/foveabox/fovea_align_gn_r50_fpn_4gpu_2x.py | # model settings
model = dict(
type='FOVEA',
pretrained='torchvision://resnet50',
backbone=dict(
type='ResNet',
depth=50,
num_stages=4,
out_indices=(0, 1, 2, 3),
frozen_stages=1,
style='pytorch'),
neck=dict(
type='FPN',
in_channels=[256, 51... | 3,630 | 29.258333 | 78 | py |
ttfnet | ttfnet-master/configs/foveabox/fovea_align_gn_ms_r101_fpn_4gpu_2x.py | # model settings
model = dict(
type='FOVEA',
pretrained='torchvision://resnet101',
backbone=dict(
type='ResNet',
depth=101,
num_stages=4,
out_indices=(0, 1, 2, 3),
frozen_stages=1,
style='pytorch'),
neck=dict(
type='FPN',
in_channels=[256, ... | 3,728 | 28.832 | 78 | py |
ttfnet | ttfnet-master/configs/foveabox/fovea_align_gn_ms_r50_fpn_4gpu_2x.py | # model settings
model = dict(
type='FOVEA',
pretrained='torchvision://resnet50',
backbone=dict(
type='ResNet',
depth=50,
num_stages=4,
out_indices=(0, 1, 2, 3),
frozen_stages=1,
style='pytorch'),
neck=dict(
type='FPN',
in_channels=[256, 51... | 3,725 | 28.808 | 78 | py |
ttfnet | ttfnet-master/configs/foveabox/fovea_r50_fpn_4gpu_1x.py | # model settings
model = dict(
type='FOVEA',
pretrained='torchvision://resnet50',
backbone=dict(
type='ResNet',
depth=50,
num_stages=4,
out_indices=(0, 1, 2, 3),
frozen_stages=1,
style='pytorch'),
neck=dict(
type='FPN',
in_channels=[256, 51... | 3,571 | 28.766667 | 78 | py |
ttfnet | ttfnet-master/configs/double_heads/dh_faster_rcnn_r50_fpn_1x.py | # model settings
model = dict(
type='DoubleHeadRCNN',
pretrained='modelzoo://resnet50',
backbone=dict(
type='ResNet',
depth=50,
num_stages=4,
out_indices=(0, 1, 2, 3),
frozen_stages=1,
style='pytorch'),
neck=dict(
type='FPN',
in_channels=[2... | 5,419 | 29.449438 | 78 | py |
ttfnet | ttfnet-master/configs/wider_face/ssd300_wider_face.py | # model settings
input_size = 300
model = dict(
type='SingleStageDetector',
pretrained='open-mmlab://vgg16_caffe',
backbone=dict(
type='SSDVGG',
input_size=input_size,
depth=16,
with_last_pool=False,
ceil_mode=True,
out_indices=(3, 4),
out_feature_indi... | 3,903 | 27.705882 | 79 | py |
ttfnet | ttfnet-master/configs/albu_example/mask_rcnn_r50_fpn_1x.py | # model settings
model = dict(
type='MaskRCNN',
pretrained='torchvision://resnet50',
backbone=dict(
type='ResNet',
depth=50,
num_stages=4,
out_indices=(0, 1, 2, 3),
frozen_stages=1,
style='pytorch'),
neck=dict(
type='FPN',
in_channels=[256,... | 7,417 | 28.791165 | 78 | py |
ttfnet | ttfnet-master/configs/grid_rcnn/grid_rcnn_gn_head_r50_fpn_2x.py | # model settings
model = dict(
type='GridRCNN',
pretrained='torchvision://resnet50',
backbone=dict(
type='ResNet',
depth=50,
num_stages=4,
out_indices=(0, 1, 2, 3),
frozen_stages=1,
style='pytorch'),
neck=dict(
type='FPN',
in_channels=[256,... | 5,585 | 29.032258 | 78 | py |
ttfnet | ttfnet-master/configs/grid_rcnn/grid_rcnn_gn_head_x101_32x4d_fpn_2x.py | # model settings
model = dict(
type='GridRCNN',
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,
style='pytorch'),
neck=d... | 5,642 | 29.015957 | 78 | py |
ttfnet | ttfnet-master/configs/libra_rcnn/libra_faster_rcnn_r50_fpn_1x.py | # model settings
model = dict(
type='FasterRCNN',
pretrained='torchvision://resnet50',
backbone=dict(
type='ResNet',
depth=50,
num_stages=4,
out_indices=(0, 1, 2, 3),
frozen_stages=1,
style='pytorch'),
neck=[
dict(
type='FPN',
... | 5,819 | 29.15544 | 78 | py |
ttfnet | ttfnet-master/configs/libra_rcnn/libra_faster_rcnn_r101_fpn_1x.py | # model settings
model = dict(
type='FasterRCNN',
pretrained='torchvision://resnet101',
backbone=dict(
type='ResNet',
depth=101,
num_stages=4,
out_indices=(0, 1, 2, 3),
frozen_stages=1,
style='pytorch'),
neck=[
dict(
type='FPN',
... | 5,822 | 29.170984 | 78 | py |
ttfnet | ttfnet-master/configs/libra_rcnn/libra_fast_rcnn_r50_fpn_1x.py | # model settings
model = dict(
type='FastRCNN',
pretrained='torchvision://resnet50',
backbone=dict(
type='ResNet',
depth=50,
num_stages=4,
out_indices=(0, 1, 2, 3),
frozen_stages=1,
style='pytorch'),
neck=[
dict(
type='FPN',
... | 4,858 | 30.551948 | 79 | py |
ttfnet | ttfnet-master/configs/libra_rcnn/libra_faster_rcnn_x101_64x4d_fpn_1x.py | # model settings
model = dict(
type='FasterRCNN',
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,
style='pytorch'),
neck... | 5,876 | 29.138462 | 78 | py |
ttfnet | ttfnet-master/configs/libra_rcnn/libra_retinanet_r50_fpn_1x.py | # model settings
model = dict(
type='RetinaNet',
pretrained='torchvision://resnet50',
backbone=dict(
type='ResNet',
depth=50,
num_stages=4,
out_indices=(0, 1, 2, 3),
frozen_stages=1,
style='pytorch'),
neck=[
dict(
type='FPN',
... | 4,184 | 27.469388 | 77 | py |
ttfnet | ttfnet-master/configs/scratch/scratch_mask_rcnn_r50_fpn_gn_6x.py | # model settings
norm_cfg = dict(type='GN', num_groups=32, requires_grad=True)
model = dict(
type='MaskRCNN',
pretrained=None,
backbone=dict(
type='ResNet',
depth=50,
num_stages=4,
out_indices=(0, 1, 2, 3),
frozen_stages=-1,
style='pytorch',
zero_init_... | 6,039 | 28.90099 | 78 | py |
ttfnet | ttfnet-master/configs/scratch/scratch_faster_rcnn_r50_fpn_gn_6x.py | # model settings
norm_cfg = dict(type='GN', num_groups=32, requires_grad=True)
model = dict(
type='FasterRCNN',
pretrained=None,
backbone=dict(
type='ResNet',
depth=50,
num_stages=4,
out_indices=(0, 1, 2, 3),
frozen_stages=-1,
style='pytorch',
zero_ini... | 5,500 | 28.735135 | 78 | py |
ttfnet | ttfnet-master/configs/pascal_voc/ssd300_voc.py | # model settings
input_size = 300
model = dict(
type='SingleStageDetector',
pretrained='open-mmlab://vgg16_caffe',
backbone=dict(
type='SSDVGG',
input_size=input_size,
depth=16,
with_last_pool=False,
ceil_mode=True,
out_indices=(3, 4),
out_feature_indi... | 4,061 | 28.434783 | 79 | py |
ttfnet | ttfnet-master/configs/pascal_voc/faster_rcnn_r50_fpn_1x_voc0712.py | # model settings
model = dict(
type='FasterRCNN',
pretrained='torchvision://resnet50',
backbone=dict(
type='ResNet',
depth=50,
num_stages=4,
out_indices=(0, 1, 2, 3),
frozen_stages=1,
style='pytorch'),
neck=dict(
type='FPN',
in_channels=[25... | 5,516 | 30.346591 | 78 | py |
ttfnet | ttfnet-master/configs/pascal_voc/ssd512_voc.py | # model settings
input_size = 512
model = dict(
type='SingleStageDetector',
pretrained='open-mmlab://vgg16_caffe',
backbone=dict(
type='SSDVGG',
input_size=input_size,
depth=16,
with_last_pool=False,
ceil_mode=True,
out_indices=(3, 4),
out_feature_indi... | 4,080 | 28.572464 | 79 | py |
ttfnet | ttfnet-master/configs/gcnet/mask_rcnn_r50_fpn_sbn_1x.py | # model settings
norm_cfg = dict(type='SyncBN', requires_grad=True)
model = dict(
type='MaskRCNN',
pretrained='torchvision://resnet50',
backbone=dict(
type='ResNet',
depth=50,
num_stages=4,
out_indices=(0, 1, 2, 3),
frozen_stages=1,
style='pytorch',
n... | 5,852 | 29.326425 | 78 | py |
ttfnet | ttfnet-master/configs/gcnet/mask_rcnn_r16_gcb_c3-c5_r50_fpn_1x.py | # model settings
model = dict(
type='MaskRCNN',
pretrained='torchvision://resnet50',
backbone=dict(
type='ResNet',
depth=50,
num_stages=4,
out_indices=(0, 1, 2, 3),
frozen_stages=1,
style='pytorch',
gcb=dict(ratio=1. / 16., ),
stage_with_gcb=(F... | 5,844 | 29.602094 | 78 | py |
ttfnet | ttfnet-master/configs/gcnet/mask_rcnn_r4_gcb_c3-c5_r50_fpn_syncbn_1x.py | # model settings
norm_cfg = dict(type='SyncBN', requires_grad=True)
model = dict(
type='MaskRCNN',
pretrained='torchvision://resnet50',
backbone=dict(
type='ResNet',
depth=50,
num_stages=4,
out_indices=(0, 1, 2, 3),
frozen_stages=1,
style='pytorch',
g... | 5,953 | 29.533333 | 78 | py |
ttfnet | ttfnet-master/configs/gcnet/mask_rcnn_r4_gcb_c3-c5_r50_fpn_1x.py | # model settings
model = dict(
type='MaskRCNN',
pretrained='torchvision://resnet50',
backbone=dict(
type='ResNet',
depth=50,
num_stages=4,
out_indices=(0, 1, 2, 3),
frozen_stages=1,
style='pytorch',
gcb=dict(ratio=1. / 4., ),
stage_with_gcb=(Fa... | 5,842 | 29.591623 | 78 | py |
ttfnet | ttfnet-master/configs/gcnet/mask_rcnn_r16_gcb_c3-c5_r50_fpn_syncbn_1x.py | # model settings
norm_cfg = dict(type='SyncBN', requires_grad=True)
model = dict(
type='MaskRCNN',
pretrained='torchvision://resnet50',
backbone=dict(
type='ResNet',
depth=50,
num_stages=4,
out_indices=(0, 1, 2, 3),
frozen_stages=1,
style='pytorch',
g... | 5,955 | 29.54359 | 78 | py |
ttfnet | ttfnet-master/configs/gn+ws/mask_rcnn_x101_32x4d_fpn_gn_ws_2x.py | # model settings
conv_cfg = dict(type='ConvWS')
norm_cfg = dict(type='GN', num_groups=32, requires_grad=True)
model = dict(
type='MaskRCNN',
pretrained='open-mmlab://jhu/resnext101_32x4d_gn_ws',
backbone=dict(
type='ResNeXt',
depth=101,
groups=32,
base_width=4,
num_st... | 6,191 | 29.502463 | 78 | py |
ttfnet | ttfnet-master/configs/gn+ws/mask_rcnn_r50_fpn_gn_ws_2x.py | # model settings
conv_cfg = dict(type='ConvWS')
norm_cfg = dict(type='GN', num_groups=32, requires_grad=True)
model = dict(
type='MaskRCNN',
pretrained='open-mmlab://jhu/resnet50_gn_ws',
backbone=dict(
type='ResNet',
depth=50,
num_stages=4,
out_indices=(0, 1, 2, 3),
f... | 6,133 | 29.517413 | 78 | py |
ttfnet | ttfnet-master/configs/gn+ws/mask_rcnn_r50_fpn_gn_ws_20_23_24e.py | # model settings
conv_cfg = dict(type='ConvWS')
norm_cfg = dict(type='GN', num_groups=32, requires_grad=True)
model = dict(
type='MaskRCNN',
pretrained='open-mmlab://jhu/resnet50_gn_ws',
backbone=dict(
type='ResNet',
depth=50,
num_stages=4,
out_indices=(0, 1, 2, 3),
f... | 6,140 | 29.552239 | 78 | py |
ttfnet | ttfnet-master/configs/gn+ws/faster_rcnn_r50_fpn_gn_ws_1x.py | # model settings
conv_cfg = dict(type='ConvWS')
norm_cfg = dict(type='GN', num_groups=32, requires_grad=True)
model = dict(
type='FasterRCNN',
pretrained='open-mmlab://jhu/resnet50_gn_ws',
backbone=dict(
type='ResNet',
depth=50,
num_stages=4,
out_indices=(0, 1, 2, 3),
... | 5,544 | 29.467033 | 78 | py |
ttfnet | ttfnet-master/configs/guided_anchoring/ga_rpn_r50_caffe_fpn_1x.py | # model settings
model = dict(
type='RPN',
pretrained='open-mmlab://resnet50_caffe',
backbone=dict(
type='ResNet',
depth=50,
num_stages=4,
out_indices=(0, 1, 2, 3),
frozen_stages=1,
norm_cfg=dict(type='BN', requires_grad=False),
norm_eval=True,
... | 4,790 | 29.322785 | 75 | py |
ttfnet | ttfnet-master/configs/guided_anchoring/ga_fast_r50_caffe_fpn_1x.py | # model settings
model = dict(
type='FastRCNN',
pretrained='open-mmlab://resnet50_caffe',
backbone=dict(
type='ResNet',
depth=50,
num_stages=4,
out_indices=(0, 1, 2, 3),
frozen_stages=1,
norm_cfg=dict(type='BN', requires_grad=False),
norm_eval=True,
... | 4,440 | 31.416058 | 78 | py |
ttfnet | ttfnet-master/configs/guided_anchoring/ga_rpn_x101_32x4d_fpn_1x.py | # model settings
model = dict(
type='RPN',
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,
style='pytorch'),
neck=dict(
... | 4,761 | 29.139241 | 77 | py |
ttfnet | ttfnet-master/configs/guided_anchoring/ga_rpn_r101_caffe_rpn_1x.py | # model settings
model = dict(
type='RPN',
pretrained='open-mmlab://resnet101_caffe',
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=False),
norm_eval=True,
... | 4,793 | 29.341772 | 75 | py |
ttfnet | ttfnet-master/configs/guided_anchoring/ga_retinanet_r50_caffe_fpn_1x.py | # model settings
model = dict(
type='RetinaNet',
pretrained='open-mmlab://resnet50_caffe',
backbone=dict(
type='ResNet',
depth=50,
num_stages=4,
out_indices=(0, 1, 2, 3),
frozen_stages=1,
norm_cfg=dict(type='BN', requires_grad=False),
norm_eval=True,
... | 4,634 | 28.522293 | 75 | py |
ttfnet | ttfnet-master/configs/guided_anchoring/ga_retinanet_x101_32x4d_fpn_1x.py | # model settings
model = dict(
type='RetinaNet',
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,
style='pytorch'),
neck=... | 4,605 | 28.33758 | 77 | py |
ttfnet | ttfnet-master/configs/guided_anchoring/ga_faster_r50_caffe_fpn_1x.py | # model settings
model = dict(
type='FasterRCNN',
pretrained='open-mmlab://resnet50_caffe',
backbone=dict(
type='ResNet',
depth=50,
num_stages=4,
out_indices=(0, 1, 2, 3),
frozen_stages=1,
norm_cfg=dict(type='BN', requires_grad=False),
norm_eval=True,
... | 6,133 | 29.67 | 76 | py |
ttfnet | ttfnet-master/configs/guided_anchoring/ga_faster_x101_32x4d_fpn_1x.py | # model settings
model = dict(
type='FasterRCNN',
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,
style='pytorch'),
neck... | 6,104 | 29.525 | 77 | py |
ttfnet | ttfnet-master/configs/cityscapes/faster_rcnn_r50_fpn_1x_cityscapes.py | # model settings
model = dict(
type='FasterRCNN',
pretrained='modelzoo://resnet50',
backbone=dict(
type='ResNet',
depth=50,
num_stages=4,
out_indices=(0, 1, 2, 3),
frozen_stages=1,
style='pytorch'),
neck=dict(
type='FPN',
in_channels=[256, ... | 5,593 | 29.568306 | 79 | py |
ttfnet | ttfnet-master/configs/cityscapes/mask_rcnn_r50_fpn_1x_cityscapes.py | # model settings
model = dict(
type='MaskRCNN',
pretrained='modelzoo://resnet50',
backbone=dict(
type='ResNet',
depth=50,
num_stages=4,
out_indices=(0, 1, 2, 3),
frozen_stages=1,
style='pytorch'),
neck=dict(
type='FPN',
in_channels=[256, 51... | 6,008 | 29.502538 | 79 | py |
ttfnet | ttfnet-master/configs/gn/mask_rcnn_r101_fpn_gn_2x.py | # model settings
norm_cfg = dict(type='GN', num_groups=32, requires_grad=True)
model = dict(
type='MaskRCNN',
pretrained='open-mmlab://detectron/resnet101_gn',
backbone=dict(
type='ResNet',
depth=101,
num_stages=4,
out_indices=(0, 1, 2, 3),
frozen_stages=1,
s... | 5,996 | 29.441624 | 78 | py |
ttfnet | ttfnet-master/configs/gn/mask_rcnn_r50_fpn_gn_2x.py | # model settings
norm_cfg = dict(type='GN', num_groups=32, requires_grad=True)
model = dict(
type='MaskRCNN',
pretrained='open-mmlab://detectron/resnet50_gn',
backbone=dict(
type='ResNet',
depth=50,
num_stages=4,
out_indices=(0, 1, 2, 3),
frozen_stages=1,
sty... | 5,993 | 29.426396 | 78 | py |
ttfnet | ttfnet-master/configs/gn/mask_rcnn_r50_fpn_gn_contrib_2x.py | # model settings
norm_cfg = dict(type='GN', num_groups=32, requires_grad=True)
model = dict(
type='MaskRCNN',
pretrained='open-mmlab://contrib/resnet50_gn',
backbone=dict(
type='ResNet',
depth=50,
num_stages=4,
out_indices=(0, 1, 2, 3),
frozen_stages=1,
style... | 6,001 | 29.467005 | 78 | py |
ttfnet | ttfnet-master/mmdet/apis/inference.py | import warnings
import matplotlib.pyplot as plt
import mmcv
import numpy as np
import pycocotools.mask as maskUtils
import torch
from mmcv.parallel import collate, scatter
from mmcv.runner import load_checkpoint
from mmdet.core import get_classes
from mmdet.datasets.pipelines import Compose
from mmdet.models import b... | 5,973 | 33.732558 | 79 | py |
ttfnet | ttfnet-master/mmdet/apis/train.py | from __future__ import division
import re
from collections import OrderedDict
import torch
from mmcv.parallel import MMDataParallel, MMDistributedDataParallel
from mmcv.runner import DistSamplerSeedHook, Runner, obj_from_dict
from mmdet import datasets
from mmdet.core import (CocoDistEvalmAPHook, CocoDistEvalRecallHo... | 9,069 | 37.927039 | 78 | py |
ttfnet | ttfnet-master/mmdet/apis/env.py | import logging
import os
import random
import subprocess
import numpy as np
import torch
import torch.distributed as dist
import torch.multiprocessing as mp
from mmcv.runner import get_dist_info
def init_dist(launcher, backend='nccl', **kwargs):
if mp.get_start_method(allow_none=True) is None:
mp.set_sta... | 2,041 | 28.171429 | 70 | py |
ttfnet | ttfnet-master/mmdet/core/evaluation/eval_hooks.py | import os
import os.path as osp
import mmcv
import numpy as np
import torch
import torch.distributed as dist
from mmcv.parallel import collate, scatter
from mmcv.runner import Hook
from pycocotools.cocoeval import COCOeval
from torch.utils.data import Dataset
from mmdet import datasets
from .coco_utils import fast_ev... | 6,301 | 35.853801 | 79 | py |
ttfnet | ttfnet-master/mmdet/core/post_processing/merge_augs.py | import numpy as np
import torch
from mmdet.ops import nms
from ..bbox import bbox_mapping_back
def merge_aug_proposals(aug_proposals, img_metas, rpn_test_cfg):
"""Merge augmented proposals (multiscale, flip, etc.)
Args:
aug_proposals (list[Tensor]): proposals from different testing
schem... | 3,573 | 34.039216 | 78 | py |
ttfnet | ttfnet-master/mmdet/core/post_processing/bbox_nms.py | import torch
from mmdet.ops.nms import nms_wrapper
def multiclass_nms(multi_bboxes,
multi_scores,
score_thr,
nms_cfg,
max_num=-1,
score_factors=None):
"""NMS for multi-class bboxes.
Args:
multi_bboxes (Ten... | 2,451 | 35.597015 | 78 | py |
ttfnet | ttfnet-master/mmdet/core/mask/mask_target.py | import mmcv
import numpy as np
import torch
from torch.nn.modules.utils import _pair
def mask_target(pos_proposals_list, pos_assigned_gt_inds_list, gt_masks_list,
cfg):
cfg_list = [cfg for _ in range(len(pos_proposals_list))]
mask_targets = map(mask_target_single, pos_proposals_list,
... | 1,501 | 37.512821 | 77 | py |
ttfnet | ttfnet-master/mmdet/core/fp16/hooks.py | import copy
import torch
import torch.nn as nn
from mmcv.runner import OptimizerHook
from ..utils.dist_utils import allreduce_grads
from .utils import cast_tensor_type
class Fp16OptimizerHook(OptimizerHook):
"""FP16 optimizer hook.
The steps of fp16 optimizer is as follows.
1. Scale the loss value.
... | 4,482 | 34.023438 | 79 | py |
ttfnet | ttfnet-master/mmdet/core/fp16/utils.py | from collections import abc
import numpy as np
import torch
def cast_tensor_type(inputs, src_type, dst_type):
if isinstance(inputs, torch.Tensor):
return inputs.to(dst_type)
elif isinstance(inputs, str):
return inputs
elif isinstance(inputs, np.ndarray):
return inputs
elif isi... | 664 | 26.708333 | 74 | py |
ttfnet | ttfnet-master/mmdet/core/fp16/decorators.py | import functools
from inspect import getfullargspec
import torch
from .utils import cast_tensor_type
def auto_fp16(apply_to=None, out_fp32=False):
"""Decorator to enable fp16 training automatically.
This decorator is useful when you write custom modules and want to support
mixed precision training. If ... | 6,211 | 37.583851 | 79 | py |
ttfnet | ttfnet-master/mmdet/core/bbox/bbox_target.py | import torch
from ..utils import multi_apply
from .transforms import bbox2delta
def bbox_target(pos_bboxes_list,
neg_bboxes_list,
pos_gt_bboxes_list,
pos_gt_labels_list,
cfg,
reg_classes=1,
target_means=[.0, .0, .0, .0],
... | 2,717 | 35.72973 | 78 | py |
ttfnet | ttfnet-master/mmdet/core/bbox/geometry.py | import torch
def bbox_overlaps(bboxes1, bboxes2, mode='iou', is_aligned=False):
"""Calculate overlap between two set of bboxes.
If ``is_aligned`` is ``False``, then calculate the ious between each bbox
of bboxes1 and bboxes2, otherwise the ious between each aligned pair of
bboxes1 and bboxes2.
A... | 2,413 | 32.527778 | 87 | py |
ttfnet | ttfnet-master/mmdet/core/bbox/transforms.py | import mmcv
import numpy as np
import torch
def bbox2delta(proposals, gt, means=[0, 0, 0, 0], stds=[1, 1, 1, 1]):
assert proposals.size() == gt.size()
proposals = proposals.float()
gt = gt.float()
px = (proposals[..., 0] + proposals[..., 2]) * 0.5
py = (proposals[..., 1] + proposals[..., 3]) * 0.... | 7,768 | 33.683036 | 79 | py |
ttfnet | ttfnet-master/mmdet/core/bbox/assigners/assign_result.py | import torch
class AssignResult(object):
def __init__(self, num_gts, gt_inds, max_overlaps, labels=None):
self.num_gts = num_gts
self.gt_inds = gt_inds
self.max_overlaps = max_overlaps
self.labels = labels
def add_gt_(self, gt_labels):
self_inds = torch.arange(
... | 664 | 32.25 | 77 | py |
ttfnet | ttfnet-master/mmdet/core/bbox/assigners/point_assigner.py | import torch
from .assign_result import AssignResult
from .base_assigner import BaseAssigner
class PointAssigner(BaseAssigner):
"""Assign a corresponding gt bbox or background to each point.
Each proposals will be assigned with `0`, or a positive integer
indicating the ground truth index.
- 0: nega... | 5,183 | 43.307692 | 79 | py |
ttfnet | ttfnet-master/mmdet/core/bbox/assigners/approx_max_iou_assigner.py | import torch
from ..geometry import bbox_overlaps
from .max_iou_assigner import MaxIoUAssigner
class ApproxMaxIoUAssigner(MaxIoUAssigner):
"""Assign a corresponding gt bbox or background to each bbox.
Each proposals will be assigned with `-1`, `0`, or a positive integer
indicating the ground truth index... | 4,800 | 40.747826 | 79 | py |
ttfnet | ttfnet-master/mmdet/core/bbox/assigners/max_iou_assigner.py | import torch
from ..geometry import bbox_overlaps
from .assign_result import AssignResult
from .base_assigner import BaseAssigner
class MaxIoUAssigner(BaseAssigner):
"""Assign a corresponding gt bbox or background to each bbox.
Each proposals will be assigned with `-1`, `0`, or a positive integer
indica... | 6,539 | 41.467532 | 79 | py |
ttfnet | ttfnet-master/mmdet/core/bbox/samplers/instance_balanced_pos_sampler.py | import numpy as np
import torch
from .random_sampler import RandomSampler
class InstanceBalancedPosSampler(RandomSampler):
def _sample_pos(self, assign_result, num_expected, **kwargs):
pos_inds = torch.nonzero(assign_result.gt_inds > 0)
if pos_inds.numel() != 0:
pos_inds = pos_inds.s... | 1,765 | 41.047619 | 77 | py |
ttfnet | ttfnet-master/mmdet/core/bbox/samplers/base_sampler.py | from abc import ABCMeta, abstractmethod
import torch
from .sampling_result import SamplingResult
class BaseSampler(metaclass=ABCMeta):
def __init__(self,
num,
pos_fraction,
neg_pos_ub=-1,
add_gt_as_proposals=True,
**kwargs):
... | 2,753 | 33.860759 | 78 | py |
ttfnet | ttfnet-master/mmdet/core/bbox/samplers/random_sampler.py | import numpy as np
import torch
from .base_sampler import BaseSampler
class RandomSampler(BaseSampler):
def __init__(self,
num,
pos_fraction,
neg_pos_ub=-1,
add_gt_as_proposals=True,
**kwargs):
super(RandomSampler, self... | 1,858 | 33.425926 | 77 | py |
ttfnet | ttfnet-master/mmdet/core/bbox/samplers/ohem_sampler.py | import torch
from ..transforms import bbox2roi
from .base_sampler import BaseSampler
class OHEMSampler(BaseSampler):
"""
Online Hard Example Mining Sampler described in [1]_.
References:
.. [1] https://arxiv.org/pdf/1604.03540.pdf
"""
def __init__(self,
num,
... | 2,912 | 35.4125 | 77 | py |
ttfnet | ttfnet-master/mmdet/core/bbox/samplers/iou_balanced_neg_sampler.py | import numpy as np
import torch
from .random_sampler import RandomSampler
class IoUBalancedNegSampler(RandomSampler):
"""IoU Balanced Sampling
arXiv: https://arxiv.org/pdf/1904.02701.pdf (CVPR 2019)
Sampling proposals according to their IoU. `floor_fraction` of needed RoIs
are sampled from proposal... | 5,869 | 42.80597 | 79 | py |
ttfnet | ttfnet-master/mmdet/core/bbox/samplers/sampling_result.py | import torch
class SamplingResult(object):
def __init__(self, pos_inds, neg_inds, bboxes, gt_bboxes, assign_result,
gt_flags):
self.pos_inds = pos_inds
self.neg_inds = neg_inds
self.pos_bboxes = bboxes[pos_inds]
self.neg_bboxes = bboxes[neg_inds]
self.pos_... | 790 | 30.64 | 76 | py |
ttfnet | ttfnet-master/mmdet/core/bbox/samplers/pseudo_sampler.py | import torch
from .base_sampler import BaseSampler
from .sampling_result import SamplingResult
class PseudoSampler(BaseSampler):
def __init__(self, **kwargs):
pass
def _sample_pos(self, **kwargs):
raise NotImplementedError
def _sample_neg(self, **kwargs):
raise NotImplementedEr... | 829 | 29.740741 | 79 | py |
ttfnet | ttfnet-master/mmdet/core/utils/dist_utils.py | from collections import OrderedDict
import torch.distributed as dist
from mmcv.runner import OptimizerHook
from torch._utils import (_flatten_dense_tensors, _take_tensors,
_unflatten_dense_tensors)
def _allreduce_coalesced(tensors, world_size, bucket_size_mb=-1):
if bucket_size_mb > 0:
... | 1,967 | 32.355932 | 73 | py |
ttfnet | ttfnet-master/mmdet/core/anchor/anchor_target.py | import torch
from ..bbox import PseudoSampler, assign_and_sample, bbox2delta, build_assigner
from ..utils import multi_apply
def anchor_target(anchor_list,
valid_flag_list,
gt_bboxes_list,
img_metas,
target_means,
target_stds,
... | 7,270 | 37.882353 | 79 | py |
ttfnet | ttfnet-master/mmdet/core/anchor/guided_anchor_target.py | import torch
from ..bbox import PseudoSampler, build_assigner, build_sampler
from ..utils import multi_apply, unmap
def calc_region(bbox, ratio, featmap_size=None):
"""Calculate a proportional bbox region.
The bbox center are fixed and the new h' and w' is h * ratio and w * ratio.
Args:
bbox (T... | 11,809 | 40.006944 | 79 | py |
ttfnet | ttfnet-master/mmdet/core/anchor/point_generator.py | import torch
class PointGenerator(object):
def _meshgrid(self, x, y, row_major=True):
xx = x.repeat(len(y))
yy = y.view(-1, 1).repeat(1, len(x)).view(-1)
if row_major:
return xx, yy
else:
return yy, xx
def grid_points(self, featmap_size, stride=16, dev... | 1,287 | 35.8 | 71 | py |
ttfnet | ttfnet-master/mmdet/core/anchor/anchor_generator.py | import torch
class AnchorGenerator(object):
"""
Examples:
>>> from mmdet.core import AnchorGenerator
>>> self = AnchorGenerator(9, [1.], [1.])
>>> all_anchors = self.grid_anchors((2, 2), device='cpu')
>>> print(all_anchors)
tensor([[ 0., 0., 8., 8.],
... | 3,545 | 35.183673 | 78 | py |
ttfnet | ttfnet-master/mmdet/core/anchor/point_target.py | import torch
from ..bbox import PseudoSampler, assign_and_sample, build_assigner
from ..utils import multi_apply
def point_target(proposals_list,
valid_flag_list,
gt_bboxes_list,
img_metas,
cfg,
gt_bboxes_ignore_list=None,
... | 6,441 | 37.807229 | 79 | py |
ttfnet | ttfnet-master/mmdet/models/builder.py | from torch import nn
from mmdet.utils import build_from_cfg
from .registry import (BACKBONES, DETECTORS, HEADS, LOSSES, NECKS,
ROI_EXTRACTORS, SHARED_HEADS)
def build(cfg, registry, default_args=None):
if isinstance(cfg, list):
modules = [
build_from_cfg(cfg_, registry,... | 959 | 20.818182 | 78 | py |
ttfnet | ttfnet-master/mmdet/models/detectors/two_stage.py | import torch
import torch.nn as nn
from mmdet.core import bbox2result, bbox2roi, build_assigner, build_sampler
from .. import builder
from ..registry import DETECTORS
from .base import BaseDetector
from .test_mixins import BBoxTestMixin, MaskTestMixin, RPNTestMixin
@DETECTORS.register_module
class TwoStageDetector(B... | 12,245 | 38.25 | 79 | py |
ttfnet | ttfnet-master/mmdet/models/detectors/base.py | import logging
from abc import ABCMeta, abstractmethod
import mmcv
import numpy as np
import pycocotools.mask as maskUtils
import torch.nn as nn
from mmdet.core import auto_fp16, get_classes, tensor2imgs
class BaseDetector(nn.Module):
"""Base class for detectors"""
__metaclass__ = ABCMeta
def __init__... | 6,006 | 34.544379 | 78 | py |
ttfnet | ttfnet-master/mmdet/models/detectors/single_stage.py | import torch.nn as nn
from mmdet.core import bbox2result
from .. import builder
from ..registry import DETECTORS
from .base import BaseDetector
@DETECTORS.register_module
class SingleStageDetector(BaseDetector):
"""Base class for single-stage detectors.
Single-stage detectors directly and densely predict bo... | 2,822 | 31.448276 | 78 | py |
ttfnet | ttfnet-master/mmdet/models/detectors/reppoints_detector.py | import torch
from mmdet.core import bbox2result, bbox_mapping_back, multiclass_nms
from ..registry import DETECTORS
from .single_stage import SingleStageDetector
@DETECTORS.register_module
class RepPointsDetector(SingleStageDetector):
"""RepPoints: Point Set Representation for Object Detection.
This det... | 3,089 | 36.682927 | 79 | py |
ttfnet | ttfnet-master/mmdet/models/detectors/cascade_rcnn.py | from __future__ import division
import torch
import torch.nn as nn
from mmdet.core import (bbox2result, bbox2roi, bbox_mapping, build_assigner,
build_sampler, merge_aug_bboxes, merge_aug_masks,
multiclass_nms)
from .. import builder
from ..registry import DETECTORS
from... | 23,674 | 41.276786 | 79 | py |
ttfnet | ttfnet-master/mmdet/models/detectors/grid_rcnn.py | import torch
from mmdet.core import bbox2result, bbox2roi, build_assigner, build_sampler
from .. import builder
from ..registry import DETECTORS
from .two_stage import TwoStageDetector
@DETECTORS.register_module
class GridRCNN(TwoStageDetector):
"""Grid R-CNN.
This detector is the implementation of:
- G... | 9,225 | 39.113043 | 79 | py |
ttfnet | ttfnet-master/mmdet/models/detectors/double_head_rcnn.py | import torch
from mmdet.core import bbox2roi, build_assigner, build_sampler
from ..registry import DETECTORS
from .two_stage import TwoStageDetector
@DETECTORS.register_module
class DoubleHeadRCNN(TwoStageDetector):
def __init__(self, reg_roi_scale_factor, **kwargs):
super().__init__(**kwargs)
s... | 7,453 | 40.642458 | 77 | py |
ttfnet | ttfnet-master/mmdet/models/detectors/htc.py | import torch
import torch.nn.functional as F
from mmdet.core import (bbox2result, bbox2roi, bbox_mapping, build_assigner,
build_sampler, merge_aug_bboxes, merge_aug_masks,
multiclass_nms)
from .. import builder
from ..registry import DETECTORS
from .cascade_rcnn import C... | 24,580 | 43.210432 | 79 | py |
ttfnet | ttfnet-master/mmdet/models/detectors/mask_scoring_rcnn.py | import torch
from mmdet.core import bbox2roi, build_assigner, build_sampler
from .. import builder
from ..registry import DETECTORS
from .two_stage import TwoStageDetector
@DETECTORS.register_module
class MaskScoringRCNN(TwoStageDetector):
"""Mask Scoring RCNN.
https://arxiv.org/abs/1903.00241
"""
... | 8,565 | 41.616915 | 79 | py |
ttfnet | ttfnet-master/mmdet/models/plugins/non_local.py | import torch
import torch.nn as nn
from mmcv.cnn import constant_init, normal_init
from ..utils import ConvModule
class NonLocal2D(nn.Module):
"""Non-local module.
See https://arxiv.org/abs/1711.07971 for details.
Args:
in_channels (int): Channels of the input feature map.
reduction (in... | 3,708 | 31.252174 | 79 | py |
ttfnet | ttfnet-master/mmdet/models/plugins/generalized_attention.py | import math
import numpy as np
import torch
import torch.nn as nn
import torch.nn.functional as F
from mmcv.cnn import kaiming_init
class GeneralizedAttention(nn.Module):
"""GeneralizedAttention module.
See 'An Empirical Study of Spatial Attention Mechanisms in Deep Networks'
(https://arxiv.org/abs/1711... | 15,139 | 38.324675 | 79 | py |
ttfnet | ttfnet-master/mmdet/models/necks/fpn.py | import torch.nn as nn
import torch.nn.functional as F
from mmcv.cnn import xavier_init
from mmdet.core import auto_fp16
from ..registry import NECKS
from ..utils import ConvModule
@NECKS.register_module
class FPN(nn.Module):
def __init__(self,
in_channels,
out_channels,
... | 5,289 | 36.253521 | 79 | py |
ttfnet | ttfnet-master/mmdet/models/necks/bfp.py | import torch.nn as nn
import torch.nn.functional as F
from mmcv.cnn import xavier_init
from ..plugins import NonLocal2D
from ..registry import NECKS
from ..utils import ConvModule
@NECKS.register_module
class BFP(nn.Module):
"""BFP (Balanced Feature Pyrmamids)
BFP takes multi-level features as inputs and ga... | 3,598 | 33.941748 | 79 | py |
ttfnet | ttfnet-master/mmdet/models/necks/hrfpn.py | import torch
import torch.nn as nn
import torch.nn.functional as F
from mmcv.cnn.weight_init import caffe2_xavier_init
from torch.utils.checkpoint import checkpoint
from ..registry import NECKS
from ..utils import ConvModule
@NECKS.register_module
class HRFPN(nn.Module):
"""HRFPN (High Resolution Feature Pyrmami... | 3,363 | 32.306931 | 79 | py |
ttfnet | ttfnet-master/mmdet/models/roi_extractors/single_level.py | from __future__ import division
import torch
import torch.nn as nn
from mmdet import ops
from mmdet.core import force_fp32
from ..registry import ROI_EXTRACTORS
@ROI_EXTRACTORS.register_module
class SingleRoIExtractor(nn.Module):
"""Extract RoI features from a single level feature map.
If there are mulitpl... | 3,794 | 34.138889 | 79 | py |
ttfnet | ttfnet-master/mmdet/models/anchor_heads/reppoints_head.py | from __future__ import division
import numpy as np
import torch
import torch.nn as nn
from mmcv.cnn import normal_init
from mmdet.core import (PointGenerator, multi_apply, multiclass_nms,
point_target)
from mmdet.ops import DeformConv
from ..builder import build_loss
from ..registry import HEA... | 27,172 | 44.515913 | 79 | py |
ttfnet | ttfnet-master/mmdet/models/anchor_heads/rpn_head.py | import torch
import torch.nn as nn
import torch.nn.functional as F
from mmcv.cnn import normal_init
from mmdet.core import delta2bbox
from mmdet.ops import nms
from ..registry import HEADS
from .anchor_head import AnchorHead
@HEADS.register_module
class RPNHead(AnchorHead):
def __init__(self, in_channels, **kwa... | 4,050 | 37.580952 | 79 | py |
ttfnet | ttfnet-master/mmdet/models/anchor_heads/anchor_head.py | from __future__ import division
import numpy as np
import torch
import torch.nn as nn
from mmcv.cnn import normal_init
from mmdet.core import (AnchorGenerator, anchor_target, delta2bbox, force_fp32,
multi_apply, multiclass_nms)
from ..builder import build_loss
from ..registry import HEADS
@H... | 13,818 | 41.259939 | 79 | py |
ttfnet | ttfnet-master/mmdet/models/anchor_heads/retina_head.py | import numpy as np
import torch.nn as nn
from mmcv.cnn import normal_init
from ..registry import HEADS
from ..utils import ConvModule, bias_init_with_prob
from .anchor_head import AnchorHead
@HEADS.register_module
class RetinaHead(AnchorHead):
"""
An anchor-based head used in [1]_.
The head contains two... | 3,602 | 33.644231 | 76 | py |
ttfnet | ttfnet-master/mmdet/models/anchor_heads/ga_rpn_head.py | import torch
import torch.nn as nn
import torch.nn.functional as F
from mmcv.cnn import normal_init
from mmdet.core import delta2bbox
from mmdet.ops import nms
from ..registry import HEADS
from .guided_anchor_head import GuidedAnchorHead
@HEADS.register_module
class GARPNHead(GuidedAnchorHead):
"""Guided-Anchor-... | 4,981 | 37.921875 | 78 | py |
ttfnet | ttfnet-master/mmdet/models/anchor_heads/ga_retina_head.py | import torch.nn as nn
from mmcv.cnn import normal_init
from mmdet.ops import MaskedConv2d
from ..registry import HEADS
from ..utils import ConvModule, bias_init_with_prob
from .guided_anchor_head import FeatureAdaption, GuidedAnchorHead
@HEADS.register_module
class GARetinaHead(GuidedAnchorHead):
"""Guided-Ancho... | 3,760 | 33.824074 | 78 | py |
ttfnet | ttfnet-master/mmdet/models/anchor_heads/ttf_head.py | import torch
import torch.nn as nn
import torch.nn.functional as F
from mmcv.cnn import normal_init, kaiming_init
import numpy as np
from mmdet.ops import ModulatedDeformConvPack
from mmdet.core import multi_apply, bbox_areas, force_fp32
from mmdet.core.anchor.guided_anchor_target import calc_region
from mmdet.models.... | 19,823 | 39.292683 | 99 | py |
ttfnet | ttfnet-master/mmdet/models/anchor_heads/ssd_head.py | import numpy as np
import torch
import torch.nn as nn
import torch.nn.functional as F
from mmcv.cnn import xavier_init
from mmdet.core import AnchorGenerator, anchor_target, multi_apply
from ..losses import smooth_l1_loss
from ..registry import HEADS
from .anchor_head import AnchorHead
# TODO: add loss evaluator for... | 7,762 | 38.607143 | 79 | py |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.