SuperAPI AI Directory

ascend-mmdet-install

Coding & development

View repository

Updated 10-24 04:38

About this skill

ascend-mmdet-install

Features

Install mmdetection (2D object detection library) in an Ascend NPU container

Prerequisites

  • mmcv is installed
  • Ascend CANN and torch_npu are installed in the container
  • The working directory is mounted

Usage

Step 1: Confirm the prerequisites

Ensure mmcv is correctly installed:

python -c "import mmcv; print(mmcv.__version__)"

Step 2: Clone the mmdetection repository

Choose according to the network conditions:

Direct server connection:

git clone -b v2.24.0 https://github.com/open-mmlab/mmdetection.git

Server network timeout: configure a proxy or clone locally and transfer via scp

# 方案1:配置代理
export http_proxy=http://proxy:port
export https_proxy=http://proxy:port
git clone -b v2.24.0 https://github.com/open-mmlab/mmdetection.git

# 方案2:本地克隆后传输(仍使用GitHub链接)
# 本地执行
git clone -b v2.24.0 https://github.com/open-mmlab/mmdetection.git
scp -r mmdetection user@server:/target/path/

Important: Always use the official GitHub link, do not use mirror sites.

Step 3: Apply patches (if any)

cd mmdetection
cp /path/to/DrivingSDK/model_examples/BEVFormer/mmdet_config.patch .
git apply --reject mmdet_config.patch

Step 4: Install

source /opt/conda/bin/activate <conda-env-name>
pip install -e .

Step 5: Verify the installation

python -c "import mmdet; print(mmdet.__version__)"

NPU verification:

python -c "import site; print([p for p in site.getsitepackages() if 'cuda' in p.lower()])"
# 应输出空列表

FAQ

  • Missing dependencies: ensure mmcv and mmengine are installed
  • Patch failure: skip non-critical patches or handle them manually

Decision guidance

Ask the user:

  1. Is mmcv installed?
  2. Can the server network access GitHub?
  3. Do specific patches need to be applied?