repo stringlengths 2 99 | file stringlengths 13 225 | code stringlengths 0 18.3M | file_length int64 0 18.3M | avg_line_length float64 0 1.36M | max_line_length int64 0 4.26M | extension_type stringclasses 1
value |
|---|---|---|---|---|---|---|
DSLA-DSLA | DSLA-DSLA/mmdet/models/roi_heads/mask_heads/htc_mask_head.py | # Copyright (c) OpenMMLab. All rights reserved.
from mmcv.cnn import ConvModule
from mmdet.models.builder import HEADS
from .fcn_mask_head import FCNMaskHead
@HEADS.register_module()
class HTCMaskHead(FCNMaskHead):
def __init__(self, with_conv_res=True, *args, **kwargs):
super(HTCMaskHead, self).__init_... | 1,282 | 31.075 | 78 | py |
DSLA-DSLA | DSLA-DSLA/mmdet/models/roi_heads/mask_heads/fcn_mask_head.py | # Copyright (c) OpenMMLab. All rights reserved.
from warnings import warn
import numpy as np
import torch
import torch.nn as nn
import torch.nn.functional as F
from mmcv.cnn import ConvModule, build_conv_layer, build_upsample_layer
from mmcv.ops.carafe import CARAFEPack
from mmcv.runner import BaseModule, ModuleList, ... | 17,449 | 41.251816 | 85 | py |
DSLA-DSLA | DSLA-DSLA/mmdet/models/roi_heads/mask_heads/fused_semantic_head.py | # Copyright (c) OpenMMLab. All rights reserved.
import warnings
import torch.nn as nn
import torch.nn.functional as F
from mmcv.cnn import ConvModule
from mmcv.runner import BaseModule, auto_fp16, force_fp32
from mmdet.models.builder import HEADS, build_loss
@HEADS.register_module()
class FusedSemanticHead(BaseModu... | 4,150 | 34.177966 | 79 | py |
DSLA-DSLA | DSLA-DSLA/mmdet/models/roi_heads/mask_heads/mask_point_head.py | # Copyright (c) OpenMMLab. All rights reserved.
# Modified from https://github.com/facebookresearch/detectron2/tree/master/projects/PointRend/point_head/point_head.py # noqa
import torch
import torch.nn as nn
from mmcv.cnn import ConvModule
from mmcv.ops import point_sample, rel_roi_point_to_rel_img_point
from mmcv.r... | 13,455 | 42.830619 | 126 | py |
DSLA-DSLA | DSLA-DSLA/mmdet/models/roi_heads/mask_heads/scnet_mask_head.py | # Copyright (c) OpenMMLab. All rights reserved.
from mmdet.models.builder import HEADS
from mmdet.models.utils import ResLayer, SimplifiedBasicBlock
from .fcn_mask_head import FCNMaskHead
@HEADS.register_module()
class SCNetMaskHead(FCNMaskHead):
"""Mask head for `SCNet <https://arxiv.org/abs/2012.10150>`_.
... | 979 | 32.793103 | 72 | py |
DSLA-DSLA | DSLA-DSLA/mmdet/models/losses/ghm_loss.py | # Copyright (c) OpenMMLab. All rights reserved.
import torch
import torch.nn as nn
import torch.nn.functional as F
from ..builder import LOSSES
from .utils import weight_reduce_loss
def _expand_onehot_labels(labels, label_weights, label_channels):
bin_labels = labels.new_full((labels.size(0), label_channels), 0)... | 7,923 | 36.028037 | 79 | py |
DSLA-DSLA | DSLA-DSLA/mmdet/models/losses/mse_loss.py | # Copyright (c) OpenMMLab. All rights reserved.
import torch.nn as nn
import torch.nn.functional as F
from ..builder import LOSSES
from .utils import weighted_loss
@weighted_loss
def mse_loss(pred, target):
"""Warpper of mse loss."""
return F.mse_loss(pred, target, reduction='none')
@LOSSES.register_module... | 1,905 | 31.862069 | 78 | py |
DSLA-DSLA | DSLA-DSLA/mmdet/models/losses/dice_loss.py | # Copyright (c) OpenMMLab. All rights reserved.
import torch
import torch.nn as nn
from ..builder import LOSSES
from .utils import weight_reduce_loss
def dice_loss(pred,
target,
weight=None,
eps=1e-3,
reduction='mean',
avg_factor=None):
"""Cal... | 4,340 | 34.008065 | 78 | py |
DSLA-DSLA | DSLA-DSLA/mmdet/models/losses/pisa_loss.py | # Copyright (c) OpenMMLab. All rights reserved.
import mmcv
import torch
from mmdet.core import bbox_overlaps
@mmcv.jit(derivate=True, coderize=True)
def isr_p(cls_score,
bbox_pred,
bbox_targets,
rois,
sampling_results,
loss_cls,
bbox_coder,
k=2,
... | 7,216 | 38.010811 | 79 | py |
DSLA-DSLA | DSLA-DSLA/mmdet/models/losses/balanced_l1_loss.py | # Copyright (c) OpenMMLab. All rights reserved.
import mmcv
import numpy as np
import torch
import torch.nn as nn
from ..builder import LOSSES
from .utils import weighted_loss
@mmcv.jit(derivate=True, coderize=True)
@weighted_loss
def balanced_l1_loss(pred,
target,
beta=1.0,... | 4,252 | 33.024 | 79 | py |
DSLA-DSLA | DSLA-DSLA/mmdet/models/losses/iou_loss.py | # Copyright (c) OpenMMLab. All rights reserved.
import math
import warnings
import mmcv
import torch
import torch.nn as nn
from mmdet.core import bbox_overlaps
from ..builder import LOSSES
from .utils import weighted_loss
@mmcv.jit(derivate=True, coderize=True)
@weighted_loss
def iou_loss(pred, target, linear=False... | 15,714 | 32.084211 | 79 | py |
DSLA-DSLA | DSLA-DSLA/mmdet/models/losses/smooth_l1_loss.py | # Copyright (c) OpenMMLab. All rights reserved.
import mmcv
import torch
import torch.nn as nn
from ..builder import LOSSES
from .utils import weighted_loss
@mmcv.jit(derivate=True, coderize=True)
@weighted_loss
def smooth_l1_loss(pred, target, beta=1.0):
"""Smooth L1 loss.
Args:
pred (torch.Tensor)... | 4,635 | 30.537415 | 78 | py |
DSLA-DSLA | DSLA-DSLA/mmdet/models/losses/gfocal_loss.py | # Copyright (c) OpenMMLab. All rights reserved.
import mmcv
import torch.nn as nn
import torch.nn.functional as F
from ..builder import LOSSES
from .utils import weighted_loss
@mmcv.jit(derivate=True, coderize=True)
@weighted_loss
def quality_focal_loss(pred, target, beta=2.0):
r"""Quality Focal Loss (QFL) is fr... | 9,834 | 38.979675 | 79 | py |
DSLA-DSLA | DSLA-DSLA/mmdet/models/losses/varifocal_loss.py | # Copyright (c) OpenMMLab. All rights reserved.
import mmcv
import torch.nn as nn
import torch.nn.functional as F
from ..builder import LOSSES
from .utils import weight_reduce_loss
@mmcv.jit(derivate=True, coderize=True)
def varifocal_loss(pred,
target,
weight=None,
... | 5,365 | 38.748148 | 79 | py |
DSLA-DSLA | DSLA-DSLA/mmdet/models/losses/utils.py | # Copyright (c) OpenMMLab. All rights reserved.
import functools
import mmcv
import torch.nn.functional as F
def reduce_loss(loss, reduction):
"""Reduce loss as specified.
Args:
loss (Tensor): Elementwise loss tensor.
reduction (str): Options are "none", "mean" and "sum".
Return:
... | 3,103 | 29.431373 | 79 | py |
DSLA-DSLA | DSLA-DSLA/mmdet/models/losses/seesaw_loss.py | # Copyright (c) OpenMMLab. All rights reserved.
import torch
import torch.nn as nn
import torch.nn.functional as F
from ..builder import LOSSES
from .accuracy import accuracy
from .cross_entropy_loss import cross_entropy
from .utils import weight_reduce_loss
def seesaw_ce_loss(cls_score,
labels,
... | 10,136 | 37.543726 | 79 | py |
DSLA-DSLA | DSLA-DSLA/mmdet/models/losses/ae_loss.py | # Copyright (c) OpenMMLab. All rights reserved.
import mmcv
import torch
import torch.nn as nn
import torch.nn.functional as F
from ..builder import LOSSES
@mmcv.jit(derivate=True, coderize=True)
def ae_loss_per_image(tl_preds, br_preds, match):
"""Associative Embedding Loss in one image.
Associative Embedd... | 3,857 | 36.096154 | 143 | py |
DSLA-DSLA | DSLA-DSLA/mmdet/models/losses/accuracy.py | # Copyright (c) OpenMMLab. All rights reserved.
import mmcv
import torch.nn as nn
@mmcv.jit(coderize=True)
def accuracy(pred, target, topk=1, thresh=None):
"""Calculate accuracy according to the prediction and target.
Args:
pred (torch.Tensor): The model prediction, shape (N, num_class)
targe... | 2,990 | 36.3875 | 79 | py |
DSLA-DSLA | DSLA-DSLA/mmdet/models/losses/focal_loss.py | # Copyright (c) OpenMMLab. All rights reserved.
import torch
import torch.nn as nn
import torch.nn.functional as F
from mmcv.ops import sigmoid_focal_loss as _sigmoid_focal_loss
from ..builder import LOSSES
from .utils import weight_reduce_loss
# This method is only for debugging
def py_sigmoid_focal_loss(pred,
... | 10,420 | 41.534694 | 79 | py |
DSLA-DSLA | DSLA-DSLA/mmdet/models/losses/cross_entropy_loss.py | # Copyright (c) OpenMMLab. All rights reserved.
import torch
import torch.nn as nn
import torch.nn.functional as F
from ..builder import LOSSES
from .utils import weight_reduce_loss
def cross_entropy(pred,
label,
weight=None,
reduction='mean',
a... | 9,696 | 37.480159 | 79 | py |
DSLA-DSLA | DSLA-DSLA/mmdet/models/losses/__init__.py | # Copyright (c) OpenMMLab. All rights reserved.
from .accuracy import Accuracy, accuracy
from .ae_loss import AssociativeEmbeddingLoss
from .balanced_l1_loss import BalancedL1Loss, balanced_l1_loss
from .cross_entropy_loss import (CrossEntropyLoss, binary_cross_entropy,
cross_entropy, m... | 1,721 | 51.181818 | 79 | py |
DSLA-DSLA | DSLA-DSLA/mmdet/models/losses/gaussian_focal_loss.py | # Copyright (c) OpenMMLab. All rights reserved.
import mmcv
import torch.nn as nn
from ..builder import LOSSES
from .utils import weighted_loss
@mmcv.jit(derivate=True, coderize=True)
@weighted_loss
def gaussian_focal_loss(pred, gaussian_target, alpha=2.0, gamma=4.0):
"""`Focal Loss <https://arxiv.org/abs/1708.0... | 3,312 | 34.623656 | 108 | py |
DSLA-DSLA | DSLA-DSLA/mmdet/models/losses/kd_loss.py | # Copyright (c) OpenMMLab. All rights reserved.
import mmcv
import torch.nn as nn
import torch.nn.functional as F
from ..builder import LOSSES
from .utils import weighted_loss
@mmcv.jit(derivate=True, coderize=True)
@weighted_loss
def knowledge_distillation_kl_div_loss(pred,
so... | 2,912 | 31.730337 | 78 | py |
DSLA-DSLA | DSLA-DSLA/mmdet/models/backbones/pvt.py | # Copyright (c) OpenMMLab. All rights reserved.
import math
import warnings
import numpy as np
import torch
import torch.nn as nn
import torch.nn.functional as F
from mmcv.cnn import (Conv2d, build_activation_layer, build_norm_layer,
constant_init, normal_init, trunc_normal_init)
from mmcv.cnn.br... | 23,217 | 38.219595 | 89 | py |
DSLA-DSLA | DSLA-DSLA/mmdet/models/backbones/hrnet.py | # Copyright (c) OpenMMLab. All rights reserved.
import warnings
import torch.nn as nn
from mmcv.cnn import build_conv_layer, build_norm_layer
from mmcv.runner import BaseModule, ModuleList, Sequential
from torch.nn.modules.batchnorm import _BatchNorm
from ..builder import BACKBONES
from .resnet import BasicBlock, Bot... | 23,106 | 38.164407 | 79 | py |
DSLA-DSLA | DSLA-DSLA/mmdet/models/backbones/regnet.py | # Copyright (c) OpenMMLab. All rights reserved.
import warnings
import numpy as np
import torch.nn as nn
from mmcv.cnn import build_conv_layer, build_norm_layer
from ..builder import BACKBONES
from .resnet import ResNet
from .resnext import Bottleneck
@BACKBONES.register_module()
class RegNet(ResNet):
"""RegNet... | 13,605 | 37.112045 | 79 | py |
DSLA-DSLA | DSLA-DSLA/mmdet/models/backbones/mobilenet_v2.py | # Copyright (c) OpenMMLab. All rights reserved.
import warnings
import torch.nn as nn
from mmcv.cnn import ConvModule
from mmcv.runner import BaseModule
from torch.nn.modules.batchnorm import _BatchNorm
from ..builder import BACKBONES
from ..utils import InvertedResidual, make_divisible
@BACKBONES.register_module()... | 7,599 | 37.383838 | 78 | py |
DSLA-DSLA | DSLA-DSLA/mmdet/models/backbones/swin.py | # Copyright (c) OpenMMLab. All rights reserved.
import warnings
from collections import OrderedDict
from copy import deepcopy
import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.utils.checkpoint as cp
from mmcv.cnn import build_norm_layer, constant_init, trunc_normal_init
from mmcv.cnn.bric... | 30,138 | 38.448953 | 79 | py |
DSLA-DSLA | DSLA-DSLA/mmdet/models/backbones/trident_resnet.py | # Copyright (c) OpenMMLab. All rights reserved.
import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.utils.checkpoint as cp
from mmcv.cnn import build_conv_layer, build_norm_layer
from mmcv.runner import BaseModule
from torch.nn.modules.utils import _pair
from mmdet.models.backbones.resnet i... | 11,129 | 36.22408 | 79 | py |
DSLA-DSLA | DSLA-DSLA/mmdet/models/backbones/detectors_resnext.py | # Copyright (c) OpenMMLab. All rights reserved.
import math
from mmcv.cnn import build_conv_layer, build_norm_layer
from ..builder import BACKBONES
from .detectors_resnet import Bottleneck as _Bottleneck
from .detectors_resnet import DetectoRS_ResNet
class Bottleneck(_Bottleneck):
expansion = 4
def __init_... | 3,920 | 30.620968 | 77 | py |
DSLA-DSLA | DSLA-DSLA/mmdet/models/backbones/resnet.py | # Copyright (c) OpenMMLab. All rights reserved.
import warnings
import torch.nn as nn
import torch.utils.checkpoint as cp
from mmcv.cnn import build_conv_layer, build_norm_layer, build_plugin_layer
from mmcv.runner import BaseModule
from torch.nn.modules.batchnorm import _BatchNorm
from ..builder import BACKBONES
fro... | 23,838 | 34.421991 | 79 | py |
DSLA-DSLA | DSLA-DSLA/mmdet/models/backbones/detectors_resnet.py | # Copyright (c) OpenMMLab. All rights reserved.
import torch.nn as nn
import torch.utils.checkpoint as cp
from mmcv.cnn import (build_conv_layer, build_norm_layer, constant_init,
kaiming_init)
from mmcv.runner import Sequential, load_checkpoint
from torch.nn.modules.batchnorm import _BatchNorm
fr... | 12,736 | 34.980226 | 79 | py |
DSLA-DSLA | DSLA-DSLA/mmdet/models/backbones/ssd_vgg.py | # Copyright (c) OpenMMLab. All rights reserved.
import warnings
import torch.nn as nn
from mmcv.cnn import VGG
from mmcv.runner import BaseModule
from ..builder import BACKBONES
from ..necks import ssd_neck
@BACKBONES.register_module()
class SSDVGG(VGG, BaseModule):
"""VGG Backbone network for single-shot-detec... | 4,705 | 35.48062 | 79 | py |
DSLA-DSLA | DSLA-DSLA/mmdet/models/backbones/resnext.py | # Copyright (c) OpenMMLab. All rights reserved.
import math
from mmcv.cnn import build_conv_layer, build_norm_layer
from ..builder import BACKBONES
from ..utils import ResLayer
from .resnet import Bottleneck as _Bottleneck
from .resnet import ResNet
class Bottleneck(_Bottleneck):
expansion = 4
def __init__... | 5,712 | 35.858065 | 79 | py |
DSLA-DSLA | DSLA-DSLA/mmdet/models/backbones/resnest.py | # Copyright (c) OpenMMLab. All rights reserved.
import math
import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.utils.checkpoint as cp
from mmcv.cnn import build_conv_layer, build_norm_layer
from mmcv.runner import BaseModule
from ..builder import BACKBONES
from ..utils import ResLayer
fro... | 10,579 | 31.755418 | 79 | py |
DSLA-DSLA | DSLA-DSLA/mmdet/models/backbones/csp_darknet.py | # Copyright (c) OpenMMLab. All rights reserved.
import math
import torch
import torch.nn as nn
from mmcv.cnn import ConvModule, DepthwiseSeparableConvModule
from mmcv.runner import BaseModule
from torch.nn.modules.batchnorm import _BatchNorm
from ..builder import BACKBONES
from ..utils import CSPLayer
class Focus(n... | 10,543 | 35.996491 | 77 | py |
DSLA-DSLA | DSLA-DSLA/mmdet/models/backbones/__init__.py | # Copyright (c) OpenMMLab. All rights reserved.
from .csp_darknet import CSPDarknet
from .darknet import Darknet
from .detectors_resnet import DetectoRS_ResNet
from .detectors_resnext import DetectoRS_ResNeXt
from .hourglass import HourglassNet
from .hrnet import HRNet
from .mobilenet_v2 import MobileNetV2
from .pvt im... | 940 | 36.64 | 79 | py |
DSLA-DSLA | DSLA-DSLA/mmdet/models/backbones/hourglass.py | # Copyright (c) OpenMMLab. All rights reserved.
import torch.nn as nn
import torch.nn.functional as F
from mmcv.cnn import ConvModule
from mmcv.runner import BaseModule
from ..builder import BACKBONES
from ..utils import ResLayer
from .resnet import BasicBlock
class HourglassModule(BaseModule):
"""Hourglass Modu... | 7,494 | 32.609865 | 79 | py |
DSLA-DSLA | DSLA-DSLA/mmdet/models/backbones/res2net.py | # Copyright (c) OpenMMLab. All rights reserved.
import math
import torch
import torch.nn as nn
import torch.utils.checkpoint as cp
from mmcv.cnn import build_conv_layer, build_norm_layer
from mmcv.runner import Sequential
from ..builder import BACKBONES
from .resnet import Bottleneck as _Bottleneck
from .resnet impor... | 11,659 | 34.54878 | 79 | py |
DSLA-DSLA | DSLA-DSLA/mmdet/models/backbones/darknet.py | # Copyright (c) OpenMMLab. All rights reserved.
# Copyright (c) 2019 Western Digital Corporation or its affiliates.
import warnings
import torch.nn as nn
from mmcv.cnn import ConvModule
from mmcv.runner import BaseModule
from torch.nn.modules.batchnorm import _BatchNorm
from ..builder import BACKBONES
class ResBlo... | 8,233 | 37.476636 | 79 | py |
DSLA-DSLA | DSLA-DSLA/mmdet/datasets/custom.py | # Copyright (c) OpenMMLab. All rights reserved.
import os.path as osp
import warnings
from collections import OrderedDict
import mmcv
import numpy as np
from mmcv.utils import print_log
from terminaltables import AsciiTable
from torch.utils.data import Dataset
from mmdet.core import eval_map, eval_recalls
from .build... | 14,679 | 36.641026 | 79 | py |
DSLA-DSLA | DSLA-DSLA/mmdet/datasets/deepfashion.py | # Copyright (c) OpenMMLab. All rights reserved.
from .builder import DATASETS
from .coco import CocoDataset
@DATASETS.register_module()
class DeepFashionDataset(CocoDataset):
CLASSES = ('top', 'skirt', 'leggings', 'dress', 'outer', 'pants', 'bag',
'neckwear', 'headwear', 'eyeglass', 'belt', 'footw... | 365 | 29.5 | 78 | py |
DSLA-DSLA | DSLA-DSLA/mmdet/datasets/voc.py | # Copyright (c) OpenMMLab. All rights reserved.
from collections import OrderedDict
from mmcv.utils import print_log
from mmdet.core import eval_map, eval_recalls
from .builder import DATASETS
from .xml_style import XMLDataset
@DATASETS.register_module()
class VOCDataset(XMLDataset):
CLASSES = ('aeroplane', 'b... | 4,297 | 39.54717 | 90 | py |
DSLA-DSLA | DSLA-DSLA/mmdet/datasets/cityscapes.py | # Copyright (c) OpenMMLab. All rights reserved.
# Modified from https://github.com/facebookresearch/detectron2/blob/master/detectron2/data/datasets/cityscapes.py # noqa
# and https://github.com/mcordts/cityscapesScripts/blob/master/cityscapesscripts/evaluation/evalInstanceLevelSemanticLabeling.py # noqa
import glob
im... | 14,336 | 41.669643 | 135 | py |
DSLA-DSLA | DSLA-DSLA/mmdet/datasets/utils.py | # Copyright (c) OpenMMLab. All rights reserved.
import copy
import warnings
from mmcv.cnn import VGG
from mmcv.runner.hooks import HOOKS, Hook
from mmdet.datasets.builder import PIPELINES
from mmdet.datasets.pipelines import LoadAnnotations, LoadImageFromFile
from mmdet.models.dense_heads import GARPNHead, RPNHead
fr... | 6,533 | 38.6 | 78 | py |
DSLA-DSLA | DSLA-DSLA/mmdet/datasets/dataset_wrappers.py | # Copyright (c) OpenMMLab. All rights reserved.
import bisect
import collections
import copy
import math
from collections import defaultdict
import numpy as np
from mmcv.utils import build_from_cfg, print_log
from torch.utils.data.dataset import ConcatDataset as _ConcatDataset
from .builder import DATASETS, PIPELINES... | 16,052 | 36.683099 | 167 | py |
DSLA-DSLA | DSLA-DSLA/mmdet/datasets/xml_style.py | # Copyright (c) OpenMMLab. All rights reserved.
import os.path as osp
import xml.etree.ElementTree as ET
import mmcv
import numpy as np
from PIL import Image
from .builder import DATASETS
from .custom import CustomDataset
@DATASETS.register_module()
class XMLDataset(CustomDataset):
"""XML dataset for detection.... | 6,243 | 33.882682 | 79 | py |
DSLA-DSLA | DSLA-DSLA/mmdet/datasets/__init__.py | # Copyright (c) OpenMMLab. All rights reserved.
from .builder import DATASETS, PIPELINES, build_dataloader, build_dataset
from .cityscapes import CityscapesDataset
from .coco import CocoDataset
from .coco_panoptic import CocoPanopticDataset
from .custom import CustomDataset
from .dataset_wrappers import (ClassBalancedD... | 1,320 | 47.925926 | 79 | py |
DSLA-DSLA | DSLA-DSLA/mmdet/datasets/lvis.py | # Copyright (c) OpenMMLab. All rights reserved.
import itertools
import logging
import os.path as osp
import tempfile
import warnings
from collections import OrderedDict
import numpy as np
from mmcv.utils import print_log
from terminaltables import AsciiTable
from .builder import DATASETS
from .coco import CocoDatase... | 46,316 | 61.506073 | 157 | py |
DSLA-DSLA | DSLA-DSLA/mmdet/datasets/builder.py | # Copyright (c) OpenMMLab. All rights reserved.
import copy
import platform
import random
import warnings
from functools import partial
import numpy as np
from mmcv.parallel import collate
from mmcv.runner import get_dist_info
from mmcv.utils import TORCH_VERSION, Registry, build_from_cfg, digit_version
from torch.uti... | 7,707 | 37.54 | 79 | py |
DSLA-DSLA | DSLA-DSLA/mmdet/datasets/coco_panoptic.py | # Copyright (c) OpenMMLab. All rights reserved.
import itertools
import os
from collections import defaultdict
import mmcv
import numpy as np
from mmcv.utils import print_log
from terminaltables import AsciiTable
from .api_wrappers import COCO, pq_compute_multi_core
from .builder import DATASETS
from .coco import Coc... | 21,842 | 39.078899 | 79 | py |
DSLA-DSLA | DSLA-DSLA/mmdet/datasets/coco.py | # Copyright (c) OpenMMLab. All rights reserved.
import contextlib
import io
import itertools
import logging
import os.path as osp
import tempfile
import warnings
from collections import OrderedDict
import mmcv
import numpy as np
from mmcv.utils import print_log
from terminaltables import AsciiTable
from mmdet.core im... | 24,063 | 40.923345 | 124 | py |
DSLA-DSLA | DSLA-DSLA/mmdet/datasets/wider_face.py | # Copyright (c) OpenMMLab. All rights reserved.
import os.path as osp
import xml.etree.ElementTree as ET
import mmcv
from .builder import DATASETS
from .xml_style import XMLDataset
@DATASETS.register_module()
class WIDERFaceDataset(XMLDataset):
"""Reader for the WIDER Face dataset in PASCAL VOC format.
Con... | 1,549 | 28.245283 | 68 | py |
DSLA-DSLA | DSLA-DSLA/mmdet/datasets/api_wrappers/panoptic_evaluation.py | # Copyright (c) OpenMMLab. All rights reserved.
# Copyright (c) 2018, Alexander Kirillov
# This file supports `file_client` for `panopticapi`,
# the source code is copied from `panopticapi`,
# only the way to load the gt images is modified.
import multiprocessing
import os
import mmcv
import numpy as np
try:
fro... | 8,631 | 39.525822 | 79 | py |
DSLA-DSLA | DSLA-DSLA/mmdet/datasets/api_wrappers/coco_api.py | # Copyright (c) OpenMMLab. All rights reserved.
# This file add snake case alias for coco api
import warnings
import pycocotools
from pycocotools.coco import COCO as _COCO
from pycocotools.cocoeval import COCOeval as _COCOeval
class COCO(_COCO):
"""This class is almost the same as official pycocotools package.
... | 1,506 | 30.395833 | 126 | py |
DSLA-DSLA | DSLA-DSLA/mmdet/datasets/api_wrappers/__init__.py | # Copyright (c) OpenMMLab. All rights reserved.
from .coco_api import COCO, COCOeval
from .panoptic_evaluation import pq_compute_multi_core, pq_compute_single_core
__all__ = [
'COCO', 'COCOeval', 'pq_compute_multi_core', 'pq_compute_single_core'
]
| 253 | 30.75 | 78 | py |
DSLA-DSLA | DSLA-DSLA/mmdet/datasets/samplers/group_sampler.py | # Copyright (c) OpenMMLab. All rights reserved.
import math
import numpy as np
import torch
from mmcv.runner import get_dist_info
from torch.utils.data import Sampler
class GroupSampler(Sampler):
def __init__(self, dataset, samples_per_gpu=1):
assert hasattr(dataset, 'flag')
self.dataset = datas... | 5,384 | 35.14094 | 78 | py |
DSLA-DSLA | DSLA-DSLA/mmdet/datasets/samplers/infinite_sampler.py | # Copyright (c) OpenMMLab. All rights reserved.
import itertools
import numpy as np
import torch
from mmcv.runner import get_dist_info
from torch.utils.data.sampler import Sampler
class InfiniteGroupBatchSampler(Sampler):
"""Similar to `BatchSampler` warping a `GroupSampler. It is designed for
iteration-base... | 6,267 | 35.231214 | 110 | py |
DSLA-DSLA | DSLA-DSLA/mmdet/datasets/samplers/distributed_sampler.py | # Copyright (c) OpenMMLab. All rights reserved.
import math
import torch
from torch.utils.data import DistributedSampler as _DistributedSampler
class DistributedSampler(_DistributedSampler):
def __init__(self,
dataset,
num_replicas=None,
rank=None,
... | 1,358 | 32.146341 | 79 | py |
DSLA-DSLA | DSLA-DSLA/mmdet/datasets/samplers/__init__.py | # Copyright (c) OpenMMLab. All rights reserved.
from .distributed_sampler import DistributedSampler
from .group_sampler import DistributedGroupSampler, GroupSampler
from .infinite_sampler import InfiniteBatchSampler, InfiniteGroupBatchSampler
__all__ = [
'DistributedSampler', 'DistributedGroupSampler', 'GroupSampl... | 383 | 37.4 | 77 | py |
DSLA-DSLA | DSLA-DSLA/mmdet/datasets/pipelines/loading.py | # Copyright (c) OpenMMLab. All rights reserved.
import os.path as osp
import mmcv
import numpy as np
import pycocotools.mask as maskUtils
from mmdet.core import BitmapMasks, PolygonMasks
from ..builder import PIPELINES
try:
from panopticapi.utils import rgb2id
except ImportError:
rgb2id = None
@PIPELINES.r... | 20,521 | 34.140411 | 79 | py |
DSLA-DSLA | DSLA-DSLA/mmdet/datasets/pipelines/instaboost.py | # Copyright (c) OpenMMLab. All rights reserved.
import numpy as np
from ..builder import PIPELINES
@PIPELINES.register_module()
class InstaBoost:
r"""Data augmentation method in `InstaBoost: Boosting Instance
Segmentation Via Probability Map Guided Copy-Pasting
<https://arxiv.org/abs/1908.07801>`_.
... | 4,510 | 36.907563 | 79 | py |
DSLA-DSLA | DSLA-DSLA/mmdet/datasets/pipelines/compose.py | # Copyright (c) OpenMMLab. All rights reserved.
import collections
from mmcv.utils import build_from_cfg
from ..builder import PIPELINES
@PIPELINES.register_module()
class Compose:
"""Compose multiple transforms sequentially.
Args:
transforms (Sequence[dict | callable]): Sequence of transform objec... | 1,504 | 27.396226 | 79 | py |
DSLA-DSLA | DSLA-DSLA/mmdet/datasets/pipelines/auto_augment.py | # Copyright (c) OpenMMLab. All rights reserved.
import copy
import cv2
import mmcv
import numpy as np
from ..builder import PIPELINES
from .compose import Compose
_MAX_LEVEL = 10
def level_to_value(level, max_value):
"""Map from level to values based on max_value."""
return (level / _MAX_LEVEL) * max_value... | 36,537 | 39.824581 | 79 | py |
DSLA-DSLA | DSLA-DSLA/mmdet/datasets/pipelines/formating.py | # Copyright (c) OpenMMLab. All rights reserved.
from collections.abc import Sequence
import mmcv
import numpy as np
import torch
from mmcv.parallel import DataContainer as DC
from ..builder import PIPELINES
def to_tensor(data):
"""Convert objects of various python types to :obj:`torch.Tensor`.
Supported ty... | 13,291 | 32.821883 | 79 | py |
DSLA-DSLA | DSLA-DSLA/mmdet/datasets/pipelines/__init__.py | # Copyright (c) OpenMMLab. All rights reserved.
from .auto_augment import (AutoAugment, BrightnessTransform, ColorTransform,
ContrastTransform, EqualizeTransform, Rotate, Shear,
Translate)
from .compose import Compose
from .formating import (Collect, DefaultFormatBu... | 1,638 | 55.517241 | 79 | py |
DSLA-DSLA | DSLA-DSLA/mmdet/datasets/pipelines/transforms.py | # Copyright (c) OpenMMLab. All rights reserved.
import copy
import inspect
import math
import warnings
import cv2
import mmcv
import numpy as np
from numpy import random
from mmdet.core import PolygonMasks, find_inside_bboxes
from mmdet.core.evaluation.bbox_overlaps import bbox_overlaps
from ..builder import PIPELINE... | 109,530 | 38.989412 | 79 | py |
DSLA-DSLA | DSLA-DSLA/mmdet/datasets/pipelines/test_time_aug.py | # Copyright (c) OpenMMLab. All rights reserved.
import warnings
import mmcv
from ..builder import PIPELINES
from .compose import Compose
@PIPELINES.register_module()
class MultiScaleFlipAug:
"""Test-time augmentation with multiple scales and flipping.
An example configuration is as followed:
.. code-b... | 4,466 | 35.614754 | 78 | py |
DSLA-DSLA | DSLA-DSLA/mmdet/utils/contextmanagers.py | # Copyright (c) OpenMMLab. All rights reserved.
import asyncio
import contextlib
import logging
import os
import time
from typing import List
import torch
logger = logging.getLogger(__name__)
DEBUG_COMPLETED_TIME = bool(os.environ.get('DEBUG_COMPLETED_TIME', False))
@contextlib.asynccontextmanager
async def comple... | 4,125 | 32.544715 | 79 | py |
DSLA-DSLA | DSLA-DSLA/mmdet/utils/util_mixins.py | # Copyright (c) OpenMMLab. All rights reserved.
"""This module defines the :class:`NiceRepr` mixin class, which defines a
``__repr__`` and ``__str__`` method that only depend on a custom ``__nice__``
method, which you must define. This means you only have to overload one
function instead of two. Furthermore, if the ob... | 3,712 | 34.028302 | 78 | py |
DSLA-DSLA | DSLA-DSLA/mmdet/utils/profiling.py | # Copyright (c) OpenMMLab. All rights reserved.
import contextlib
import sys
import time
import torch
if sys.version_info >= (3, 7):
@contextlib.contextmanager
def profile_time(trace_name,
name,
enabled=True,
stream=None,
end... | 1,336 | 31.609756 | 73 | py |
DSLA-DSLA | DSLA-DSLA/mmdet/utils/misc.py | # Copyright (c) OpenMMLab. All rights reserved.
import glob
import os.path as osp
import warnings
def find_latest_checkpoint(path, suffix='pth'):
"""Find the latest checkpoint from the working directory.
Args:
path(str): The path to find checkpoints.
suffix(str): File extension.
D... | 1,203 | 29.871795 | 74 | py |
DSLA-DSLA | DSLA-DSLA/mmdet/utils/util_random.py | # Copyright (c) OpenMMLab. All rights reserved.
"""Helpers for random number generators."""
import numpy as np
def ensure_rng(rng=None):
"""Coerces input into a random number generator.
If the input is None, then a global random state is returned.
If the input is a numeric value, then that is used as a ... | 1,025 | 28.314286 | 119 | py |
DSLA-DSLA | DSLA-DSLA/mmdet/utils/logger.py | # Copyright (c) OpenMMLab. All rights reserved.
import logging
from mmcv.utils import get_logger
def get_root_logger(log_file=None, log_level=logging.INFO):
"""Get root logger.
Args:
log_file (str, optional): File path of log. Defaults to None.
log_level (int, optional): The level of logger.... | 529 | 24.238095 | 77 | py |
DSLA-DSLA | DSLA-DSLA/mmdet/utils/collect_env.py | # Copyright (c) OpenMMLab. All rights reserved.
from mmcv.utils import collect_env as collect_base_env
from mmcv.utils import get_git_hash
import mmdet
def collect_env():
"""Collect the information of the running environments."""
env_info = collect_base_env()
env_info['MMDetection'] = mmdet.__version__ +... | 471 | 25.222222 | 74 | py |
DSLA-DSLA | DSLA-DSLA/mmdet/utils/__init__.py | # Copyright (c) OpenMMLab. All rights reserved.
from .collect_env import collect_env
from .logger import get_root_logger
from .misc import find_latest_checkpoint
__all__ = [
'get_root_logger',
'collect_env',
'find_latest_checkpoint',
]
| 249 | 21.727273 | 47 | py |
BS-Net | BS-Net-main/loaddata.py | import pandas as pd
import numpy as np
from torch.utils.data import Dataset, DataLoader
from torchvision import transforms, utils
from PIL import Image
import random
from nyu_transform import *
import pdb
from scipy import io
class depthDataset(Dataset):
"""Face Landmarks dataset."""
def __init__(self, csv_fil... | 6,915 | 42.772152 | 115 | py |
BS-Net | BS-Net-main/evaluate_ibims_error_metrics.py | # -*- coding: utf-8 -*-
"""
Created on Thu Nov 01 19:18:59 2018
@author: Tobias Koch, [email protected]
Remote Sensing Technology, Technical University of Munich
www.lmf.bgu.tum.de
"""
import numpy as np
from skimage import feature
from scipy import ndimage
from sklearn.decomposition import PCA
import math
def compu... | 7,372 | 34.447115 | 120 | py |
BS-Net | BS-Net-main/sobel.py | import torch
import torch.nn as nn
import numpy as np
print(19//5)
class Sobel(nn.Module):
def __init__(self):
super(Sobel, self).__init__()
self.edge_conv=nn.Conv2d(1, 2, kernel_size=3, stride=1, padding=1, bias=False)
# edge_kx = np.array([[1, 0, -1], [2, 0, -2], [1, 0, -1]])
edge_... | 815 | 29.222222 | 86 | py |
BS-Net | BS-Net-main/test_iBims1.py | import warnings
warnings.filterwarnings("ignore")
import torch
import numpy as np
import torch.nn.parallel
import torch.backends.cudnn as cudnn
import torch.optim
import loaddata
import sobel
import os
import argparse
from models import modules as modules, net as net, dilation_resnet as resnet
from util import comput... | 11,843 | 41 | 140 | py |
BS-Net | BS-Net-main/util.py | import torch
from PIL import Image,ImageDraw,ImageFont
import matplotlib.pyplot as plt
import torch.nn as nn
import numpy as np
from skimage import feature
from scipy import ndimage
from sklearn.decomposition import PCA
import math
cmap = plt.cm.viridis
def lg10(x):
return torch.div(torch.log(x), math.log(10))
de... | 14,525 | 34.257282 | 120 | py |
BS-Net | BS-Net-main/nyu_transform.py | import torch
import numpy as np
from PIL import Image
import collections
try:
import accimage
except ImportError:
accimage = None
import random
import scipy.ndimage as ndimage
def _is_pil_image(img):
if accimage is not None:
return isinstance(img, (Image.Image, accimage.Image))
else:
... | 23,434 | 38.058333 | 137 | py |
BS-Net | BS-Net-main/metrics.py | import torch
import math
import numpy as np
def log10(x):
"""Convert a new tensor with the base-10 logarithm of the elements of x. """
return torch.log(x) / math.log(10)
class Result(object):
def __init__(self):
self.irmse, self.imae = 0, 0
self.mse, self.rmse, self.mae = 0, 0, 0
... | 4,037 | 37.09434 | 109 | py |
BS-Net | BS-Net-main/train.py | # -*- coding: UTF-8 -*-
import warnings
warnings.filterwarnings("ignore")
import argparse
import time
import os
import torch
import torch.nn as nn
import torch.nn.parallel
import torch.backends.cudnn as cudnn
import torch.optim
import loaddata
import random
import numpy as np
import util
from models import modules as m... | 6,175 | 35.544379 | 93 | py |
BS-Net | BS-Net-main/test_NYUDv2.py | import warnings
warnings.filterwarnings("ignore")
import time
import torch
import torch.nn.parallel
import torch.backends.cudnn as cudnn
import torch.optim
import loaddata
import numpy as np
from metrics import AverageMeter, Result
from models import modules as modules, net as net, dilation_resnet as resnet
import torc... | 6,987 | 35.395833 | 133 | py |
BS-Net | BS-Net-main/models/dilation_resnet.py | """Dilated ResNet"""
import math
import torch
import torch.utils.model_zoo as model_zoo
import torch.nn as nn
__all__ = ['ResNet', 'resnet18', 'resnet34', 'resnet50', 'resnet101',
'resnet152', 'BasicBlock', 'Bottleneck']
model_urls = {
'resnet18': 'https://download.pytorch.org/models/resnet18-5c106cde.... | 11,689 | 37.837209 | 162 | py |
BS-Net | BS-Net-main/models/modules.py | import torch
import torch.nn.functional as F
import torch.nn as nn
class _UpProjection(nn.Sequential):
def __init__(self, num_input_features, num_output_features):
super(_UpProjection, self).__init__()
self.conv1 = nn.Conv2d(num_input_features, num_output_features,
k... | 10,669 | 38.227941 | 125 | py |
BS-Net | BS-Net-main/models/net.py | import torch.nn as nn
import models.modules as modules
class model(nn.Module):
def __init__(self, Encoder, num_features, block_channel):
super(model, self).__init__()
self.E = Encoder #(2048,8,10)
self.DCE = modules.DCE(num_features,num_features//2, sizes=(1, 2, 3, 6))
self.BUBF = ... | 763 | 35.380952 | 80 | py |
correlate | correlate-master/main.py | from causal_discovery.LPCMCI.observational_discovery import observational_causal_discovery
from config import *
from correlation import corr_coefficients_and_p_values
from data_cleaning_and_imputation import *
from helper import histograms, dataset_creation, pca_function, \
autocorrelation, normalization
from pred... | 2,287 | 34.2 | 116 | py |
correlate | correlate-master/correlation.py | from multiprocessing.pool import ThreadPool as Pool
import numpy as np
import pandas as pd
import seaborn
import statsmodels.formula.api as sm
from matplotlib import pyplot as plt
from statsmodels.stats.multitest import multipletests
from tqdm import tqdm
from config import show_plots, load_precomputed_coefficients_a... | 4,211 | 34.694915 | 119 | py |
correlate | correlate-master/data_generation.py | import math
import numpy as np
import pandas as pd
from matplotlib import pyplot as plt
from tigramite import plotting as tp
import causal_discovery.LPCMCI.generate_data_mod as mod
# Imports from code inside directory
from config import noise_sigma, tau_max, contemp_fraction, verbosity_thesis, show_plots
def sample... | 9,030 | 35.711382 | 120 | py |
correlate | correlate-master/setup.py | """
Install tigramite
"""
from __future__ import print_function
import pathlib
import os
from setuptools import setup, Extension
from setuptools.command.build_ext import build_ext
# Handle building against numpy headers before installing numpy
class UseNumpyHeadersBuildExt(build_ext):
"""
Subclassed build_ex... | 4,316 | 34.677686 | 114 | py |
correlate | correlate-master/data_cleaning_and_imputation.py | from datetime import datetime
import pandas as pd
def data_cleaning_and_imputation(df, target_label, add_all_yesterdays_features, add_yesterdays_target_feature,
add_ereyesterdays_target_feature):
"""
interpolate weight and VO2Max
add yesterdays and ereyesterdays mood as f... | 5,926 | 36.27673 | 111 | py |
correlate | correlate-master/test_data_generation.py | import pandas as pd
from statsmodels.compat.pandas import assert_frame_equal
from config import checkpoint_path
from data_generation import data_generator
from intervention_proposal.get_intervention import lin_f
class TestGetIntervention:
def test_data_generator(self):
# # ERROR X[:max_lag] = ts_old[-ma... | 3,865 | 32.327586 | 91 | py |
correlate | correlate-master/phone_io.py | import json
import numpy as np
import pandas as pd
from config import target_label, phone_vis_height_width, survey_value_manipulation
from helper import bound
def write_csv_for_phone_visualization(ci95,
ci68,
target_mean,
... | 8,512 | 52.20625 | 120 | py |
correlate | correlate-master/checkpoints.py | import pickle
from config import checkpoint_path
from data_generation import generate_stationary_scm
def save_checkpoint(ts_measured_actual, was_intervened, ts_generated_actual, ts_generated_optimal, regret_list,
random_seed, random_state, coeff, min_coeff, sim_study_input):
# save input data... | 1,794 | 56.903226 | 203 | py |
correlate | correlate-master/helper.py | import math
from datetime import datetime
import matplotlib.patches as mpatches
import numpy as np
import pandas as pd
import seaborn as sns
from matplotlib import pyplot as plt
from sklearn.decomposition import PCA
from statsmodels.graphics.tsaplots import plot_acf, plot_pacf
from config import add_all_yesterdays_fe... | 9,069 | 40.415525 | 119 | py |
correlate | correlate-master/config_helper.py |
import numpy as np
| 25 | 2.25 | 18 | py |
correlate | correlate-master/tmp.py | import pandas as pd
my_list = []
for i in range(1000):
my_list.append(14.7498 - 13.2869 * (i+30) ** 0.0101585)
df = pd.DataFrame(my_list)
print(my_list) | 156 | 25.166667 | 59 | py |
correlate | correlate-master/config.py | """
config parameters
"""
verbosity = 0
verbosity_thesis = 0 # 1 regret, 2
# path
private_folder_path = '/home/chrei/code/quantifiedSelfData/'
checkpoint_path = '/home/chrei/PycharmProjects/correlate/checkpoints/'
plots_path = '/home/chrei/PycharmProjects/correlate/plots/thesis_plots/'
# target
target_label = '0' #... | 2,478 | 24.295918 | 171 | py |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.