repo stringclasses 454
values | file_path stringlengths 5 201 | extension stringclasses 1
value | content stringlengths 8 509k | num_lines int64 3 16.9k | size_bytes int64 8 511k |
|---|---|---|---|---|---|
mmdetection | tests/test_models/test_dense_heads/test_fcos_head.py | .py | # Copyright (c) OpenMMLab. All rights reserved.
from unittest import TestCase
import torch
from mmengine.structures import InstanceData
from mmdet.models.dense_heads import FCOSHead
class TestFCOSHead(TestCase):
def test_fcos_head_loss(self):
"""Tests fcos head loss when truth is empty and non-empty.""... | 98 | 4,509 |
mmdetection | tests/test_models/test_dense_heads/test_autoassign_head.py | .py | # Copyright (c) OpenMMLab. All rights reserved.
from unittest import TestCase
import torch
from mmengine.structures import InstanceData
from mmdet.models.dense_heads import AutoAssignHead
class TestAutoAssignHead(TestCase):
def test_autoassign_head_loss(self):
"""Tests autoassign head loss when truth i... | 75 | 3,186 |
mmdetection | tests/test_models/test_dense_heads/test_centripetal_head.py | .py | # Copyright (c) OpenMMLab. All rights reserved.
from unittest import TestCase
import torch
from mmengine.structures import InstanceData
from mmdet.models.dense_heads import CentripetalHead
class TestCentripetalHead(TestCase):
def test_centripetal_head_loss(self):
"""Tests corner head loss when truth is... | 75 | 3,158 |
mmdetection | tests/test_models/test_dense_heads/test_ssd_head.py | .py | # Copyright (c) OpenMMLab. All rights reserved.
from math import ceil
from unittest import TestCase
import torch
from mmengine import Config
from mmengine.structures import InstanceData
from mmdet import * # noqa
from mmdet.models.dense_heads import SSDHead
class TestSSDHead(TestCase):
def test_ssd_head_loss(... | 92 | 3,494 |
mmdetection | tests/test_models/test_dense_heads/test_corner_head.py | .py | # Copyright (c) OpenMMLab. All rights reserved.
from unittest import TestCase
import torch
from mmengine.structures import InstanceData
from mmdet.evaluation import bbox_overlaps
from mmdet.models.dense_heads import CornerHead
class TestCornerHead(TestCase):
def test_corner_head_loss(self):
"""Tests co... | 179 | 7,299 |
mmdetection | tests/test_models/test_dense_heads/test_fsaf_head.py | .py | # Copyright (c) OpenMMLab. All rights reserved.
from math import ceil
from unittest import TestCase
import torch
from mmengine import Config
from mmengine.structures import InstanceData
from mmdet.models.dense_heads import FSAFHead
class TestFSAFHead(TestCase):
def test_fsaf_head_loss(self):
"""Tests f... | 94 | 3,536 |
mmdetection | tests/test_models/test_dense_heads/test_atss_head.py | .py | # Copyright (c) OpenMMLab. All rights reserved.
from unittest import TestCase
import torch
from mmengine import Config
from mmengine.structures import InstanceData
from mmdet import * # noqa
from mmdet.models.dense_heads import ATSSHead
class TestATSSHead(TestCase):
def test_atss_head_loss(self):
"""T... | 95 | 3,776 |
mmdetection | tests/test_models/test_dense_heads/test_centernet_update_head.py | .py | # Copyright (c) OpenMMLab. All rights reserved.
from unittest import TestCase
import torch
from mmengine.structures import InstanceData
from mmdet.models.dense_heads import CenterNetUpdateHead
class TestCenterNetUpdateHead(TestCase):
def test_centernet_update_head_loss(self):
"""Tests fcos head loss wh... | 64 | 2,608 |
mmdetection | tests/test_models/test_dense_heads/test_ga_rpn_head.py | .py | # Copyright (c) OpenMMLab. All rights reserved.
from unittest import TestCase
import torch
from mmengine.config import ConfigDict
from mmengine.structures import InstanceData
from mmdet.models.dense_heads import GARPNHead
ga_rpn_config = ConfigDict(
dict(
num_classes=1,
in_channels=4,
fea... | 144 | 5,031 |
mmdetection | tests/test_models/test_dense_heads/test_yolo_head.py | .py | # Copyright (c) OpenMMLab. All rights reserved.
from unittest import TestCase
import torch
from mmengine.config import Config
from mmengine.structures import InstanceData
from mmdet.models.dense_heads import YOLOV3Head
class TestYOLOV3Head(TestCase):
def test_yolo_head_loss(self):
"""Tests YOLO head lo... | 81 | 3,290 |
mmdetection | tests/test_models/test_dense_heads/test_ld_head.py | .py | # Copyright (c) OpenMMLab. All rights reserved.
from unittest import TestCase
import torch
from mmengine import Config
from mmengine.structures import InstanceData
from mmdet import * # noqa
from mmdet.models.dense_heads import GFLHead, LDHead
class TestLDHead(TestCase):
def test_ld_head_loss(self):
"... | 150 | 6,184 |
mmdetection | tests/test_models/test_dense_heads/test_lad_head.py | .py | # Copyright (c) OpenMMLab. All rights reserved.
from unittest import TestCase
import numpy as np
import torch
from mmengine import Config
from mmengine.structures import InstanceData
from mmdet import * # noqa
from mmdet.models.dense_heads import LADHead, lad_head
from mmdet.models.dense_heads.lad_head import levels... | 169 | 6,520 |
mmdetection | tests/test_models/test_dense_heads/test_solo_head.py | .py | # Copyright (c) OpenMMLab. All rights reserved.
from unittest import TestCase
import numpy as np
import torch
from mmengine.config import ConfigDict
from mmengine.structures import InstanceData
from parameterized import parameterized
from mmdet import * # noqa
from mmdet.models.dense_heads import (DecoupledSOLOHead,... | 145 | 5,125 |
mmdetection | tests/test_models/test_dense_heads/test_embedding_rpn_head.py | .py | # Copyright (c) OpenMMLab. All rights reserved.
from unittest import TestCase
import pytest
import torch
from mmengine.structures import InstanceData
from mmdet.models.dense_heads import EmbeddingRPNHead
from mmdet.structures import DetDataSample
class TestEmbeddingRPNHead(TestCase):
def test_init(self):
... | 56 | 1,802 |
mmdetection | tests/test_models/test_dense_heads/test_vfnet_head.py | .py | # Copyright (c) OpenMMLab. All rights reserved.
from unittest import TestCase
import torch
from mmengine import Config
from mmengine.structures import InstanceData
from mmdet import * # noqa
from mmdet.models.dense_heads import VFNetHead
class TestVFNetHead(TestCase):
def test_vfnet_head_loss(self):
"... | 136 | 5,715 |
mmdetection | tests/test_models/test_dense_heads/test_guided_anchor_head.py | .py | # Copyright (c) OpenMMLab. All rights reserved.
from unittest import TestCase
import torch
from mmengine.config import ConfigDict
from mmengine.structures import InstanceData
from mmdet.models.dense_heads import GuidedAnchorHead
guided_anchor_head_config = ConfigDict(
dict(
num_classes=4,
in_chan... | 158 | 5,905 |
mmdetection | tests/test_models/test_dense_heads/test_yolof_head.py | .py | # Copyright (c) OpenMMLab. All rights reserved.
from unittest import TestCase
import torch
from mmengine import Config
from mmengine.structures import InstanceData
from mmdet import * # noqa
from mmdet.models.dense_heads import YOLOFHead
class TestYOLOFHead(TestCase):
def test_yolof_head_loss(self):
"... | 89 | 3,396 |
mmdetection | tests/test_models/test_dense_heads/test_solov2_head.py | .py | # Copyright (c) OpenMMLab. All rights reserved.
from unittest import TestCase
import numpy as np
import torch
from mmengine.config import ConfigDict
from mmengine.structures import InstanceData
from mmdet import * # noqa
from mmdet.models.dense_heads import SOLOV2Head
from mmdet.structures.mask import BitmapMasks
... | 131 | 4,598 |
mmdetection | tests/test_models/test_dense_heads/test_centernet_head.py | .py | # Copyright (c) OpenMMLab. All rights reserved.
from unittest import TestCase
import torch
from mmengine.config import ConfigDict
from mmengine.structures import InstanceData
from mmdet.models.dense_heads import CenterNetHead
class TestCenterNetHead(TestCase):
def test_center_head_loss(self):
"""Tests ... | 159 | 7,238 |
mmdetection | tests/test_models/test_dense_heads/test_ga_retina_head.py | .py | # Copyright (c) OpenMMLab. All rights reserved.
from unittest import TestCase
import torch
from mmengine.config import ConfigDict
from mmdet.models.dense_heads import GARetinaHead
ga_retina_head_config = ConfigDict(
dict(
num_classes=4,
in_channels=4,
feat_channels=4,
stacked_conv... | 98 | 3,067 |
mmdetection | tests/test_models/test_dense_heads/test_retina_sepBN_head.py | .py | # Copyright (c) OpenMMLab. All rights reserved.
from unittest import TestCase
import torch
from mmengine import Config
from mmengine.structures import InstanceData
from mmdet import * # noqa
from mmdet.models.dense_heads import RetinaSepBNHead
class TestRetinaSepBNHead(TestCase):
def test_init(self):
... | 89 | 3,483 |
mmdetection | tests/test_models/test_dense_heads/test_gfl_head.py | .py | # Copyright (c) OpenMMLab. All rights reserved.
from unittest import TestCase
import torch
from mmengine import Config
from mmengine.structures import InstanceData
from mmdet import * # noqa
from mmdet.models.dense_heads import GFLHead
class TestGFLHead(TestCase):
def test_gfl_head_loss(self):
"""Test... | 90 | 3,503 |
mmdetection | tests/test_models/test_dense_heads/test_nasfcos_head.py | .py | # Copyright (c) OpenMMLab. All rights reserved.
from unittest import TestCase
import torch
from mmengine.structures import InstanceData
from mmdet.models.dense_heads import NASFCOSHead
class TestNASFCOSHead(TestCase):
def test_nasfcos_head_loss(self):
"""Tests nasfcos head loss when truth is empty and ... | 71 | 3,065 |
mmdetection | tests/test_models/test_dense_heads/test_boxinst_head.py | .py | # Copyright (c) OpenMMLab. All rights reserved.
from unittest import TestCase
import numpy as np
import torch
from mmengine import MessageHub
from mmengine.config import ConfigDict
from mmengine.structures import InstanceData
from mmdet.models.dense_heads import BoxInstBboxHead, BoxInstMaskHead
from mmdet.structures.... | 126 | 5,300 |
mmdetection | tests/test_models/test_dense_heads/test_cascade_rpn_head.py | .py | # Copyright (c) OpenMMLab. All rights reserved.
from unittest import TestCase
import torch
from mmengine.config import ConfigDict
from mmengine.structures import InstanceData
from mmdet.models.dense_heads import CascadeRPNHead
from mmdet.structures import DetDataSample
rpn_weight = 0.7
cascade_rpn_config = ConfigDic... | 180 | 6,383 |
mmdetection | tests/test_models/test_dense_heads/test_rpn_head.py | .py | # Copyright (c) OpenMMLab. All rights reserved.
from unittest import TestCase
import pytest
import torch
from mmengine import Config
from mmengine.structures import InstanceData
from mmdet import * # noqa
from mmdet.models.dense_heads import RPNHead
class TestRPNHead(TestCase):
def test_init(self):
""... | 125 | 4,805 |
mmdetection | tests/test_models/test_dense_heads/test_paa_head.py | .py | # Copyright (c) OpenMMLab. All rights reserved.
from unittest import TestCase
import numpy as np
import torch
from mmengine import Config
from mmengine.structures import InstanceData
from mmdet import * # noqa
from mmdet.models.dense_heads import PAAHead, paa_head
from mmdet.models.utils import levels_to_images
cl... | 149 | 5,675 |
mmdetection | tests/test_models/test_dense_heads/test_reppoints_head.py | .py | import unittest
import torch
from mmengine.config import ConfigDict
from mmengine.structures import InstanceData
from parameterized import parameterized
from mmdet.models.dense_heads import RepPointsHead
from mmdet.structures import DetDataSample
class TestRepPointsHead(unittest.TestCase):
@parameterized.expan... | 144 | 5,581 |
mmdetection | tests/test_models/test_dense_heads/test_ddq_detr_head.py | .py | # Copyright (c) OpenMMLab. All rights reserved.
import json
from unittest import TestCase
import torch
from mmengine import Config
from mmengine.structures import InstanceData
from mmdet.models.dense_heads import DDQDETRHead
from mmdet.structures import DetDataSample
class TestDDQDETRHead(TestCase):
def test_d... | 172 | 6,526 |
mmdetection | tests/test_models/test_dense_heads/test_fovea_head.py | .py | # Copyright (c) OpenMMLab. All rights reserved.
from unittest import TestCase
import torch
from mmengine.structures import InstanceData
from mmdet.models.dense_heads import FoveaHead
class TestFOVEAHead(TestCase):
def test_fovea_head_loss(self):
"""Tests anchor head loss when truth is empty and non-emp... | 62 | 2,443 |
mmdetection | tests/test_models/test_dense_heads/test_anchor_head.py | .py | # Copyright (c) OpenMMLab. All rights reserved.
from unittest import TestCase
import torch
from mmengine import Config
from mmengine.structures import InstanceData
from mmdet import * # noqa
from mmdet.models.dense_heads import AnchorHead
class TestAnchorHead(TestCase):
def test_anchor_head_loss(self):
... | 78 | 3,035 |
mmdetection | tests/test_models/test_dense_heads/test_condinst_head.py | .py | # Copyright (c) OpenMMLab. All rights reserved.
from unittest import TestCase
import numpy as np
import torch
from mmengine.config import ConfigDict
from mmengine.structures import InstanceData
from mmdet.models.dense_heads import CondInstBboxHead, CondInstMaskHead
from mmdet.structures.mask import BitmapMasks
def ... | 201 | 8,815 |
mmdetection | tests/test_models/test_dense_heads/test_pisa_retinanet_head.py | .py | # Copyright (c) OpenMMLab. All rights reserved.
from math import ceil
from unittest import TestCase
import torch
from mmengine import Config
from mmengine.structures import InstanceData
from mmdet import * # noqa
from mmdet.models.dense_heads import PISARetinaHead
class TestPISARetinaHead(TestCase):
def test_... | 106 | 4,122 |
mmdetection | tests/test_structures/test_det_data_sample.py | .py | from unittest import TestCase
import numpy as np
import pytest
import torch
from mmengine.structures import InstanceData, PixelData
from mmdet.structures import DetDataSample
def _equal(a, b):
if isinstance(a, (torch.Tensor, np.ndarray)):
return (a == b).all()
else:
return a == b
class Tes... | 167 | 6,906 |
mmdetection | tests/test_structures/test_reid_data_sample.py | .py | # Copyright (c) OpenMMLab. All rights reserved.
from unittest import TestCase
import numpy as np
import torch
from mmengine.structures import LabelData
from mmdet.structures import ReIDDataSample
def _equal(a, b):
if isinstance(a, (torch.Tensor, np.ndarray)):
return (a == b).all()
else:
retu... | 130 | 4,576 |
mmdetection | tests/test_structures/test_track_data_sample.py | .py | from unittest import TestCase
import pytest
from mmdet.structures import DetDataSample, TrackDataSample
class TestDetDataSample(TestCase):
def test_init(self):
track_data_sample = TrackDataSample(
metainfo=dict(key_frames_inds=[0], ref_frames_inds=[1]))
assert 'key_frames_inds' in ... | 48 | 1,884 |
mmdetection | tests/test_structures/test_mask/test_mask_structures.py | .py | from unittest import TestCase
import numpy as np
from mmengine.testing import assert_allclose
from mmdet.structures.mask import BitmapMasks, PolygonMasks
class TestMaskStructures(TestCase):
def test_bitmap_translate_same_size(self):
mask_array = np.zeros((5, 10, 10), dtype=np.uint8)
mask_array[... | 74 | 2,740 |
mmdetection | tests/test_structures/test_bbox/utils.py | .py | from mmdet.structures.bbox import BaseBoxes
class ToyBaseBoxes(BaseBoxes):
box_dim = 4
@property
def centers(self):
pass
@property
def areas(self):
pass
@property
def widths(self):
pass
@property
def heights(self):
pass
def flip_(self, img_... | 56 | 938 |
mmdetection | tests/test_structures/test_bbox/test_base_boxes.py | .py | from unittest import TestCase
import numpy as np
import torch
from mmengine.testing import assert_allclose
from .utils import ToyBaseBoxes
class TestBaseBoxes(TestCase):
def test_init(self):
box_tensor = torch.rand((3, 4, 4))
boxes = ToyBaseBoxes(box_tensor)
boxes = ToyBaseBoxes(box_te... | 277 | 10,821 |
mmdetection | tests/test_structures/test_bbox/test_horizontal_boxes.py | .py | import random
from math import sqrt
from unittest import TestCase
import cv2
import numpy as np
import torch
from mmengine.testing import assert_allclose
from mmdet.structures.bbox import HorizontalBoxes
from mmdet.structures.mask import BitmapMasks, PolygonMasks
class TestHorizontalBoxes(TestCase):
def test_i... | 188 | 7,719 |
mmdetection | tests/test_structures/test_bbox/test_box_type.py | .py | from unittest import TestCase
from unittest.mock import MagicMock
import torch
from mmdet.structures.bbox.box_type import (_box_type_to_name, box_converters,
box_types, convert_box_type,
get_box_type, register_box,
... | 192 | 5,813 |
mmdetection | projects/ViTDet/vitdet/layer_decay_optimizer_constructor.py | .py | # Copyright (c) OpenMMLab. All rights reserved.
import json
from typing import List
import torch.nn as nn
from mmengine.dist import get_dist_info
from mmengine.logging import MMLogger
from mmengine.optim import DefaultOptimWrapperConstructor
from mmdet.registry import OPTIM_WRAPPER_CONSTRUCTORS
def get_layer_id_for... | 110 | 4,218 |
mmdetection | projects/ViTDet/vitdet/__init__.py | .py | from .fp16_compression_hook import Fp16CompresssionHook
from .layer_decay_optimizer_constructor import LayerDecayOptimizerConstructor
from .simple_fpn import SimpleFPN
from .vit import LN2d, ViT
__all__ = [
'LayerDecayOptimizerConstructor', 'ViT', 'SimpleFPN', 'LN2d',
'Fp16CompresssionHook'
]
| 10 | 303 |
mmdetection | projects/ViTDet/vitdet/simple_fpn.py | .py | # Copyright (c) OpenMMLab. All rights reserved.
from typing import List
import torch.nn as nn
import torch.nn.functional as F
from mmcv.cnn import ConvModule, build_norm_layer
from mmengine.model import BaseModule
from torch import Tensor
from mmdet.registry import MODELS
from mmdet.utils import MultiConfig, OptConfi... | 103 | 3,467 |
mmdetection | projects/ViTDet/vitdet/fp16_compression_hook.py | .py | # Copyright (c) OpenMMLab. All rights reserved.
from mmengine.hooks import Hook
from mmdet.registry import HOOKS
@HOOKS.register_module()
class Fp16CompresssionHook(Hook):
"""Support fp16 compression in DDP mode.
In detectron2, vitdet use Fp16CompresssionHook in training process
Fp16CompresssionHook can... | 26 | 920 |
mmdetection | projects/ViTDet/vitdet/vit.py | .py | # Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved
import math
import torch
import torch.nn as nn
import torch.nn.functional as F
from mmcv.cnn import build_activation_layer, build_norm_layer
from mmcv.cnn.bricks import DropPath
from mmengine.logging import MMLogger
from mmengine.model import BaseM... | 449 | 14,727 |
mmdetection | projects/ViTDet/configs/vitdet_mask-rcnn_vit-b-mae_lsj-100e.py | .py | _base_ = [
'../../../configs/_base_/models/mask-rcnn_r50_fpn.py',
'./lsj-100e_coco-instance.py',
]
custom_imports = dict(imports=['projects.ViTDet.vitdet'])
backbone_norm_cfg = dict(type='LN', requires_grad=True)
norm_cfg = dict(type='LN2d', requires_grad=True)
image_size = (1024, 1024)
batch_augments = [
... | 61 | 1,577 |
mmdetection | projects/ViTDet/configs/lsj-100e_coco-instance.py | .py | _base_ = [
'../../../configs/_base_/default_runtime.py',
]
# dataset settings
dataset_type = 'CocoDataset'
data_root = 'data/coco/'
image_size = (1024, 1024)
backend_args = None
train_pipeline = [
dict(type='LoadImageFromFile', backend_args=backend_args),
dict(type='LoadAnnotations', with_bbox=True, with... | 136 | 3,947 |
mmdetection | projects/Detic/demo.py | .py | # Copyright (c) OpenMMLab. All rights reserved.
import os
import urllib
from argparse import ArgumentParser
import mmcv
import torch
from mmengine.logging import print_log
from mmengine.utils import ProgressBar, scandir
from mmdet.apis import inference_detector, init_detector
from mmdet.registry import VISUALIZERS
fr... | 143 | 4,710 |
mmdetection | projects/Detic/detic/utils.py | .py | # Copyright (c) OpenMMLab. All rights reserved.
import numpy as np
import torch
import torch.nn.functional as F
from mmengine.logging import print_log
from .text_encoder import CLIPTextEncoder
# download from
# https://github.com/facebookresearch/Detic/tree/main/datasets/metadata
DATASET_EMBEDDINGS = {
'lvis': 'd... | 79 | 2,864 |
mmdetection | projects/Detic/detic/text_encoder.py | .py | # Copyright (c) OpenMMLab. All rights reserved.
from typing import List, Union
import torch
import torch.nn as nn
class CLIPTextEncoder(nn.Module):
def __init__(self, model_name='ViT-B/32'):
super().__init__()
import clip
from clip.simple_tokenizer import SimpleTokenizer
self.tok... | 51 | 1,605 |
mmdetection | projects/Detic/detic/__init__.py | .py | # Copyright (c) OpenMMLab. All rights reserved.
from .centernet_rpn_head import CenterNetRPNHead
from .detic_bbox_head import DeticBBoxHead
from .detic_roi_head import DeticRoIHead
from .zero_shot_classifier import ZeroShotClassifier
__all__ = [
'CenterNetRPNHead', 'DeticBBoxHead', 'DeticRoIHead', 'ZeroShotClassif... | 10 | 327 |
mmdetection | projects/Detic/detic/detic_bbox_head.py | .py | # Copyright (c) OpenMMLab. All rights reserved.
from typing import Optional, Union
from mmengine.config import ConfigDict
from mmengine.structures import InstanceData
from torch import Tensor
from mmdet.models.layers import multiclass_nms
from mmdet.models.roi_heads.bbox_heads import Shared2FCBBoxHead
from mmdet.mode... | 113 | 4,599 |
mmdetection | projects/Detic/detic/zero_shot_classifier.py | .py | # Copyright (c) Facebook, Inc. and its affiliates.
import numpy as np
import torch
from torch import nn
from torch.nn import functional as F
from mmdet.registry import MODELS
@MODELS.register_module(force=True) # avoid bug
class ZeroShotClassifier(nn.Module):
def __init__(
self,
in_features: in... | 74 | 2,324 |
mmdetection | projects/Detic/detic/centernet_rpn_head.py | .py | # Copyright (c) OpenMMLab. All rights reserved.
import copy
from typing import List, Sequence, Tuple
import torch
import torch.nn as nn
from mmcv.cnn import Scale
from mmengine import ConfigDict
from mmengine.structures import InstanceData
from torch import Tensor
from mmdet.models.dense_heads import CenterNetUpdateH... | 197 | 7,938 |
mmdetection | projects/Detic/detic/detic_roi_head.py | .py | # Copyright (c) OpenMMLab. All rights reserved.
from typing import List, Sequence, Tuple
import torch
from mmengine.structures import InstanceData
from torch import Tensor
from mmdet.models.roi_heads import CascadeRoIHead
from mmdet.models.task_modules.samplers import SamplingResult
from mmdet.models.test_time_augs i... | 327 | 13,673 |
mmdetection | projects/Detic/configs/detic_centernet2_swin-b_fpn_4x_lvis-coco-in21k.py | .py | _base_ = 'mmdet::common/lsj-200e_coco-detection.py'
custom_imports = dict(
imports=['projects.Detic.detic'], allow_failed_imports=False)
image_size = (1024, 1024)
batch_augments = [dict(type='BatchFixedSizePad', size=image_size)]
cls_layer = dict(
type='ZeroShotClassifier',
zs_weight_path='rand',
zs_... | 299 | 9,887 |
mmdetection | projects/RF100-Benchmark/coco_metric.py | .py | # Copyright (c) OpenMMLab. All rights reserved.
import itertools
import os.path as osp
import tempfile
from collections import OrderedDict
from typing import Dict
import numpy as np
from mmengine.fileio import load
from mmengine.logging import MMLogger
from terminaltables import AsciiTable
from mmdet.datasets.api_wra... | 244 | 10,047 |
mmdetection | projects/RF100-Benchmark/__init__.py | .py | from .coco import RF100CocoDataset
from .coco_metric import RF100CocoMetric
__all__ = ['RF100CocoDataset', 'RF100CocoMetric']
| 5 | 127 |
mmdetection | projects/RF100-Benchmark/coco.py | .py | # Copyright (c) OpenMMLab. All rights reserved.
import copy
import os.path as osp
from typing import List, Union
from mmengine.fileio import get_local_path
from mmdet.datasets.api_wrappers import COCO
from mmdet.datasets.coco import CocoDataset
from mmdet.registry import DATASETS
@DATASETS.register_module()
class R... | 214 | 8,712 |
mmdetection | projects/RF100-Benchmark/scripts/create_new_config.py | .py | from argparse import ArgumentParser
from mmengine.fileio import load
from mmengine.utils import mkdir_or_exist
def parse_args():
parser = ArgumentParser(description='create new config')
parser.add_argument('config')
parser.add_argument('dataset')
parser.add_argument('--save-dir', default='temp_config... | 43 | 1,307 |
mmdetection | projects/RF100-Benchmark/scripts/download_dataset.py | .py | from argparse import ArgumentParser
from os import environ
from pathlib import Path
from roboflow import Roboflow
def main():
# construct the argument parser and parse the arguments
parser = ArgumentParser()
parser.add_argument(
'-p',
'--project',
required=True,
type=str,... | 66 | 1,784 |
mmdetection | projects/RF100-Benchmark/scripts/parse_dataset_link.py | .py | import re
from argparse import ArgumentParser
def main():
parser = ArgumentParser(
description='A handy script that will decompose and print from '
"a roboflow dataset link it's workspace, project and version")
parser.add_argument(
'-l', '--link', required=True, help='A link to a robof... | 19 | 571 |
mmdetection | projects/RF100-Benchmark/scripts/log_extract.py | .py | import argparse
import csv
import json
import os
import re
import numpy as np
import pandas as pd
from openpyxl import load_workbook
from openpyxl.styles import Alignment
def parse_args():
parser = argparse.ArgumentParser(description='log_name')
parser.add_argument(
'method', type=str, help='method n... | 287 | 10,292 |
mmdetection | projects/RF100-Benchmark/configs/tood_r50_fpn_ms_8xb8_tweeter-profile.py | .py | _base_ = '../../../configs/tood/tood_r50_fpn_1x_coco.py'
custom_imports = dict(
imports=['projects.RF100-Benchmark'], allow_failed_imports=False)
data_root = 'rf100/tweeter-profile/'
class_name = ('profile_info', )
num_classes = len(class_name)
metainfo = dict(classes=class_name)
image_scale = (640, 640)
model =... | 102 | 2,950 |
mmdetection | projects/RF100-Benchmark/configs/faster-rcnn_r50_fpn_ms_8xb8_tweeter-profile.py | .py | _base_ = '../../../configs/faster_rcnn/faster-rcnn_r50_fpn_1x_coco.py'
custom_imports = dict(
imports=['projects.RF100-Benchmark'], allow_failed_imports=False)
data_root = 'rf100/tweeter-profile/'
class_name = ('profile_info', )
num_classes = len(class_name)
metainfo = dict(classes=class_name)
image_scale = (640,... | 102 | 3,016 |
mmdetection | projects/RF100-Benchmark/configs/dino_r50_fpn_ms_8xb8_tweeter-profile.py | .py | _base_ = '../../../configs/dino/dino-4scale_r50_8xb2-12e_coco.py'
custom_imports = dict(
imports=['projects.RF100-Benchmark'], allow_failed_imports=False)
data_root = 'rf100/tweeter-profile/'
class_name = ('profile_info', )
num_classes = len(class_name)
metainfo = dict(classes=class_name)
image_scale = (640, 640)... | 103 | 3,021 |
mmdetection | projects/CO-DETR/configs/codino/co_dino_5scale_r50_8xb2_1x_coco.py | .py | _base_ = './co_dino_5scale_r50_lsj_8xb2_1x_coco.py'
model = dict(
use_lsj=False, data_preprocessor=dict(pad_mask=False, batch_augments=None))
# train_pipeline, NOTE the img_scale and the Pad's size_divisor is different
# from the default setting in mmdet.
train_pipeline = [
dict(type='LoadImageFromFile', back... | 69 | 2,575 |
mmdetection | projects/CO-DETR/configs/codino/co_dino_5scale_swin_l_16xb1_1x_coco.py | .py | _base_ = ['co_dino_5scale_r50_8xb2_1x_coco.py']
pretrained = 'https://github.com/SwinTransformer/storage/releases/download/v1.0.0/swin_large_patch4_window12_384_22k.pth' # noqa
# model settings
model = dict(
backbone=dict(
_delete_=True,
type='SwinTransformer',
pretrain_img_size=384,
... | 32 | 1,032 |
mmdetection | projects/CO-DETR/configs/codino/co_dino_5scale_r50_lsj_8xb2_3x_coco.py | .py | _base_ = ['co_dino_5scale_r50_lsj_8xb2_1x_coco.py']
param_scheduler = [dict(milestones=[30])]
train_cfg = dict(max_epochs=36)
| 5 | 127 |
mmdetection | projects/CO-DETR/configs/codino/co_dino_5scale_r50_lsj_8xb2_1x_coco.py | .py | _base_ = 'mmdet::common/ssj_scp_270k_coco-instance.py'
custom_imports = dict(
imports=['projects.CO-DETR.codetr'], allow_failed_imports=False)
# model settings
num_dec_layer = 6
loss_lambda = 2.0
num_classes = 80
image_size = (1024, 1024)
batch_augments = [
dict(type='BatchFixedSizePad', size=image_size, pad... | 360 | 12,307 |
mmdetection | projects/CO-DETR/configs/codino/co_dino_5scale_swin_l_lsj_16xb1_1x_coco.py | .py | _base_ = ['co_dino_5scale_r50_lsj_8xb2_1x_coco.py']
image_size = (1280, 1280)
batch_augments = [
dict(type='BatchFixedSizePad', size=image_size, pad_mask=True)
]
pretrained = 'https://github.com/SwinTransformer/storage/releases/download/v1.0.0/swin_large_patch4_window12_384_22k.pth' # noqa
# model settings
model... | 73 | 2,359 |
mmdetection | projects/CO-DETR/configs/codino/co_dino_5scale_swin_l_lsj_16xb1_3x_coco.py | .py | _base_ = ['co_dino_5scale_swin_l_lsj_16xb1_1x_coco.py']
model = dict(backbone=dict(drop_path_rate=0.5))
param_scheduler = [dict(type='MultiStepLR', milestones=[30])]
train_cfg = dict(max_epochs=36)
| 8 | 201 |
mmdetection | projects/CO-DETR/configs/codino/co_dino_5scale_swin_l_16xb1_16e_o365tococo.py | .py | _base_ = ['co_dino_5scale_r50_8xb2_1x_coco.py']
pretrained = 'https://github.com/SwinTransformer/storage/releases/download/v1.0.0/swin_large_patch4_window12_384_22k.pth' # noqa
load_from = 'https://download.openmmlab.com/mmdetection/v3.0/codetr/co_dino_5scale_swin_large_16e_o365tococo-614254c9.pth' # noqa
# model s... | 116 | 4,461 |
mmdetection | projects/CO-DETR/configs/codino/co_dino_5scale_swin_l_16xb1_3x_coco.py | .py | _base_ = ['co_dino_5scale_swin_l_16xb1_1x_coco.py']
# model settings
model = dict(backbone=dict(drop_path_rate=0.6))
param_scheduler = [dict(milestones=[30])]
train_cfg = dict(max_epochs=36)
| 7 | 192 |
mmdetection | projects/CO-DETR/codetr/transformer.py | .py | import math
import warnings
import torch
import torch.nn as nn
from mmcv.cnn import build_norm_layer
from mmcv.cnn.bricks.transformer import (BaseTransformerLayer,
TransformerLayerSequence,
build_transformer_layer_sequence)
from mmcv.ops... | 1,377 | 58,175 |
mmdetection | projects/CO-DETR/codetr/co_atss_head.py | .py | from typing import List
import torch
from torch import Tensor
from mmdet.models.dense_heads import ATSSHead
from mmdet.models.utils import images_to_levels, multi_apply
from mmdet.registry import MODELS
from mmdet.utils import InstanceList, OptInstanceList, reduce_mean
@MODELS.register_module()
class CoATSSHead(ATS... | 154 | 6,562 |
mmdetection | projects/CO-DETR/codetr/__init__.py | .py | # Copyright (c) OpenMMLab. All rights reserved.
from .co_atss_head import CoATSSHead
from .co_dino_head import CoDINOHead
from .co_roi_head import CoStandardRoIHead
from .codetr import CoDETR
from .transformer import (CoDinoTransformer, DetrTransformerDecoderLayer,
DetrTransformerEncoder, Dino... | 14 | 529 |
mmdetection | projects/CO-DETR/codetr/co_dino_head.py | .py | # Copyright (c) OpenMMLab. All rights reserved.
import copy
from typing import List
import torch
import torch.nn as nn
import torch.nn.functional as F
from mmcv.cnn import Linear
from mmcv.ops import batched_nms
from mmengine.structures import InstanceData
from torch import Tensor
from mmdet.models import DINOHead
fr... | 678 | 28,772 |
mmdetection | projects/CO-DETR/codetr/codetr.py | .py | import copy
from typing import Tuple, Union
import torch
import torch.nn as nn
from torch import Tensor
from mmdet.models.detectors.base import BaseDetector
from mmdet.registry import MODELS
from mmdet.structures import OptSampleList, SampleList
from mmdet.utils import InstanceList, OptConfigType, OptMultiConfig
@M... | 321 | 13,088 |
mmdetection | projects/CO-DETR/codetr/co_roi_head.py | .py | from typing import List, Tuple
import torch
from torch import Tensor
from mmdet.models.roi_heads import StandardRoIHead
from mmdet.models.task_modules.samplers import SamplingResult
from mmdet.models.utils import unpack_gt_instances
from mmdet.registry import MODELS
from mmdet.structures import DetDataSample
from mmd... | 109 | 4,582 |
mmdetection | projects/LabelStudio/backend_template/_wsgi.py | .py | # Copyright (c) OpenMMLab. All rights reserved.
import argparse
import json
import logging
import logging.config
import os
logging.config.dictConfig({
'version': 1,
'formatters': {
'standard': {
'format':
'[%(asctime)s] [%(levelname)s] [%(name)s::%(funcName)s::%(lineno)d] %(mess... | 146 | 4,005 |
mmdetection | projects/LabelStudio/backend_template/mmdetection.py | .py | # Copyright (c) OpenMMLab. All rights reserved.
import io
import json
import logging
import os
from urllib.parse import urlparse
import boto3
from botocore.exceptions import ClientError
from label_studio_ml.model import LabelStudioMLBase
from label_studio_ml.utils import (DATA_UNDEFINED_NAME, get_image_size,
... | 149 | 6,028 |
mmdetection | projects/example_project/dummy/dummy_resnet.py | .py | # Copyright (c) OpenMMLab. All rights reserved.
from mmdet.models.backbones import ResNet
from mmdet.registry import MODELS
@MODELS.register_module()
class DummyResNet(ResNet):
"""Implements a dummy ResNet wrapper for demonstration purpose.
Args:
**kwargs: All the arguments are passed to the parent cl... | 16 | 441 |
mmdetection | projects/example_project/dummy/__init__.py | .py | # Copyright (c) OpenMMLab. All rights reserved.
from .dummy_resnet import DummyResNet
__all__ = ['DummyResNet']
| 5 | 113 |
mmdetection | projects/example_project/configs/faster-rcnn_dummy-resnet_fpn_1x_coco.py | .py | _base_ = ['../../../configs/faster_rcnn/faster-rcnn_r50_fpn_1x_coco.py']
custom_imports = dict(imports=['projects.example_project.dummy'])
_base_.model.backbone.type = 'DummyResNet'
| 6 | 184 |
mmdetection | projects/iSAID/isaid_json.py | .py | import argparse
import json
import os.path as osp
def json_convert(path):
with open(path, 'r+') as f:
coco_data = json.load(f)
coco_data['categories'].append({'id': 0, 'name': 'background'})
coco_data['categories'] = sorted(
coco_data['categories'], key=lambda x: x['id'])
... | 30 | 988 |
mmdetection | projects/iSAID/configs/mask_rcnn_r50_fpn_1x_isaid.py | .py | _base_ = [
'../../../configs/_base_/models/mask-rcnn_r50_fpn.py',
'../../../configs/_base_/datasets/isaid_instance.py',
'../../../configs/_base_/schedules/schedule_1x.py',
'../../../configs/_base_/default_runtime.py'
]
| 7 | 235 |
mmdetection | projects/Detic_new/detic/detic.py | .py | # Copyright (c) OpenMMLab. All rights reserved.
import copy
from typing import List, Union
import numpy as np
import torch
import torch.nn as nn
import torch.nn.functional as F
from mmengine.logging import print_log
from torch import Tensor
from mmdet.datasets import LVISV1Dataset
from mmdet.models.detectors.cascade_... | 275 | 10,825 |
mmdetection | projects/Detic_new/detic/__init__.py | .py | # Copyright (c) OpenMMLab. All rights reserved.
from .centernet_rpn_head import CenterNetRPNHead
from .detic import Detic
from .detic_bbox_head import DeticBBoxHead
from .detic_roi_head import DeticRoIHead
from .heatmap_focal_loss import HeatmapFocalLoss
from .imagenet_lvis import ImageNetLVISV1Dataset
from .zero_shot_... | 14 | 508 |
mmdetection | projects/Detic_new/detic/imagenet_lvis.py | .py | # Copyright (c) OpenMMLab. All rights reserved.METAINFO
import copy
import os.path as osp
import pickle
import warnings
from typing import List, Union
from mmengine.fileio import get_local_path
from mmdet.datasets import LVISV1Dataset
from mmdet.registry import DATASETS
@DATASETS.register_module()
class ImageNetLVI... | 396 | 23,070 |
mmdetection | projects/Detic_new/detic/detic_bbox_head.py | .py | # Copyright (c) OpenMMLab. All rights reserved.
import json
from typing import List, Optional
import torch
from mmengine.config import ConfigDict
from mmengine.structures import InstanceData
from torch import Tensor
from torch.nn import functional as F
from mmdet.models.layers import multiclass_nms
from mmdet.models.... | 435 | 18,456 |
mmdetection | projects/Detic_new/detic/zero_shot_classifier.py | .py | # Copyright (c) Facebook, Inc. and its affiliates.
import numpy as np
import torch
from torch import nn
from torch.nn import functional as F
from mmdet.registry import MODELS
@MODELS.register_module()
class ZeroShotClassifier(nn.Module):
def __init__(
self,
in_features: int,
out_features... | 74 | 2,301 |
mmdetection | projects/Detic_new/detic/iou_loss.py | .py | import torch
from torch import nn
# support calculate IOULoss with box_pred
class IOULoss(nn.Module):
def __init__(self, loc_loss_type='iou'):
super(IOULoss, self).__init__()
self.loc_loss_type = loc_loss_type
def forward(self, pred, target, weight=None, reduction='sum'):
pred_left ... | 126 | 4,019 |
mmdetection | projects/Detic_new/detic/heatmap_focal_loss.py | .py | # Copyright (c) OpenMMLab. All rights reserved.
from typing import Optional, Union
import torch
import torch.nn as nn
from torch import Tensor
from mmdet.registry import MODELS
# support class-agnostic heatmap_focal_loss
def heatmap_focal_loss_with_pos_inds(
pred: Tensor,
targets: Tensor,
po... | 132 | 4,636 |
mmdetection | projects/Detic_new/detic/centernet_rpn_head.py | .py | # Copyright (c) OpenMMLab. All rights reserved.
import copy
from typing import Dict, List, Optional, Sequence, Tuple
import torch
import torch.nn as nn
from mmcv.cnn import Scale
from mmengine import ConfigDict
from mmengine.structures import InstanceData
from torch import Tensor
from mmdet.models.dense_heads import ... | 574 | 24,150 |
mmdetection | projects/Detic_new/detic/detic_roi_head.py | .py | # Copyright (c) OpenMMLab. All rights reserved.
from typing import List, Sequence, Tuple
import torch
from mmengine.structures import InstanceData
from torch import Tensor
from mmdet.models.roi_heads import CascadeRoIHead
from mmdet.models.task_modules.samplers import SamplingResult
from mmdet.models.test_time_augs i... | 441 | 18,673 |
mmdetection | projects/Detic_new/configs/detic_centernet2_swin-b_fpn_4x_lvis-base_in21k-lvis.py | .py | _base_ = './detic_centernet2_r50_fpn_4x_lvis_in21k-lvis.py'
image_size_det = (896, 896)
image_size_cls = (448, 448)
model = dict(
backbone=dict(
_delete_=True,
type='SwinTransformer',
embed_dims=128,
depths=[2, 2, 18, 2],
num_heads=[4, 8, 16, 32],
window_size=7,
... | 119 | 3,437 |
mmdetection | projects/Detic_new/configs/detic_centernet2_r50_fpn_4x_lvis-base_in21k-lvis.py | .py | _base_ = './detic_centernet2_r50_fpn_4x_lvis_boxsup.py'
dataset_type = ['LVISV1Dataset', 'ImageNetLVISV1Dataset']
image_size_det = (640, 640)
image_size_cls = (320, 320)
# backend = 'pillow'
backend_args = None
train_pipeline_det = [
dict(type='LoadImageFromFile', backend_args=backend_args),
dict(type='LoadAn... | 94 | 2,786 |
mmdetection | projects/Detic_new/configs/detic_centernet2_swin-b_fpn_4x_lvis_in21k-lvis.py | .py | _base_ = './detic_centernet2_r50_fpn_4x_lvis_in21k-lvis.py'
image_size_det = (896, 896)
image_size_cls = (448, 448)
model = dict(
backbone=dict(
_delete_=True,
type='SwinTransformer',
embed_dims=128,
depths=[2, 2, 18, 2],
num_heads=[4, 8, 16, 32],
window_size=7,
... | 117 | 3,325 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.