This repository provides a simplified approach to installing MMDetection, designed for beginners to solve common environment configuration issues like CUDA error, mmcv, mmdet setup error, and dependency conflict error.
中文 | English
- ✅ Pre-configured environment files, no need to solve dependency issues manually
- ✅ Detailed step-by-step instructions for first-time users
- ✅ Automated installation scripts for one-click setup
- ✅ Avoids common errors and pitfalls
- Python 3.8
- CUDA 11.8
- Sufficient disk space (at least 5GB)
⚠️ If you plan to use a different version (e.g., Python 3.10 or CUDA 12),
please manually align compatible versions of PyTorch, MMCV, and MMEngine to avoid conflicts.
Incompatible versions may cause installation issues or runtime errors.
If you are using a 50-series GPU might cause some error!!✅ Recommended references:
- Clone this repository
git clone https://github.com/yourusername/mmdetection-easy-setup.git
cd mmdetection-easy-setup- Create and activate Conda environment
conda env create -f environment.yml
conda activate mmdetection_easy_setup- Use mim install mmengine and mmcv
mim install mmengine
mim install "mmcv==2.1.0"- Install mmdet
Case a: If you develop and run mmdet directly, install it from source:
git clone https://github.com/open-mmlab/mmdetection.git
cd mmdetection
pip install -v -e .
# "-v" means verbose, or more output
# "-e" means installing a project in editable mode,
# thus any local modifications made to the code will take effect without reinstallation.Case b: If you use mmdet as a dependency or third-party package, install it with MIM:
mim install mmdet- Clone this repository
git clone https://github.com/yourusername/easy-mmdetection-setup.git
cd easy-mmdetection-setup- Create virtual environment
python -m venv mmdetection_easy_setup
source mmdetection_easy_setup/bin/activate # Linux
# or
mmdetection_easy_setup\Scripts\activate # Windows- Install dependencies
pip install -r requirements.txt- Use mim install mmengine and mmcv
mim install mmengine
mim install "mmcv==2.1.0"- Install mmdet
Case a: If you develop and run mmdet directly, install it from source:
git clone https://github.com/open-mmlab/mmdetection.git
cd mmdetection
pip install -v -e .
# "-v" means verbose, or more output
# "-e" means installing a project in editable mode,
# thus any local modifications made to the code will take effect without reinstallation.Case b: If you use mmdet as a dependency or third-party package, install it with MIM:
mim install mmdet# Linux/Mac
./install.sh
# Windows
install.batAfter successful installation, run the following test:
cd ./mmdetection-easy-setup
python verify_install_env.py# Execute in Python
import mmdet
import torch
print(f"MMDetection version: {mmdet.__version__}")
print(f"PyTorch version: {torch.__version__}")
print(f"CUDA available: {torch.cuda.is_available()}")After installation, check out MMdetection Getting Started Guide to learn how to:
- Run your first object detection
- Use pre-trained models for inference
- Train with your own dataset
- See example code for common tasks
Getting "CUDA error: ..." during installation
This usually indicates that the PyTorch version doesn't match your CUDA version. Make sure to use a PyTorch build that matches your system's CUDA version. You can find compatible versions at the PyTorch website.ImportError: cannot import name 'XXXX' from 'mmdet'
This typically happens when MMCV and MMDetection versions are not compatible. Please ensure you're using our provided environment files where the versions have been tested for compatibility.This installation method has been tested on:
- Windows 11 + CUDA 11.8
If you find any issues or have suggestions for improvements, please feel free to open an issue or submit a pull request.
This project is licensed under the Apache License 2.0 - see the LICENSE file for details.
- MMDetection - For creating this amazing object detection toolbox
- OpenMMLab - For their continued contributions to the computer vision community