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 |
|---|---|---|---|---|---|---|
Instaboost | Instaboost-master/yolact/eval.py | from data import COCODetection, get_label_map, MEANS, COLORS
from yolact import Yolact
from utils.augmentations import BaseTransform, FastBaseTransform, Resize
from utils.functions import MovingAverage, ProgressBar
from layers.box_utils import jaccard, center_size
from utils import timer
from utils.functions import Sav... | 42,349 | 40.397849 | 159 | py |
Instaboost | Instaboost-master/yolact/train.py | from data import *
from utils.augmentations import SSDAugmentation, BaseTransform
from utils.functions import MovingAverage, SavePath
from utils import timer
from layers.modules import MultiBoxLoss
from yolact import Yolact
import os
import sys
import time
import math
from pathlib import Path
import torch
from torch.au... | 15,713 | 40.028721 | 152 | py |
Instaboost | Instaboost-master/yolact/scripts/convert_darknet.py | from backbone import DarkNetBackbone
import h5py
import torch
f = h5py.File('darknet53.h5', 'r')
m = f['model_weights']
yolo_keys = list(m.keys())
yolo_keys = [x for x in yolo_keys if len(m[x].keys()) > 0]
yolo_keys.sort()
sd = DarkNetBackbone().state_dict()
sd_keys = list(sd.keys())
sd_keys.sort()
# Note this won... | 1,466 | 28.938776 | 93 | py |
Instaboost | Instaboost-master/yolact/scripts/unpack_statedict.py | import torch
import sys, os
# Usage python scripts/unpack_statedict.py path_to_pth out_folder/
# Make sure to include that slash after your out folder, since I can't
# be arsed to do path concatenation so I'd rather type out this comment
print('Loading state dict...')
state = torch.load(sys.argv[1])
if not os.path.e... | 456 | 25.882353 | 71 | py |
Instaboost | Instaboost-master/yolact/scripts/optimize_bboxes.py | """
Instead of clustering bbox widths and heights, this script
directly optimizes average IoU across the training set given
the specified number of anchor boxes.
Run this script from the Yolact root directory.
"""
import pickle
import random
from itertools import product
from math import sqrt
import numpy as np
impo... | 6,743 | 31.897561 | 215 | py |
Instaboost | Instaboost-master/yolact/scripts/compute_masks.py | import numpy as np
import matplotlib.pyplot as plt
import cv2
import torch
import torch.nn.functional as F
COLORS = ((255, 0, 0, 128), (0, 255, 0, 128), (0, 0, 255, 128),
(0, 255, 255, 128), (255, 0, 255, 128), (255, 255, 0, 128))
def mask_iou(mask1, mask2):
"""
Inputs inputs are matricies of size _... | 2,618 | 26.861702 | 97 | py |
Instaboost | Instaboost-master/yolact/scripts/augment_bbox.py |
import os.path as osp
import json, pickle
import sys
from math import sqrt
from itertools import product
import torch
from numpy import random
import numpy as np
max_image_size = 550
augment_idx = 0
dump_file = 'weights/bboxes_aug.pkl'
box_file = 'weights/bboxes.pkl'
def augment_boxes(bboxes):
bboxes_rel = []
fo... | 3,978 | 22.133721 | 77 | py |
Instaboost | Instaboost-master/yolact/scripts/bbox_recall.py | """
This script compiles all the bounding boxes in the training data and
clusters them for each convout resolution on which they're used.
Run this script from the Yolact root directory.
"""
import os.path as osp
import json, pickle
import sys
from math import sqrt
from itertools import product
import torch
import ran... | 5,960 | 31.752747 | 117 | py |
Instaboost | Instaboost-master/yolact/layers/output_utils.py | """ Contains functions used to sanitize and prepare the output of Yolact. """
import torch
import torch.nn as nn
import torch.nn.functional as F
import numpy as np
import cv2
from data import cfg, mask_type, MEANS, STD, activation_func
from utils.augmentations import Resize
from utils import timer
from .box_utils im... | 7,626 | 35.492823 | 171 | py |
Instaboost | Instaboost-master/yolact/layers/box_utils.py | # -*- coding: utf-8 -*-
import torch
from utils import timer
from data import cfg
@torch.jit.script
def point_form(boxes):
""" Convert prior_boxes to (xmin, ymin, xmax, ymax)
representation for comparison to point form ground truth data.
Args:
boxes: (tensor) center-size default boxes from priorbo... | 13,255 | 37.201729 | 125 | py |
Instaboost | Instaboost-master/yolact/layers/interpolate.py | import torch.nn as nn
import torch.nn.functional as F
class InterpolateModule(nn.Module):
"""
This is a module version of F.interpolate (rip nn.Upsampling).
Any arguments you give it just get passed along for the ride.
"""
def __init__(self, *args, **kwdargs):
super().__init__()
self.args = args
self.kwda... | 412 | 21.944444 | 63 | py |
Instaboost | Instaboost-master/yolact/layers/functions/detection.py | import torch
import torch.nn.functional as F
from ..box_utils import decode, jaccard, index2d
from utils import timer
from data import cfg, mask_type
import numpy as np
import pyximport
pyximport.install(setup_args={"include_dirs":np.get_include()}, reload_support=True)
from utils.cython_nms import nms as cnms
cl... | 8,523 | 37.224215 | 121 | py |
Instaboost | Instaboost-master/yolact/layers/modules/multibox_loss.py | # -*- coding: utf-8 -*-
import torch
import torch.nn as nn
import torch.nn.functional as F
from torch.autograd import Variable
from ..box_utils import match, log_sum_exp, decode, center_size, crop
from data import cfg, mask_type, activation_func
class MultiBoxLoss(nn.Module):
"""SSD Weighted Loss Function
Com... | 25,358 | 44.609712 | 144 | py |
Instaboost | Instaboost-master/yolact/utils/augmentations.py | import torch
from torchvision import transforms
import cv2
import numpy as np
import types
from numpy import random
from data import cfg, MEANS, STD
def intersect(box_a, box_b):
max_xy = np.minimum(box_a[:, 2:], box_b[2:])
min_xy = np.maximum(box_a[:, :2], box_b[:2])
inter = np.clip((max_xy - min_xy), a_... | 22,709 | 33.305136 | 100 | py |
Instaboost | Instaboost-master/yolact/utils/functions.py |
import torch
import os
import math
from collections import deque
from pathlib import Path
class MovingAverage():
""" Keeps an average window of the specified number of items. """
def __init__(self, max_window_size=1000):
self.max_window_size = max_window_size
self.reset()
def add(self, e... | 4,209 | 25.64557 | 96 | py |
Instaboost | Instaboost-master/yolact/data/config.py | from backbone import ResNetBackbone, VGGBackbone, ResNetBackboneGN, DarkNetBackbone
from math import sqrt
import torch
# for making bounding boxes pretty
COLORS = ((244, 67, 54),
(233, 30, 99),
(156, 39, 176),
(103, 58, 183),
( 63, 81, 181),
( 33, 150, 243),
... | 26,421 | 37.072046 | 134 | py |
Instaboost | Instaboost-master/yolact/data/__init__.py | from .config import *
from .coco import COCODetection, COCOAnnotationTransform, get_label_map
import torch
import cv2
import numpy as np
def detection_collate(batch):
"""Custom collate fn for dealing with batches of images that have a different
number of associated object annotations (bounding boxes).
Ar... | 1,033 | 30.333333 | 96 | py |
Instaboost | Instaboost-master/yolact/data/coco.py | import os
import os.path as osp
import sys
import torch
import torch.utils.data as data
import torchvision.transforms as transforms
import cv2
import numpy as np
from .config import cfg
from pycocotools import mask as maskUtils
from instaboost import get_new_data, InstaBoostConfig
def get_label_map():
if cfg.datas... | 8,724 | 39.022936 | 122 | py |
Instaboost | Instaboost-master/mmdetection/tools/test.py | import argparse
import torch
import mmcv
from mmcv.runner import load_checkpoint, parallel_test, obj_from_dict
from mmcv.parallel import scatter, collate, MMDataParallel
from mmdet import datasets
from mmdet.core import results2json, coco_eval
from mmdet.datasets import build_dataloader
from mmdet.models import build... | 4,431 | 33.625 | 75 | py |
Instaboost | Instaboost-master/mmdetection/tools/train.py | from __future__ import division
import argparse
from mmcv import Config
from mmdet import __version__
from mmdet.datasets import get_dataset
from mmdet.apis import (train_detector, init_dist, get_root_logger,
set_random_seed)
from mmdet.models import build_detector
import torch
def parse_arg... | 2,762 | 29.362637 | 77 | py |
Instaboost | Instaboost-master/mmdetection/configs/faster_rcnn_r50_fpn_1x.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, ... | 4,467 | 27.458599 | 77 | py |
Instaboost | Instaboost-master/mmdetection/configs/retinanet_r101_fpn_1x.py | # model settings
model = dict(
type='RetinaNet',
pretrained='modelzoo://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,265 | 25.991736 | 77 | py |
Instaboost | Instaboost-master/mmdetection/configs/fast_mask_rcnn_r50_fpn_1x.py | # model settings
model = dict(
type='FastRCNN',
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... | 4,044 | 28.311594 | 77 | py |
Instaboost | Instaboost-master/mmdetection/configs/faster_rcnn_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... | 4,520 | 27.433962 | 77 | py |
Instaboost | Instaboost-master/mmdetection/configs/cascade_rcnn_x101_32x4d_fpn_1x.py | # model settings
model = dict(
type='CascadeRCNN',
num_stages=3,
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='... | 6,195 | 28.089202 | 77 | py |
Instaboost | Instaboost-master/mmdetection/configs/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... | 4,520 | 27.433962 | 77 | py |
Instaboost | Instaboost-master/mmdetection/configs/mask_rcnn_r101_fpn_1x.py | # model settings
model = dict(
type='MaskRCNN',
pretrained='modelzoo://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, ... | 4,762 | 27.183432 | 77 | py |
Instaboost | Instaboost-master/mmdetection/configs/cascade_mask_rcnn_r101_fpn_4x.py | # model settings
model = dict(
type='CascadeRCNN',
num_stages=3,
pretrained='modelzoo://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',
... | 6,620 | 28.039474 | 77 | py |
Instaboost | Instaboost-master/mmdetection/configs/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=... | 3,315 | 25.95935 | 77 | py |
Instaboost | Instaboost-master/mmdetection/configs/fast_mask_rcnn_r101_fpn_1x.py | # model settings
model = dict(
type='FastRCNN',
pretrained='modelzoo://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, ... | 4,047 | 28.333333 | 77 | py |
Instaboost | Instaboost-master/mmdetection/configs/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(
... | 3,398 | 26.41129 | 77 | py |
Instaboost | Instaboost-master/mmdetection/configs/cascade_mask_rcnn_r101_fpn_6x.py | # model settings
model = dict(
type='CascadeRCNN',
num_stages=3,
pretrained='modelzoo://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',
... | 6,620 | 28.039474 | 77 | py |
Instaboost | Instaboost-master/mmdetection/configs/faster_rcnn_ohem_r50_fpn_1x.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, ... | 4,465 | 27.44586 | 77 | py |
Instaboost | Instaboost-master/mmdetection/configs/mask_rcnn_r50_fpn_1x.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... | 4,759 | 27.16568 | 77 | py |
Instaboost | Instaboost-master/mmdetection/configs/ssd512_coco.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... | 3,921 | 28.712121 | 79 | py |
Instaboost | Instaboost-master/mmdetection/configs/faster_rcnn_r101_fpn_1x.py | # model settings
model = dict(
type='FasterRCNN',
pretrained='modelzoo://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... | 4,470 | 27.477707 | 77 | py |
Instaboost | Instaboost-master/mmdetection/configs/mask_rcnn_x101_64x4d_fpn_1x.py | # model settings
model = dict(
type='MaskRCNN',
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=d... | 4,812 | 27.146199 | 77 | py |
Instaboost | Instaboost-master/mmdetection/configs/cascade_rcnn_r50_fpn_1x.py | # model settings
model = dict(
type='CascadeRCNN',
num_stages=3,
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',
... | 6,142 | 28.113744 | 77 | py |
Instaboost | Instaboost-master/mmdetection/configs/cascade_mask_rcnn_x101_32x4d_fpn_1x.py | # model settings
model = dict(
type='CascadeRCNN',
num_stages=3,
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='... | 6,669 | 28 | 77 | py |
Instaboost | Instaboost-master/mmdetection/configs/rpn_x101_64x4d_fpn_1x.py | # model settings
model = dict(
type='RPN',
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=dict(
... | 3,398 | 26.41129 | 77 | py |
Instaboost | Instaboost-master/mmdetection/configs/fast_rcnn_r101_fpn_1x.py | # model settings
model = dict(
type='FastRCNN',
pretrained='modelzoo://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,628 | 28.504065 | 77 | py |
Instaboost | Instaboost-master/mmdetection/configs/rpn_r50_fpn_1x.py | # model settings
model = dict(
type='RPN',
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, 512, 10... | 3,344 | 26.418033 | 77 | py |
Instaboost | Instaboost-master/mmdetection/configs/retinanet_r50_fpn_1x.py | # model settings
model = dict(
type='RetinaNet',
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... | 3,262 | 25.966942 | 77 | py |
Instaboost | Instaboost-master/mmdetection/configs/retinanet_x101_64x4d_fpn_1x.py | # model settings
model = dict(
type='RetinaNet',
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=... | 3,315 | 25.95935 | 77 | py |
Instaboost | Instaboost-master/mmdetection/configs/fast_rcnn_r50_fpn_1x.py | # model settings
model = dict(
type='FastRCNN',
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... | 3,625 | 28.479675 | 77 | py |
Instaboost | Instaboost-master/mmdetection/configs/mask_rcnn_r101_fpn_gn_2x.py | # model settings
normalize = dict(type='GN', num_groups=32, frozen=False)
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,
style=... | 5,018 | 27.196629 | 75 | py |
Instaboost | Instaboost-master/mmdetection/configs/cascade_mask_rcnn_r50_fpn_1x.py | # model settings
model = dict(
type='CascadeRCNN',
num_stages=3,
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',
... | 6,616 | 28.02193 | 77 | py |
Instaboost | Instaboost-master/mmdetection/configs/cascade_rcnn_x101_64x4d_fpn_1x.py | # model settings
model = dict(
type='CascadeRCNN',
num_stages=3,
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='... | 6,195 | 28.089202 | 77 | py |
Instaboost | Instaboost-master/mmdetection/configs/cascade_mask_rcnn_x101_64x4d_fpn_1x.py | # model settings
model = dict(
type='CascadeRCNN',
num_stages=3,
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='... | 6,669 | 28 | 77 | py |
Instaboost | Instaboost-master/mmdetection/configs/ssd300_coco.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,904 | 28.583333 | 79 | py |
Instaboost | Instaboost-master/mmdetection/configs/mask_rcnn_x101_32x4d_fpn_1x.py | # model settings
model = dict(
type='MaskRCNN',
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... | 4,812 | 27.146199 | 77 | py |
Instaboost | Instaboost-master/mmdetection/configs/mask_rcnn_r50_fpn_gn_2x.py | # model settings
normalize = dict(type='GN', num_groups=32, frozen=False)
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,
style='p... | 5,015 | 27.179775 | 75 | py |
Instaboost | Instaboost-master/mmdetection/configs/cascade_mask_rcnn_r101_fpn_1x.py | # model settings
model = dict(
type='CascadeRCNN',
num_stages=3,
pretrained='modelzoo://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',
... | 6,619 | 28.035088 | 77 | py |
Instaboost | Instaboost-master/mmdetection/configs/cascade_rcnn_r101_fpn_1x.py | # model settings
model = dict(
type='CascadeRCNN',
num_stages=3,
pretrained='modelzoo://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',
... | 6,145 | 28.127962 | 77 | py |
Instaboost | Instaboost-master/mmdetection/configs/rpn_r101_fpn_1x.py | # model settings
model = dict(
type='RPN',
pretrained='modelzoo://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, 512, ... | 3,347 | 26.442623 | 77 | py |
Instaboost | Instaboost-master/mmdetection/configs/mask_rcnn_r50_fpn_gn_contrib_2x.py | # model settings
normalize = dict(type='GN', num_groups=32, frozen=False)
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='pyt... | 5,023 | 27.224719 | 77 | py |
Instaboost | Instaboost-master/mmdetection/configs/dcn/mask_rcnn_dconv_c3-c5_r50_fpn_1x.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',
dcn=dict(
modulated=False,
defor... | 4,940 | 27.396552 | 77 | py |
Instaboost | Instaboost-master/mmdetection/configs/dcn/cascade_rcnn_dconv_c3-c5_r50_fpn_1x.py | # model settings
model = dict(
type='CascadeRCNN',
num_stages=3,
pretrained='modelzoo://resnet50',
backbone=dict(
type='ResNet',
depth=50,
num_stages=4,
out_indices=(0, 1, 2, 3),
frozen_stages=1,
style='pytorch',
dcn=dict(
modulated=Fal... | 6,323 | 28.277778 | 77 | py |
Instaboost | Instaboost-master/mmdetection/configs/dcn/faster_rcnn_mdconv_c3-c5_r50_fpn_1x.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',
dcn=dict(
modulated=True,
defo... | 4,648 | 27.697531 | 77 | py |
Instaboost | Instaboost-master/mmdetection/configs/dcn/faster_rcnn_dconv_c3-c5_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',
d... | 4,731 | 27.678788 | 77 | py |
Instaboost | Instaboost-master/mmdetection/configs/dcn/faster_rcnn_dpool_r50_fpn_1x.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, ... | 4,607 | 27.269939 | 77 | py |
Instaboost | Instaboost-master/mmdetection/configs/dcn/faster_rcnn_mdpool_r50_fpn_1x.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, ... | 4,617 | 27.331288 | 77 | py |
Instaboost | Instaboost-master/mmdetection/configs/dcn/cascade_mask_rcnn_dconv_c3-c5_r50_fpn_1x.py | # model settings
model = dict(
type='CascadeRCNN',
num_stages=3,
pretrained='modelzoo://resnet50',
backbone=dict(
type='ResNet',
depth=50,
num_stages=4,
out_indices=(0, 1, 2, 3),
frozen_stages=1,
style='pytorch',
dcn=dict(
modulated=Fal... | 6,797 | 28.175966 | 77 | py |
Instaboost | Instaboost-master/mmdetection/configs/dcn/faster_rcnn_dconv_c3-c5_r50_fpn_1x.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',
dcn=dict(
modulated=False,
def... | 4,648 | 27.697531 | 77 | py |
Instaboost | Instaboost-master/mmdetection/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,023 | 28.807407 | 79 | py |
Instaboost | Instaboost-master/mmdetection/configs/pascal_voc/faster_rcnn_r50_fpn_1x_voc0712.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, ... | 4,721 | 28.886076 | 77 | py |
Instaboost | Instaboost-master/mmdetection/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,042 | 28.948148 | 79 | py |
Instaboost | Instaboost-master/mmdetection/mmdet/apis/inference.py | import mmcv
import numpy as np
import pycocotools.mask as maskUtils
import torch
from mmdet.core import get_classes
from mmdet.datasets import to_tensor
from mmdet.datasets.transforms import ImageTransform
def _prepare_data(img, img_transform, cfg, device):
ori_shape = img.shape
img, img_shape, pad_shape, sc... | 2,654 | 30.607143 | 76 | py |
Instaboost | Instaboost-master/mmdetection/mmdet/apis/train.py | from __future__ import division
from collections import OrderedDict
import torch
from mmcv.runner import Runner, DistSamplerSeedHook
from mmcv.parallel import MMDataParallel, MMDistributedDataParallel
from mmdet.core import (DistOptimizerHook, DistEvalmAPHook,
CocoDistEvalRecallHook, CocoDist... | 3,964 | 31.5 | 77 | py |
Instaboost | Instaboost-master/mmdetection/mmdet/apis/env.py | import logging
import os
import random
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_start_method('spawn')... | 1,514 | 25.12069 | 70 | py |
Instaboost | Instaboost-master/mmdetection/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.runner import Hook, obj_from_dict
from mmcv.parallel import scatter, collate
from pycocotools.cocoeval import COCOeval
from torch.utils.data import Dataset
from .coco_utils import results2json, fast_... | 6,076 | 36.282209 | 77 | py |
Instaboost | Instaboost-master/mmdetection/mmdet/core/post_processing/merge_augs.py | import torch
import numpy as np
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
sche... | 3,317 | 33.206186 | 78 | py |
Instaboost | Instaboost-master/mmdetection/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):
"""NMS for multi-class bboxes.
Args:
multi_bboxes (Tensor): shape (n, #class*4) or (n, 4)
multi_scores (Tensor): shape (n, #class)
score_thr (float): bbo... | 1,980 | 34.375 | 79 | py |
Instaboost | Instaboost-master/mmdetection/mmdet/core/mask/mask_target.py | import torch
import numpy as np
import mmcv
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,
pos_assigned_gt_inds_list, ... | 1,427 | 37.594595 | 77 | py |
Instaboost | Instaboost-master/mmdetection/mmdet/core/bbox/bbox_target.py | import torch
from .transforms import bbox2delta
from ..utils import multi_apply
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,799 | 36.837838 | 78 | py |
Instaboost | Instaboost-master/mmdetection/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,163 | 32.8125 | 79 | py |
Instaboost | Instaboost-master/mmdetection/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.... | 5,036 | 31.082803 | 78 | py |
Instaboost | Instaboost-master/mmdetection/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 |
Instaboost | Instaboost-master/mmdetection/mmdet/core/bbox/assigners/max_iou_assigner.py | import torch
from .base_assigner import BaseAssigner
from .assign_result import AssignResult
from ..geometry import bbox_overlaps
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,462 | 41.24183 | 79 | py |
Instaboost | Instaboost-master/mmdetection/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 |
Instaboost | Instaboost-master/mmdetection/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 |
Instaboost | Instaboost-master/mmdetection/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 |
Instaboost | Instaboost-master/mmdetection/mmdet/core/bbox/samplers/ohem_sampler.py | import torch
from .base_sampler import BaseSampler
from ..transforms import bbox2roi
class OHEMSampler(BaseSampler):
def __init__(self,
num,
pos_fraction,
context,
neg_pos_ub=-1,
add_gt_as_proposals=True,
**kwa... | 2,756 | 36.256757 | 77 | py |
Instaboost | Instaboost-master/mmdetection/mmdet/core/bbox/samplers/iou_balanced_neg_sampler.py | import numpy as np
import torch
from .random_sampler import RandomSampler
class IoUBalancedNegSampler(RandomSampler):
def __init__(self,
num,
pos_fraction,
hard_thr=0.1,
hard_fraction=0.5,
**kwargs):
super(IoUBalancedNe... | 2,757 | 42.777778 | 74 | py |
Instaboost | Instaboost-master/mmdetection/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 |
Instaboost | Instaboost-master/mmdetection/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 |
Instaboost | Instaboost-master/mmdetection/mmdet/core/loss/losses.py | # TODO merge naive and weighted loss.
import torch
import torch.nn.functional as F
from ...ops import sigmoid_focal_loss
def weighted_nll_loss(pred, label, weight, avg_factor=None):
if avg_factor is None:
avg_factor = max(torch.sum(weight > 0).float().item(), 1.)
raw = F.nll_loss(pred, label, reducti... | 4,584 | 34.269231 | 78 | py |
Instaboost | Instaboost-master/mmdetection/mmdet/core/utils/dist_utils.py | from collections import OrderedDict
import torch.distributed as dist
from torch._utils import (_flatten_dense_tensors, _unflatten_dense_tensors,
_take_tensors)
from mmcv.runner import OptimizerHook
def _allreduce_coalesced(tensors, world_size, bucket_size_mb=-1):
if bucket_size_mb > 0:
... | 1,941 | 32.482759 | 75 | py |
Instaboost | Instaboost-master/mmdetection/mmdet/core/anchor/anchor_target.py | import torch
from ..bbox import assign_and_sample, build_assigner, PseudoSampler, bbox2delta
from ..utils import multi_apply
def anchor_target(anchor_list,
valid_flag_list,
gt_bboxes_list,
img_metas,
target_means,
target_stds,
... | 7,198 | 37.497326 | 79 | py |
Instaboost | Instaboost-master/mmdetection/mmdet/core/anchor/anchor_generator.py | import torch
class AnchorGenerator(object):
def __init__(self, base_size, scales, ratios, scale_major=True, ctr=None):
self.base_size = base_size
self.scales = torch.Tensor(scales)
self.ratios = torch.Tensor(ratios)
self.scale_major = scale_major
self.ctr = ctr
sel... | 3,117 | 35.682353 | 78 | py |
Instaboost | Instaboost-master/mmdetection/mmdet/models/registry.py | import torch.nn as nn
class Registry(object):
def __init__(self, name):
self._name = name
self._module_dict = dict()
@property
def name(self):
return self._name
@property
def module_dict(self):
return self._module_dict
def _register_module(self, module_class... | 1,138 | 24.886364 | 73 | py |
Instaboost | Instaboost-master/mmdetection/mmdet/models/builder.py | import mmcv
from torch import nn
from .registry import BACKBONES, NECKS, ROI_EXTRACTORS, HEADS, DETECTORS
def _build_module(cfg, registry, default_args):
assert isinstance(cfg, dict) and 'type' in cfg
assert isinstance(default_args, dict) or default_args is None
args = cfg.copy()
obj_type = args.pop(... | 1,500 | 27.865385 | 79 | py |
Instaboost | Instaboost-master/mmdetection/mmdet/models/detectors/two_stage.py | import torch
import torch.nn as nn
from .base import BaseDetector
from .test_mixins import RPNTestMixin, BBoxTestMixin, MaskTestMixin
from .. import builder
from ..registry import DETECTORS
from mmdet.core import bbox2roi, bbox2result, build_assigner, build_sampler
@DETECTORS.register_module
class TwoStageDetector(B... | 7,747 | 36.429952 | 79 | py |
Instaboost | Instaboost-master/mmdetection/mmdet/models/detectors/base.py | import logging
from abc import ABCMeta, abstractmethod
import mmcv
import numpy as np
import torch.nn as nn
import pycocotools.mask as maskUtils
from mmdet.core import tensor2imgs, get_classes
class BaseDetector(nn.Module):
"""Base class for detectors"""
__metaclass__ = ABCMeta
def __init__(self):
... | 4,354 | 31.259259 | 77 | py |
Instaboost | Instaboost-master/mmdetection/mmdet/models/detectors/single_stage.py | import torch.nn as nn
from .base import BaseDetector
from .. import builder
from ..registry import DETECTORS
from mmdet.core import bbox2result
@DETECTORS.register_module
class SingleStageDetector(BaseDetector):
def __init__(self,
backbone,
neck=None,
bbox_head... | 2,348 | 32.084507 | 78 | py |
Instaboost | Instaboost-master/mmdetection/mmdet/models/detectors/cascade_rcnn.py | from __future__ import division
import torch
import torch.nn as nn
from .base import BaseDetector
from .test_mixins import RPNTestMixin
from .. import builder
from ..registry import DETECTORS
from mmdet.core import (build_assigner, bbox2roi, bbox2result, build_sampler,
merge_aug_masks)
@DETE... | 13,895 | 40.357143 | 79 | py |
Instaboost | Instaboost-master/mmdetection/mmdet/models/necks/fpn.py | import torch.nn as nn
import torch.nn.functional as F
from mmcv.cnn import xavier_init
from ..utils import ConvModule
from ..registry import NECKS
@NECKS.register_module
class FPN(nn.Module):
def __init__(self,
in_channels,
out_channels,
num_outs,
... | 4,894 | 35.804511 | 79 | py |
Instaboost | Instaboost-master/mmdetection/mmdet/models/roi_extractors/single_level.py | from __future__ import division
import torch
import torch.nn as nn
from mmdet import ops
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 mulitple input feature levels, each RoI i... | 3,075 | 33.561798 | 79 | py |
Instaboost | Instaboost-master/mmdetection/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 .anchor_head import AnchorHead
from ..registry import HEADS
@HEADS.register_module
class RPNHead(AnchorHead):
def __init__(self, in_channels, **kwa... | 4,048 | 37.561905 | 78 | py |
Instaboost | Instaboost-master/mmdetection/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,
multi_apply, weighted_cross_entropy, weighted_smoothl1,
weighted_binary_cross_entro... | 11,497 | 39.485915 | 79 | py |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.