Registry / ai-ml / mmdet
library3.3.0pypypiunverified

MMDetection is an open-source object detection toolbox based on PyTorch, part of the OpenMMLab project. It provides a comprehensive collection of detection, instance segmentation, and object grounding algorithms, along with a benchmark for various computer vision tasks. Currently at version 3.3.0, it features frequent updates, including state-of-the-art models like Grounding DINO and various Transformer-based detectors, and integrates closely with other OpenMMLab libraries like MMEngine and MMCV.

pip install openmim mim install 'mmcv>=2.0.0' # or 'mmcv-lite>=2.0.0' mim install mmdet
INSTALL
IMPORT
SIG · MMDET
M
mmdet
ai-mlpythonv3.3.0
Install
Import
Disk
Pass rate
0/ 10
Env Coverage0 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v? · pip install
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
py 3.103.940 runs
no_wheel
glibc
py 3.103.940 runs
timeout
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

DetInferencer
from mim.commands.search import DetInferencer
from mim.commands.search import DetInferencer

This quickstart demonstrates how to perform inference using MMDetection 3.x's `DetInferencer` class. It downloads a pre-trained `rtmdet_tiny` model, runs inference on a dummy image, prints the detected objects, and saves the visualization to a specified output directory.

import os import torch from mmdet.apis import DetInferencer import mmcv # For image loading if not using DetInferencer's internal loading # Ensure an image file exists for the demo # For simplicity, create a dummy image or download one img_path = 'demo_image.jpg' if not os.path.exists(img_path): # Using a common utility to create a simple dummy image from PIL import Image img = Image.new('RGB', (640, 480), color = 'red') img.save(img_path) print(f"Created dummy image: {img_path}") # Initialize the DetInferencer with a pre-trained model. # The model weights will be automatically downloaded. # Using device='cpu' for broader compatibility. # rtmdet_tiny is a lightweight model for quick demo. inferencer = DetInferencer(model='rtmdet_tiny_8xb32-300e_coco', device='cpu') # Perform inference on the image # The result contains detections, bounding boxes, labels, and scores. result = inferencer(img_path, show=False) # show=False to prevent immediate display # Print detected objects (example for the first image if batched) if isinstance(result['predictions'], list) and len(result['predictions']) > 0: first_image_predictions = result['predictions'][0] print(f"Detected objects in {img_path}:") for box, label, score in zip(first_image_predictions['bboxes'], first_image_predictions['labels'], first_image_predictions['scores']): print(f" Label: {label}, Score: {score:.2f}, BBox: {list(map(int, box))}") # To save the visualization, specify an output directory output_dir = 'mmdet_output' os.makedirs(output_dir, exist_ok=True) inferencer(img_path, out_dir=output_dir) print(f"Inference results saved to {output_dir}") # Clean up the dummy image and output directory (optional) os.remove(img_path) # For a full cleanup, you might also remove output_dir recursively # import shutil; shutil.rmtree(output_dir)
Debug
Known issues
breakingMMDetection 3.x introduced significant breaking changes compared to 2.x, including a completely revamped config system, data pipelines, API, and a new dependency on MMEngine.
fix
Refer to the official migration guide (from 2.x to 3.x) and update configuration files, API calls, and data processing logic. Ensure `mmengine` and `mmcv>=2.0.0` are installed.
affects: 3.0.0 and later
deprecatedPython 3.6 support has been deprecated since MMDetection 2.28.0. MMDetection 3.x officially requires Python 3.7 or newer.
fix
Upgrade your Python environment to 3.7 or a later supported version (e.g., 3.8, 3.9, 3.10, 3.11).
affects: 2.28.0 and later (especially 3.x)
gotchaMMCV version compatibility is crucial. Mismatches between MMDetection, PyTorch, and MMCV versions (especially `mmcv-full` vs `mmcv` in v2.x) are a very common source of installation and runtime errors.
fix
Always install `mmcv` (or `mmcv-full` for older versions) using `mim install` or explicitly check compatibility tables in the official documentation before manual installation. Ensure `mmcv` version matches MMDetection and PyTorch/CUDA versions.
affects: All versions
gotchaRuntime errors like 'undefined symbol', 'DLL load failed', 'invalid device function', or 'no kernel image is available for execution' often stem from CUDA, PyTorch, and MMCV compilation mismatches.
fix
Verify that your PyTorch, CUDA toolkit, and MMCV (especially custom ops) are compiled with compatible CUDA versions and GCC. Use `python mmdet/utils/collect_env.py` to diagnose the environment. Reinstall PyTorch and MMCV if necessary, ensuring correct CUDA versions.
affects: All versions with GPU support
Upgrade
Version history
3.3.0latest on PyPI · released Jan 5, 2024
Audit
Dependencies
torchrequiredCore deep learning framework. MMDetection 3.x requires PyTorch 1.8+.
torchvisionrequiredCompanion library for PyTorch, providing datasets, models, and image transformations.
mmenginerequiredOpenMMLab's foundational library for training deep learning models, used as the new runner in MMDetection 3.x.
mmcvrequiredOpenMMLab's foundational library for computer vision, providing common utilities and CUDA operators. MMDetection 3.x requires MMCV 2.0.0+.
openmimoptionalOpenMMLab's unified package manager, simplifies installation of OpenMMLab projects and their dependencies.
pycocotoolsoptionalRequired for COCO dataset evaluation.
Agent activity
15 hits · last 30 days
node
12
OpenAI (training)
1
Resources
mmdet — pip install mmdet · libregistry