Unverified Commit 144f1e12 authored by Zaida Zhou's avatar Zaida Zhou Committed by GitHub
Browse files

[Docs] Add a script to check the installation of mmcv-full (#1474)

* [Docs] Add a script to verify the installation of mmcv-full

* polish documentation

* polish documentation

* print the running and compiling environments

* rename scripts to .dev_scripts

* polish readme
parent 0ce29733
import numpy as np
import torch
from mmcv.ops import box_iou_rotated
from mmcv.utils import collect_env
def check_installation():
"""Check whether mmcv-full has been installed successfully."""
np_boxes1 = np.asarray(
[[1.0, 1.0, 3.0, 4.0, 0.5], [2.0, 2.0, 3.0, 4.0, 0.6],
[7.0, 7.0, 8.0, 8.0, 0.4]],
dtype=np.float32)
np_boxes2 = np.asarray(
[[0.0, 2.0, 2.0, 5.0, 0.3], [2.0, 1.0, 3.0, 3.0, 0.5],
[5.0, 5.0, 6.0, 7.0, 0.4]],
dtype=np.float32)
boxes1 = torch.from_numpy(np_boxes1)
boxes2 = torch.from_numpy(np_boxes2)
# test mmcv-full with CPU ops
box_iou_rotated(boxes1, boxes2)
# test mmcv-full with both CPU and CUDA ops
if torch.cuda.is_available():
boxes1 = boxes1.cuda()
boxes2 = boxes2.cuda()
box_iou_rotated(boxes1, boxes2)
if __name__ == '__main__':
print('Start checking the installation of mmcv-full ...')
check_installation()
print('mmcv-full has been installed successfully.\n')
env_info_dict = collect_env()
env_info = '\n'.join([(f'{k}: {v}') for k, v in env_info_dict.items()])
dash_line = '-' * 60 + '\n'
print('Environment info:\n' + dash_line + env_info + '\n' + dash_line)
......@@ -52,7 +52,7 @@ a. Install the full version.
Before installing mmcv-full, make sure that PyTorch has been successfully installed following the [official guide](https://pytorch.org/).
We provide pre-built mmcv packages (recommended) with different PyTorch and CUDA versions to simplify the building.
We provide pre-built mmcv packages (recommended) with different PyTorch and CUDA versions to simplify the building. In addition, you can run [check_installation.py](.dev_scripts/check_installation.py) to check the installation of mmcv-full after running the installation commands.
i. Install the latest version.
......
......@@ -51,7 +51,7 @@ a. 安装完整版
在安装 mmcv-full 之前,请确保 PyTorch 已经成功安装在环境中,可以参考 PyTorch 官方[文档](https://pytorch.org/)
我们提供了不同 PyTorch 和 CUDA 版本的 mmcv-full 预编译包,可以大大简化用户安装编译过程。强烈推荐通过预编译包来安装。
我们提供了不同 PyTorch 和 CUDA 版本的 mmcv-full 预编译包,可以大大简化用户安装编译过程。强烈推荐通过预编译包来安装。另外,安装完成后可以运行 [check_installation.py](.dev_scripts/check_installation.py) 脚本检查 mmcv-full 是否安装成功。
i. 安装最新版本
......
......@@ -13,7 +13,7 @@ a. Install the full version.
Before installing mmcv-full, make sure that PyTorch has been successfully installed following the [official guide](https://pytorch.org/).
We provide pre-built mmcv packages (recommended) with different PyTorch and CUDA versions to simplify the building.
We provide pre-built mmcv packages (recommended) with different PyTorch and CUDA versions to simplify the building. In addition, you can run [check_installation.py](.dev_scripts/check_installation.py) to check the installation of mmcv-full after running the installation commands.
i. Install the latest version.
......
......@@ -13,7 +13,7 @@ a. 安装完整版
在安装 mmcv-full 之前,请确保 PyTorch 已经成功安装在环境中,可以参考 PyTorch 官方[文档](https://pytorch.org/)
我们提供了不同 PyTorch 和 CUDA 版本的 mmcv-full 预编译包,可以大大简化用户安装编译过程。强烈推荐通过预编译包来安装。
我们提供了不同 PyTorch 和 CUDA 版本的 mmcv-full 预编译包,可以大大简化用户安装编译过程。强烈推荐通过预编译包来安装。另外,安装完成后可以运行 [check_installation.py](https://github.com/open-mmlab/mmcv/.dev_scripts/check_installation.py) 脚本检查 mmcv-full 是否安装成功。
i. 安装最新版本
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment