Features
Install the OpenMMLab series libraries in the Ascend NPU container environment, supporting:
- mmcv (computer vision foundation library)
- mmdet (object detection library)
- mmdet3d (3D object detection library)
- detectron2 (Facebook's detection and segmentation library)
Runtime Environment
- Target environment: Ascend NPU container (Linux)
- Client:Windows/macOS/Linux
- Network: Requires access to GitHub/Gitee
Modules
- mmcv: Compile and install mmcv-full (including NPU operators) →
mmcv/SKILL.md - mmdet: Install mmdetection →
mmdet/SKILL.md - mmdet3d: Install mmdetection3d (including mmsegmentation dependency) →
mmdet3d/SKILL.md - detectron2: Install detectron2 from source (NPU-compatible) →
detectron2/SKILL.md
Configuration
Required information (must be confirmed with the user)
-
Target server information:
- Server address/SSH connection method
- Container name or ID
- Working directory mount path (e.g. /home/zqq)
-
conda environment:
- Environment name (e.g. torch2.1.0_py38)
- Python version
- PyTorch version
-
Network situation:
- Whether a proxy is available
- Whether the GitHub connection times out
Optional information
- patch file location: Configuration file path in DrivingSDK
- Installation order: Adjusted according to user requirements
Prerequisite third-party library dependencies
Before installing the OpenMMLab libraries, the prerequisite dependency packages need to be installed. Select the corresponding requirements file according to the target PyTorch version:
| PyTorch version | requirements file |
|---|---|
| torch 2.1.x | requirements.txt |
| torch 2.6.0 | requirements_pytorch2.6.0.txt |
| torch 2.7.1 | requirements_pytorch2.7.1.txt |
| torch 2.7.1 (Ascend NPU) | requirements_pytorch2.7.1_a5.txt |
File location reference:DrivingSDK/model_examples/BEVFormer/requirements*.txt
Installation method:
pip install -r /path/to/requirements_xxx.txt
Key principles
⚠️ Important: Do not install OpenMMLab libraries directly with pip
It is strictly forbidden to use pip install mmcv-full or similar methods to install directly, because:
- The patch files provided by DrivingSDK contain NPU adaptation modifications; direct installation will cause the patches to fail to apply
- The source installation + patch application method must be used
Correct process:
- Try to git clone the repository directly; if it times out, proceed to the next step
- git clone the repository locally (using a mirror or direct clone)
- Transfer to the server via scp
- Apply the patch files in DrivingSDK
- Compile and install
NPU environment check
Verification is required after installation:
python -c "import site; print([p for p in site.getsitepackages() if 'cuda' in p.lower()])"
If CUDA-related path output appears, it means the CUDA version was installed and needs to be reinstalled.
Network strategy
| Situation | Strategy |
|---|---|
| The server can connect directly to GitHub normally | git clone directly on the server |
| The server network times out | Clone locally → transfer to the server via scp |
| A proxy is available | Operate after configuring the proxy |
Dependencies
mmcv (基础)
├── mmdet
├── mmdet3d → 依赖 mmsegmentation
└── detectron2
Decision guidance
Ask the user to confirm:
- Which conda environment should be used?
- How is the server's network situation? (Can it access GitHub directly?)
- Do all libraries need to be installed? Or specific libraries?
- Patch file location? (e.g., if using DrivingSDK)
Pre-installation checks:
- Confirm the target environment is NPU rather than CUDA
- Check whether torch_npu is already installed
- Confirm the working directory is writable