repo stringlengths 7 90 | file_url stringlengths 81 315 | file_path stringlengths 4 228 | content stringlengths 0 32.8k | language stringclasses 1
value | license stringclasses 7
values | commit_sha stringlengths 40 40 | retrieved_at stringdate 2026-01-04 14:38:15 2026-01-05 02:33:18 | truncated bool 2
classes |
|---|---|---|---|---|---|---|---|---|
open-mmlab/mmdetection | https://github.com/open-mmlab/mmdetection/blob/cfd5d3a985b0249de009b67d04f37263e11cdf3d/tools/analysis_tools/coco_error_analysis.py | tools/analysis_tools/coco_error_analysis.py | # Copyright (c) OpenMMLab. All rights reserved.
import copy
import os
from argparse import ArgumentParser
from multiprocessing import Pool
import matplotlib.pyplot as plt
import numpy as np
from pycocotools.coco import COCO
from pycocotools.cocoeval import COCOeval
def makeplot(rs, ps, outDir, class_name, iou_type):... | python | Apache-2.0 | cfd5d3a985b0249de009b67d04f37263e11cdf3d | 2026-01-04T14:42:57.197037Z | false |
open-mmlab/mmdetection | https://github.com/open-mmlab/mmdetection/blob/cfd5d3a985b0249de009b67d04f37263e11cdf3d/tools/analysis_tools/confusion_matrix.py | tools/analysis_tools/confusion_matrix.py | import argparse
import os
import matplotlib.pyplot as plt
import numpy as np
from matplotlib.ticker import MultipleLocator
from mmcv.ops import nms
from mmengine import Config, DictAction
from mmengine.fileio import load
from mmengine.registry import init_default_scope
from mmengine.utils import ProgressBar
from mmde... | python | Apache-2.0 | cfd5d3a985b0249de009b67d04f37263e11cdf3d | 2026-01-04T14:42:57.197037Z | false |
open-mmlab/mmdetection | https://github.com/open-mmlab/mmdetection/blob/cfd5d3a985b0249de009b67d04f37263e11cdf3d/tools/analysis_tools/browse_grounding_raw.py | tools/analysis_tools/browse_grounding_raw.py | # Copyright (c) OpenMMLab. All rights reserved.
import argparse
import json
import os.path as osp
import cv2
import numpy as np
from mmcv.image import imfrombytes, imwrite
from mmengine.fileio import get
from mmengine.structures import InstanceData
from mmengine.utils import mkdir_or_exist
from mmdet.structures impor... | python | Apache-2.0 | cfd5d3a985b0249de009b67d04f37263e11cdf3d | 2026-01-04T14:42:57.197037Z | false |
open-mmlab/mmdetection | https://github.com/open-mmlab/mmdetection/blob/cfd5d3a985b0249de009b67d04f37263e11cdf3d/tools/analysis_tools/test_robustness.py | tools/analysis_tools/test_robustness.py | # Copyright (c) OpenMMLab. All rights reserved.
import argparse
import copy
import os
import os.path as osp
from mmengine.config import Config, DictAction
from mmengine.dist import get_dist_info
from mmengine.evaluator import DumpResults
from mmengine.fileio import dump
from mmengine.runner import Runner
from mmdet.e... | python | Apache-2.0 | cfd5d3a985b0249de009b67d04f37263e11cdf3d | 2026-01-04T14:42:57.197037Z | false |
open-mmlab/mmdetection | https://github.com/open-mmlab/mmdetection/blob/cfd5d3a985b0249de009b67d04f37263e11cdf3d/tools/analysis_tools/get_flops.py | tools/analysis_tools/get_flops.py | # Copyright (c) OpenMMLab. All rights reserved.
import argparse
import tempfile
from functools import partial
from pathlib import Path
import numpy as np
import torch
from mmengine.config import Config, DictAction
from mmengine.logging import MMLogger
from mmengine.model import revert_sync_batchnorm
from mmengine.regi... | python | Apache-2.0 | cfd5d3a985b0249de009b67d04f37263e11cdf3d | 2026-01-04T14:42:57.197037Z | false |
open-mmlab/mmdetection | https://github.com/open-mmlab/mmdetection/blob/cfd5d3a985b0249de009b67d04f37263e11cdf3d/tools/analysis_tools/analyze_logs.py | tools/analysis_tools/analyze_logs.py | # Copyright (c) OpenMMLab. All rights reserved.
import argparse
import json
from collections import defaultdict
import matplotlib.pyplot as plt
import numpy as np
import seaborn as sns
def cal_train_time(log_dicts, args):
for i, log_dict in enumerate(log_dicts):
print(f'{"-" * 5}Analyze train time of {ar... | python | Apache-2.0 | cfd5d3a985b0249de009b67d04f37263e11cdf3d | 2026-01-04T14:42:57.197037Z | false |
open-mmlab/mmdetection | https://github.com/open-mmlab/mmdetection/blob/cfd5d3a985b0249de009b67d04f37263e11cdf3d/tools/analysis_tools/analyze_results.py | tools/analysis_tools/analyze_results.py | # Copyright (c) OpenMMLab. All rights reserved.
import argparse
import os.path as osp
from multiprocessing import Pool
import mmcv
import numpy as np
from mmengine.config import Config, DictAction
from mmengine.fileio import load
from mmengine.registry import init_default_scope
from mmengine.runner import Runner
from ... | python | Apache-2.0 | cfd5d3a985b0249de009b67d04f37263e11cdf3d | 2026-01-04T14:42:57.197037Z | false |
open-mmlab/mmdetection | https://github.com/open-mmlab/mmdetection/blob/cfd5d3a985b0249de009b67d04f37263e11cdf3d/tools/analysis_tools/fuse_results.py | tools/analysis_tools/fuse_results.py | import argparse
from mmengine.fileio import dump, load
from mmengine.logging import print_log
from mmengine.utils import ProgressBar
from pycocotools.coco import COCO
from pycocotools.cocoeval import COCOeval
from mmdet.models.utils import weighted_boxes_fusion
def parse_args():
parser = argparse.ArgumentParser... | python | Apache-2.0 | cfd5d3a985b0249de009b67d04f37263e11cdf3d | 2026-01-04T14:42:57.197037Z | false |
open-mmlab/mmdetection | https://github.com/open-mmlab/mmdetection/blob/cfd5d3a985b0249de009b67d04f37263e11cdf3d/tools/analysis_tools/eval_metric.py | tools/analysis_tools/eval_metric.py | # Copyright (c) OpenMMLab. All rights reserved.
import argparse
import mmengine
from mmengine import Config, DictAction
from mmengine.evaluator import Evaluator
from mmengine.registry import init_default_scope
from mmdet.registry import DATASETS
def parse_args():
parser = argparse.ArgumentParser(description='Ev... | python | Apache-2.0 | cfd5d3a985b0249de009b67d04f37263e11cdf3d | 2026-01-04T14:42:57.197037Z | false |
open-mmlab/mmdetection | https://github.com/open-mmlab/mmdetection/blob/cfd5d3a985b0249de009b67d04f37263e11cdf3d/tools/analysis_tools/benchmark.py | tools/analysis_tools/benchmark.py | # Copyright (c) OpenMMLab. All rights reserved.
import argparse
import os
from mmengine import MMLogger
from mmengine.config import Config, DictAction
from mmengine.dist import init_dist
from mmengine.registry import init_default_scope
from mmengine.utils import mkdir_or_exist
from mmdet.utils.benchmark import (DataL... | python | Apache-2.0 | cfd5d3a985b0249de009b67d04f37263e11cdf3d | 2026-01-04T14:42:57.197037Z | false |
open-mmlab/mmdetection | https://github.com/open-mmlab/mmdetection/blob/cfd5d3a985b0249de009b67d04f37263e11cdf3d/tools/analysis_tools/coco_occluded_separated_recall.py | tools/analysis_tools/coco_occluded_separated_recall.py | # Copyright (c) OpenMMLab. All rights reserved.
from argparse import ArgumentParser
import mmengine
from mmengine.logging import print_log
from mmdet.datasets import CocoDataset
from mmdet.evaluation import CocoOccludedSeparatedMetric
def main():
parser = ArgumentParser(
description='Compute recall of C... | python | Apache-2.0 | cfd5d3a985b0249de009b67d04f37263e11cdf3d | 2026-01-04T14:42:57.197037Z | false |
open-mmlab/mmdetection | https://github.com/open-mmlab/mmdetection/blob/cfd5d3a985b0249de009b67d04f37263e11cdf3d/tools/analysis_tools/optimize_anchors.py | tools/analysis_tools/optimize_anchors.py | # Copyright (c) OpenMMLab. All rights reserved.
"""Optimize anchor settings on a specific dataset.
This script provides two method to optimize YOLO anchors including k-means
anchor cluster and differential evolution. You can use ``--algorithm k-means``
and ``--algorithm differential_evolution`` to switch two method.
... | python | Apache-2.0 | cfd5d3a985b0249de009b67d04f37263e11cdf3d | 2026-01-04T14:42:57.197037Z | false |
open-mmlab/mmdetection | https://github.com/open-mmlab/mmdetection/blob/cfd5d3a985b0249de009b67d04f37263e11cdf3d/tools/analysis_tools/browse_grounding_dataset.py | tools/analysis_tools/browse_grounding_dataset.py | # Copyright (c) OpenMMLab. All rights reserved.
import argparse
import os.path as osp
import numpy as np
from mmcv.image import imwrite
from mmengine.config import Config, DictAction
from mmengine.registry import init_default_scope
from mmengine.utils import ProgressBar
from mmdet.registry import DATASETS, VISUALIZER... | python | Apache-2.0 | cfd5d3a985b0249de009b67d04f37263e11cdf3d | 2026-01-04T14:42:57.197037Z | false |
open-mmlab/mmdetection | https://github.com/open-mmlab/mmdetection/blob/cfd5d3a985b0249de009b67d04f37263e11cdf3d/tools/analysis_tools/browse_dataset.py | tools/analysis_tools/browse_dataset.py | # Copyright (c) OpenMMLab. All rights reserved.
import argparse
import os.path as osp
from mmengine.config import Config, DictAction
from mmengine.registry import init_default_scope
from mmengine.utils import ProgressBar
from mmdet.models.utils import mask2ndarray
from mmdet.registry import DATASETS, VISUALIZERS
from... | python | Apache-2.0 | cfd5d3a985b0249de009b67d04f37263e11cdf3d | 2026-01-04T14:42:57.197037Z | false |
open-mmlab/mmdetection | https://github.com/open-mmlab/mmdetection/blob/cfd5d3a985b0249de009b67d04f37263e11cdf3d/tools/analysis_tools/robustness_eval.py | tools/analysis_tools/robustness_eval.py | # Copyright (c) OpenMMLab. All rights reserved.
import os.path as osp
from argparse import ArgumentParser
import numpy as np
from mmengine.fileio import load
def print_coco_results(results):
def _print(result, ap=1, iouThr=None, areaRng='all', maxDets=100):
titleStr = 'Average Precision' if ap == 1 else... | python | Apache-2.0 | cfd5d3a985b0249de009b67d04f37263e11cdf3d | 2026-01-04T14:42:57.197037Z | false |
open-mmlab/mmdetection | https://github.com/open-mmlab/mmdetection/blob/cfd5d3a985b0249de009b67d04f37263e11cdf3d/tools/analysis_tools/mot/mot_error_visualize.py | tools/analysis_tools/mot/mot_error_visualize.py | # Copyright (c) OpenMMLab. All rights reserved.
import argparse
import os
import os.path as osp
import re
import mmcv
import motmetrics as mm
import numpy as np
import pandas as pd
from mmengine import Config
from mmengine.logging import print_log
from mmengine.registry import init_default_scope
from torch.utils.data ... | python | Apache-2.0 | cfd5d3a985b0249de009b67d04f37263e11cdf3d | 2026-01-04T14:42:57.197037Z | false |
open-mmlab/mmdetection | https://github.com/open-mmlab/mmdetection/blob/cfd5d3a985b0249de009b67d04f37263e11cdf3d/tools/analysis_tools/mot/mot_param_search.py | tools/analysis_tools/mot/mot_param_search.py | # Copyright (c) OpenMMLab. All rights reserved.
import argparse
import os
import os.path as osp
from itertools import product
from mmengine.config import Config, DictAction
from mmengine.dist import get_dist_info
from mmengine.logging import MMLogger, print_log
from mmengine.model import is_model_wrapper
from mmengine... | python | Apache-2.0 | cfd5d3a985b0249de009b67d04f37263e11cdf3d | 2026-01-04T14:42:57.197037Z | false |
open-mmlab/mmdetection | https://github.com/open-mmlab/mmdetection/blob/cfd5d3a985b0249de009b67d04f37263e11cdf3d/tools/analysis_tools/mot/browse_dataset.py | tools/analysis_tools/mot/browse_dataset.py | # Copyright (c) OpenMMLab. All rights reserved.
import argparse
import os.path as osp
import mmengine
from mmengine import Config, DictAction
from mmengine.registry import init_default_scope
from mmdet.registry import DATASETS, VISUALIZERS
def parse_args():
parser = argparse.ArgumentParser(description='Browse a... | python | Apache-2.0 | cfd5d3a985b0249de009b67d04f37263e11cdf3d | 2026-01-04T14:42:57.197037Z | false |
open-mmlab/mmdetection | https://github.com/open-mmlab/mmdetection/blob/cfd5d3a985b0249de009b67d04f37263e11cdf3d/tools/deployment/mmdet_handler.py | tools/deployment/mmdet_handler.py | # Copyright (c) OpenMMLab. All rights reserved.
import base64
import os
import mmcv
import numpy as np
import torch
from ts.torch_handler.base_handler import BaseHandler
from mmdet.apis import inference_detector, init_detector
class MMdetHandler(BaseHandler):
threshold = 0.5
def initialize(self, context):
... | python | Apache-2.0 | cfd5d3a985b0249de009b67d04f37263e11cdf3d | 2026-01-04T14:42:57.197037Z | false |
open-mmlab/mmdetection | https://github.com/open-mmlab/mmdetection/blob/cfd5d3a985b0249de009b67d04f37263e11cdf3d/tools/deployment/test_torchserver.py | tools/deployment/test_torchserver.py | import os
from argparse import ArgumentParser
import mmcv
import requests
import torch
from mmengine.structures import InstanceData
from mmdet.apis import inference_detector, init_detector
from mmdet.registry import VISUALIZERS
from mmdet.structures import DetDataSample
def parse_args():
parser = ArgumentParser... | python | Apache-2.0 | cfd5d3a985b0249de009b67d04f37263e11cdf3d | 2026-01-04T14:42:57.197037Z | false |
open-mmlab/mmdetection | https://github.com/open-mmlab/mmdetection/blob/cfd5d3a985b0249de009b67d04f37263e11cdf3d/tools/deployment/mmdet2torchserve.py | tools/deployment/mmdet2torchserve.py | # Copyright (c) OpenMMLab. All rights reserved.
from argparse import ArgumentParser, Namespace
from pathlib import Path
from tempfile import TemporaryDirectory
from mmengine.config import Config
from mmengine.utils import mkdir_or_exist
try:
from model_archiver.model_packaging import package_model
from model_... | python | Apache-2.0 | cfd5d3a985b0249de009b67d04f37263e11cdf3d | 2026-01-04T14:42:57.197037Z | false |
open-mmlab/mmdetection | https://github.com/open-mmlab/mmdetection/blob/cfd5d3a985b0249de009b67d04f37263e11cdf3d/.dev_scripts/benchmark_valid_flops.py | .dev_scripts/benchmark_valid_flops.py | import logging
import re
import tempfile
from argparse import ArgumentParser
from collections import OrderedDict
from functools import partial
from pathlib import Path
import numpy as np
import pandas as pd
import torch
from mmengine import Config, DictAction
from mmengine.analysis import get_model_complexity_info
fro... | python | Apache-2.0 | cfd5d3a985b0249de009b67d04f37263e11cdf3d | 2026-01-04T14:42:57.197037Z | false |
open-mmlab/mmdetection | https://github.com/open-mmlab/mmdetection/blob/cfd5d3a985b0249de009b67d04f37263e11cdf3d/.dev_scripts/convert_test_benchmark_script.py | .dev_scripts/convert_test_benchmark_script.py | # Copyright (c) OpenMMLab. All rights reserved.
import argparse
import os
import os.path as osp
from mmengine import Config
def parse_args():
parser = argparse.ArgumentParser(
description='Convert benchmark model list to script')
parser.add_argument('config', help='test config file path')
parser.... | python | Apache-2.0 | cfd5d3a985b0249de009b67d04f37263e11cdf3d | 2026-01-04T14:42:57.197037Z | false |
open-mmlab/mmdetection | https://github.com/open-mmlab/mmdetection/blob/cfd5d3a985b0249de009b67d04f37263e11cdf3d/.dev_scripts/benchmark_filter.py | .dev_scripts/benchmark_filter.py | # Copyright (c) OpenMMLab. All rights reserved.
import argparse
import os
import os.path as osp
def parse_args():
parser = argparse.ArgumentParser(description='Filter configs to train')
parser.add_argument(
'--basic-arch',
action='store_true',
help='to train models in basic arch')
... | python | Apache-2.0 | cfd5d3a985b0249de009b67d04f37263e11cdf3d | 2026-01-04T14:42:57.197037Z | false |
open-mmlab/mmdetection | https://github.com/open-mmlab/mmdetection/blob/cfd5d3a985b0249de009b67d04f37263e11cdf3d/.dev_scripts/check_links.py | .dev_scripts/check_links.py | # Modified from:
# https://github.com/allenai/allennlp/blob/main/scripts/check_links.py
import argparse
import logging
import os
import pathlib
import re
import sys
from multiprocessing.dummy import Pool
from typing import NamedTuple, Optional, Tuple
import requests
from mmengine.logging import MMLogger
def parse_a... | python | Apache-2.0 | cfd5d3a985b0249de009b67d04f37263e11cdf3d | 2026-01-04T14:42:57.197037Z | false |
open-mmlab/mmdetection | https://github.com/open-mmlab/mmdetection/blob/cfd5d3a985b0249de009b67d04f37263e11cdf3d/.dev_scripts/benchmark_inference_fps.py | .dev_scripts/benchmark_inference_fps.py | # Copyright (c) OpenMMLab. All rights reserved.
import argparse
import os
import os.path as osp
from mmengine.config import Config, DictAction
from mmengine.dist import init_dist
from mmengine.fileio import dump
from mmengine.utils import mkdir_or_exist
from terminaltables import GithubFlavoredMarkdownTable
from tool... | python | Apache-2.0 | cfd5d3a985b0249de009b67d04f37263e11cdf3d | 2026-01-04T14:42:57.197037Z | false |
open-mmlab/mmdetection | https://github.com/open-mmlab/mmdetection/blob/cfd5d3a985b0249de009b67d04f37263e11cdf3d/.dev_scripts/benchmark_options.py | .dev_scripts/benchmark_options.py | # Copyright (c) OpenMMLab. All rights reserved.
third_part_libs = [
'pip install -r ../requirements/albu.txt',
'pip install instaboostfast',
'pip install git+https://github.com/cocodataset/panopticapi.git',
'pip install timm',
'pip install mmpretrain',
'pip install git+https://github.com/lvis-d... | python | Apache-2.0 | cfd5d3a985b0249de009b67d04f37263e11cdf3d | 2026-01-04T14:42:57.197037Z | false |
open-mmlab/mmdetection | https://github.com/open-mmlab/mmdetection/blob/cfd5d3a985b0249de009b67d04f37263e11cdf3d/.dev_scripts/convert_train_benchmark_script.py | .dev_scripts/convert_train_benchmark_script.py | # Copyright (c) OpenMMLab. All rights reserved.
import argparse
import os
import os.path as osp
def parse_args():
parser = argparse.ArgumentParser(
description='Convert benchmark model json to script')
parser.add_argument(
'txt_path', type=str, help='txt path output by benchmark_filter')
p... | python | Apache-2.0 | cfd5d3a985b0249de009b67d04f37263e11cdf3d | 2026-01-04T14:42:57.197037Z | false |
open-mmlab/mmdetection | https://github.com/open-mmlab/mmdetection/blob/cfd5d3a985b0249de009b67d04f37263e11cdf3d/.dev_scripts/test_init_backbone.py | .dev_scripts/test_init_backbone.py | # Copyright (c) OpenMMLab. All rights reserved.
"""Check out backbone whether successfully load pretrained checkpoint."""
import copy
import os
from os.path import dirname, exists, join
import pytest
from mmengine.config import Config
from mmengine.runner import CheckpointLoader
from mmengine.utils import ProgressBar
... | python | Apache-2.0 | cfd5d3a985b0249de009b67d04f37263e11cdf3d | 2026-01-04T14:42:57.197037Z | false |
open-mmlab/mmdetection | https://github.com/open-mmlab/mmdetection/blob/cfd5d3a985b0249de009b67d04f37263e11cdf3d/.dev_scripts/gather_test_benchmark_metric.py | .dev_scripts/gather_test_benchmark_metric.py | # Copyright (c) OpenMMLab. All rights reserved.
import argparse
import glob
import os.path as osp
from mmengine.config import Config
from mmengine.fileio import dump, load
from mmengine.utils import mkdir_or_exist
def parse_args():
parser = argparse.ArgumentParser(
description='Gather benchmarked models ... | python | Apache-2.0 | cfd5d3a985b0249de009b67d04f37263e11cdf3d | 2026-01-04T14:42:57.197037Z | false |
open-mmlab/mmdetection | https://github.com/open-mmlab/mmdetection/blob/cfd5d3a985b0249de009b67d04f37263e11cdf3d/.dev_scripts/gather_models.py | .dev_scripts/gather_models.py | # Copyright (c) OpenMMLab. All rights reserved.
import argparse
import glob
import os
import os.path as osp
import shutil
import subprocess
import time
from collections import OrderedDict
import torch
import yaml
from mmengine.config import Config
from mmengine.fileio import dump
from mmengine.utils import digit_versi... | python | Apache-2.0 | cfd5d3a985b0249de009b67d04f37263e11cdf3d | 2026-01-04T14:42:57.197037Z | false |
open-mmlab/mmdetection | https://github.com/open-mmlab/mmdetection/blob/cfd5d3a985b0249de009b67d04f37263e11cdf3d/.dev_scripts/benchmark_test_image.py | .dev_scripts/benchmark_test_image.py | # Copyright (c) OpenMMLab. All rights reserved.
import logging
import os.path as osp
from argparse import ArgumentParser
import mmcv
from mmengine.config import Config
from mmengine.logging import MMLogger
from mmengine.utils import mkdir_or_exist
from mmdet.apis import inference_detector, init_detector
from mmdet.re... | python | Apache-2.0 | cfd5d3a985b0249de009b67d04f37263e11cdf3d | 2026-01-04T14:42:57.197037Z | false |
open-mmlab/mmdetection | https://github.com/open-mmlab/mmdetection/blob/cfd5d3a985b0249de009b67d04f37263e11cdf3d/.dev_scripts/batch_test_list.py | .dev_scripts/batch_test_list.py | # Copyright (c) OpenMMLab. All rights reserved.
# missing wider_face/timm_example/strong_baselines/simple_copy_paste/
# selfsup_pretrain/seesaw_loss/pascal_voc/openimages/lvis/ld/lad/cityscapes/deepfashion
# yapf: disable
atss = dict(
config='configs/atss/atss_r50_fpn_1x_coco.py',
checkpoint='atss_r50_fpn_1x_... | python | Apache-2.0 | cfd5d3a985b0249de009b67d04f37263e11cdf3d | 2026-01-04T14:42:57.197037Z | false |
open-mmlab/mmdetection | https://github.com/open-mmlab/mmdetection/blob/cfd5d3a985b0249de009b67d04f37263e11cdf3d/.dev_scripts/benchmark_train.py | .dev_scripts/benchmark_train.py | # Copyright (c) OpenMMLab. All rights reserved.
import logging
import os
import os.path as osp
from argparse import ArgumentParser
from mmengine.config import Config, DictAction
from mmengine.logging import MMLogger, print_log
from mmengine.registry import RUNNERS
from mmengine.runner import Runner
from mmdet.testing... | python | Apache-2.0 | cfd5d3a985b0249de009b67d04f37263e11cdf3d | 2026-01-04T14:42:57.197037Z | false |
open-mmlab/mmdetection | https://github.com/open-mmlab/mmdetection/blob/cfd5d3a985b0249de009b67d04f37263e11cdf3d/.dev_scripts/gather_train_benchmark_metric.py | .dev_scripts/gather_train_benchmark_metric.py | # Copyright (c) OpenMMLab. All rights reserved.
import argparse
import glob
import os.path as osp
from gather_models import get_final_results
from mmengine.config import Config
from mmengine.fileio import dump
from mmengine.utils import mkdir_or_exist
try:
import xlrd
except ImportError:
xlrd = None
try:
... | python | Apache-2.0 | cfd5d3a985b0249de009b67d04f37263e11cdf3d | 2026-01-04T14:42:57.197037Z | false |
open-mmlab/mmdetection | https://github.com/open-mmlab/mmdetection/blob/cfd5d3a985b0249de009b67d04f37263e11cdf3d/.dev_scripts/download_checkpoints.py | .dev_scripts/download_checkpoints.py | # Copyright (c) OpenMMLab. All rights reserved.
import argparse
import math
import os
import os.path as osp
from multiprocessing import Pool
import torch
from mmengine.config import Config
from mmengine.utils import mkdir_or_exist
def download(url, out_file, min_bytes=math.pow(1024, 2), progress=True):
# math.p... | python | Apache-2.0 | cfd5d3a985b0249de009b67d04f37263e11cdf3d | 2026-01-04T14:42:57.197037Z | false |
open-mmlab/mmdetection | https://github.com/open-mmlab/mmdetection/blob/cfd5d3a985b0249de009b67d04f37263e11cdf3d/.dev_scripts/benchmark_test.py | .dev_scripts/benchmark_test.py | # Copyright (c) OpenMMLab. All rights reserved.
import logging
import os
import os.path as osp
from argparse import ArgumentParser
from mmengine.config import Config, DictAction
from mmengine.logging import MMLogger
from mmengine.registry import RUNNERS
from mmengine.runner import Runner
from mmdet.testing import rep... | python | Apache-2.0 | cfd5d3a985b0249de009b67d04f37263e11cdf3d | 2026-01-04T14:42:57.197037Z | false |
open-mmlab/mmdetection | https://github.com/open-mmlab/mmdetection/blob/cfd5d3a985b0249de009b67d04f37263e11cdf3d/tests/test_evaluation/test_metrics/test_coco_occluded_metric.py | tests/test_evaluation/test_metrics/test_coco_occluded_metric.py | # Copyright (c) OpenMMLab. All rights reserved.
import os.path as osp
from tempfile import TemporaryDirectory
import mmengine
import numpy as np
from mmdet.datasets import CocoDataset
from mmdet.evaluation import CocoOccludedSeparatedMetric
def test_coco_occluded_separated_metric():
ann = [[
'fake1.jpg'... | python | Apache-2.0 | cfd5d3a985b0249de009b67d04f37263e11cdf3d | 2026-01-04T14:42:57.197037Z | false |
open-mmlab/mmdetection | https://github.com/open-mmlab/mmdetection/blob/cfd5d3a985b0249de009b67d04f37263e11cdf3d/tests/test_evaluation/test_metrics/test_lvis_metric.py | tests/test_evaluation/test_metrics/test_lvis_metric.py | import os.path as osp
import tempfile
import unittest
import numpy as np
import pycocotools.mask as mask_util
import torch
from mmdet.evaluation.metrics import LVISMetric
try:
import lvis
except ImportError:
lvis = None
from mmengine.fileio import dump
class TestLVISMetric(unittest.TestCase):
def _cr... | python | Apache-2.0 | cfd5d3a985b0249de009b67d04f37263e11cdf3d | 2026-01-04T14:42:57.197037Z | false |
open-mmlab/mmdetection | https://github.com/open-mmlab/mmdetection/blob/cfd5d3a985b0249de009b67d04f37263e11cdf3d/tests/test_evaluation/test_metrics/test_crowdhuman_metric.py | tests/test_evaluation/test_metrics/test_crowdhuman_metric.py | import os.path as osp
import tempfile
from unittest import TestCase
import numpy as np
import torch
from mmdet.evaluation import CrowdHumanMetric
class TestCrowdHumanMetric(TestCase):
def _create_dummy_results(self):
bboxes = np.array([[1330, 317, 418, 1338], [792, 24, 723, 2017],
... | python | Apache-2.0 | cfd5d3a985b0249de009b67d04f37263e11cdf3d | 2026-01-04T14:42:57.197037Z | false |
open-mmlab/mmdetection | https://github.com/open-mmlab/mmdetection/blob/cfd5d3a985b0249de009b67d04f37263e11cdf3d/tests/test_evaluation/test_metrics/test_coco_metric.py | tests/test_evaluation/test_metrics/test_coco_metric.py | import os.path as osp
import tempfile
from unittest import TestCase
import numpy as np
import pycocotools.mask as mask_util
import torch
from mmengine.fileio import dump
from mmdet.evaluation import CocoMetric
class TestCocoMetric(TestCase):
def _create_dummy_coco_json(self, json_name):
dummy_mask = np... | python | Apache-2.0 | cfd5d3a985b0249de009b67d04f37263e11cdf3d | 2026-01-04T14:42:57.197037Z | false |
open-mmlab/mmdetection | https://github.com/open-mmlab/mmdetection/blob/cfd5d3a985b0249de009b67d04f37263e11cdf3d/tests/test_evaluation/test_metrics/test_mot_challenge_metrics.py | tests/test_evaluation/test_metrics/test_mot_challenge_metrics.py | # Copyright (c) OpenMMLab. All rights reserved.
import copy
import os
import tempfile
from unittest import TestCase
import torch
from mmengine.structures import BaseDataElement, InstanceData
from mmdet.evaluation import MOTChallengeMetric
from mmdet.structures import DetDataSample, TrackDataSample
class TestMOTChal... | python | Apache-2.0 | cfd5d3a985b0249de009b67d04f37263e11cdf3d | 2026-01-04T14:42:57.197037Z | false |
open-mmlab/mmdetection | https://github.com/open-mmlab/mmdetection/blob/cfd5d3a985b0249de009b67d04f37263e11cdf3d/tests/test_evaluation/test_metrics/test_reid_metric.py | tests/test_evaluation/test_metrics/test_reid_metric.py | # Copyright (c) OpenMMLab. All rights reserved.
from unittest import TestCase
import torch
from mmengine.registry import init_default_scope
from mmdet.registry import METRICS
from mmdet.structures import ReIDDataSample
class TestReIDMetrics(TestCase):
@classmethod
def setUpClass(cls):
init_default_... | python | Apache-2.0 | cfd5d3a985b0249de009b67d04f37263e11cdf3d | 2026-01-04T14:42:57.197037Z | false |
open-mmlab/mmdetection | https://github.com/open-mmlab/mmdetection/blob/cfd5d3a985b0249de009b67d04f37263e11cdf3d/tests/test_evaluation/test_metrics/test_openimages_metric.py | tests/test_evaluation/test_metrics/test_openimages_metric.py | # Copyright (c) OpenMMLab. All rights reserved.
import unittest
import numpy as np
import torch
from mmdet.datasets import OpenImagesDataset
from mmdet.evaluation import OpenImagesMetric
from mmdet.utils import register_all_modules
class TestOpenImagesMetric(unittest.TestCase):
def _create_dummy_results(self):... | python | Apache-2.0 | cfd5d3a985b0249de009b67d04f37263e11cdf3d | 2026-01-04T14:42:57.197037Z | false |
open-mmlab/mmdetection | https://github.com/open-mmlab/mmdetection/blob/cfd5d3a985b0249de009b67d04f37263e11cdf3d/tests/test_evaluation/test_metrics/test_youtube_vis_metric.py | tests/test_evaluation/test_metrics/test_youtube_vis_metric.py | # Copyright (c) OpenMMLab. All rights reserved.
import os
import tempfile
from unittest import TestCase
import numpy as np
import pycocotools.mask as mask_util
import torch
from mmengine.registry import init_default_scope
from mmengine.structures import BaseDataElement, InstanceData
from mmdet.registry import METRICS... | python | Apache-2.0 | cfd5d3a985b0249de009b67d04f37263e11cdf3d | 2026-01-04T14:42:57.197037Z | false |
open-mmlab/mmdetection | https://github.com/open-mmlab/mmdetection/blob/cfd5d3a985b0249de009b67d04f37263e11cdf3d/tests/test_evaluation/test_metrics/test_coco_video_metric.py | tests/test_evaluation/test_metrics/test_coco_video_metric.py | # Copyright (c) OpenMMLab. All rights reserved.
import os.path as osp
import tempfile
from unittest import TestCase
import numpy as np
import pycocotools.mask as mask_util
import torch
from mmengine.fileio import dump
from mmengine.structures import BaseDataElement, InstanceData
from mmdet.evaluation import CocoVideo... | python | Apache-2.0 | cfd5d3a985b0249de009b67d04f37263e11cdf3d | 2026-01-04T14:42:57.197037Z | false |
open-mmlab/mmdetection | https://github.com/open-mmlab/mmdetection/blob/cfd5d3a985b0249de009b67d04f37263e11cdf3d/tests/test_evaluation/test_metrics/test_cityscapes_metric.py | tests/test_evaluation/test_metrics/test_cityscapes_metric.py | import os
import os.path as osp
import tempfile
import unittest
import numpy as np
import torch
from PIL import Image
from mmdet.evaluation import CityScapesMetric
try:
import cityscapesscripts
except ImportError:
cityscapesscripts = None
class TestCityScapesMetric(unittest.TestCase):
def setUp(self):... | python | Apache-2.0 | cfd5d3a985b0249de009b67d04f37263e11cdf3d | 2026-01-04T14:42:57.197037Z | false |
open-mmlab/mmdetection | https://github.com/open-mmlab/mmdetection/blob/cfd5d3a985b0249de009b67d04f37263e11cdf3d/tests/test_evaluation/test_metrics/test_dump_det_results.py | tests/test_evaluation/test_metrics/test_dump_det_results.py | # Copyright (c) OpenMMLab. All rights reserved.
import os.path as osp
import tempfile
from unittest import TestCase
import torch
from mmengine.fileio import load
from torch import Tensor
from mmdet.evaluation import DumpDetResults
from mmdet.structures.mask import encode_mask_results
class TestDumpResults(TestCase)... | python | Apache-2.0 | cfd5d3a985b0249de009b67d04f37263e11cdf3d | 2026-01-04T14:42:57.197037Z | false |
open-mmlab/mmdetection | https://github.com/open-mmlab/mmdetection/blob/cfd5d3a985b0249de009b67d04f37263e11cdf3d/tests/test_evaluation/test_metrics/__init__.py | tests/test_evaluation/test_metrics/__init__.py | python | Apache-2.0 | cfd5d3a985b0249de009b67d04f37263e11cdf3d | 2026-01-04T14:42:57.197037Z | false | |
open-mmlab/mmdetection | https://github.com/open-mmlab/mmdetection/blob/cfd5d3a985b0249de009b67d04f37263e11cdf3d/tests/test_evaluation/test_metrics/test_coco_panoptic_metric.py | tests/test_evaluation/test_metrics/test_coco_panoptic_metric.py | import os
import os.path as osp
import tempfile
import unittest
from copy import deepcopy
import mmcv
import numpy as np
import torch
from mmengine.fileio import dump
from mmdet.evaluation import INSTANCE_OFFSET, CocoPanopticMetric
try:
import panopticapi
except ImportError:
panopticapi = None
class TestCo... | python | Apache-2.0 | cfd5d3a985b0249de009b67d04f37263e11cdf3d | 2026-01-04T14:42:57.197037Z | false |
open-mmlab/mmdetection | https://github.com/open-mmlab/mmdetection/blob/cfd5d3a985b0249de009b67d04f37263e11cdf3d/tests/test_structures/test_track_data_sample.py | tests/test_structures/test_track_data_sample.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 ... | python | Apache-2.0 | cfd5d3a985b0249de009b67d04f37263e11cdf3d | 2026-01-04T14:42:57.197037Z | false |
open-mmlab/mmdetection | https://github.com/open-mmlab/mmdetection/blob/cfd5d3a985b0249de009b67d04f37263e11cdf3d/tests/test_structures/test_reid_data_sample.py | tests/test_structures/test_reid_data_sample.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... | python | Apache-2.0 | cfd5d3a985b0249de009b67d04f37263e11cdf3d | 2026-01-04T14:42:57.197037Z | false |
open-mmlab/mmdetection | https://github.com/open-mmlab/mmdetection/blob/cfd5d3a985b0249de009b67d04f37263e11cdf3d/tests/test_structures/__init__.py | tests/test_structures/__init__.py | python | Apache-2.0 | cfd5d3a985b0249de009b67d04f37263e11cdf3d | 2026-01-04T14:42:57.197037Z | false | |
open-mmlab/mmdetection | https://github.com/open-mmlab/mmdetection/blob/cfd5d3a985b0249de009b67d04f37263e11cdf3d/tests/test_structures/test_det_data_sample.py | tests/test_structures/test_det_data_sample.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... | python | Apache-2.0 | cfd5d3a985b0249de009b67d04f37263e11cdf3d | 2026-01-04T14:42:57.197037Z | false |
open-mmlab/mmdetection | https://github.com/open-mmlab/mmdetection/blob/cfd5d3a985b0249de009b67d04f37263e11cdf3d/tests/test_structures/test_mask/test_mask_structures.py | tests/test_structures/test_mask/test_mask_structures.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[... | python | Apache-2.0 | cfd5d3a985b0249de009b67d04f37263e11cdf3d | 2026-01-04T14:42:57.197037Z | false |
open-mmlab/mmdetection | https://github.com/open-mmlab/mmdetection/blob/cfd5d3a985b0249de009b67d04f37263e11cdf3d/tests/test_structures/test_bbox/test_horizontal_boxes.py | tests/test_structures/test_bbox/test_horizontal_boxes.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... | python | Apache-2.0 | cfd5d3a985b0249de009b67d04f37263e11cdf3d | 2026-01-04T14:42:57.197037Z | false |
open-mmlab/mmdetection | https://github.com/open-mmlab/mmdetection/blob/cfd5d3a985b0249de009b67d04f37263e11cdf3d/tests/test_structures/test_bbox/test_box_type.py | tests/test_structures/test_bbox/test_box_type.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,
... | python | Apache-2.0 | cfd5d3a985b0249de009b67d04f37263e11cdf3d | 2026-01-04T14:42:57.197037Z | false |
open-mmlab/mmdetection | https://github.com/open-mmlab/mmdetection/blob/cfd5d3a985b0249de009b67d04f37263e11cdf3d/tests/test_structures/test_bbox/utils.py | tests/test_structures/test_bbox/utils.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_... | python | Apache-2.0 | cfd5d3a985b0249de009b67d04f37263e11cdf3d | 2026-01-04T14:42:57.197037Z | false |
open-mmlab/mmdetection | https://github.com/open-mmlab/mmdetection/blob/cfd5d3a985b0249de009b67d04f37263e11cdf3d/tests/test_structures/test_bbox/test_base_boxes.py | tests/test_structures/test_bbox/test_base_boxes.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... | python | Apache-2.0 | cfd5d3a985b0249de009b67d04f37263e11cdf3d | 2026-01-04T14:42:57.197037Z | false |
open-mmlab/mmdetection | https://github.com/open-mmlab/mmdetection/blob/cfd5d3a985b0249de009b67d04f37263e11cdf3d/tests/test_structures/test_bbox/__init__.py | tests/test_structures/test_bbox/__init__.py | python | Apache-2.0 | cfd5d3a985b0249de009b67d04f37263e11cdf3d | 2026-01-04T14:42:57.197037Z | false | |
open-mmlab/mmdetection | https://github.com/open-mmlab/mmdetection/blob/cfd5d3a985b0249de009b67d04f37263e11cdf3d/tests/test_datasets/test_tta.py | tests/test_datasets/test_tta.py | # Copyright (c) OpenMMLab. All rights reserved.
import os.path as osp
from unittest import TestCase
import mmcv
import pytest
from mmdet.datasets.transforms import * # noqa
from mmdet.registry import TRANSFORMS
class TestMuitiScaleFlipAug(TestCase):
def test_exception(self):
with pytest.raises(TypeErr... | python | Apache-2.0 | cfd5d3a985b0249de009b67d04f37263e11cdf3d | 2026-01-04T14:42:57.197037Z | false |
open-mmlab/mmdetection | https://github.com/open-mmlab/mmdetection/blob/cfd5d3a985b0249de009b67d04f37263e11cdf3d/tests/test_datasets/test_openimages.py | tests/test_datasets/test_openimages.py | # Copyright (c) OpenMMLab. All rights reserved.
import unittest
from mmdet.datasets import OpenImagesChallengeDataset, OpenImagesDataset
class TestOpenImagesDataset(unittest.TestCase):
def test_init(self):
dataset = OpenImagesDataset(
data_root='tests/data/OpenImages/',
ann_file=... | python | Apache-2.0 | cfd5d3a985b0249de009b67d04f37263e11cdf3d | 2026-01-04T14:42:57.197037Z | false |
open-mmlab/mmdetection | https://github.com/open-mmlab/mmdetection/blob/cfd5d3a985b0249de009b67d04f37263e11cdf3d/tests/test_datasets/test_mot_challenge_dataset.py | tests/test_datasets/test_mot_challenge_dataset.py | # Copyright (c) OpenMMLab. All rights reserved.
import unittest
from mmdet.datasets import MOTChallengeDataset
class TestMOTChallengeDataset(unittest.TestCase):
def test_mot_challenge_dataset(self):
# test CocoDataset
metainfo = dict(classes=('pedestrian'), task_name='new_task')
dataset ... | python | Apache-2.0 | cfd5d3a985b0249de009b67d04f37263e11cdf3d | 2026-01-04T14:42:57.197037Z | false |
open-mmlab/mmdetection | https://github.com/open-mmlab/mmdetection/blob/cfd5d3a985b0249de009b67d04f37263e11cdf3d/tests/test_datasets/test_coco.py | tests/test_datasets/test_coco.py | # Copyright (c) OpenMMLab. All rights reserved.
import unittest
from mmdet.datasets import CocoDataset
class TestCocoDataset(unittest.TestCase):
def test_coco_dataset(self):
# test CocoDataset
metainfo = dict(classes=('bus', 'car'), task_name='new_task')
dataset = CocoDataset(
... | python | Apache-2.0 | cfd5d3a985b0249de009b67d04f37263e11cdf3d | 2026-01-04T14:42:57.197037Z | false |
open-mmlab/mmdetection | https://github.com/open-mmlab/mmdetection/blob/cfd5d3a985b0249de009b67d04f37263e11cdf3d/tests/test_datasets/test_objects365.py | tests/test_datasets/test_objects365.py | # Copyright (c) OpenMMLab. All rights reserved.
import unittest
from mmdet.datasets import Objects365V1Dataset, Objects365V2Dataset
class TestObjects365V1Dataset(unittest.TestCase):
def test_obj365v1_dataset(self):
# test Objects365V1Dataset
metainfo = dict(classes=('bus', 'car'), task_name='new... | python | Apache-2.0 | cfd5d3a985b0249de009b67d04f37263e11cdf3d | 2026-01-04T14:42:57.197037Z | false |
open-mmlab/mmdetection | https://github.com/open-mmlab/mmdetection/blob/cfd5d3a985b0249de009b67d04f37263e11cdf3d/tests/test_datasets/test_reid_dataset.py | tests/test_datasets/test_reid_dataset.py | # Copyright (c) OpenMMLab. All rights reserved.
import os.path as osp
from unittest import TestCase
from mmdet.datasets import ReIDDataset
PREFIX = osp.join(osp.dirname(__file__), '../data')
# This is a demo annotation file for ReIDDataset.
REID_ANN_FILE = f'{PREFIX}/demo_reid_data/mot17_reid/ann.txt'
class TestReI... | python | Apache-2.0 | cfd5d3a985b0249de009b67d04f37263e11cdf3d | 2026-01-04T14:42:57.197037Z | false |
open-mmlab/mmdetection | https://github.com/open-mmlab/mmdetection/blob/cfd5d3a985b0249de009b67d04f37263e11cdf3d/tests/test_datasets/test_cityscapes.py | tests/test_datasets/test_cityscapes.py | # Copyright (c) OpenMMLab. All rights reserved.
import os
import unittest
from mmengine.fileio import dump
from mmdet.datasets import CityscapesDataset
class TestCityscapesDataset(unittest.TestCase):
def setUp(self) -> None:
image1 = {
'file_name': 'munster/munster_000102_000019_leftImg8bit... | python | Apache-2.0 | cfd5d3a985b0249de009b67d04f37263e11cdf3d | 2026-01-04T14:42:57.197037Z | false |
open-mmlab/mmdetection | https://github.com/open-mmlab/mmdetection/blob/cfd5d3a985b0249de009b67d04f37263e11cdf3d/tests/test_datasets/test_youtube_vis_dataset.py | tests/test_datasets/test_youtube_vis_dataset.py | # Copyright (c) OpenMMLab. All rights reserved.
from unittest import TestCase
from mmdet.datasets import YouTubeVISDataset
class TestYouTubeVISDataset(TestCase):
@classmethod
def setUpClass(cls):
cls.dataset = YouTubeVISDataset(
ann_file='tests/data/vis_sample.json', dataset_version='20... | python | Apache-2.0 | cfd5d3a985b0249de009b67d04f37263e11cdf3d | 2026-01-04T14:42:57.197037Z | false |
open-mmlab/mmdetection | https://github.com/open-mmlab/mmdetection/blob/cfd5d3a985b0249de009b67d04f37263e11cdf3d/tests/test_datasets/test_pascal_voc.py | tests/test_datasets/test_pascal_voc.py | # Copyright (c) OpenMMLab. All rights reserved.
import unittest
from mmdet.datasets import VOCDataset
class TestVOCDataset(unittest.TestCase):
def test_voc2007_init(self):
dataset = VOCDataset(
data_root='tests/data/VOCdevkit/',
ann_file='VOC2007/ImageSets/Main/trainval.txt',
... | python | Apache-2.0 | cfd5d3a985b0249de009b67d04f37263e11cdf3d | 2026-01-04T14:42:57.197037Z | false |
open-mmlab/mmdetection | https://github.com/open-mmlab/mmdetection/blob/cfd5d3a985b0249de009b67d04f37263e11cdf3d/tests/test_datasets/test_coco_api_wrapper.py | tests/test_datasets/test_coco_api_wrapper.py | import os.path as osp
import tempfile
import unittest
from mmengine.fileio import dump
from mmdet.datasets.api_wrappers import COCOPanoptic
class TestCOCOPanoptic(unittest.TestCase):
def setUp(self):
self.tmp_dir = tempfile.TemporaryDirectory()
def tearDown(self):
self.tmp_dir.cleanup()
... | python | Apache-2.0 | cfd5d3a985b0249de009b67d04f37263e11cdf3d | 2026-01-04T14:42:57.197037Z | false |
open-mmlab/mmdetection | https://github.com/open-mmlab/mmdetection/blob/cfd5d3a985b0249de009b67d04f37263e11cdf3d/tests/test_datasets/test_crowdhuman.py | tests/test_datasets/test_crowdhuman.py | # Copyright (c) OpenMMLab. All rights reserved.
import unittest
from mmdet.datasets import CrowdHumanDataset
class TestCrowdHumanDataset(unittest.TestCase):
def test_crowdhuman_init(self):
dataset = CrowdHumanDataset(
data_root='tests/data/crowdhuman_dataset/',
ann_file='test_ann... | python | Apache-2.0 | cfd5d3a985b0249de009b67d04f37263e11cdf3d | 2026-01-04T14:42:57.197037Z | false |
open-mmlab/mmdetection | https://github.com/open-mmlab/mmdetection/blob/cfd5d3a985b0249de009b67d04f37263e11cdf3d/tests/test_datasets/test_coco_panoptic.py | tests/test_datasets/test_coco_panoptic.py | # Copyright (c) OpenMMLab. All rights reserved.
import os
import unittest
from mmengine.fileio import dump
from mmdet.datasets import CocoPanopticDataset
class TestCocoPanopticDataset(unittest.TestCase):
def setUp(self):
image1 = {
'id': 0,
'width': 640,
'height': 64... | python | Apache-2.0 | cfd5d3a985b0249de009b67d04f37263e11cdf3d | 2026-01-04T14:42:57.197037Z | false |
open-mmlab/mmdetection | https://github.com/open-mmlab/mmdetection/blob/cfd5d3a985b0249de009b67d04f37263e11cdf3d/tests/test_datasets/test_wider_face.py | tests/test_datasets/test_wider_face.py | # Copyright (c) OpenMMLab. All rights reserved.
import unittest
import cv2
import numpy as np
from mmdet.datasets import WIDERFaceDataset
class TestWIDERFaceDataset(unittest.TestCase):
def setUp(self) -> None:
img_path = 'tests/data/WIDERFace/WIDER_train/0--Parade/0_Parade_marchingband_1_5.jpg' # noqa... | python | Apache-2.0 | cfd5d3a985b0249de009b67d04f37263e11cdf3d | 2026-01-04T14:42:57.197037Z | false |
open-mmlab/mmdetection | https://github.com/open-mmlab/mmdetection/blob/cfd5d3a985b0249de009b67d04f37263e11cdf3d/tests/test_datasets/test_lvis.py | tests/test_datasets/test_lvis.py | # Copyright (c) OpenMMLab. All rights reserved.
import os
import unittest
from mmengine.fileio import dump
from mmdet.datasets import LVISV1Dataset, LVISV05Dataset
try:
import lvis
except ImportError:
lvis = None
class TestLVISDataset(unittest.TestCase):
def setUp(self) -> None:
image1 = {
... | python | Apache-2.0 | cfd5d3a985b0249de009b67d04f37263e11cdf3d | 2026-01-04T14:42:57.197037Z | false |
open-mmlab/mmdetection | https://github.com/open-mmlab/mmdetection/blob/cfd5d3a985b0249de009b67d04f37263e11cdf3d/tests/test_datasets/test_dsdldet.py | tests/test_datasets/test_dsdldet.py | # Copyright (c) OpenMMLab. All rights reserved.
import unittest
from mmdet.datasets import DSDLDetDataset
try:
from dsdl.dataset import DSDLDataset
except ImportError:
DSDLDataset = None
class TestDSDLDetDataset(unittest.TestCase):
def test_dsdldet_init(self):
if DSDLDataset is not None:
... | python | Apache-2.0 | cfd5d3a985b0249de009b67d04f37263e11cdf3d | 2026-01-04T14:42:57.197037Z | false |
open-mmlab/mmdetection | https://github.com/open-mmlab/mmdetection/blob/cfd5d3a985b0249de009b67d04f37263e11cdf3d/tests/test_datasets/test_samplers/test_multi_source_sampler.py | tests/test_datasets/test_samplers/test_multi_source_sampler.py | # Copyright (c) OpenMMLab. All rights reserved.
import bisect
from unittest import TestCase
from unittest.mock import patch
import numpy as np
from torch.utils.data import ConcatDataset, Dataset
from mmdet.datasets.samplers import GroupMultiSourceSampler, MultiSourceSampler
class DummyDataset(Dataset):
def __... | python | Apache-2.0 | cfd5d3a985b0249de009b67d04f37263e11cdf3d | 2026-01-04T14:42:57.197037Z | false |
open-mmlab/mmdetection | https://github.com/open-mmlab/mmdetection/blob/cfd5d3a985b0249de009b67d04f37263e11cdf3d/tests/test_datasets/test_samplers/test_batch_sampler.py | tests/test_datasets/test_samplers/test_batch_sampler.py | # Copyright (c) OpenMMLab. All rights reserved.
from unittest import TestCase
from unittest.mock import patch
import numpy as np
from mmengine.dataset import DefaultSampler
from torch.utils.data import Dataset
from mmdet.datasets.samplers import AspectRatioBatchSampler
class DummyDataset(Dataset):
def __init_... | python | Apache-2.0 | cfd5d3a985b0249de009b67d04f37263e11cdf3d | 2026-01-04T14:42:57.197037Z | false |
open-mmlab/mmdetection | https://github.com/open-mmlab/mmdetection/blob/cfd5d3a985b0249de009b67d04f37263e11cdf3d/tests/test_datasets/test_samplers/test_track_img_sampler.py | tests/test_datasets/test_samplers/test_track_img_sampler.py | # Copyright (c) OpenMMLab. All rights reserved.
from collections.abc import Iterable
from copy import deepcopy
from unittest import TestCase
from mmengine.dataset import ClassBalancedDataset, ConcatDataset
from mmdet.datasets import MOTChallengeDataset, TrackImgSampler
class TestTrackImgSampler(TestCase):
def ... | python | Apache-2.0 | cfd5d3a985b0249de009b67d04f37263e11cdf3d | 2026-01-04T14:42:57.197037Z | false |
open-mmlab/mmdetection | https://github.com/open-mmlab/mmdetection/blob/cfd5d3a985b0249de009b67d04f37263e11cdf3d/tests/test_datasets/test_transforms/test_geometric.py | tests/test_datasets/test_transforms/test_geometric.py | # Copyright (c) OpenMMLab. All rights reserved.
import copy
import unittest
import numpy as np
from mmdet.datasets.transforms import (GeomTransform, Rotate, ShearX, ShearY,
TranslateX, TranslateY)
from mmdet.structures.bbox import HorizontalBoxes
from mmdet.structures.mask impor... | python | Apache-2.0 | cfd5d3a985b0249de009b67d04f37263e11cdf3d | 2026-01-04T14:42:57.197037Z | true |
open-mmlab/mmdetection | https://github.com/open-mmlab/mmdetection/blob/cfd5d3a985b0249de009b67d04f37263e11cdf3d/tests/test_datasets/test_transforms/test_frame_sampling.py | tests/test_datasets/test_transforms/test_frame_sampling.py | import unittest
import numpy as np
from mmdet.datasets.transforms import BaseFrameSample, UniformRefFrameSample
class TestFrameSample(unittest.TestCase):
def setUp(self):
"""Setup the model and optimizer which are used in every test method.
TestCase calls functions in this order: setUp() -> te... | python | Apache-2.0 | cfd5d3a985b0249de009b67d04f37263e11cdf3d | 2026-01-04T14:42:57.197037Z | false |
open-mmlab/mmdetection | https://github.com/open-mmlab/mmdetection/blob/cfd5d3a985b0249de009b67d04f37263e11cdf3d/tests/test_datasets/test_transforms/test_wrappers.py | tests/test_datasets/test_transforms/test_wrappers.py | import copy
import os.path as osp
import unittest
from mmcv.transforms import Compose
from mmdet.datasets.transforms import MultiBranch, RandomOrder
from mmdet.utils import register_all_modules
from .utils import construct_toy_data
register_all_modules()
class TestMultiBranch(unittest.TestCase):
def setUp(sel... | python | Apache-2.0 | cfd5d3a985b0249de009b67d04f37263e11cdf3d | 2026-01-04T14:42:57.197037Z | false |
open-mmlab/mmdetection | https://github.com/open-mmlab/mmdetection/blob/cfd5d3a985b0249de009b67d04f37263e11cdf3d/tests/test_datasets/test_transforms/test_colorspace.py | tests/test_datasets/test_transforms/test_colorspace.py | # Copyright (c) OpenMMLab. All rights reserved.
import copy
import unittest
from mmdet.datasets.transforms import (AutoContrast, Brightness, Color,
ColorTransform, Contrast, Equalize,
Invert, Posterize, Sharpness, Solarize,
... | python | Apache-2.0 | cfd5d3a985b0249de009b67d04f37263e11cdf3d | 2026-01-04T14:42:57.197037Z | false |
open-mmlab/mmdetection | https://github.com/open-mmlab/mmdetection/blob/cfd5d3a985b0249de009b67d04f37263e11cdf3d/tests/test_datasets/test_transforms/test_loading.py | tests/test_datasets/test_transforms/test_loading.py | # Copyright (c) OpenMMLab. All rights reserved.
import copy
import os
import os.path as osp
import sys
import unittest
from unittest.mock import MagicMock, Mock, patch
import mmcv
import numpy as np
from mmdet.datasets.transforms import (FilterAnnotations, LoadAnnotations,
LoadE... | python | Apache-2.0 | cfd5d3a985b0249de009b67d04f37263e11cdf3d | 2026-01-04T14:42:57.197037Z | false |
open-mmlab/mmdetection | https://github.com/open-mmlab/mmdetection/blob/cfd5d3a985b0249de009b67d04f37263e11cdf3d/tests/test_datasets/test_transforms/test_augment_wrappers.py | tests/test_datasets/test_transforms/test_augment_wrappers.py | # Copyright (c) OpenMMLab. All rights reserved.
import copy
import unittest
from mmdet.datasets.transforms import (AutoAugment, AutoContrast, Brightness,
Color, Contrast, Equalize, Invert,
Posterize, RandAugment, Rotate,
... | python | Apache-2.0 | cfd5d3a985b0249de009b67d04f37263e11cdf3d | 2026-01-04T14:42:57.197037Z | false |
open-mmlab/mmdetection | https://github.com/open-mmlab/mmdetection/blob/cfd5d3a985b0249de009b67d04f37263e11cdf3d/tests/test_datasets/test_transforms/utils.py | tests/test_datasets/test_transforms/utils.py | # Copyright (c) OpenMMLab. All rights reserved.
import numpy as np
from mmengine.testing import assert_allclose
from mmdet.structures.bbox import BaseBoxes, HorizontalBoxes
from mmdet.structures.mask import BitmapMasks, PolygonMasks
def create_random_bboxes(num_bboxes, img_w, img_h):
bboxes_left_top = np.random.... | python | Apache-2.0 | cfd5d3a985b0249de009b67d04f37263e11cdf3d | 2026-01-04T14:42:57.197037Z | false |
open-mmlab/mmdetection | https://github.com/open-mmlab/mmdetection/blob/cfd5d3a985b0249de009b67d04f37263e11cdf3d/tests/test_datasets/test_transforms/test_transforms.py | tests/test_datasets/test_transforms/test_transforms.py | # Copyright (c) OpenMMLab. All rights reserved.
import copy
import os.path as osp
import unittest
import mmcv
import numpy as np
import torch
from mmcv.transforms import LoadImageFromFile
# yapf:disable
from mmdet.datasets.transforms import (CopyPaste, CutOut, Expand,
FixScaleRe... | python | Apache-2.0 | cfd5d3a985b0249de009b67d04f37263e11cdf3d | 2026-01-04T14:42:57.197037Z | true |
open-mmlab/mmdetection | https://github.com/open-mmlab/mmdetection/blob/cfd5d3a985b0249de009b67d04f37263e11cdf3d/tests/test_datasets/test_transforms/test_formatting.py | tests/test_datasets/test_transforms/test_formatting.py | # Copyright (c) OpenMMLab. All rights reserved.
import copy
import os.path as osp
import unittest
import numpy as np
import torch
from mmengine.structures import InstanceData, LabelData, PixelData
from mmdet.datasets.transforms import (PackDetInputs, PackReIDInputs,
PackTrackInp... | python | Apache-2.0 | cfd5d3a985b0249de009b67d04f37263e11cdf3d | 2026-01-04T14:42:57.197037Z | false |
open-mmlab/mmdetection | https://github.com/open-mmlab/mmdetection/blob/cfd5d3a985b0249de009b67d04f37263e11cdf3d/tests/test_datasets/test_transforms/__init__.py | tests/test_datasets/test_transforms/__init__.py | # Copyright (c) OpenMMLab. All rights reserved.
from .utils import construct_toy_data, create_full_masks, create_random_bboxes
__all__ = ['create_random_bboxes', 'create_full_masks', 'construct_toy_data']
| python | Apache-2.0 | cfd5d3a985b0249de009b67d04f37263e11cdf3d | 2026-01-04T14:42:57.197037Z | false |
open-mmlab/mmdetection | https://github.com/open-mmlab/mmdetection/blob/cfd5d3a985b0249de009b67d04f37263e11cdf3d/tests/test_datasets/test_transforms/test_instaboost.py | tests/test_datasets/test_transforms/test_instaboost.py | import os.path as osp
import unittest
import numpy as np
from mmdet.registry import TRANSFORMS
from mmdet.utils import register_all_modules
register_all_modules()
class TestInstaboost(unittest.TestCase):
def setUp(self):
"""Setup the model and optimizer which are used in every test method.
Te... | python | Apache-2.0 | cfd5d3a985b0249de009b67d04f37263e11cdf3d | 2026-01-04T14:42:57.197037Z | false |
open-mmlab/mmdetection | https://github.com/open-mmlab/mmdetection/blob/cfd5d3a985b0249de009b67d04f37263e11cdf3d/tests/test_visualization/test_local_visualizer.py | tests/test_visualization/test_local_visualizer.py | import os
from unittest import TestCase
import cv2
import numpy as np
import torch
from mmengine.structures import InstanceData, PixelData
from mmdet.evaluation import INSTANCE_OFFSET
from mmdet.structures import DetDataSample
from mmdet.visualization import DetLocalVisualizer, TrackLocalVisualizer
def _rand_bboxes... | python | Apache-2.0 | cfd5d3a985b0249de009b67d04f37263e11cdf3d | 2026-01-04T14:42:57.197037Z | false |
open-mmlab/mmdetection | https://github.com/open-mmlab/mmdetection/blob/cfd5d3a985b0249de009b67d04f37263e11cdf3d/tests/test_visualization/test_palette.py | tests/test_visualization/test_palette.py | # Copyright (c) OpenMMLab. All rights reserved.
import numpy as np
from mmdet.datasets import CocoDataset
from mmdet.visualization import get_palette, jitter_color, palette_val
def test_palette():
assert palette_val([(1, 2, 3)])[0] == (1 / 255, 2 / 255, 3 / 255)
# test list
palette = [(1, 0, 0), (0, 1, ... | python | Apache-2.0 | cfd5d3a985b0249de009b67d04f37263e11cdf3d | 2026-01-04T14:42:57.197037Z | false |
open-mmlab/mmdetection | https://github.com/open-mmlab/mmdetection/blob/cfd5d3a985b0249de009b67d04f37263e11cdf3d/tests/test_engine/__init__.py | tests/test_engine/__init__.py | python | Apache-2.0 | cfd5d3a985b0249de009b67d04f37263e11cdf3d | 2026-01-04T14:42:57.197037Z | false | |
open-mmlab/mmdetection | https://github.com/open-mmlab/mmdetection/blob/cfd5d3a985b0249de009b67d04f37263e11cdf3d/tests/test_engine/test_runner/test_loops.py | tests/test_engine/test_runner/test_loops.py | # Copyright (c) OpenMMLab. All rights reserved.
import tempfile
from unittest import TestCase
from unittest.mock import Mock
import torch
import torch.nn as nn
from mmengine.evaluator import Evaluator
from mmengine.model import BaseModel
from mmengine.optim import OptimWrapper
from mmengine.runner import Runner
from t... | python | Apache-2.0 | cfd5d3a985b0249de009b67d04f37263e11cdf3d | 2026-01-04T14:42:57.197037Z | false |
open-mmlab/mmdetection | https://github.com/open-mmlab/mmdetection/blob/cfd5d3a985b0249de009b67d04f37263e11cdf3d/tests/test_engine/test_optimizers/test_layer_decay_optimizer_constructor.py | tests/test_engine/test_optimizers/test_layer_decay_optimizer_constructor.py | # Copyright (c) OpenMMLab. All rights reserved.
import torch
import torch.nn as nn
from mmcv.cnn import ConvModule
from mmdet.engine import LearningRateDecayOptimizerConstructor
base_lr = 1
decay_rate = 2
base_wd = 0.05
weight_decay = 0.05
expected_stage_wise_lr_wd_convnext = [{
'weight_decay': 0.0,
'lr_scal... | python | Apache-2.0 | cfd5d3a985b0249de009b67d04f37263e11cdf3d | 2026-01-04T14:42:57.197037Z | false |
open-mmlab/mmdetection | https://github.com/open-mmlab/mmdetection/blob/cfd5d3a985b0249de009b67d04f37263e11cdf3d/tests/test_engine/test_optimizers/__init__.py | tests/test_engine/test_optimizers/__init__.py | python | Apache-2.0 | cfd5d3a985b0249de009b67d04f37263e11cdf3d | 2026-01-04T14:42:57.197037Z | false | |
open-mmlab/mmdetection | https://github.com/open-mmlab/mmdetection/blob/cfd5d3a985b0249de009b67d04f37263e11cdf3d/tests/test_engine/test_hooks/test_visualization_hook.py | tests/test_engine/test_hooks/test_visualization_hook.py | # Copyright (c) OpenMMLab. All rights reserved.
import os.path as osp
import shutil
import time
from unittest import TestCase
from unittest.mock import Mock
import torch
from mmengine.structures import InstanceData
from mmdet.engine.hooks import DetVisualizationHook, TrackVisualizationHook
from mmdet.structures impor... | python | Apache-2.0 | cfd5d3a985b0249de009b67d04f37263e11cdf3d | 2026-01-04T14:42:57.197037Z | false |
open-mmlab/mmdetection | https://github.com/open-mmlab/mmdetection/blob/cfd5d3a985b0249de009b67d04f37263e11cdf3d/tests/test_engine/test_hooks/test_checkloss_hook.py | tests/test_engine/test_hooks/test_checkloss_hook.py | # Copyright (c) OpenMMLab. All rights reserved.
from unittest import TestCase
from unittest.mock import Mock
import torch
from mmdet.engine.hooks import CheckInvalidLossHook
class TestCheckInvalidLossHook(TestCase):
def test_after_train_iter(self):
n = 50
hook = CheckInvalidLossHook(n)
... | python | Apache-2.0 | cfd5d3a985b0249de009b67d04f37263e11cdf3d | 2026-01-04T14:42:57.197037Z | false |
open-mmlab/mmdetection | https://github.com/open-mmlab/mmdetection/blob/cfd5d3a985b0249de009b67d04f37263e11cdf3d/tests/test_engine/test_hooks/test_sync_norm_hook.py | tests/test_engine/test_hooks/test_sync_norm_hook.py | # Copyright (c) OpenMMLab. All rights reserved.
from unittest import TestCase
from unittest.mock import Mock, patch
import torch.nn as nn
from mmdet.engine.hooks import SyncNormHook
class TestSyncNormHook(TestCase):
@patch(
'mmdet.engine.hooks.sync_norm_hook.get_dist_info', return_value=(0, 1))
def... | python | Apache-2.0 | cfd5d3a985b0249de009b67d04f37263e11cdf3d | 2026-01-04T14:42:57.197037Z | false |
open-mmlab/mmdetection | https://github.com/open-mmlab/mmdetection/blob/cfd5d3a985b0249de009b67d04f37263e11cdf3d/tests/test_engine/test_hooks/test_yolox_mode_switch_hook.py | tests/test_engine/test_hooks/test_yolox_mode_switch_hook.py | # Copyright (c) OpenMMLab. All rights reserved.
from unittest import TestCase
from unittest.mock import Mock, patch
from mmdet.engine.hooks import YOLOXModeSwitchHook
class TestYOLOXModeSwitchHook(TestCase):
@patch('mmdet.engine.hooks.yolox_mode_switch_hook.is_model_wrapper')
def test_is_model_wrapper_and_p... | python | Apache-2.0 | cfd5d3a985b0249de009b67d04f37263e11cdf3d | 2026-01-04T14:42:57.197037Z | false |
open-mmlab/mmdetection | https://github.com/open-mmlab/mmdetection/blob/cfd5d3a985b0249de009b67d04f37263e11cdf3d/tests/test_engine/test_hooks/test_num_class_check_hook.py | tests/test_engine/test_hooks/test_num_class_check_hook.py | # Copyright (c) OpenMMLab. All rights reserved.
from copy import deepcopy
from unittest import TestCase
from unittest.mock import Mock
from mmcv.cnn import VGG
from mmengine.dataset import BaseDataset
from torch import nn
from mmdet.engine.hooks import NumClassCheckHook
from mmdet.models.roi_heads.mask_heads import F... | python | Apache-2.0 | cfd5d3a985b0249de009b67d04f37263e11cdf3d | 2026-01-04T14:42:57.197037Z | false |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.