mirror of https://github.com/open-mmlab/mmcv.git
[Docs] Refine reamde and installation (#2340)
* [Docs] Simplify README * Simplify README_zh-CN * Update installation docs * Add mmyolo link in README * update introduction * update installation * Update build docs * remove io link in README * updatepull/2349/head
parent
cb2eb57683
commit
5b279fbd53
262
README.md
262
README.md
|
@ -20,6 +20,7 @@
|
|||
</div>
|
||||
|
||||
[](https://mmcv.readthedocs.io/en/2.x/)
|
||||
[](https://mmcv.readthedocs.io/en/2.x/get_started/installation.html)
|
||||
[](https://pypi.org/project/mmcv/)
|
||||
[](https://pypi.org/project/mmcv)
|
||||
[](https://github.com/open-mmlab/mmcv/actions)
|
||||
|
@ -30,38 +31,15 @@ English | [简体中文](README_zh-CN.md)
|
|||
|
||||
## Introduction
|
||||
|
||||
MMCV is a foundational library for computer vision research and supports many
|
||||
research projects as below:
|
||||
MMCV is a foundational library for computer vision research and it provides the following functionalities:
|
||||
|
||||
- [MIM](https://github.com/open-mmlab/mim): MIM installs OpenMMLab packages.
|
||||
- [MMClassification](https://github.com/open-mmlab/mmclassification): OpenMMLab image classification toolbox and benchmark.
|
||||
- [MMDetection](https://github.com/open-mmlab/mmdetection): OpenMMLab detection toolbox and benchmark.
|
||||
- [MMDetection3D](https://github.com/open-mmlab/mmdetection3d): OpenMMLab's next-generation platform for general 3D object detection.
|
||||
- [MMRotate](https://github.com/open-mmlab/mmrotate): OpenMMLab rotated object detection toolbox and benchmark.
|
||||
- [MMSegmentation](https://github.com/open-mmlab/mmsegmentation): OpenMMLab semantic segmentation toolbox and benchmark.
|
||||
- [MMOCR](https://github.com/open-mmlab/mmocr): OpenMMLab text detection, recognition, and understanding toolbox.
|
||||
- [MMPose](https://github.com/open-mmlab/mmpose): OpenMMLab pose estimation toolbox and benchmark.
|
||||
- [MMHuman3D](https://github.com/open-mmlab/mmhuman3d): OpenMMLab 3D human parametric model toolbox and benchmark.
|
||||
- [MMSelfSup](https://github.com/open-mmlab/mmselfsup): OpenMMLab self-supervised learning toolbox and benchmark.
|
||||
- [MMRazor](https://github.com/open-mmlab/mmrazor): OpenMMLab model compression toolbox and benchmark.
|
||||
- [MMFewShot](https://github.com/open-mmlab/mmfewshot): OpenMMLab fewshot learning toolbox and benchmark.
|
||||
- [MMAction2](https://github.com/open-mmlab/mmaction2): OpenMMLab's next-generation action understanding toolbox and benchmark.
|
||||
- [MMTracking](https://github.com/open-mmlab/mmtracking): OpenMMLab video perception toolbox and benchmark.
|
||||
- [MMFlow](https://github.com/open-mmlab/mmflow): OpenMMLab optical flow toolbox and benchmark.
|
||||
- [MMEditing](https://github.com/open-mmlab/mmediting): OpenMMLab image and video editing toolbox.
|
||||
- [MMGeneration](https://github.com/open-mmlab/mmgeneration): OpenMMLab image and video generative models toolbox.
|
||||
- [MMDeploy](https://github.com/open-mmlab/mmdeploy): OpenMMLab model deployment framework.
|
||||
- [Image/Video processing](https://mmcv.readthedocs.io/en/2.x/understand_mmcv/data_process.html)
|
||||
- [Image and annotation visualization](https://mmcv.readthedocs.io/en/2.x/understand_mmcv/visualization.html)
|
||||
- [Image transformation](https://mmcv.readthedocs.io/en/2.x/understand_mmcv/data_transform.html)
|
||||
- [Various CNN architectures](https://mmcv.readthedocs.io/en/2.x/understand_mmcv/cnn.html)
|
||||
- [High-quality implementation of common CPU and CUDA ops](https://mmcv.readthedocs.io/en/2.x/understand_mmcv/ops.html)
|
||||
|
||||
It provides the following functionalities.
|
||||
|
||||
- Universal IO APIs
|
||||
- Image/Video processing
|
||||
- Image and annotation visualization
|
||||
- Image transformation
|
||||
- Various CNN architectures
|
||||
- High-quality implementation of common CUDA ops
|
||||
|
||||
It supports the following systems.
|
||||
It supports the following systems:
|
||||
|
||||
- Linux
|
||||
- Windows
|
||||
|
@ -75,186 +53,66 @@ Note: MMCV requires Python 3.6+.
|
|||
|
||||
There are two versions of MMCV:
|
||||
|
||||
- **mmcv**: comprehensive, with full features and various CUDA ops out of box. It takes longer time to build.
|
||||
- **mmcv**: comprehensive, with full features and various CUDA ops out of the box. It takes longer time to build.
|
||||
- **mmcv-lite**: lite, without CUDA ops but all other features, similar to mmcv\<1.0.0. It is useful when you do not need those CUDA ops.
|
||||
|
||||
**Note**: Do not install both versions in the same environment, otherwise you may encounter errors like `ModuleNotFound`. You need to uninstall one before installing the other. `Installing the full version is highly recommended if CUDA is available`.
|
||||
|
||||
a. Install the full version.
|
||||
### Install mmcv
|
||||
|
||||
Before installing mmcv, make sure that PyTorch has been successfully installed following the [official guide](https://pytorch.org/). For macOS M1 users, please make sure you are using `PyTorch Nightly`.
|
||||
Before installing mmcv, make sure that PyTorch has been successfully installed following the [PyTorch official installation guide](https://github.com/pytorch/pytorch#installation). For macOS M1 users, please make sure you are using `PyTorch Nightly`.
|
||||
|
||||
We provide pre-built mmcv packages (recommended) with different PyTorch and CUDA versions to simplify the building for **Linux and Windows systems**. In addition, you can run [check_installation.py](.dev_scripts/check_installation.py) to check the installation of mmcv after running the installation commands.
|
||||
The command to install mmcv on Linux or Windows platforms is as follows (if your system is macOS, please refer to [build mmcv from source](https://mmcv.readthedocs.io/en/2.x/get_started/build.html#macos-mmcv))
|
||||
|
||||
i. Install the latest version.
|
||||
|
||||
The rule for installing the latest `mmcv` is as follows:
|
||||
|
||||
```shell
|
||||
pip install 'mmcv>=2.0.0rc1' -f https://download.openmmlab.com/mmcv/dist/{cu_version}/{torch_version}/index.html
|
||||
```bash
|
||||
pip install -U openmim
|
||||
mim install 'mmcv>=2.0.0rc1'
|
||||
```
|
||||
|
||||
Please replace `{cu_version}` and `{torch_version}` in the url to your desired one. For example,
|
||||
to install the latest `mmcv` with `CUDA 11.1` and `PyTorch 1.9.0`, use the following command:
|
||||
If you need to specify the version of mmcv, you can use the following command
|
||||
|
||||
```shell
|
||||
pip install 'mmcv>=2.0.0rc1' -f https://download.openmmlab.com/mmcv/dist/cu111/torch1.9.0/index.html
|
||||
```bash
|
||||
mim install mmcv==2.0.0rc1
|
||||
```
|
||||
|
||||
**Note**: mmcv is only compiled on PyTorch 1.x.0 because the compatibility usually holds between 1.x.0 and 1.x.1. If your PyTorch version is 1.x.1, you can install mmcv compiled with PyTorch 1.x.0 and it usually works well. For example, if your PyTorch version is 1.8.1 and CUDA version is 11.1, you can use the following command to install mmcv.
|
||||
If you find that the above installation command does not use a pre-built package ending with `.whl` but a source package ending with `.tar.gz`, you may not have a pre-build package corresponding to the PyTorch or CUDA or mmcv version, in which case you can [build mmcv from source](https://mmcv.readthedocs.io/en/2.x/get_started/build.html).
|
||||
|
||||
```shell
|
||||
pip install 'mmcv>=2.0.0rc1' -f https://download.openmmlab.com/mmcv/dist/cu111/torch1.8.0/index.html
|
||||
<details>
|
||||
<summary>Installation log using pre-built packages</summary>
|
||||
|
||||
Looking in links: https://download.openmmlab.com/mmcv/dist/cu102/torch1.8.0/index.html<br />
|
||||
Collecting mmcv<br />
|
||||
<b>Downloading https://download.openmmlab.com/mmcv/dist/cu102/torch1.8.0/mmcv-2.0.0rc1-cp38-cp38-manylinux1_x86_64.whl</b>
|
||||
|
||||
</details>
|
||||
|
||||
<details>
|
||||
<summary>Installation log using source packages</summary>
|
||||
|
||||
Looking in links: https://download.openmmlab.com/mmcv/dist/cu102/torch1.8.0/index.html<br />
|
||||
Collecting mmcv==2.0.0rc1<br />
|
||||
<b>Downloading mmcv-2.0.0rc1.tar.gz</b>
|
||||
|
||||
</details>
|
||||
|
||||
For more installation methods, please refer to the [Installation documentation](https://mmcv.readthedocs.io/en/2.x/get_started/installation.html).
|
||||
|
||||
### Install mmcv-lite
|
||||
|
||||
If you need to use PyTorch-related modules, make sure PyTorch has been successfully installed in your environment by referring to the [PyTorch official installation guide](https://github.com/pytorch/pytorch#installation).
|
||||
|
||||
```bash
|
||||
pip install -U openmim
|
||||
mim install 'mmcv-lite>=2.0.0rc1'
|
||||
```
|
||||
|
||||
For more details, please refer the the following tables and delete `=={mmcv_version}`.
|
||||
|
||||
ii. Install a specified version.
|
||||
|
||||
The rule for installing a specified `mmcv` is as follows:
|
||||
|
||||
```shell
|
||||
pip install mmcv=={mmcv_version} -f https://download.openmmlab.com/mmcv/dist/{cu_version}/{torch_version}/index.html
|
||||
```
|
||||
|
||||
First of all, please refer to the Releases and replace `{mmcv_version}` a specified one. e.g. `2.0.0rc1`.
|
||||
Then replace `{cu_version}` and `{torch_version}` in the url to your desired versions. For example,
|
||||
to install `mmcv==2.0.0rc1` with `CUDA 11.1` and `PyTorch 1.9.0`, use the following command:
|
||||
|
||||
```shell
|
||||
pip install mmcv==2.0.0rc1 -f https://download.openmmlab.com/mmcv/dist/cu111/torch1.9.0/index.html
|
||||
```
|
||||
|
||||
For more details, please refer the the following tables.
|
||||
|
||||
<table class="docutils">
|
||||
<tbody>
|
||||
<tr>
|
||||
<th width="80"> CUDA </th>
|
||||
<th valign="bottom" align="left" width="120">torch 1.12</th>
|
||||
<th valign="bottom" align="left" width="120">torch 1.11</th>
|
||||
<th valign="bottom" align="left" width="120">torch 1.10</th>
|
||||
<th valign="bottom" align="left" width="120">torch 1.9</th>
|
||||
<th valign="bottom" align="left" width="120">torch 1.8</th>
|
||||
<th valign="bottom" align="left" width="120">torch 1.7</th>
|
||||
<th valign="bottom" align="left" width="120">torch 1.6</th>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="left">11.6</td>
|
||||
<td align="left"><details><summary> install </summary><pre><code>pip install mmcv-full=={mmcv_version} -f https://download.openmmlab.com/mmcv/dist/cu116/torch1.12.0/index.html</code></pre> </details></td>
|
||||
<td align="left"></td>
|
||||
<td align="left"></td>
|
||||
<td align="left"></td>
|
||||
<td align="left"></td>
|
||||
<td align="left"></td>
|
||||
<td align="left"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="left">11.5</td>
|
||||
<td align="left"></td>
|
||||
<td align="left"><details><summary> install </summary><pre><code>pip install mmcv-full=={mmcv_version} -f https://download.openmmlab.com/mmcv/dist/cu115/torch1.11.0/index.html</code></pre> </details></td>
|
||||
<td align="left"></td>
|
||||
<td align="left"></td>
|
||||
<td align="left"></td>
|
||||
<td align="left"></td>
|
||||
<td align="left"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="left">11.3</td>
|
||||
<td align="left"><details><summary> install </summary><pre><code>pip install mmcv-full=={mmcv_version} -f https://download.openmmlab.com/mmcv/dist/cu113/torch1.12.0/index.html</code></pre> </details></td>
|
||||
<td align="left"><details><summary> install </summary><pre><code>pip install mmcv-full=={mmcv_version} -f https://download.openmmlab.com/mmcv/dist/cu113/torch1.11.0/index.html</code></pre> </details></td>
|
||||
<td align="left"><details><summary> install </summary><pre><code>pip install mmcv-full=={mmcv_version} -f https://download.openmmlab.com/mmcv/dist/cu113/torch1.10.0/index.html</code></pre> </details></td>
|
||||
<td align="left"></td>
|
||||
<td align="left"></td>
|
||||
<td align="left"></td>
|
||||
<td align="left"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="left">11.1</td>
|
||||
<td align="left"></td>
|
||||
<td align="left"></td>
|
||||
<td align="left"><details><summary> install </summary><pre><code>pip install mmcv-full=={mmcv_version} -f https://download.openmmlab.com/mmcv/dist/cu111/torch1.10.0/index.html</code></pre> </details> </td>
|
||||
<td align="left"><details><summary> install </summary><pre><code>pip install mmcv-full=={mmcv_version} -f https://download.openmmlab.com/mmcv/dist/cu111/torch1.9.0/index.html</code></pre> </details> </td>
|
||||
<td align="left"><details><summary> install </summary><pre><code>pip install mmcv-full=={mmcv_version} -f https://download.openmmlab.com/mmcv/dist/cu111/torch1.8.0/index.html</code></pre> </details> </td>
|
||||
<td align="left"> </td>
|
||||
<td align="left"> </td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="left">11.0</td>
|
||||
<td align="left"></td>
|
||||
<td align="left"></td>
|
||||
<td align="left"></td>
|
||||
<td align="left"></td>
|
||||
<td align="left"></td>
|
||||
<td align="left"><details><summary> install </summary><pre><code>pip install mmcv-full=={mmcv_version} -f https://download.openmmlab.com/mmcv/dist/cu110/torch1.7.0/index.html</code></pre> </details> </td>
|
||||
<td align="left"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="left">10.2</td>
|
||||
<td align="left"><details><summary> install </summary><pre><code>pip install mmcv-full=={mmcv_version} -f https://download.openmmlab.com/mmcv/dist/cu102/torch1.12.0/index.html</code></pre> </details></td>
|
||||
<td align="left"><details><summary> install </summary><pre><code>pip install mmcv-full=={mmcv_version} -f https://download.openmmlab.com/mmcv/dist/cu102/torch1.11.0/index.html</code></pre> </details></td>
|
||||
<td align="left"><details><summary> install </summary><pre><code>pip install mmcv-full=={mmcv_version} -f https://download.openmmlab.com/mmcv/dist/cu102/torch1.10.0/index.html</code></pre> </details></td>
|
||||
<td align="left"><details><summary> install </summary><pre><code>pip install mmcv-full=={mmcv_version} -f https://download.openmmlab.com/mmcv/dist/cu102/torch1.9.0/index.html</code></pre> </details> </td>
|
||||
<td align="left"><details><summary> install </summary><pre><code>pip install mmcv-full=={mmcv_version} -f https://download.openmmlab.com/mmcv/dist/cu102/torch1.8.0/index.html</code></pre> </details> </td>
|
||||
<td align="left"><details><summary> install </summary><pre><code>pip install mmcv-full=={mmcv_version} -f https://download.openmmlab.com/mmcv/dist/cu102/torch1.7.0/index.html</code></pre> </details> </td>
|
||||
<td align="left"><details><summary> install </summary><pre><code>pip install mmcv-full=={mmcv_version} -f https://download.openmmlab.com/mmcv/dist/cu102/torch1.6.0/index.html</code></pre> </details> </td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="left">10.1</td>
|
||||
<td align="left"></td>
|
||||
<td align="left"></td>
|
||||
<td align="left"></td>
|
||||
<td align="left"></td>
|
||||
<td align="left"><details><summary> install </summary><pre><code> pip install mmcv-full=={mmcv_version} -f https://download.openmmlab.com/mmcv/dist/cu101/torch1.8.0/index.html</code></pre> </details> </td>
|
||||
<td align="left"><details><summary> install </summary><pre><code> pip install mmcv-full=={mmcv_version} -f https://download.openmmlab.com/mmcv/dist/cu101/torch1.7.0/index.html</code></pre> </details> </td>
|
||||
<td align="left"><details><summary> install </summary><pre><code> pip install mmcv-full=={mmcv_version} -f https://download.openmmlab.com/mmcv/dist/cu101/torch1.6.0/index.html</code></pre> </details> </td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="left">9.2</td>
|
||||
<td align="left"></td>
|
||||
<td align="left"></td>
|
||||
<td align="left"></td>
|
||||
<td align="left"></td>
|
||||
<td align="left"></td>
|
||||
<td align="left"><details><summary> install </summary><pre><code> pip install mmcv-full=={mmcv_version} -f https://download.openmmlab.com/mmcv/dist/cu92/torch1.7.0/index.html</code></pre> </details> </td>
|
||||
<td align="left"><details><summary> install </summary><pre><code> pip install mmcv-full=={mmcv_version} -f https://download.openmmlab.com/mmcv/dist/cu92/torch1.6.0/index.html</code></pre> </details> </td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="left">cpu</td>
|
||||
<td align="left"><details><summary> install </summary><pre><code> pip install mmcv-full=={mmcv_version} -f https://download.openmmlab.com/mmcv/dist/cpu/torch1.12.0/index.html</code></pre> </details></td>
|
||||
<td align="left"><details><summary> install </summary><pre><code> pip install mmcv-full=={mmcv_version} -f https://download.openmmlab.com/mmcv/dist/cpu/torch1.11.0/index.html</code></pre> </details></td>
|
||||
<td align="left"><details><summary> install </summary><pre><code> pip install mmcv-full=={mmcv_version} -f https://download.openmmlab.com/mmcv/dist/cpu/torch1.10.0/index.html</code></pre> </details> </td>
|
||||
<td align="left"><details><summary> install </summary><pre><code> pip install mmcv-full=={mmcv_version} -f https://download.openmmlab.com/mmcv/dist/cpu/torch1.9.0/index.html</code></pre> </details> </td>
|
||||
<td align="left"><details><summary> install </summary><pre><code> pip install mmcv-full=={mmcv_version} -f https://download.openmmlab.com/mmcv/dist/cpu/torch1.8.0/index.html</code></pre> </details> </td>
|
||||
<td align="left"><details><summary> install </summary><pre><code> pip install mmcv-full=={mmcv_version} -f https://download.openmmlab.com/mmcv/dist/cpu/torch1.7.0/index.html</code></pre> </details> </td>
|
||||
<td align="left"><details><summary> install </summary><pre><code> pip install mmcv-full=={mmcv_version} -f https://download.openmmlab.com/mmcv/dist/cpu/torch1.6.0/index.html</code></pre> </details> </td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
**Note**: mmcv does not provide pre-built packages for `cu102-torch1.11` and `cu92-torch*` on Windows.
|
||||
|
||||
Another way is to compile locally by running
|
||||
|
||||
```python
|
||||
pip install 'mmcv>=2.0.0rc1'
|
||||
```
|
||||
|
||||
Note that the local compiling may take up to 10 mins.
|
||||
|
||||
b. Install the lite version.
|
||||
|
||||
```python
|
||||
pip install mmcv-lite
|
||||
```
|
||||
|
||||
If you would like to build MMCV from source, please refer to the [guide](https://mmcv.readthedocs.io/en/2.x/get_started/build.html).
|
||||
|
||||
## FAQ
|
||||
|
||||
If you face some installation issues, CUDA related issues or RuntimeErrors,
|
||||
you may first refer to this [Frequently Asked Questions](https://mmcv.readthedocs.io/en/2.x/faq.html).
|
||||
|
||||
If you face installation problems or runtime issues, you may first refer to this [Frequently Asked Questions](https://mmcv.readthedocs.io/en/2.x/faq.html) to see if there is a solution. If the problem is still not solved, feel free to open an [issue](https://github.com/open-mmlab/mmcv/issues).
|
||||
|
||||
## Citation
|
||||
|
||||
If you find this project useful in your research, please consider cite:
|
||||
|
@ -275,3 +133,27 @@ We appreciate all contributions to improve MMCV. Please refer to [CONTRIBUTING.m
|
|||
## License
|
||||
|
||||
MMCV is released under the Apache 2.0 license, while some specific operations in this library are with other licenses. Please refer to [LICENSES.md](LICENSES.md) for the careful check, if you are using our code for commercial matters.
|
||||
|
||||
## Projects in OpenMMLab
|
||||
|
||||
- [MMEngine](https://github.com/open-mmlab/mmengine): OpenMMLab foundational library for training deep learning models.
|
||||
- [MMCV](https://github.com/open-mmlab/mmcv): OpenMMLab foundational library for computer vision.
|
||||
- [MIM](https://github.com/open-mmlab/mim): MIM installs OpenMMLab packages.
|
||||
- [MMClassification](https://github.com/open-mmlab/mmclassification): OpenMMLab image classification toolbox and benchmark.
|
||||
- [MMDetection](https://github.com/open-mmlab/mmdetection): OpenMMLab detection toolbox and benchmark.
|
||||
- [MMDetection3D](https://github.com/open-mmlab/mmdetection3d): OpenMMLab's next-generation platform for general 3D object detection.
|
||||
- [MMRotate](https://github.com/open-mmlab/mmrotate): OpenMMLab rotated object detection toolbox and benchmark.
|
||||
- [MMYOLO](https://github.com/open-mmlab/mmyolo): OpenMMLab YOLO series toolbox and benchmark.
|
||||
- [MMSegmentation](https://github.com/open-mmlab/mmsegmentation): OpenMMLab semantic segmentation toolbox and benchmark.
|
||||
- [MMOCR](https://github.com/open-mmlab/mmocr): OpenMMLab text detection, recognition, and understanding toolbox.
|
||||
- [MMPose](https://github.com/open-mmlab/mmpose): OpenMMLab pose estimation toolbox and benchmark.
|
||||
- [MMHuman3D](https://github.com/open-mmlab/mmhuman3d): OpenMMLab 3D human parametric model toolbox and benchmark.
|
||||
- [MMSelfSup](https://github.com/open-mmlab/mmselfsup): OpenMMLab self-supervised learning toolbox and benchmark.
|
||||
- [MMRazor](https://github.com/open-mmlab/mmrazor): OpenMMLab model compression toolbox and benchmark.
|
||||
- [MMFewShot](https://github.com/open-mmlab/mmfewshot): OpenMMLab fewshot learning toolbox and benchmark.
|
||||
- [MMAction2](https://github.com/open-mmlab/mmaction2): OpenMMLab's next-generation action understanding toolbox and benchmark.
|
||||
- [MMTracking](https://github.com/open-mmlab/mmtracking): OpenMMLab video perception toolbox and benchmark.
|
||||
- [MMFlow](https://github.com/open-mmlab/mmflow): OpenMMLab optical flow toolbox and benchmark.
|
||||
- [MMEditing](https://github.com/open-mmlab/mmediting): OpenMMLab image and video editing toolbox.
|
||||
- [MMGeneration](https://github.com/open-mmlab/mmgeneration): OpenMMLab image and video generative models toolbox.
|
||||
- [MMDeploy](https://github.com/open-mmlab/mmdeploy): OpenMMLab model deployment framework.
|
||||
|
|
303
README_zh-CN.md
303
README_zh-CN.md
|
@ -20,6 +20,7 @@
|
|||
</div>
|
||||
|
||||
[](https://mmcv.readthedocs.io/zh_CN/2.x/)
|
||||
[](https://mmcv.readthedocs.io/zh_CN/2.x/get_started/installation.html)
|
||||
[](https://pypi.org/project/mmcv/)
|
||||
[](https://pypi.org/project/mmcv)
|
||||
[](https://github.com/open-mmlab/mmcv/actions)
|
||||
|
@ -30,13 +31,103 @@
|
|||
|
||||
## 简介
|
||||
|
||||
MMCV 是一个面向计算机视觉的基础库,它支持了很多开源项目,例如:
|
||||
MMCV 是一个面向计算机视觉的基础库,它提供了以下功能:
|
||||
|
||||
- [MIM](https://github.com/open-mmlab/mim): MIM 是 OpenMMLab 项目、算法、模型的统一入口
|
||||
- [图像和视频处理](https://mmcv.readthedocs.io/zh_CN/2.x/understand_mmcv/data_process.html)
|
||||
- [图像和标注结果可视化](https://mmcv.readthedocs.io/zh_CN/2.x/understand_mmcv/visualization.html)
|
||||
- [图像变换](https://mmcv.readthedocs.io/zh_CN/2.x/understand_mmcv/data_transform.html)
|
||||
- [多种 CNN 网络结构](https://mmcv.readthedocs.io/zh_CN/2.x/understand_mmcv/cnn.html)
|
||||
- [高质量实现的常见 CUDA 算子](https://mmcv.readthedocs.io/zh_CN/2.x/understand_mmcv/ops.html)
|
||||
|
||||
MMCV 支持多种平台,包括:
|
||||
|
||||
- Linux
|
||||
- Windows
|
||||
- macOS
|
||||
|
||||
如想了解更多特性和使用,请参考[文档](http://mmcv.readthedocs.io/zh_CN/2.x)。
|
||||
|
||||
提示: MMCV 需要 Python 3.6 以上版本。
|
||||
|
||||
## 安装
|
||||
|
||||
MMCV 有两个版本:
|
||||
|
||||
- **mmcv**: 完整版,包含所有的特性以及丰富的开箱即用的 CUDA 算子。注意完整版本可能需要更长时间来编译。
|
||||
- **mmcv-lite**: 精简版,不包含 CUDA 算子但包含其余所有特性和功能,类似 MMCV 1.0 之前的版本。如果你不需要使用 CUDA 算子的话,精简版可以作为一个考虑选项。
|
||||
|
||||
**注意**: 请不要在同一个环境中安装两个版本,否则可能会遇到类似 `ModuleNotFound` 的错误。在安装一个版本之前,需要先卸载另一个。`如果 CUDA 可用,强烈推荐安装 mmcv`。
|
||||
|
||||
### 安装 mmcv
|
||||
|
||||
在安装 mmcv 之前,请确保 PyTorch 已经成功安装在环境中,可以参考 [PyTorch 官方安装文档](https://github.com/pytorch/pytorch#installation)。
|
||||
|
||||
在 Linux 和 Windows 平台安装 mmcv 的命令如下(如果你的系统是 macOS,请参考[源码安装 mmcv](https://mmcv.readthedocs.io/zh_CN/2.x/get_started/build.html#macos-mmcv))
|
||||
|
||||
```bash
|
||||
pip install -U openmim
|
||||
mim install 'mmcv>=2.0.0rc1'
|
||||
```
|
||||
|
||||
如果需要指定 mmcv 的版本,可以使用以下命令
|
||||
|
||||
```bash
|
||||
mim install mmcv==2.0.0rc1
|
||||
```
|
||||
|
||||
如果发现上述的安装命令没有使用预编译包(以 `.whl` 结尾)而是使用源码包(以 `.tar.gz` 结尾)安装,则有可能是我们没有提供和当前环境的 PyTorch 版本、CUDA 版本相匹配的 mmcv 预编译包,此时,你可以[源码安装 mmcv](https://mmcv.readthedocs.io/zh_CN/2.x/get_started/build.html)。
|
||||
|
||||
<details>
|
||||
<summary>使用预编译包的安装日志</summary>
|
||||
|
||||
Looking in links: https://download.openmmlab.com/mmcv/dist/cu102/torch1.8.0/index.html<br />
|
||||
Collecting mmcv<br />
|
||||
<b>Downloading https://download.openmmlab.com/mmcv/dist/cu102/torch1.8.0/mmcv-2.0.0rc1-cp38-cp38-manylinux1_x86_64.whl</b>
|
||||
|
||||
</details>
|
||||
|
||||
<details>
|
||||
<summary>使用源码包的安装日志</summary>
|
||||
|
||||
Looking in links: https://download.openmmlab.com/mmcv/dist/cu102/torch1.8.0/index.html<br />
|
||||
Collecting mmcv==2.0.0rc1<br />
|
||||
<b>Downloading mmcv-2.0.0rc1.tar.gz</b>
|
||||
|
||||
</details>
|
||||
|
||||
更多安装方式请参考[安装文档](https://mmcv.readthedocs.io/zh_CN/2.x/get_started/installation.html)。
|
||||
|
||||
### 安装 mmcv-lite
|
||||
|
||||
如果你需要使用和 PyTorch 相关的模块,请确保 PyTorch 已经成功安装在环境中,可以参考 [PyTorch 官方安装文档](https://github.com/pytorch/pytorch#installation)。
|
||||
|
||||
```bash
|
||||
pip install -U openmim
|
||||
mim install 'mmcv-lite>=2.0.0rc1'
|
||||
```
|
||||
|
||||
## FAQ
|
||||
|
||||
如果你遇到了安装问题或者运行时问题,请查看[问题解决页面](https://mmcv.readthedocs.io/zh_CN/2.x/faq.html)是否已有解决方案。如果问题仍然没有解决,欢迎提 [issue](https://github.com/open-mmlab/mmcv/issues)。
|
||||
|
||||
## 贡献指南
|
||||
|
||||
我们感谢所有的贡献者为改进和提升 MMCV 所作出的努力。请参考[贡献指南](CONTRIBUTING.md)来了解参与项目贡献的相关指引。
|
||||
|
||||
## 许可证
|
||||
|
||||
`MMCV` 目前以 Apache 2.0 的许可证发布,但是其中有一部分功能并不是使用的 Apache2.0 许可证,我们在 [许可证](LICENSES.md) 中详细地列出了这些功能以及他们对应的许可证,如果您正在从事盈利性活动,请谨慎参考此文档。
|
||||
|
||||
## OpenMMLab 的其他项目
|
||||
|
||||
- [MMEngine](https://github.com/open-mmlab/mmengine): OpenMMLab 深度学习模型训练基础库
|
||||
- [MMCV](https://github.com/open-mmlab/mmcv): OpenMMLab 计算机视觉基础库
|
||||
- [MIM](https://github.com/open-mmlab/mim): MIM 是 OpenMMlab 项目、算法、模型的统一入口
|
||||
- [MMClassification](https://github.com/open-mmlab/mmclassification): OpenMMLab 图像分类工具箱
|
||||
- [MMDetection](https://github.com/open-mmlab/mmdetection): OpenMMLab 目标检测工具箱
|
||||
- [MMDetection3D](https://github.com/open-mmlab/mmdetection3d): OpenMMLab 新一代通用 3D 目标检测平台
|
||||
- [MMRotate](https://github.com/open-mmlab/mmrotate): OpenMMLab 旋转框检测工具箱与测试基准
|
||||
- [MMYOLO](https://github.com/open-mmlab/mmyolo): OpenMMLab YOLO 系列工具箱与测试基准
|
||||
- [MMSegmentation](https://github.com/open-mmlab/mmsegmentation): OpenMMLab 语义分割工具箱
|
||||
- [MMOCR](https://github.com/open-mmlab/mmocr): OpenMMLab 全流程文字检测识别理解工具箱
|
||||
- [MMPose](https://github.com/open-mmlab/mmpose): OpenMMLab 姿态估计工具箱
|
||||
|
@ -51,214 +142,6 @@ MMCV 是一个面向计算机视觉的基础库,它支持了很多开源项目
|
|||
- [MMGeneration](https://github.com/open-mmlab/mmgeneration): OpenMMLab 图片视频生成模型工具箱
|
||||
- [MMDeploy](https://github.com/open-mmlab/mmdeploy): OpenMMLab 模型部署框架
|
||||
|
||||
MMCV 提供了如下众多功能:
|
||||
|
||||
- 通用的 IO 接口
|
||||
- 图像和视频处理
|
||||
- 图像和标注结果可视化
|
||||
- 图像变换
|
||||
- 多种 CNN 网络结构
|
||||
- 高质量实现的常见 CUDA 算子
|
||||
|
||||
MMCV 支持以下的系统:
|
||||
|
||||
- Linux
|
||||
- Windows
|
||||
- macOS
|
||||
|
||||
如想了解更多特性和使用,请参考[文档](http://mmcv.readthedocs.io/zh_CN/latest)。
|
||||
|
||||
提示: MMCV 需要 Python 3.6 以上版本。
|
||||
|
||||
## 安装
|
||||
|
||||
MMCV 有两个版本:
|
||||
|
||||
- **mmcv**: 完整版,包含所有的特性以及丰富的开箱即用的 CUDA 算子。注意完整版本可能需要更长时间来编译。
|
||||
- **mmcv-lite**: 精简版,不包含 CUDA 算子但包含其余所有特性和功能,类似 MMCV 1.0 之前的版本。如果你不需要使用 CUDA 算子的话,精简版可以作为一个考虑选项。
|
||||
|
||||
**注意**: 请不要在同一个环境中安装两个版本,否则可能会遇到类似 `ModuleNotFound` 的错误。在安装一个版本之前,需要先卸载另一个。`如果 CUDA 可用,强烈推荐安装 mmcv`。
|
||||
|
||||
a. 安装完整版
|
||||
|
||||
在安装 mmcv 之前,请确保 PyTorch 已经成功安装在环境中,可以参考 PyTorch [官方文档](https://pytorch.org/)。对于使用 macOS M1 的用户,请确保你的 PyTorch 是 `Nightly` 版本。
|
||||
|
||||
我们提供了 **Linux 和 Windows 平台** PyTorch 和 CUDA 版本组合的 mmcv 预编译包,可以大大简化用户安装编译过程。强烈推荐通过预编译包来安装。另外,安装完成后可以运行 [check_installation.py](.dev_scripts/check_installation.py) 脚本检查 mmcv 是否安装成功。
|
||||
|
||||
i. 安装最新版本
|
||||
|
||||
如下是安装最新版 `mmcv` 的命令
|
||||
|
||||
```shell
|
||||
pip install 'mmcv>=2.0.0rc1' -f https://download.openmmlab.com/mmcv/dist/{cu_version}/{torch_version}/index.html
|
||||
```
|
||||
|
||||
请将链接中的 `{cu_version}` 和 `{torch_version}` 根据自身需求替换成实际的版本号,例如想安装和 `CUDA 11.1`、`PyTorch 1.9.0` 兼容的最新版 `mmcv`,使用如下替换过的命令
|
||||
|
||||
```shell
|
||||
pip install 'mmcv>=2.0.0rc1' -f https://download.openmmlab.com/mmcv/dist/cu111/torch1.9.0/index.html
|
||||
```
|
||||
|
||||
**注意**: PyTorch 在 1.x.0 和 1.x.1 之间通常是兼容的,故 mmcv 只提供 1.x.0 的编译包。如果你的 PyTorch 版本是 1.x.1,你可以放心地安装在 1.x.0 版本编译的 mmcv。例如,如果你的 PyTorch 版本是 1.8.1、CUDA 版本是 11.1,你可以使用以下命令安装 mmcv。
|
||||
|
||||
```shell
|
||||
pip install 'mmcv>=2.0.0rc1' -f https://download.openmmlab.com/mmcv/dist/cu111/torch1.8.0/index.html
|
||||
```
|
||||
|
||||
如果想知道更多 CUDA 和 PyTorch 版本的命令,可以参考下面的表格,将链接中的 `=={mmcv_version}` 删去即可。
|
||||
|
||||
ii. 安装特定的版本
|
||||
|
||||
如下是安装特定版本 `mmcv` 的命令
|
||||
|
||||
```shell
|
||||
pip install mmcv=={mmcv_version} -f https://download.openmmlab.com/mmcv/dist/{cu_version}/{torch_version}/index.html
|
||||
```
|
||||
|
||||
首先请参考版本发布信息找到想要安装的版本号,将 `{mmcv_version}` 替换成该版本号,例如 `2.0.0rc1`。
|
||||
然后将链接中的 `{cu_version}` 和 `{torch_version}` 根据自身需求替换成实际的版本号,例如想安装和 `CUDA 11.1`、`PyTorch 1.9.0` 兼容的 `mmcv` 2.0.0rc1 版本,使用如下替换过的命令
|
||||
|
||||
```shell
|
||||
pip install mmcv==2.0.0rc1 -f https://download.openmmlab.com/mmcv/dist/cu111/torch1.9.0/index.html
|
||||
```
|
||||
|
||||
对于更多的 PyTorch 和 CUDA 版本组合,请参考下表:
|
||||
|
||||
<table class="docutils">
|
||||
<tbody>
|
||||
<tr>
|
||||
<th width="80"> CUDA </th>
|
||||
<th valign="bottom" align="left" width="120">torch 1.12</th>
|
||||
<th valign="bottom" align="left" width="120">torch 1.11</th>
|
||||
<th valign="bottom" align="left" width="120">torch 1.10</th>
|
||||
<th valign="bottom" align="left" width="120">torch 1.9</th>
|
||||
<th valign="bottom" align="left" width="120">torch 1.8</th>
|
||||
<th valign="bottom" align="left" width="120">torch 1.7</th>
|
||||
<th valign="bottom" align="left" width="120">torch 1.6</th>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="left">11.6</td>
|
||||
<td align="left"><details><summary> 安装 </summary><pre><code>pip install mmcv-full=={mmcv_version} -f https://download.openmmlab.com/mmcv/dist/cu116/torch1.12.0/index.html</code></pre> </details></td>
|
||||
<td align="left"></td>
|
||||
<td align="left"></td>
|
||||
<td align="left"></td>
|
||||
<td align="left"></td>
|
||||
<td align="left"></td>
|
||||
<td align="left"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="left">11.5</td>
|
||||
<td align="left"></td>
|
||||
<td align="left"><details><summary> 安装 </summary><pre><code>pip install mmcv-full=={mmcv_version} -f https://download.openmmlab.com/mmcv/dist/cu115/torch1.11.0/index.html</code></pre> </details></td>
|
||||
<td align="left"></td>
|
||||
<td align="left"></td>
|
||||
<td align="left"></td>
|
||||
<td align="left"></td>
|
||||
<td align="left"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="left">11.3</td>
|
||||
<td align="left"><details><summary> 安装 </summary><pre><code>pip install mmcv-full=={mmcv_version} -f https://download.openmmlab.com/mmcv/dist/cu113/torch1.12.0/index.html</code></pre> </details></td>
|
||||
<td align="left"><details><summary> 安装 </summary><pre><code>pip install mmcv-full=={mmcv_version} -f https://download.openmmlab.com/mmcv/dist/cu113/torch1.11.0/index.html</code></pre> </details></td>
|
||||
<td align="left"><details><summary> 安装 </summary><pre><code>pip install mmcv-full=={mmcv_version} -f https://download.openmmlab.com/mmcv/dist/cu113/torch1.10.0/index.html</code></pre> </details></td>
|
||||
<td align="left"></td>
|
||||
<td align="left"></td>
|
||||
<td align="left"></td>
|
||||
<td align="left"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="left">11.1</td>
|
||||
<td align="left"></td>
|
||||
<td align="left"></td>
|
||||
<td align="left"><details><summary> 安装 </summary><pre><code>pip install mmcv-full=={mmcv_version} -f https://download.openmmlab.com/mmcv/dist/cu111/torch1.10.0/index.html</code></pre> </details> </td>
|
||||
<td align="left"><details><summary> 安装 </summary><pre><code>pip install mmcv-full=={mmcv_version} -f https://download.openmmlab.com/mmcv/dist/cu111/torch1.9.0/index.html</code></pre> </details> </td>
|
||||
<td align="left"><details><summary> 安装 </summary><pre><code>pip install mmcv-full=={mmcv_version} -f https://download.openmmlab.com/mmcv/dist/cu111/torch1.8.0/index.html</code></pre> </details> </td>
|
||||
<td align="left"> </td>
|
||||
<td align="left"> </td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="left">11.0</td>
|
||||
<td align="left"></td>
|
||||
<td align="left"></td>
|
||||
<td align="left"></td>
|
||||
<td align="left"></td>
|
||||
<td align="left"></td>
|
||||
<td align="left"><details><summary> 安装 </summary><pre><code>pip install mmcv-full=={mmcv_version} -f https://download.openmmlab.com/mmcv/dist/cu110/torch1.7.0/index.html</code></pre> </details> </td>
|
||||
<td align="left"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="left">10.2</td>
|
||||
<td align="left"><details><summary> 安装 </summary><pre><code>pip install mmcv-full=={mmcv_version} -f https://download.openmmlab.com/mmcv/dist/cu102/torch1.12.0/index.html</code></pre> </details></td>
|
||||
<td align="left"><details><summary> 安装 </summary><pre><code>pip install mmcv-full=={mmcv_version} -f https://download.openmmlab.com/mmcv/dist/cu102/torch1.11.0/index.html</code></pre> </details></td>
|
||||
<td align="left"><details><summary> 安装 </summary><pre><code>pip install mmcv-full=={mmcv_version} -f https://download.openmmlab.com/mmcv/dist/cu102/torch1.10.0/index.html</code></pre> </details></td>
|
||||
<td align="left"><details><summary> 安装 </summary><pre><code>pip install mmcv-full=={mmcv_version} -f https://download.openmmlab.com/mmcv/dist/cu102/torch1.9.0/index.html</code></pre> </details> </td>
|
||||
<td align="left"><details><summary> 安装 </summary><pre><code>pip install mmcv-full=={mmcv_version} -f https://download.openmmlab.com/mmcv/dist/cu102/torch1.8.0/index.html</code></pre> </details> </td>
|
||||
<td align="left"><details><summary> 安装 </summary><pre><code>pip install mmcv-full=={mmcv_version} -f https://download.openmmlab.com/mmcv/dist/cu102/torch1.7.0/index.html</code></pre> </details> </td>
|
||||
<td align="left"><details><summary> 安装 </summary><pre><code>pip install mmcv-full=={mmcv_version} -f https://download.openmmlab.com/mmcv/dist/cu102/torch1.6.0/index.html</code></pre> </details> </td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="left">10.1</td>
|
||||
<td align="left"></td>
|
||||
<td align="left"></td>
|
||||
<td align="left"></td>
|
||||
<td align="left"></td>
|
||||
<td align="left"><details><summary> 安装 </summary><pre><code> pip install mmcv-full=={mmcv_version} -f https://download.openmmlab.com/mmcv/dist/cu101/torch1.8.0/index.html</code></pre> </details> </td>
|
||||
<td align="left"><details><summary> 安装 </summary><pre><code> pip install mmcv-full=={mmcv_version} -f https://download.openmmlab.com/mmcv/dist/cu101/torch1.7.0/index.html</code></pre> </details> </td>
|
||||
<td align="left"><details><summary> 安装 </summary><pre><code> pip install mmcv-full=={mmcv_version} -f https://download.openmmlab.com/mmcv/dist/cu101/torch1.6.0/index.html</code></pre> </details> </td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="left">9.2</td>
|
||||
<td align="left"></td>
|
||||
<td align="left"></td>
|
||||
<td align="left"></td>
|
||||
<td align="left"></td>
|
||||
<td align="left"></td>
|
||||
<td align="left"><details><summary> 安装 </summary><pre><code> pip install mmcv-full=={mmcv_version} -f https://download.openmmlab.com/mmcv/dist/cu92/torch1.7.0/index.html</code></pre> </details> </td>
|
||||
<td align="left"><details><summary> 安装 </summary><pre><code> pip install mmcv-full=={mmcv_version} -f https://download.openmmlab.com/mmcv/dist/cu92/torch1.6.0/index.html</code></pre> </details> </td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="left">cpu</td>
|
||||
<td align="left"><details><summary> 安装 </summary><pre><code> pip install mmcv-full=={mmcv_version} -f https://download.openmmlab.com/mmcv/dist/cpu/torch1.12.0/index.html</code></pre> </details></td>
|
||||
<td align="left"><details><summary> 安装 </summary><pre><code> pip install mmcv-full=={mmcv_version} -f https://download.openmmlab.com/mmcv/dist/cpu/torch1.11.0/index.html</code></pre> </details></td>
|
||||
<td align="left"><details><summary> 安装 </summary><pre><code> pip install mmcv-full=={mmcv_version} -f https://download.openmmlab.com/mmcv/dist/cpu/torch1.10.0/index.html</code></pre> </details> </td>
|
||||
<td align="left"><details><summary> 安装 </summary><pre><code> pip install mmcv-full=={mmcv_version} -f https://download.openmmlab.com/mmcv/dist/cpu/torch1.9.0/index.html</code></pre> </details> </td>
|
||||
<td align="left"><details><summary> 安装 </summary><pre><code> pip install mmcv-full=={mmcv_version} -f https://download.openmmlab.com/mmcv/dist/cpu/torch1.8.0/index.html</code></pre> </details> </td>
|
||||
<td align="left"><details><summary> 安装 </summary><pre><code> pip install mmcv-full=={mmcv_version} -f https://download.openmmlab.com/mmcv/dist/cpu/torch1.7.0/index.html</code></pre> </details> </td>
|
||||
<td align="left"><details><summary> 安装 </summary><pre><code> pip install mmcv-full=={mmcv_version} -f https://download.openmmlab.com/mmcv/dist/cpu/torch1.6.0/index.html</code></pre> </details> </td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
**注意**:mmcv 没有提供 Windows 平台 `cu102-torch1.8.0` 和 `cu92-torch*` 的预编译包。
|
||||
|
||||
除了使用预编译包之外,另一种方式是在本地进行编译,直接运行下述命令
|
||||
|
||||
```python
|
||||
pip install 'mmcv>=2.0.0rc1'
|
||||
```
|
||||
|
||||
但注意本地编译可能会耗时 10 分钟以上。
|
||||
|
||||
b. 安装精简版
|
||||
|
||||
```python
|
||||
pip install mmcv-lite
|
||||
```
|
||||
|
||||
如果想从源码编译 MMCV,请参考[该文档](https://mmcv.readthedocs.io/zh_CN/2.x/get_started/build.html)。
|
||||
|
||||
## FAQ
|
||||
|
||||
如果你遇到了安装问题,CUDA 相关的问题或者 RuntimeErrors,可以首先参考[问题解决页面](https://mmcv.readthedocs.io/zh_CN/2.x/faq.html) 看是否已经有解决方案。
|
||||
|
||||
## 贡献指南
|
||||
|
||||
我们感谢所有的贡献者为改进和提升 MMCV 所作出的努力。请参考[贡献指南](CONTRIBUTING.md)来了解参与项目贡献的相关指引。
|
||||
|
||||
## 许可证
|
||||
|
||||
`MMCV` 目前以 Apache 2.0 的许可证发布,但是其中有一部分功能并不是使用的 Apache2.0 许可证,我们在 [许可证](LICENSES.md) 中详细地列出了这些功能以及他们对应的许可证,如果您正在从事盈利性活动,请谨慎参考此文档。
|
||||
|
||||
## 欢迎加入 OpenMMLab 社区
|
||||
|
||||
扫描下方的二维码可关注 OpenMMLab 团队的 [知乎官方账号](https://www.zhihu.com/people/openmmlab),加入 OpenMMLab 团队的 [官方交流 QQ 群](https://jq.qq.com/?_wv=1027&k=3ijNTqfg),或添加微信小助手”OpenMMLabwx“加入官方交流微信群。
|
||||
|
|
|
@ -16,5 +16,8 @@ RUN apt-get update && apt-get install -y libgl1 libglib2.0-0 \
|
|||
&& rm -rf /var/lib/apt/lists/*
|
||||
|
||||
# Install mmcv
|
||||
ARG MMCV="2.0.0rc1"
|
||||
RUN pip install openmim && mim install mmcv==${MMCV} && python -c 'import mmcv;print(mmcv.__version__)'
|
||||
ARG MMCV=""
|
||||
RUN if [ "${MMCV}" = "" ]; then pip install -U openmim && mim install 'mmcv>=2.0.0rc1'; else pip install -U openmim && mim install mmcv==${MMCV}; fi
|
||||
|
||||
# Verify the installation
|
||||
RUN python -c 'import mmcv;print(mmcv.__version__)'
|
||||
|
|
|
@ -0,0 +1,349 @@
|
|||
{
|
||||
"Linux": [
|
||||
{
|
||||
"cuda": "11.6",
|
||||
"torch": "1.12.x",
|
||||
"mmcv": [
|
||||
"2.0.0rc1"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cuda": "11.5",
|
||||
"torch": "1.11.x",
|
||||
"mmcv": [
|
||||
"2.0.0rc1"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cuda": "11.3",
|
||||
"torch": "1.12.x",
|
||||
"mmcv": [
|
||||
"2.0.0rc1"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cuda": "11.3",
|
||||
"torch": "1.11.x",
|
||||
"mmcv": [
|
||||
"2.0.0rc1"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cuda": "11.3",
|
||||
"torch": "1.10.x",
|
||||
"mmcv": [
|
||||
"2.0.0rc1"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cuda": "11.1",
|
||||
"torch": "1.10.x",
|
||||
"mmcv": [
|
||||
"2.0.0rc1"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cuda": "11.1",
|
||||
"torch": "1.9.x",
|
||||
"mmcv": [
|
||||
"2.0.0rc1"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cuda": "11.1",
|
||||
"torch": "1.8.x",
|
||||
"mmcv": [
|
||||
"2.0.0rc1"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cuda": "11.0",
|
||||
"torch": "1.7.x",
|
||||
"mmcv": [
|
||||
"2.0.0rc1"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cuda": "10.2",
|
||||
"torch": "1.12.x",
|
||||
"mmcv": [
|
||||
"2.0.0rc1"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cuda": "10.2",
|
||||
"torch": "1.11.x",
|
||||
"mmcv": [
|
||||
"2.0.0rc1"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cuda": "10.2",
|
||||
"torch": "1.10.x",
|
||||
"mmcv": [
|
||||
"2.0.0rc1"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cuda": "10.2",
|
||||
"torch": "1.9.x",
|
||||
"mmcv": [
|
||||
"2.0.0rc1"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cuda": "10.2",
|
||||
"torch": "1.8.x",
|
||||
"mmcv": [
|
||||
"2.0.0rc1"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cuda": "10.2",
|
||||
"torch": "1.7.x",
|
||||
"mmcv": [
|
||||
"2.0.0rc1"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cuda": "10.2",
|
||||
"torch": "1.6.x",
|
||||
"mmcv": [
|
||||
"2.0.0rc1"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cuda": "10.1",
|
||||
"torch": "1.8.x",
|
||||
"mmcv": [
|
||||
"2.0.0rc1"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cuda": "10.1",
|
||||
"torch": "1.7.x",
|
||||
"mmcv": [
|
||||
"2.0.0rc1"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cuda": "10.1",
|
||||
"torch": "1.6.x",
|
||||
"mmcv": [
|
||||
"2.0.0rc1"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cuda": "9.2",
|
||||
"torch": "1.7.x",
|
||||
"mmcv": [
|
||||
"2.0.0rc1"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cuda": "9.2",
|
||||
"torch": "1.6.x",
|
||||
"mmcv": [
|
||||
"2.0.0rc1"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cuda": "cpu",
|
||||
"torch": "1.12.x",
|
||||
"mmcv": [
|
||||
"2.0.0rc1"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cuda": "cpu",
|
||||
"torch": "1.11.x",
|
||||
"mmcv": [
|
||||
"2.0.0rc1"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cuda": "cpu",
|
||||
"torch": "1.10.x",
|
||||
"mmcv": [
|
||||
"2.0.0rc1"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cuda": "cpu",
|
||||
"torch": "1.9.x",
|
||||
"mmcv": [
|
||||
"2.0.0rc1"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cuda": "cpu",
|
||||
"torch": "1.8.x",
|
||||
"mmcv": [
|
||||
"2.0.0rc1"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cuda": "cpu",
|
||||
"torch": "1.7.x",
|
||||
"mmcv": [
|
||||
"2.0.0rc1"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cuda": "cpu",
|
||||
"torch": "1.6.x",
|
||||
"mmcv": [
|
||||
"2.0.0rc1"
|
||||
]
|
||||
}
|
||||
],
|
||||
"Windows": [
|
||||
{
|
||||
"cuda": "11.6",
|
||||
"torch": "1.12.x",
|
||||
"mmcv": [
|
||||
"2.0.0rc1"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cuda": "11.5",
|
||||
"torch": "1.11.x",
|
||||
"mmcv": [
|
||||
"2.0.0rc1"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cuda": "11.3",
|
||||
"torch": "1.12.x",
|
||||
"mmcv": [
|
||||
"2.0.0rc1"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cuda": "11.3",
|
||||
"torch": "1.11.x",
|
||||
"mmcv": [
|
||||
"2.0.0rc1"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cuda": "11.3",
|
||||
"torch": "1.10.x",
|
||||
"mmcv": [
|
||||
"2.0.0rc1"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cuda": "11.1",
|
||||
"torch": "1.10.x",
|
||||
"mmcv": [
|
||||
"2.0.0rc1"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cuda": "11.1",
|
||||
"torch": "1.9.x",
|
||||
"mmcv": [
|
||||
"2.0.0rc1"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cuda": "11.1",
|
||||
"torch": "1.8.x",
|
||||
"mmcv": [
|
||||
"2.0.0rc1"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cuda": "10.2",
|
||||
"torch": "1.10.x",
|
||||
"mmcv": [
|
||||
"2.0.0rc1"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cuda": "10.2",
|
||||
"torch": "1.9.x",
|
||||
"mmcv": [
|
||||
"2.0.0rc1"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cuda": "10.2",
|
||||
"torch": "1.8.x",
|
||||
"mmcv": [
|
||||
"2.0.0rc1"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cuda": "10.2",
|
||||
"torch": "1.6.x",
|
||||
"mmcv": [
|
||||
"2.0.0rc1"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cuda": "10.1",
|
||||
"torch": "1.8.x",
|
||||
"mmcv": [
|
||||
"2.0.0rc1"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cuda": "10.1",
|
||||
"torch": "1.6.x",
|
||||
"mmcv": [
|
||||
"2.0.0rc1"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cuda": "cpu",
|
||||
"torch": "1.12.x",
|
||||
"mmcv": [
|
||||
"2.0.0rc1"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cuda": "cpu",
|
||||
"torch": "1.11.x",
|
||||
"mmcv": [
|
||||
"2.0.0rc1"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cuda": "cpu",
|
||||
"torch": "1.10.x",
|
||||
"mmcv": [
|
||||
"2.0.0rc1"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cuda": "cpu",
|
||||
"torch": "1.9.x",
|
||||
"mmcv": [
|
||||
"2.0.0rc1"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cuda": "cpu",
|
||||
"torch": "1.8.x",
|
||||
"mmcv": [
|
||||
"2.0.0rc1"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cuda": "cpu",
|
||||
"torch": "1.7.x",
|
||||
"mmcv": [
|
||||
"2.0.0rc1"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cuda": "cpu",
|
||||
"torch": "1.6.x",
|
||||
"mmcv": [
|
||||
"2.0.0rc1"
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
|
@ -58,6 +58,8 @@ extensions = [
|
|||
|
||||
myst_heading_anchors = 4
|
||||
|
||||
myst_enable_extensions = ['colon_fence']
|
||||
|
||||
# Configuration for intersphinx
|
||||
intersphinx_mapping = {
|
||||
'python': ('https://docs.python.org/3', None),
|
||||
|
|
|
@ -1,46 +1,14 @@
|
|||
## Build MMCV from source
|
||||
|
||||
### Build on Linux or macOS
|
||||
### Build mmcv
|
||||
|
||||
Clone the repo with
|
||||
Before installing mmcv, make sure that PyTorch has been successfully installed following the [PyTorch official installation guide](https://pytorch.org/get-started/locally/#start-locally). This can be verified using the following command
|
||||
|
||||
```bash
|
||||
git clone https://github.com/open-mmlab/mmcv.git
|
||||
cd mmcv
|
||||
git checkout 2.x
|
||||
python -c 'import torch;print(torch.__version__)'
|
||||
```
|
||||
|
||||
It is recommended to install `ninja` to speed up the compilation
|
||||
|
||||
```bash
|
||||
pip install -r requirements/optional.txt
|
||||
```
|
||||
|
||||
You can either
|
||||
|
||||
- install the lite version
|
||||
|
||||
```bash
|
||||
MMCV_WITH_OPS=0 pip install -e .
|
||||
```
|
||||
|
||||
- or install the full version
|
||||
|
||||
```bash
|
||||
pip install -e .
|
||||
```
|
||||
|
||||
If you are on macOS, add the following environment variables before the installing command. Meanwhile, please make sure you are using `PyTorch Nightly` in macOS M1.
|
||||
|
||||
```bash
|
||||
CC=clang CXX=clang++ CFLAGS='-stdlib=libc++'
|
||||
```
|
||||
|
||||
e.g.,
|
||||
|
||||
```bash
|
||||
CC=clang CXX=clang++ CFLAGS='-stdlib=libc++' pip install -e .
|
||||
```
|
||||
If version information is output, then PyTorch is installed.
|
||||
|
||||
```{note}
|
||||
If you would like to use `opencv-python-headless` instead of `opencv-python`,
|
||||
|
@ -48,12 +16,104 @@ e.g., in a minimum container environment or servers without GUI,
|
|||
you can first install it before installing MMCV to skip the installation of `opencv-python`.
|
||||
```
|
||||
|
||||
### Build on Windows
|
||||
#### Build on Linux
|
||||
|
||||
1. Clone the repo
|
||||
|
||||
```bash
|
||||
git clone https://github.com/open-mmlab/mmcv.git
|
||||
cd mmcv
|
||||
```
|
||||
|
||||
2. Install `ninja` and `psutil` to speed up the compilation
|
||||
|
||||
```bash
|
||||
pip install -r requirements/optional.txt
|
||||
```
|
||||
|
||||
3. Check the nvcc version (requires 9.2+. Skip if no GPU available.)
|
||||
|
||||
```bash
|
||||
nvcc --version
|
||||
```
|
||||
|
||||
If the above command outputs the following message, it means that the nvcc setting is OK, otherwise you need to set CUDA_HOME.
|
||||
|
||||
```
|
||||
nvcc: NVIDIA (R) Cuda compiler driver
|
||||
Copyright (c) 2005-2020 NVIDIA Corporation
|
||||
Built on Mon_Nov_30_19:08:53_PST_2020
|
||||
Cuda compilation tools, release 11.2, V11.2.67
|
||||
Build cuda_11.2.r11.2/compiler.29373293_0
|
||||
```
|
||||
|
||||
:::{note}
|
||||
If you want to support ROCm, you can refer to [AMD ROCm](https://rocmdocs.amd.com/en/latest/Installation_Guide/Installation-Guide.html) to install ROCm.
|
||||
:::
|
||||
|
||||
4. Check the gcc version (requires 5.4+)
|
||||
|
||||
```bash
|
||||
gcc --version
|
||||
```
|
||||
|
||||
5. Start building (takes 10+ min)
|
||||
|
||||
```bash
|
||||
pip install -e . -v
|
||||
```
|
||||
|
||||
6. Validate the installation
|
||||
|
||||
```bash
|
||||
python .dev_scripts/check_installation.py
|
||||
```
|
||||
|
||||
If no error is reported by the above command, the installation is successful. If there is an error reported, please check [Frequently Asked Questions](../faq.md) to see if there is already a solution.
|
||||
|
||||
If no solution is found, please feel free to open an [issue](https://github.com/open-mmlab/mmcv/issues).
|
||||
|
||||
#### Build on macOS
|
||||
|
||||
```{note}
|
||||
If you are using a mac with an M1 chip, install the nightly version of PyTorch, otherwise you will encounter the problem in [issues#2218](https://github.com/open-mmlab/mmcv/issues/2218).
|
||||
```
|
||||
|
||||
1. Clone the repo
|
||||
|
||||
```bash
|
||||
git clone https://github.com/open-mmlab/mmcv.git
|
||||
cd mmcv
|
||||
```
|
||||
|
||||
2. Install `ninja` and `psutil` to speed up the compilation
|
||||
|
||||
```bash
|
||||
pip install -r requirements/optional.txt
|
||||
```
|
||||
|
||||
3. Start building
|
||||
|
||||
```bash
|
||||
MMCV_WITH_OPS=1 pip install -e .
|
||||
```
|
||||
|
||||
4. Validate the installation
|
||||
|
||||
```bash
|
||||
python .dev_scripts/check_installation.py
|
||||
```
|
||||
|
||||
If no error is reported by the above command, the installation is successful. If there is an error reported, please check [Frequently Asked Questions](../faq.md) to see if there is already a solution.
|
||||
|
||||
If no solution is found, please feel free to open an [issue](https://github.com/open-mmlab/mmcv/issues).
|
||||
|
||||
#### Build on Windows
|
||||
|
||||
Building MMCV on Windows is a bit more complicated than that on Linux.
|
||||
The following instructions show how to get this accomplished.
|
||||
|
||||
#### Prerequisite
|
||||
##### Prerequisite
|
||||
|
||||
The following software is required for building MMCV on windows.
|
||||
Install them first.
|
||||
|
@ -72,7 +132,7 @@ Install them first.
|
|||
You should know how to set up environment variables, especially `Path`, on Windows. The following instruction relies heavily on this skill.
|
||||
```
|
||||
|
||||
#### Setup Python Environment
|
||||
##### Common steps
|
||||
|
||||
1. Launch Anaconda prompt from Windows Start menu
|
||||
|
||||
|
@ -80,63 +140,39 @@ You should know how to set up environment variables, especially `Path`, on Windo
|
|||
|
||||
2. Create a new conda environment
|
||||
|
||||
```shell
|
||||
conda create --name mmcv python=3.7 # 3.6, 3.7, 3.8 should work too as tested
|
||||
conda activate mmcv # make sure to activate environment before any operation
|
||||
```powershell
|
||||
(base) PS C:\Users\xxx> conda create --name mmcv python=3.7
|
||||
(base) PS C:\Users\xxx> conda activate mmcv # make sure to activate environment before any operation
|
||||
```
|
||||
|
||||
3. Install PyTorch. Choose a version based on your need.
|
||||
|
||||
```shell
|
||||
conda install pytorch torchvision cudatoolkit=10.2 -c pytorch
|
||||
```powershell
|
||||
# CUDA version
|
||||
(mmcv) PS C:\Users\xxx> conda install pytorch torchvision cudatoolkit=10.2 -c pytorch
|
||||
# CPU version
|
||||
(mmcv) PS C:\Users\xxx> conda install install pytorch torchvision cpuonly -c pytorch
|
||||
```
|
||||
|
||||
We only tested PyTorch version >= 1.6.0.
|
||||
4. Clone the repo
|
||||
|
||||
4. Prepare MMCV source code
|
||||
|
||||
```shell
|
||||
git clone https://github.com/open-mmlab/mmcv.git
|
||||
cd mmcv
|
||||
git checkout 2.x
|
||||
```powershell
|
||||
(mmcv) PS C:\Users\xxx> git clone https://github.com/open-mmlab/mmcv.git
|
||||
(mmcv) PS C:\Users\xxx\mmcv> cd mmcv
|
||||
```
|
||||
|
||||
5. Install required Python packages
|
||||
5. Install `ninja` and `psutil` to speed up the compilation
|
||||
|
||||
```shell
|
||||
pip install -r requirements/runtime.txt
|
||||
```powershell
|
||||
(mmcv) PS C:\Users\xxx\mmcv> pip install -r requirements/optional.txt
|
||||
```
|
||||
|
||||
6. It is recommended to install `ninja` to speed up the compilation
|
||||
|
||||
```bash
|
||||
pip install -r requirements/optional.txt
|
||||
```
|
||||
|
||||
#### Build and install MMCV
|
||||
|
||||
MMCV can be built in three ways:
|
||||
|
||||
1. Lite version (without ops)
|
||||
|
||||
In this way, no custom ops are compiled and mmcv is a pure python package.
|
||||
|
||||
2. Full version (CPU ops)
|
||||
|
||||
Module `ops` will be compiled as a pytorch extension, but only x86 code will be compiled. The compiled ops can be executed on CPU only.
|
||||
|
||||
3. Full version (CUDA ops)
|
||||
|
||||
Both x86 and CUDA codes of `ops` module will be compiled. The compiled version can be run on both CPU and CUDA-enabled GPU (if implemented).
|
||||
|
||||
##### Common steps
|
||||
|
||||
1. Set up MSVC compiler
|
||||
6. Set up MSVC compiler
|
||||
|
||||
Set Environment variable, add `C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.27.29110\bin\Hostx86\x64` to `PATH`, so that `cl.exe` will be available in prompt, as shown below.
|
||||
|
||||
```none
|
||||
(base) PS C:\Users\xxx> cl
|
||||
```powershell
|
||||
(mmcv) PS C:\Users\xxx\mmcv> cl
|
||||
Microsoft (R) C/C++ Optimizing Compiler Version 19.27.29111 for x64
|
||||
Copyright (C) Microsoft Corporation. All rights reserved.
|
||||
|
||||
|
@ -147,128 +183,110 @@ MMCV can be built in three ways:
|
|||
|
||||
You may want to change the system language to English because pytorch will parse text output from `cl.exe` to check its version. However only utf-8 is recognized. Navigate to Control Panel -> Region -> Administrative -> Language for Non-Unicode programs and change it to English.
|
||||
|
||||
##### Option 1: Build MMCV (lite version)
|
||||
##### Build and install MMCV
|
||||
|
||||
After finishing above common steps, launch Anaconda shell from Start menu and issue the following commands:
|
||||
mmcv can be built in two ways:
|
||||
|
||||
```shell
|
||||
# activate environment
|
||||
conda activate mmcv
|
||||
# change directory
|
||||
cd mmcv
|
||||
git checkout 2.x
|
||||
# install
|
||||
python setup.py develop
|
||||
# check
|
||||
pip list
|
||||
1. Full version (CPU ops)
|
||||
|
||||
Module `ops` will be compiled as a pytorch extension, but only x86 code will be compiled. The compiled ops can be executed on CPU only.
|
||||
|
||||
2. Full version (CUDA ops)
|
||||
|
||||
Both x86 and CUDA codes of `ops` module will be compiled. The compiled version can be run on both CPU and CUDA-enabled GPU (if implemented).
|
||||
|
||||
###### CPU version
|
||||
|
||||
Build and install
|
||||
|
||||
```powershell
|
||||
(mmcv) PS C:\Users\xxx\mmcv> python setup.py build_ext
|
||||
(mmcv) PS C:\Users\xxx\mmcv> python setup.py develop
|
||||
```
|
||||
|
||||
##### Option 2: Build MMCV (full version with CPU)
|
||||
###### GPU version
|
||||
|
||||
1. Finish above common steps
|
||||
1. Make sure `CUDA_PATH` or `CUDA_HOME` is already set in `envs` via `ls env:`, desired output is shown as below:
|
||||
|
||||
2. Set up environment variables
|
||||
|
||||
```shell
|
||||
$env:MMCV_WITH_OPS = 1
|
||||
$env:MAX_JOBS = 8 # based on your available number of CPU cores and amount of memory
|
||||
```
|
||||
|
||||
3. Following build steps of the lite version
|
||||
|
||||
```shell
|
||||
# activate environment
|
||||
conda activate mmcv
|
||||
# change directory
|
||||
cd mmcv
|
||||
git checkout 2.x
|
||||
# build
|
||||
python setup.py build_ext # if success, cl will be launched to compile ops
|
||||
# install
|
||||
python setup.py develop
|
||||
# check
|
||||
pip list
|
||||
```
|
||||
|
||||
##### Option 3: Build MMCV (full version with CUDA)
|
||||
|
||||
1. Finish above common steps
|
||||
|
||||
2. Make sure `CUDA_PATH` or `CUDA_HOME` is already set in `envs` via `ls env:`, desired output is shown as below:
|
||||
|
||||
```none
|
||||
(base) PS C:\Users\WRH> ls env:
|
||||
```powershell
|
||||
(mmcv) PS C:\Users\xxx\mmcv> ls env:
|
||||
|
||||
Name Value
|
||||
---- -----
|
||||
<... omit some lines ...>
|
||||
CUDA_PATH C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v10.2
|
||||
CUDA_PATH_V10_1 C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v10.1
|
||||
CUDA_PATH_V10_2 C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v10.2
|
||||
<... omit some lines ...>
|
||||
```
|
||||
|
||||
This should already be done by CUDA installer. If not, or you have multiple version of CUDA toolkit installed, set it with
|
||||
|
||||
```shell
|
||||
$env:CUDA_HOME = "C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v10.2"
|
||||
```powershell
|
||||
(mmcv) PS C:\Users\xxx\mmcv> $env:CUDA_HOME = "C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v10.2"
|
||||
# OR
|
||||
$env:CUDA_HOME = $env:CUDA_PATH_V10_2 # if CUDA_PATH_V10_2 is in envs:
|
||||
(mmcv) PS C:\Users\xxx\mmcv> $env:CUDA_HOME = $env:CUDA_PATH_V10_2 # if CUDA_PATH_V10_2 is in envs:
|
||||
```
|
||||
|
||||
3. Set CUDA target arch
|
||||
2. Set CUDA target arch
|
||||
|
||||
```shell
|
||||
# Suppose you are using GTX 1080, which is of capability 6.1
|
||||
$env:TORCH_CUDA_ARCH_LIST="6.1"
|
||||
# OR build all supported arch, will be slow
|
||||
$env:TORCH_CUDA_ARCH_LIST="3.5 3.7 5.0 5.2 6.0 6.1 7.0 7.5"
|
||||
# Here you need to change to the target architecture corresponding to your GPU
|
||||
(mmcv) PS C:\Users\xxx\mmcv> $env:TORCH_CUDA_ARCH_LIST="7.5"
|
||||
```
|
||||
|
||||
```{note}
|
||||
Check your the compute capability of your GPU from [here](https://developer.nvidia.com/cuda-gpus).
|
||||
```
|
||||
:::{note}
|
||||
Check your the compute capability of your GPU from [here](https://developer.nvidia.com/cuda-gpus).
|
||||
|
||||
4. Launch compiling the same way as CPU
|
||||
```powershell
|
||||
(mmcv) PS C:\Users\xxx\mmcv> &"C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v10.2\extras\demo_suite\deviceQuery.exe"
|
||||
Device 0: "NVIDIA GeForce GTX 1660 SUPER"
|
||||
CUDA Driver Version / Runtime Version 11.7 / 11.1
|
||||
CUDA Capability Major/Minor version number: 7.5
|
||||
```
|
||||
|
||||
```shell
|
||||
$env:MMCV_WITH_OPS = 1
|
||||
$env:MAX_JOBS = 8 # based on available number of CPU cores and amount of memory
|
||||
# activate environment
|
||||
conda activate mmcv
|
||||
# change directory
|
||||
cd mmcv
|
||||
git checkout 2.x
|
||||
The 7.5 above indicates the target architecture. Note: You need to replace v10.2 with your CUDA version in the above command.
|
||||
:::
|
||||
|
||||
3. Build and install
|
||||
|
||||
```powershell
|
||||
# build
|
||||
python setup.py build_ext # if success, cl will be launched to compile ops
|
||||
# install
|
||||
python setup.py develop
|
||||
# check
|
||||
pip list
|
||||
```
|
||||
|
||||
```{note}
|
||||
If you are compiling against PyTorch 1.6.0, you might meet some errors from PyTorch as described in [this issue](https://github.com/pytorch/pytorch/issues/42467). Follow [this pull request](https://github.com/pytorch/pytorch/pull/43380/files) to modify the source code in your local PyTorch installation.
|
||||
```{note}
|
||||
If you are compiling against PyTorch 1.6.0, you might meet some errors from PyTorch as described in [this issue](https://github.com/pytorch/pytorch/issues/42467). Follow [this pull request](https://github.com/pytorch/pytorch/pull/43380/files) to modify the source code in your local PyTorch installation.
|
||||
```
|
||||
|
||||
##### Validate installation
|
||||
|
||||
```powershell
|
||||
(mmcv) PS C:\Users\xxx\mmcv> python .dev_scripts/check_installation.py
|
||||
```
|
||||
|
||||
If you meet issues when running or compiling mmcv, we list some common issues in [Frequently Asked Question](../faq.html).
|
||||
If no error is reported by the above command, the installation is successful. If there is an error reported, please check [Frequently Asked Questions](../faq.md) to see if there is already a solution.
|
||||
If no solution is found, please feel free to open an [issue](https://github.com/open-mmlab/mmcv/issues).
|
||||
|
||||
## \[Optional\] Build MMCV on IPU machine
|
||||
### Build mmcv-lite
|
||||
|
||||
Firstly, you need to apply for an IPU cloud machine, see [here](https://www.graphcore.ai/ipus-in-the-cloud).
|
||||
If you need to use PyTorch-related modules, make sure PyTorch has been successfully installed in your environment by referring to the [PyTorch official installation guide](https://github.com/pytorch/pytorch#installation).
|
||||
|
||||
### Option 1: Docker
|
||||
1. Clone the repo
|
||||
|
||||
1. Pull docker
|
||||
```bash
|
||||
git clone https://github.com/open-mmlab/mmcv.git
|
||||
cd mmcv
|
||||
```
|
||||
|
||||
```shell
|
||||
docker pull graphcore/pytorch
|
||||
```
|
||||
2. Start building
|
||||
|
||||
2. Build MMCV under same python environment
|
||||
```bash
|
||||
MMCV_WITH_OPS=0 pip install -e . -v
|
||||
```
|
||||
|
||||
### Option 2: Install from SDK
|
||||
3. Validate installation
|
||||
|
||||
1. Build MMCV
|
||||
|
||||
2. Use pip to install sdk according to [IPU PyTorch document](https://docs.graphcore.ai/projects/poptorch-user-guide/en/latest/installation.html). Also, you need to apply for machine and sdk to Graphcore.
|
||||
```bash
|
||||
python -c 'import mmcv;print(mmcv.__version__)'
|
||||
```
|
||||
|
|
|
@ -9,178 +9,339 @@ There are two versions of MMCV:
|
|||
Do not install both versions in the same environment, otherwise you may encounter errors like `ModuleNotFound`. You need to uninstall one before installing the other. `Installing the full version is highly recommended if CUDA is avaliable`.
|
||||
```
|
||||
|
||||
a. Install the full version.
|
||||
|
||||
Before installing mmcv, make sure that PyTorch has been successfully installed following the [official guide](https://pytorch.org/). For macOS M1 users, please make sure you are using `PyTorch Nightly`.
|
||||
|
||||
We provide pre-built mmcv packages (recommended) with different PyTorch and CUDA versions to simplify the building for **Linux and Windows systems**. In addition, you can run [check_installation.py](https://github.com/open-mmlab/mmcv/blob/2.x/.dev_scripts/check_installation.py) to check the installation of mmcv after running the installation commands.
|
||||
|
||||
i. Install the latest version.
|
||||
|
||||
The rule for installing the latest `mmcv` is as follows:
|
||||
|
||||
```shell
|
||||
pip install 'mmcv>=2.0.0rc1' -f https://download.openmmlab.com/mmcv/dist/{cu_version}/{torch_version}/index.html
|
||||
```
|
||||
|
||||
Please replace `{cu_version}` and `{torch_version}` in the url to your desired one. For example,
|
||||
to install the latest `mmcv` with `CUDA 11.1` and `PyTorch 1.9.0`, use the following command:
|
||||
|
||||
```shell
|
||||
pip install 'mmcv>=2.0.0rc1' -f https://download.openmmlab.com/mmcv/dist/cu111/torch1.9.0/index.html
|
||||
```
|
||||
|
||||
For more details, please refer the the following tables and delete `=={mmcv_version}`.
|
||||
|
||||
ii. Install a specified version.
|
||||
|
||||
The rule for installing a specified `mmcv` is as follows:
|
||||
|
||||
```shell
|
||||
pip install mmcv=={mmcv_version} -f https://download.openmmlab.com/mmcv/dist/{cu_version}/{torch_version}/index.html
|
||||
```
|
||||
|
||||
First of all, please refer to the Releases and replace `{mmcv_version}` a specified one. e.g. `2.0.0rc1`.
|
||||
Then replace `{cu_version}` and `{torch_version}` in the url to your desired versions. For example,
|
||||
to install `mmcv==2.0.0rc1` with `CUDA 11.1` and `PyTorch 1.9.0`, use the following command:
|
||||
|
||||
```shell
|
||||
pip install mmcv==2.0.0rc1 -f https://download.openmmlab.com/mmcv/dist/cu111/torch1.9.0/index.html
|
||||
```
|
||||
### Install mmcv
|
||||
|
||||
```{note}
|
||||
The following installation steps are for Linux and Windows platforms only. To install mmcv on macOS platform, please refer to [build mmcv from source](build.md#build-on-macos).
|
||||
```
|
||||
|
||||
Before installing mmcv-full, make sure that PyTorch has been successfully installed following the [PyTorch official installation guide](https://pytorch.org/get-started/locally/#start-locally). This can be verified using the following command
|
||||
|
||||
```bash
|
||||
python -c 'import torch;print(torch.__version__)'
|
||||
```
|
||||
|
||||
If version information is output, then PyTorch is installed.
|
||||
|
||||
#### Install with mim (recommended)
|
||||
|
||||
[mim](https://github.com/open-mmlab/mim) is the package management tool for the OpenMMLab projects, which makes it easy to install mmcv
|
||||
|
||||
```bash
|
||||
pip install -U openmim
|
||||
mim install 'mmcv>=2.0.0rc1'
|
||||
```
|
||||
|
||||
If you find that the above installation command does not use a pre-built package ending with `.whl` but a source package ending with `.tar.gz`, you may not have a pre-build package corresponding to the PyTorch or CUDA or mmcv version, in which case you can [build mmcv from source](build.md).
|
||||
|
||||
<details>
|
||||
<summary>Installation log using pre-built packages</summary>
|
||||
|
||||
Looking in links: https://download.openmmlab.com/mmcv/dist/cu102/torch1.8.0/index.html<br />
|
||||
Collecting mmcv<br />
|
||||
<b>Downloading https://download.openmmlab.com/mmcv/dist/cu102/torch1.8.0/mmcv-2.0.0rc1-cp38-cp38-manylinux1_x86_64.whl</b>
|
||||
|
||||
</details>
|
||||
|
||||
<details>
|
||||
<summary>Installation log using source packages</summary>
|
||||
|
||||
Looking in links: https://download.openmmlab.com/mmcv/dist/cu102/torch1.8.0/index.html<br />
|
||||
Collecting mmcv==2.0.0rc1<br />
|
||||
<b>Downloading mmcv-2.0.0rc1.tar.gz</b>
|
||||
|
||||
</details>
|
||||
|
||||
To install a specific version of mmcv, for example, mmcv version 2.0.0rc1, you can use the following command
|
||||
|
||||
```bash
|
||||
mim install mmcv==2.0.0rc1
|
||||
```
|
||||
|
||||
:::{note}
|
||||
If you would like to use `opencv-python-headless` instead of `opencv-python`,
|
||||
e.g., in a minimum container environment or servers without GUI,
|
||||
you can first install it before installing MMCV to skip the installation of `opencv-python`.
|
||||
|
||||
Alternatively, if it takes too long to install a dependency library, you can specify the pypi source
|
||||
|
||||
```bash
|
||||
mim install 'mmcv>=2.0.0rc1' -i https://pypi.tuna.tsinghua.edu.cn/simple
|
||||
```
|
||||
|
||||
:::
|
||||
|
||||
You can run [check_installation.py](https://github.com/open-mmlab/mmcv/blob/2.x/.dev_scripts/check_installation.py) to check the installation of mmcv-full after running the installation commands.
|
||||
|
||||
#### Install with pip
|
||||
|
||||
Use the following command to check the version of CUDA and PyTorch
|
||||
|
||||
```bash
|
||||
python -c 'import torch;print(torch.__version__);print(torch.version.cuda)'
|
||||
```
|
||||
|
||||
Select the appropriate installation command depending on the type of system, CUDA version, PyTorch version, and MMCV version
|
||||
|
||||
<html>
|
||||
<body>
|
||||
<style>
|
||||
select {
|
||||
z-index: 1000;
|
||||
position: absolute;
|
||||
top: 10px;
|
||||
width: 6.7rem;
|
||||
}
|
||||
#select-container {
|
||||
position: relative;
|
||||
height: 30px;
|
||||
}
|
||||
#select-cmd {
|
||||
background-color: #f5f6f7;
|
||||
font-size: 14px;
|
||||
margin-top: 20px;
|
||||
}
|
||||
/* 让每一个都间隔1.3rem */
|
||||
#select-os {
|
||||
/* left: 1.375rem; */
|
||||
left: 0;
|
||||
}
|
||||
#select-cuda {
|
||||
/* left: 9.375rem; 9.375 = 1.375 + 6.7 + 1.3 */
|
||||
left: 8rem;
|
||||
}
|
||||
#select-torch {
|
||||
/* left: 17.375rem; 17.375 = 9.375 + 6.7 + 1.3 */
|
||||
left: 16rem;
|
||||
}
|
||||
#select-mmcv {
|
||||
/* left: 25.375rem; 25.375 = 17.375 + 6.7 + 1.3 */
|
||||
left: 24rem;
|
||||
}
|
||||
</style>
|
||||
<div id="select-container">
|
||||
<select
|
||||
onmousedown="handleSelectMouseDown(this.id)"
|
||||
onblur="handleSelectBlur(this.id)"
|
||||
onchange="changeOS(this.value)"
|
||||
id="select-os">
|
||||
</select>
|
||||
<select
|
||||
onmousedown="handleSelectMouseDown(this.id)"
|
||||
onblur="handleSelectBlur(this.id)"
|
||||
onchange="changeCUDA(this.value)"
|
||||
id="select-cuda">
|
||||
</select>
|
||||
<select
|
||||
onmousedown="handleSelectMouseDown(this.id)"
|
||||
onblur="handleSelectBlur(this.id)"
|
||||
onchange="changeTorch(this.value)"
|
||||
id="select-torch">
|
||||
</select>
|
||||
<select
|
||||
onmousedown="handleSelectMouseDown(this.id)"
|
||||
onblur="handleSelectBlur(this.id)"
|
||||
onchange="changeMMCV(this.value)"
|
||||
id="select-mmcv">
|
||||
</select>
|
||||
</div>
|
||||
<pre id="select-cmd"></pre>
|
||||
</body>
|
||||
<script>
|
||||
let osVal, cudaVal, torchVal, mmcvVal;
|
||||
function changeMMCV(val) {
|
||||
mmcvVal = val;
|
||||
change("select-mmcv");
|
||||
}
|
||||
function changeTorch(val) {
|
||||
torchVal = val;
|
||||
change("select-torch");
|
||||
}
|
||||
function changeCUDA(val) {
|
||||
cudaVal = val;
|
||||
change("select-cuda");
|
||||
}
|
||||
function changeOS(val) {
|
||||
osVal = val;
|
||||
change("select-os");
|
||||
}
|
||||
function handleSelectMouseDown(id) {
|
||||
const dom = document.getElementById(id);
|
||||
if (!dom) return;
|
||||
const len = dom?.options?.length;
|
||||
if (len >= 9) {
|
||||
dom.size = 10;
|
||||
dom.style.zIndex = 100;
|
||||
}
|
||||
}
|
||||
function handleSelectClick() {
|
||||
const selects = Array.from(document.getElementsByTagName("select"));
|
||||
selects.forEach(select => {
|
||||
select.size = 1;
|
||||
});
|
||||
}
|
||||
function handleSelectBlur(id) {
|
||||
const dom = document.getElementById(id);
|
||||
if (!dom) {
|
||||
handleSelectClick();
|
||||
return;
|
||||
}
|
||||
dom.size = 1;
|
||||
dom.style.zIndex = 1;
|
||||
}
|
||||
function changeCmd() {
|
||||
const cmd = document.getElementById("select-cmd");
|
||||
let cmdString = "pip install mmcv=={mmcv_version} -f https://download.openmmlab.com/mmcv/dist/{cu_version}/{torch_version}/index.html";
|
||||
// e.g: pip install mmcv==2.0.0rc1 -f https://download.openmmlab.com/mmcv/dist/cu111/torch1.9/index.html
|
||||
const cudaVersion = `${cudaVal === "cpu" ? cudaVal : `cu${cudaVal.split(".").join("")}`}`;
|
||||
const torchVersion = `torch${torchVal.substring(0, torchVal.length - 2)}`;
|
||||
cmdString = cmdString.replace("{cu_version}", cudaVersion).replace("{mmcv_version}", mmcvVal).replace("{torch_version}", torchVersion);
|
||||
cmd.textContent = cmdString;
|
||||
}
|
||||
function unique(arr) {
|
||||
if (!arr || !Array.isArray(arr)) return [];
|
||||
return [...new Set(arr)];
|
||||
}
|
||||
function genOptionFragment(data, id) {
|
||||
const name = id.includes("-")? id.split("-")[1] : id;
|
||||
const fragment = new DocumentFragment();
|
||||
data.forEach(option => {
|
||||
const ele = document.createElement("option");
|
||||
let text = `${name} ${option}`;
|
||||
if (name === "os" || option.toUpperCase() === "CPU") {
|
||||
text = `${option}`;
|
||||
}
|
||||
ele.textContent = text;
|
||||
ele.value = option;
|
||||
ele.addEventListener('click', handleSelectClick);
|
||||
fragment.appendChild(ele);
|
||||
});
|
||||
return fragment;
|
||||
}
|
||||
function findAndAppend(data, id) {
|
||||
const fragment = genOptionFragment(data, id);
|
||||
const dom = document.getElementById(id);
|
||||
if (dom) dom.replaceChildren(fragment);
|
||||
}
|
||||
function change(id) {
|
||||
const order = ["select-mmcv", "select-torch", "select-cuda", "select-os"];
|
||||
const idx = order.indexOf(id);
|
||||
if (idx === -1) return;
|
||||
const versionDetail = version[osVal];
|
||||
if (idx >= 3) {
|
||||
let cuda = [];
|
||||
versionDetail.forEach(v => {
|
||||
cuda.push(v.cuda);
|
||||
});
|
||||
cuda = unique(cuda);
|
||||
cudaVal = cuda[0];
|
||||
findAndAppend(cuda, "select-cuda");
|
||||
}
|
||||
if (idx >= 2) {
|
||||
const torch = [];
|
||||
versionDetail.forEach(v => {
|
||||
if (v.cuda === cudaVal) torch.push(v.torch);
|
||||
});
|
||||
torchVal = torch[0];
|
||||
findAndAppend(torch, "select-torch");
|
||||
}
|
||||
if (idx >= 1) {
|
||||
let mmcv = [];
|
||||
versionDetail.forEach(v => {
|
||||
if (v.cuda === cudaVal && v.torch === torchVal) mmcv = v.mmcv;
|
||||
});
|
||||
mmcvVal = mmcv[0];
|
||||
findAndAppend(mmcv, "select-mmcv");
|
||||
}
|
||||
changeCmd();
|
||||
}
|
||||
function init() {
|
||||
document.addEventListener("click", handleSelectBlur);
|
||||
const version = window.version;
|
||||
const os = Object.keys(version);
|
||||
osVal = os[0];
|
||||
findAndAppend(os, "select-os");
|
||||
change("select-os");
|
||||
changeCmd();
|
||||
}
|
||||
window.onload = function () {
|
||||
const url = "../_static/version.json"
|
||||
const request = new XMLHttpRequest();
|
||||
request.open("get", url);
|
||||
request.send(null);
|
||||
request.onload = function () {
|
||||
if (request.status !== 200) return;
|
||||
const data = JSON.parse(request.responseText);
|
||||
window.version = data;
|
||||
init();
|
||||
}
|
||||
}
|
||||
</script>
|
||||
</html>
|
||||
|
||||
If you do not find a corresponding version in the dropdown box above, you probably do not have a pre-built package corresponding to the PyTorch or CUDA or mmcv version, at which point you can [build mmcv from source](build.md).
|
||||
|
||||
:::{note}
|
||||
mmcv is only compiled on PyTorch 1.x.0 because the compatibility
|
||||
usually holds between 1.x.0 and 1.x.1. If your PyTorch version is 1.x.1, you
|
||||
can install mmcv compiled with PyTorch 1.x.0 and it usually works well.
|
||||
For example, if your PyTorch version is 1.8.1 and CUDA version is 11.1, you
|
||||
can use the following command to install mmcv.
|
||||
For example, if your PyTorch version is 1.8.1, you can feel free to choose 1.8.x.
|
||||
:::
|
||||
|
||||
`pip install mmcv==2.0.0rc1 -f https://download.openmmlab.com/mmcv/dist/cu111/torch1.8.0/index.html`
|
||||
:::{note}
|
||||
If you would like to use `opencv-python-headless` instead of `opencv-python`,
|
||||
e.g., in a minimum container environment or servers without GUI,
|
||||
you can first install it before installing MMCV to skip the installation of `opencv-python`.
|
||||
|
||||
Alternatively, if it takes too long to install a dependency library, you can specify the pypi source
|
||||
|
||||
```bash
|
||||
mim install mmcv -i https://pypi.tuna.tsinghua.edu.cn/simple
|
||||
```
|
||||
|
||||
For more details, please refer the the following tables.
|
||||
:::
|
||||
|
||||
<table class="docutils">
|
||||
<tbody>
|
||||
<tr>
|
||||
<th width="80"> CUDA </th>
|
||||
<th valign="bottom" align="left" width="120">torch 1.12</th>
|
||||
<th valign="bottom" align="left" width="120">torch 1.11</th>
|
||||
<th valign="bottom" align="left" width="120">torch 1.10</th>
|
||||
<th valign="bottom" align="left" width="120">torch 1.9</th>
|
||||
<th valign="bottom" align="left" width="120">torch 1.8</th>
|
||||
<th valign="bottom" align="left" width="120">torch 1.7</th>
|
||||
<th valign="bottom" align="left" width="120">torch 1.6</th>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="left">11.6</td>
|
||||
<td align="left"><details><summary> install </summary><pre><code>pip install mmcv-full=={mmcv_version} -f https://download.openmmlab.com/mmcv/dist/cu116/torch1.12.0/index.html</code></pre> </details></td>
|
||||
<td align="left"></td>
|
||||
<td align="left"></td>
|
||||
<td align="left"></td>
|
||||
<td align="left"></td>
|
||||
<td align="left"></td>
|
||||
<td align="left"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="left">11.5</td>
|
||||
<td align="left"></td>
|
||||
<td align="left"><details><summary> install </summary><pre><code>pip install mmcv-full=={mmcv_version} -f https://download.openmmlab.com/mmcv/dist/cu115/torch1.11.0/index.html</code></pre> </details></td>
|
||||
<td align="left"></td>
|
||||
<td align="left"></td>
|
||||
<td align="left"></td>
|
||||
<td align="left"></td>
|
||||
<td align="left"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="left">11.3</td>
|
||||
<td align="left"><details><summary> install </summary><pre><code>pip install mmcv-full=={mmcv_version} -f https://download.openmmlab.com/mmcv/dist/cu113/torch1.12.0/index.html</code></pre> </details></td>
|
||||
<td align="left"><details><summary> install </summary><pre><code>pip install mmcv-full=={mmcv_version} -f https://download.openmmlab.com/mmcv/dist/cu113/torch1.11.0/index.html</code></pre> </details></td>
|
||||
<td align="left"><details><summary> install </summary><pre><code>pip install mmcv-full=={mmcv_version} -f https://download.openmmlab.com/mmcv/dist/cu113/torch1.10.0/index.html</code></pre> </details></td>
|
||||
<td align="left"></td>
|
||||
<td align="left"></td>
|
||||
<td align="left"></td>
|
||||
<td align="left"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="left">11.1</td>
|
||||
<td align="left"></td>
|
||||
<td align="left"></td>
|
||||
<td align="left"><details><summary> install </summary><pre><code>pip install mmcv-full=={mmcv_version} -f https://download.openmmlab.com/mmcv/dist/cu111/torch1.10.0/index.html</code></pre> </details> </td>
|
||||
<td align="left"><details><summary> install </summary><pre><code>pip install mmcv-full=={mmcv_version} -f https://download.openmmlab.com/mmcv/dist/cu111/torch1.9.0/index.html</code></pre> </details> </td>
|
||||
<td align="left"><details><summary> install </summary><pre><code>pip install mmcv-full=={mmcv_version} -f https://download.openmmlab.com/mmcv/dist/cu111/torch1.8.0/index.html</code></pre> </details> </td>
|
||||
<td align="left"> </td>
|
||||
<td align="left"> </td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="left">11.0</td>
|
||||
<td align="left"></td>
|
||||
<td align="left"></td>
|
||||
<td align="left"></td>
|
||||
<td align="left"></td>
|
||||
<td align="left"></td>
|
||||
<td align="left"><details><summary> install </summary><pre><code>pip install mmcv-full=={mmcv_version} -f https://download.openmmlab.com/mmcv/dist/cu110/torch1.7.0/index.html</code></pre> </details> </td>
|
||||
<td align="left"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="left">10.2</td>
|
||||
<td align="left"><details><summary> install </summary><pre><code>pip install mmcv-full=={mmcv_version} -f https://download.openmmlab.com/mmcv/dist/cu102/torch1.12.0/index.html</code></pre> </details></td>
|
||||
<td align="left"><details><summary> install </summary><pre><code>pip install mmcv-full=={mmcv_version} -f https://download.openmmlab.com/mmcv/dist/cu102/torch1.11.0/index.html</code></pre> </details></td>
|
||||
<td align="left"><details><summary> install </summary><pre><code>pip install mmcv-full=={mmcv_version} -f https://download.openmmlab.com/mmcv/dist/cu102/torch1.10.0/index.html</code></pre> </details></td>
|
||||
<td align="left"><details><summary> install </summary><pre><code>pip install mmcv-full=={mmcv_version} -f https://download.openmmlab.com/mmcv/dist/cu102/torch1.9.0/index.html</code></pre> </details> </td>
|
||||
<td align="left"><details><summary> install </summary><pre><code>pip install mmcv-full=={mmcv_version} -f https://download.openmmlab.com/mmcv/dist/cu102/torch1.8.0/index.html</code></pre> </details> </td>
|
||||
<td align="left"><details><summary> install </summary><pre><code>pip install mmcv-full=={mmcv_version} -f https://download.openmmlab.com/mmcv/dist/cu102/torch1.7.0/index.html</code></pre> </details> </td>
|
||||
<td align="left"><details><summary> install </summary><pre><code>pip install mmcv-full=={mmcv_version} -f https://download.openmmlab.com/mmcv/dist/cu102/torch1.6.0/index.html</code></pre> </details> </td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="left">10.1</td>
|
||||
<td align="left"></td>
|
||||
<td align="left"></td>
|
||||
<td align="left"></td>
|
||||
<td align="left"></td>
|
||||
<td align="left"><details><summary> install </summary><pre><code> pip install mmcv-full=={mmcv_version} -f https://download.openmmlab.com/mmcv/dist/cu101/torch1.8.0/index.html</code></pre> </details> </td>
|
||||
<td align="left"><details><summary> install </summary><pre><code> pip install mmcv-full=={mmcv_version} -f https://download.openmmlab.com/mmcv/dist/cu101/torch1.7.0/index.html</code></pre> </details> </td>
|
||||
<td align="left"><details><summary> install </summary><pre><code> pip install mmcv-full=={mmcv_version} -f https://download.openmmlab.com/mmcv/dist/cu101/torch1.6.0/index.html</code></pre> </details> </td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="left">9.2</td>
|
||||
<td align="left"></td>
|
||||
<td align="left"></td>
|
||||
<td align="left"></td>
|
||||
<td align="left"></td>
|
||||
<td align="left"></td>
|
||||
<td align="left"><details><summary> install </summary><pre><code> pip install mmcv-full=={mmcv_version} -f https://download.openmmlab.com/mmcv/dist/cu92/torch1.7.0/index.html</code></pre> </details> </td>
|
||||
<td align="left"><details><summary> install </summary><pre><code> pip install mmcv-full=={mmcv_version} -f https://download.openmmlab.com/mmcv/dist/cu92/torch1.6.0/index.html</code></pre> </details> </td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="left">cpu</td>
|
||||
<td align="left"><details><summary> install </summary><pre><code> pip install mmcv-full=={mmcv_version} -f https://download.openmmlab.com/mmcv/dist/cpu/torch1.12.0/index.html</code></pre> </details></td>
|
||||
<td align="left"><details><summary> install </summary><pre><code> pip install mmcv-full=={mmcv_version} -f https://download.openmmlab.com/mmcv/dist/cpu/torch1.11.0/index.html</code></pre> </details></td>
|
||||
<td align="left"><details><summary> install </summary><pre><code> pip install mmcv-full=={mmcv_version} -f https://download.openmmlab.com/mmcv/dist/cpu/torch1.10.0/index.html</code></pre> </details> </td>
|
||||
<td align="left"><details><summary> install </summary><pre><code> pip install mmcv-full=={mmcv_version} -f https://download.openmmlab.com/mmcv/dist/cpu/torch1.9.0/index.html</code></pre> </details> </td>
|
||||
<td align="left"><details><summary> install </summary><pre><code> pip install mmcv-full=={mmcv_version} -f https://download.openmmlab.com/mmcv/dist/cpu/torch1.8.0/index.html</code></pre> </details> </td>
|
||||
<td align="left"><details><summary> install </summary><pre><code> pip install mmcv-full=={mmcv_version} -f https://download.openmmlab.com/mmcv/dist/cpu/torch1.7.0/index.html</code></pre> </details> </td>
|
||||
<td align="left"><details><summary> install </summary><pre><code> pip install mmcv-full=={mmcv_version} -f https://download.openmmlab.com/mmcv/dist/cpu/torch1.6.0/index.html</code></pre> </details> </td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
You can run [check_installation.py](https://github.com/open-mmlab/mmcv/blob/2.x/.dev_scripts/check_installation.py) to check the installation of mmcv after running the installation commands.
|
||||
|
||||
```{note}
|
||||
mmcv does not provide pre-built packages for `cu102-torch1.11` and `cu92-torch*` on Windows.
|
||||
#### Using mmcv with Docker
|
||||
|
||||
Build with local repository
|
||||
|
||||
```bash
|
||||
git clone https://github.com/open-mmlab/mmcv.git && cd mmcv
|
||||
docker build -t mmcv -f docker/release/Dockerfile .
|
||||
```
|
||||
|
||||
Another way is to compile locally by running
|
||||
Or build with remote repository
|
||||
|
||||
```python
|
||||
pip install 'mmcv>=2.0.0rc1'
|
||||
```bash
|
||||
docker build -t mmcv https://github.com/open-mmlab/mmcv.git#2.x:docker/release
|
||||
```
|
||||
|
||||
Note that the local compiling may take up to 10 mins.
|
||||
The [Dockerfile](release/Dockerfile) installs latest released version of mmcv-full by default, but you can specify mmcv versions to install expected versions.
|
||||
|
||||
b. Install the lite version.
|
||||
```bash
|
||||
docker image build -t mmcv -f docker/release/Dockerfile --build-arg MMCV=2.0.0rc1 .
|
||||
```
|
||||
|
||||
If you also want to use other versions of PyTorch and CUDA, you can also pass them when building docker images.
|
||||
|
||||
An example to build an image with PyTorch 1.11 and CUDA 11.3.
|
||||
|
||||
```bash
|
||||
docker build -t mmcv -f docker/release/Dockerfile \
|
||||
--build-arg PYTORCH=1.11.0 \
|
||||
--build-arg CUDA=11.3 \
|
||||
--build-arg CUDNN=8 \
|
||||
--build-arg MMCV=2.0.0rc1 .
|
||||
```
|
||||
|
||||
More available versions of PyTorch and CUDA can be found at [dockerhub/pytorch](https://hub.docker.com/r/pytorch/pytorch/tags).
|
||||
|
||||
### Install mmcv-lite
|
||||
|
||||
If you need to use PyTorch-related modules, make sure PyTorch has been successfully installed in your environment by referring to the [PyTorch official installation guide](https://github.com/pytorch/pytorch#installation).
|
||||
|
||||
```python
|
||||
pip install mmcv-lite
|
||||
```
|
||||
|
||||
If you would like to build MMCV from source, please refer to the [guide](build.md).
|
||||
|
|
|
@ -1,13 +1,26 @@
|
|||
## Introduction
|
||||
|
||||
MMCV is a foundational library for computer vision research and supports many
|
||||
research projects as below:
|
||||
MMCV is a foundational library for computer vision research and provides the following functionalities.
|
||||
|
||||
- [Image/Video processing](../understand_mmcv/data_process.md)
|
||||
- [Image and annotation visualization](../understand_mmcv/visualization.md)
|
||||
- [Image transformation](../understand_mmcv/data_transform.md)
|
||||
- [Various CNN architectures](../understand_mmcv/cnn.md)
|
||||
- [High-quality implementation of common CUDA ops](../understand_mmcv/ops.md)
|
||||
|
||||
It supports the following systems:
|
||||
|
||||
- Linux
|
||||
- Windows
|
||||
- macOS
|
||||
|
||||
It supports many research projects as below:
|
||||
|
||||
- [MIM](https://github.com/open-mmlab/mim): MIM installs OpenMMLab packages.
|
||||
- [MMClassification](https://github.com/open-mmlab/mmclassification): OpenMMLab image classification toolbox and benchmark.
|
||||
- [MMDetection](https://github.com/open-mmlab/mmdetection): OpenMMLab detection toolbox and benchmark.
|
||||
- [MMDetection3D](https://github.com/open-mmlab/mmdetection3d): OpenMMLab's next-generation platform for general 3D object detection.
|
||||
- [MMRotate](https://github.com/open-mmlab/mmrotate): OpenMMLab rotated object detection toolbox and benchmark.
|
||||
- [MMYOLO](https://github.com/open-mmlab/mmyolo): OpenMMLab YOLO series toolbox and benchmark.
|
||||
- [MMSegmentation](https://github.com/open-mmlab/mmsegmentation): OpenMMLab semantic segmentation toolbox and benchmark.
|
||||
- [MMOCR](https://github.com/open-mmlab/mmocr): OpenMMLab text detection, recognition, and understanding toolbox.
|
||||
- [MMPose](https://github.com/open-mmlab/mmpose): OpenMMLab pose estimation toolbox and benchmark.
|
||||
|
@ -21,22 +34,3 @@ research projects as below:
|
|||
- [MMEditing](https://github.com/open-mmlab/mmediting): OpenMMLab image and video editing toolbox.
|
||||
- [MMGeneration](https://github.com/open-mmlab/mmgeneration): OpenMMLab image and video generative models toolbox.
|
||||
- [MMDeploy](https://github.com/open-mmlab/mmdeploy): OpenMMLab model deployment framework.
|
||||
|
||||
It provides the following functionalities:
|
||||
|
||||
- Universal IO APIs
|
||||
- Image/Video processing
|
||||
- Image and annotation visualization
|
||||
- Image transformation
|
||||
- Various CNN architectures
|
||||
- High-quality implementation of common CUDA ops
|
||||
|
||||
It supports the following systems.
|
||||
|
||||
- Linux
|
||||
- Windows
|
||||
- macOS
|
||||
|
||||
```{note}
|
||||
MMCV requires Python 3.6+.
|
||||
```
|
||||
|
|
|
@ -16,6 +16,7 @@ You can switch between Chinese and English documents in the lower-left corner of
|
|||
:caption: Understand MMCV
|
||||
|
||||
understand_mmcv/data_process.md
|
||||
understand_mmcv/data_transform.md
|
||||
understand_mmcv/visualization.md
|
||||
understand_mmcv/cnn.md
|
||||
understand_mmcv/ops.md
|
||||
|
|
|
@ -0,0 +1,349 @@
|
|||
{
|
||||
"Linux": [
|
||||
{
|
||||
"cuda": "11.6",
|
||||
"torch": "1.12.x",
|
||||
"mmcv": [
|
||||
"2.0.0rc1"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cuda": "11.5",
|
||||
"torch": "1.11.x",
|
||||
"mmcv": [
|
||||
"2.0.0rc1"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cuda": "11.3",
|
||||
"torch": "1.12.x",
|
||||
"mmcv": [
|
||||
"2.0.0rc1"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cuda": "11.3",
|
||||
"torch": "1.11.x",
|
||||
"mmcv": [
|
||||
"2.0.0rc1"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cuda": "11.3",
|
||||
"torch": "1.10.x",
|
||||
"mmcv": [
|
||||
"2.0.0rc1"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cuda": "11.1",
|
||||
"torch": "1.10.x",
|
||||
"mmcv": [
|
||||
"2.0.0rc1"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cuda": "11.1",
|
||||
"torch": "1.9.x",
|
||||
"mmcv": [
|
||||
"2.0.0rc1"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cuda": "11.1",
|
||||
"torch": "1.8.x",
|
||||
"mmcv": [
|
||||
"2.0.0rc1"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cuda": "11.0",
|
||||
"torch": "1.7.x",
|
||||
"mmcv": [
|
||||
"2.0.0rc1"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cuda": "10.2",
|
||||
"torch": "1.12.x",
|
||||
"mmcv": [
|
||||
"2.0.0rc1"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cuda": "10.2",
|
||||
"torch": "1.11.x",
|
||||
"mmcv": [
|
||||
"2.0.0rc1"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cuda": "10.2",
|
||||
"torch": "1.10.x",
|
||||
"mmcv": [
|
||||
"2.0.0rc1"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cuda": "10.2",
|
||||
"torch": "1.9.x",
|
||||
"mmcv": [
|
||||
"2.0.0rc1"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cuda": "10.2",
|
||||
"torch": "1.8.x",
|
||||
"mmcv": [
|
||||
"2.0.0rc1"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cuda": "10.2",
|
||||
"torch": "1.7.x",
|
||||
"mmcv": [
|
||||
"2.0.0rc1"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cuda": "10.2",
|
||||
"torch": "1.6.x",
|
||||
"mmcv": [
|
||||
"2.0.0rc1"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cuda": "10.1",
|
||||
"torch": "1.8.x",
|
||||
"mmcv": [
|
||||
"2.0.0rc1"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cuda": "10.1",
|
||||
"torch": "1.7.x",
|
||||
"mmcv": [
|
||||
"2.0.0rc1"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cuda": "10.1",
|
||||
"torch": "1.6.x",
|
||||
"mmcv": [
|
||||
"2.0.0rc1"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cuda": "9.2",
|
||||
"torch": "1.7.x",
|
||||
"mmcv": [
|
||||
"2.0.0rc1"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cuda": "9.2",
|
||||
"torch": "1.6.x",
|
||||
"mmcv": [
|
||||
"2.0.0rc1"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cuda": "cpu",
|
||||
"torch": "1.12.x",
|
||||
"mmcv": [
|
||||
"2.0.0rc1"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cuda": "cpu",
|
||||
"torch": "1.11.x",
|
||||
"mmcv": [
|
||||
"2.0.0rc1"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cuda": "cpu",
|
||||
"torch": "1.10.x",
|
||||
"mmcv": [
|
||||
"2.0.0rc1"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cuda": "cpu",
|
||||
"torch": "1.9.x",
|
||||
"mmcv": [
|
||||
"2.0.0rc1"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cuda": "cpu",
|
||||
"torch": "1.8.x",
|
||||
"mmcv": [
|
||||
"2.0.0rc1"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cuda": "cpu",
|
||||
"torch": "1.7.x",
|
||||
"mmcv": [
|
||||
"2.0.0rc1"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cuda": "cpu",
|
||||
"torch": "1.6.x",
|
||||
"mmcv": [
|
||||
"2.0.0rc1"
|
||||
]
|
||||
}
|
||||
],
|
||||
"Windows": [
|
||||
{
|
||||
"cuda": "11.6",
|
||||
"torch": "1.12.x",
|
||||
"mmcv": [
|
||||
"2.0.0rc1"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cuda": "11.5",
|
||||
"torch": "1.11.x",
|
||||
"mmcv": [
|
||||
"2.0.0rc1"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cuda": "11.3",
|
||||
"torch": "1.12.x",
|
||||
"mmcv": [
|
||||
"2.0.0rc1"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cuda": "11.3",
|
||||
"torch": "1.11.x",
|
||||
"mmcv": [
|
||||
"2.0.0rc1"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cuda": "11.3",
|
||||
"torch": "1.10.x",
|
||||
"mmcv": [
|
||||
"2.0.0rc1"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cuda": "11.1",
|
||||
"torch": "1.10.x",
|
||||
"mmcv": [
|
||||
"2.0.0rc1"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cuda": "11.1",
|
||||
"torch": "1.9.x",
|
||||
"mmcv": [
|
||||
"2.0.0rc1"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cuda": "11.1",
|
||||
"torch": "1.8.x",
|
||||
"mmcv": [
|
||||
"2.0.0rc1"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cuda": "10.2",
|
||||
"torch": "1.10.x",
|
||||
"mmcv": [
|
||||
"2.0.0rc1"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cuda": "10.2",
|
||||
"torch": "1.9.x",
|
||||
"mmcv": [
|
||||
"2.0.0rc1"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cuda": "10.2",
|
||||
"torch": "1.8.x",
|
||||
"mmcv": [
|
||||
"2.0.0rc1"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cuda": "10.2",
|
||||
"torch": "1.6.x",
|
||||
"mmcv": [
|
||||
"2.0.0rc1"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cuda": "10.1",
|
||||
"torch": "1.8.x",
|
||||
"mmcv": [
|
||||
"2.0.0rc1"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cuda": "10.1",
|
||||
"torch": "1.6.x",
|
||||
"mmcv": [
|
||||
"2.0.0rc1"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cuda": "cpu",
|
||||
"torch": "1.12.x",
|
||||
"mmcv": [
|
||||
"2.0.0rc1"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cuda": "cpu",
|
||||
"torch": "1.11.x",
|
||||
"mmcv": [
|
||||
"2.0.0rc1"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cuda": "cpu",
|
||||
"torch": "1.10.x",
|
||||
"mmcv": [
|
||||
"2.0.0rc1"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cuda": "cpu",
|
||||
"torch": "1.9.x",
|
||||
"mmcv": [
|
||||
"2.0.0rc1"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cuda": "cpu",
|
||||
"torch": "1.8.x",
|
||||
"mmcv": [
|
||||
"2.0.0rc1"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cuda": "cpu",
|
||||
"torch": "1.7.x",
|
||||
"mmcv": [
|
||||
"2.0.0rc1"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cuda": "cpu",
|
||||
"torch": "1.6.x",
|
||||
"mmcv": [
|
||||
"2.0.0rc1"
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
|
@ -59,6 +59,8 @@ extensions = [
|
|||
|
||||
myst_heading_anchors = 4
|
||||
|
||||
myst_enable_extensions = ['colon_fence']
|
||||
|
||||
# Configuration for intersphinx
|
||||
intersphinx_mapping = {
|
||||
'python': ('https://docs.python.org/3', None),
|
||||
|
|
|
@ -1,133 +1,188 @@
|
|||
## 从源码编译 MMCV
|
||||
|
||||
### 在 Linux 或者 macOS 上编译 MMCV
|
||||
### 编译 mmcv
|
||||
|
||||
克隆算法库
|
||||
在编译 mmcv 之前,请确保 PyTorch 已经成功安装在环境中,可以参考 [PyTorch 官方安装文档](https://pytorch.org/get-started/locally/#start-locally)。可使用以下命令验证
|
||||
|
||||
```bash
|
||||
git clone https://github.com/open-mmlab/mmcv.git
|
||||
cd mmcv
|
||||
git checkout 2.x
|
||||
python -c 'import torch;print(torch.__version__)'
|
||||
```
|
||||
|
||||
建议安装 `ninja` 以加快编译速度
|
||||
:::{note}
|
||||
|
||||
- 如果克隆代码仓库的速度过慢,可以使用以下命令克隆(注意:gitee 的 mmcv 不一定和 github 的保持一致,因为每天只同步一次)
|
||||
|
||||
```bash
|
||||
pip install -r requirements/optional.txt
|
||||
git clone https://gitee.com/open-mmlab/mmcv.git
|
||||
```
|
||||
|
||||
你可以安装 lite 版本
|
||||
- 如果打算使用 `opencv-python-headless` 而不是 `opencv-python`,例如在一个很小的容器环境或者没有图形用户界面的服务器中,你可以先安装 `opencv-python-headless`,这样在安装 mmcv 依赖的过程中会跳过 `opencv-python`。
|
||||
|
||||
- 如果编译过程安装依赖库的时间过长,可以[设置 pypi 源](https://mirrors.tuna.tsinghua.edu.cn/help/pypi/)
|
||||
|
||||
```bash
|
||||
MMCV_WITH_OPS=0 pip install -e .
|
||||
pip config set global.index-url https://pypi.tuna.tsinghua.edu.cn/simple
|
||||
```
|
||||
|
||||
也可以安装 full 版本
|
||||
:::
|
||||
|
||||
```bash
|
||||
pip install -e .
|
||||
```
|
||||
#### 在 Linux 上编译 mmcv
|
||||
|
||||
如果是在 macOS 上编译,则需要在安装命令前添加一些环境变量,同时对于使用 macOS M1 的用户,请确保你的 PyTorch 是 `Nightly` 版本。
|
||||
| TODO: 视频教程
|
||||
|
||||
```bash
|
||||
CC=clang CXX=clang++ CFLAGS='-stdlib=libc++'
|
||||
```
|
||||
1. 克隆代码仓库
|
||||
|
||||
例如
|
||||
|
||||
```bash
|
||||
CC=clang CXX=clang++ CFLAGS='-stdlib=libc++' pip install -e .
|
||||
```
|
||||
|
||||
```{note}
|
||||
如果你打算使用 `opencv-python-headless` 而不是 `opencv-python`,例如在一个很小的容器环境或者没有图形用户界面的服务器中,你可以先安装 `opencv-python-headless`,这样在安装 mmcv 依赖的过程中会跳过 `opencv-python`
|
||||
```
|
||||
|
||||
### 在 Windows 上编译 MMCV
|
||||
|
||||
在 Windows 上编译 MMCV 比 Linux 复杂,本节将一步步介绍如何在 Windows 上编译 MMCV。
|
||||
|
||||
#### 依赖项
|
||||
|
||||
请首先安装以下的依赖项:
|
||||
|
||||
- [Git](https://git-scm.com/download/win):安装期间,请选择 **add git to Path**
|
||||
- [Visual Studio Community 2019](https://visualstudio.microsoft.com):用于编译 C++ 和 CUDA 代码
|
||||
- [Miniconda](https://docs.conda.io/en/latest/miniconda.html):包管理工具
|
||||
- [CUDA 10.2](https://developer.nvidia.com/cuda-10.2-download-archive):如果只需要 CPU 版本可以不安装 CUDA,安装CUDA时,可根据需要进行自定义安装。如果已经安装新版本的显卡驱动,建议取消驱动程序的安装
|
||||
|
||||
```{note}
|
||||
您需要知道如何在 Windows 上设置变量环境,尤其是 "PATH" 的设置,以下安装过程都会用到。
|
||||
```
|
||||
|
||||
#### 设置 Python 环境
|
||||
|
||||
1. 从 Windows 菜单启动 Anaconda 命令行
|
||||
|
||||
```{note}
|
||||
如 Miniconda 安装程序建议,不要使用原始的 `cmd.exe` 或是 `powershell.exe`。命令行有两个版本,一个基于 PowerShell,一个基于传统的 `cmd.exe`。请注意以下说明都是使用的基于 PowerShell
|
||||
```
|
||||
|
||||
2. 创建一个新的 Conda 环境
|
||||
|
||||
```shell
|
||||
conda create --name mmcv python=3.7 # 经测试,3.6, 3.7, 3.8 也能通过
|
||||
conda activate mmcv # 确保做任何操作前先激活环境
|
||||
```
|
||||
|
||||
3. 安装 PyTorch 时,可以根据需要安装支持 CUDA 或不支持 CUDA 的版本
|
||||
|
||||
```shell
|
||||
# CUDA version
|
||||
conda install pytorch torchvision cudatoolkit=10.2 -c pytorch
|
||||
# CPU version
|
||||
conda install pytorch torchvision cpuonly -c pytorch
|
||||
```
|
||||
|
||||
4. 准备 MMCV 源代码
|
||||
|
||||
```shell
|
||||
```bash
|
||||
git clone https://github.com/open-mmlab/mmcv.git
|
||||
cd mmcv
|
||||
```
|
||||
|
||||
5. 安装所需 Python 依赖包
|
||||
|
||||
```shell
|
||||
pip3 install -r requirements/runtime.txt
|
||||
```
|
||||
|
||||
6. 建议安装 `ninja` 以加快编译速度
|
||||
2. 安装 `ninja` 和 `psutil` 以加快编译速度
|
||||
|
||||
```bash
|
||||
pip install -r requirements/optional.txt
|
||||
```
|
||||
|
||||
#### 编译与安装 MMCV
|
||||
3. 检查 nvcc 的版本(要求大于等于 9.2,如果没有 GPU,可以跳过)
|
||||
|
||||
MMCV 有三种安装的模式:
|
||||
```bash
|
||||
nvcc --version
|
||||
```
|
||||
|
||||
1. Lite 版本(不包含算子)
|
||||
上述命令如果输出以下信息,表示 nvcc 的设置没有问题,否则需要设置 CUDA_HOME
|
||||
|
||||
这种方式下,没有算子被编译,这种模式的 mmcv 是原生的 python 包
|
||||
```
|
||||
nvcc: NVIDIA (R) Cuda compiler driver
|
||||
Copyright (c) 2005-2020 NVIDIA Corporation
|
||||
Built on Mon_Nov_30_19:08:53_PST_2020
|
||||
Cuda compilation tools, release 11.2, V11.2.67
|
||||
Build cuda_11.2.r11.2/compiler.29373293_0
|
||||
```
|
||||
|
||||
2. Full 版本(只包含 CPU 算子)
|
||||
:::{note}
|
||||
如果想要支持 ROCm,可以参考 [AMD ROCm](https://rocmdocs.amd.com/en/latest/Installation_Guide/Installation-Guide.html) 安装 ROCm。
|
||||
:::
|
||||
|
||||
编译 CPU 算子,但只有 x86 将会被编译,并且编译版本只能在 CPU only 情况下运行
|
||||
4. 检查 gcc 的版本(要求大于等于**5.4**)
|
||||
|
||||
3. Full 版本(既包含 CPU 算子,又包含 CUDA 算子)
|
||||
```bash
|
||||
gcc --version
|
||||
```
|
||||
|
||||
同时编译 CPU 和 CUDA 算子,`ops` 模块的 x86 与 CUDA 的代码都可以被编译。同时编译的版本可以在 CUDA 上调用 GPU
|
||||
5. 开始编译(预估耗时 10 分钟)
|
||||
|
||||
```bash
|
||||
pip install -e . -v
|
||||
```
|
||||
|
||||
6. 验证安装
|
||||
|
||||
```bash
|
||||
python .dev_scripts/check_installation.py
|
||||
```
|
||||
|
||||
如果上述命令没有报错,说明安装成功。如有报错,请查看[问题解决页面](../faq.html)是否已经有解决方案。
|
||||
|
||||
如果没有找到解决方案,欢迎提 [issue](https://github.com/open-mmlab/mmcv/issues)。
|
||||
|
||||
#### 在 macOS 上编译 mmcv
|
||||
|
||||
| TODO: 视频教程
|
||||
|
||||
```{note}
|
||||
如果你使用的 mac 是 M1 芯片,请安装 PyTorch 的 nightly 版本,否则会遇到 [issues#2218](https://github.com/open-mmlab/mmcv/issues/2218) 中的问题。
|
||||
```
|
||||
|
||||
1. 克隆代码仓库
|
||||
|
||||
```bash
|
||||
git clone https://github.com/open-mmlab/mmcv.git
|
||||
cd mmcv
|
||||
```
|
||||
|
||||
2. 安装 `ninja` 和 `psutil` 以加快编译速度
|
||||
|
||||
```bash
|
||||
pip install -r requirements/optional.txt
|
||||
```
|
||||
|
||||
3. 开始编译
|
||||
|
||||
```bash
|
||||
pip install -e .
|
||||
```
|
||||
|
||||
4. 验证安装
|
||||
|
||||
```bash
|
||||
python .dev_scripts/check_installation.py
|
||||
```
|
||||
|
||||
如果上述命令没有报错,说明安装成功。如有报错,请查看[问题解决页面](../faq.md)是否已经有解决方案。
|
||||
|
||||
如果没有找到解决方案,欢迎提 [issue](https://github.com/open-mmlab/mmcv/issues)。
|
||||
|
||||
#### 在 Windows 上编译 mmcv
|
||||
|
||||
| TODO: 视频教程
|
||||
|
||||
在 Windows 上编译 mmcv 比 Linux 复杂,本节将一步步介绍如何在 Windows 上编译 mmcv。
|
||||
|
||||
##### 依赖项
|
||||
|
||||
请先安装以下的依赖项:
|
||||
|
||||
- [Git](https://git-scm.com/download/win):安装期间,请选择 **add git to Path**
|
||||
- [Visual Studio Community 2019](https://visualstudio.microsoft.com):用于编译 C++ 和 CUDA 代码
|
||||
- [Miniconda](https://docs.conda.io/en/latest/miniconda.html):包管理工具
|
||||
- [CUDA 10.2](https://developer.nvidia.com/cuda-10.2-download-archive):如果只需要 CPU 版本可以不安装 CUDA,安装 CUDA 时,可根据需要进行自定义安装。如果已经安装新版本的显卡驱动,建议取消驱动程序的安装
|
||||
|
||||
```{note}
|
||||
如果不清楚如何安装以上依赖,请参考[Windows 环境从零安装 mmcv](https://zhuanlan.zhihu.com/p/434491590)。
|
||||
另外,你需要知道如何在 Windows 上设置变量环境,尤其是 "PATH" 的设置,以下安装过程都会用到。
|
||||
```
|
||||
|
||||
##### 通用步骤
|
||||
|
||||
1. 设置 MSVC 编译器
|
||||
1. 从 Windows 菜单启动 Anaconda 命令行
|
||||
|
||||
如 Miniconda 安装程序建议,不要使用原始的 `cmd.exe` 或是 `powershell.exe`。命令行有两个版本,一个基于 PowerShell,一个基于传统的 `cmd.exe`。请注意以下说明都是使用的基于 PowerShell
|
||||
|
||||
2. 创建一个新的 Conda 环境
|
||||
|
||||
```powershell
|
||||
(base) PS C:\Users\xxx> conda create --name mmcv python=3.7
|
||||
(base) PS C:\Users\xxx> conda activate mmcv # 确保做任何操作前先激活环境
|
||||
```
|
||||
|
||||
3. 安装 PyTorch 时,可以根据需要安装支持 CUDA 或不支持 CUDA 的版本
|
||||
|
||||
```powershell
|
||||
# CUDA version
|
||||
(mmcv) PS C:\Users\xxx> conda install pytorch torchvision cudatoolkit=10.2 -c pytorch
|
||||
# CPU version
|
||||
(mmcv) PS C:\Users\xxx> conda install install pytorch torchvision cpuonly -c pytorch
|
||||
```
|
||||
|
||||
4. 克隆代码仓库
|
||||
|
||||
```powershell
|
||||
(mmcv) PS C:\Users\xxx> git clone https://github.com/open-mmlab/mmcv.git
|
||||
(mmcv) PS C:\Users\xxx> cd mmcv
|
||||
```
|
||||
|
||||
5. 安装 `ninja` 和 `psutil` 以加快编译速度
|
||||
|
||||
```powershell
|
||||
(mmcv) PS C:\Users\xxx\mmcv> pip install -r requirements/optional.txt
|
||||
```
|
||||
|
||||
6. 设置 MSVC 编译器
|
||||
|
||||
设置环境变量。添加 `C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.27.29110\bin\Hostx86\x64` 到 `PATH`,则 `cl.exe` 可以在命令行中运行,如下所示。
|
||||
|
||||
```none
|
||||
(base) PS C:\Users\xxx> cl
|
||||
```powershell
|
||||
(mmcv) PS C:\Users\xxx\mmcv> cl
|
||||
Microsoft (R) C/C++ Optimizing Compiler Version 19.27.29111 for x64
|
||||
Copyright (C) Microsoft Corporation. All rights reserved.
|
||||
|
||||
|
@ -138,60 +193,33 @@ MMCV 有三种安装的模式:
|
|||
|
||||
因为 PyTorch 将解析 `cl.exe` 的输出以检查其版本,只有 utf-8 将会被识别,你可能需要将系统语言更改为英语。控制面板 -> 地区-> 管理-> 非 Unicode 来进行语言转换。
|
||||
|
||||
##### 安装方式一:Lite version(不包含算子)
|
||||
##### 编译与安装 mmcv
|
||||
|
||||
在完成上述的公共步骤后,从菜单打开 Anaconda 命令框,输入以下命令
|
||||
mmcv 有两个版本:
|
||||
|
||||
```shell
|
||||
# 激活环境
|
||||
conda activate mmcv
|
||||
# 切换到 mmcv 根目录
|
||||
cd mmcv
|
||||
# 切换到 2.x 分支
|
||||
git checkout 2.x
|
||||
# 安装
|
||||
python setup.py develop
|
||||
# 检查是否安装成功
|
||||
pip list
|
||||
- 只包含 CPU 算子的版本
|
||||
|
||||
编译 CPU 算子,但只有 x86 将会被编译,并且编译版本只能在 CPU only 情况下运行
|
||||
|
||||
- 既包含 CPU 算子,又包含 CUDA 算子的版本
|
||||
|
||||
同时编译 CPU 和 CUDA 算子,`ops` 模块的 x86 与 CUDA 的代码都可以被编译。同时编译的版本可以在 CUDA 上调用 GPU
|
||||
|
||||
###### CPU 版本
|
||||
|
||||
编译安装
|
||||
|
||||
```powershell
|
||||
(mmcv) PS C:\Users\xxx\mmcv> python setup.py build_ext # 如果成功, cl 将被启动用于编译算子
|
||||
(mmcv) PS C:\Users\xxx\mmcv> python setup.py develop # 安装
|
||||
```
|
||||
|
||||
##### 安装方式二:Full version(只编译 CPU 算子)
|
||||
###### GPU 版本
|
||||
|
||||
1. 完成上述的公共步骤
|
||||
1. 检查 `CUDA_PATH` 或者 `CUDA_HOME` 环境变量已经存在在 `envs` 之中
|
||||
|
||||
2. 设置环境变量
|
||||
|
||||
```shell
|
||||
$env:MMCV_WITH_OPS = 1
|
||||
$env:MAX_JOBS = 8 # 根据你可用CPU以及内存量进行设置
|
||||
```
|
||||
|
||||
3. 编译安装
|
||||
|
||||
```shell
|
||||
conda activate mmcv # 激活环境
|
||||
cd mmcv # 改变路径
|
||||
git checkout 2.x # 切换到 2.x 分支
|
||||
python setup.py build_ext # 如果成功, cl 将被启动用于编译算子
|
||||
python setup.py develop # 安装
|
||||
pip list # 检查是否安装成功
|
||||
```
|
||||
|
||||
##### 安装方式三:Full version(既编译 CPU 算子又编译 CUDA 算子)
|
||||
|
||||
1. 完成上述的公共步骤
|
||||
|
||||
2. 设置环境变量
|
||||
|
||||
```shell
|
||||
$env:MMCV_WITH_OPS = 1
|
||||
$env:MAX_JOBS = 8 # 根据你可用CPU以及内存量进行设置
|
||||
```
|
||||
|
||||
3. 检查 `CUDA_PATH` 或者 `CUDA_HOME` 环境变量已经存在在 `envs` 之中
|
||||
|
||||
```none
|
||||
(base) PS C:\Users\WRH> ls env:
|
||||
```powershell
|
||||
(mmcv) PS C:\Users\xxx\mmcv> ls env:
|
||||
|
||||
Name Value
|
||||
---- -----
|
||||
|
@ -202,39 +230,71 @@ pip list
|
|||
|
||||
如果没有,你可以按照下面的步骤设置
|
||||
|
||||
```shell
|
||||
$env:CUDA_HOME = "C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v10.2"
|
||||
```powershell
|
||||
(mmcv) PS C:\Users\xxx\mmcv> $env:CUDA_HOME = "C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v10.2"
|
||||
# 或者
|
||||
$env:CUDA_HOME = $env:CUDA_PATH_V10_2 # CUDA_PATH_V10_2 已经在环境变量中
|
||||
(mmcv) PS C:\Users\xxx\mmcv> $env:CUDA_HOME = $env:CUDA_PATH_V10_2 # CUDA_PATH_V10_2 已经在环境变量中
|
||||
```
|
||||
|
||||
4. 设置 CUDA 的目标架构
|
||||
2. 设置 CUDA 的目标架构
|
||||
|
||||
```shell
|
||||
$env:TORCH_CUDA_ARCH_LIST="6.1" # 支持 GTX 1080
|
||||
# 或者用所有支持的版本,但可能会变得很慢
|
||||
$env:TORCH_CUDA_ARCH_LIST="3.5 3.7 5.0 5.2 6.0 6.1 7.0 7.5"
|
||||
```powershell
|
||||
# 这里需要改成你的显卡对应的目标架构
|
||||
(mmcv) PS C:\Users\xxx\mmcv> $env:TORCH_CUDA_ARCH_LIST="7.5"
|
||||
```
|
||||
|
||||
```{note}
|
||||
我们可以在 [here](https://developer.nvidia.com/cuda-gpus) 查看 GPU 的计算能力
|
||||
:::{note}
|
||||
可以点击 [cuda-gpus](https://developer.nvidia.com/cuda-gpus) 查看 GPU 的计算能力,也可以通过 CUDA 目录下的 deviceQuery.exe 工具查看
|
||||
|
||||
```powershell
|
||||
(mmcv) PS C:\Users\xxx\mmcv> &"C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v10.2\extras\demo_suite\deviceQuery.exe"
|
||||
Device 0: "NVIDIA GeForce GTX 1660 SUPER"
|
||||
CUDA Driver Version / Runtime Version 11.7 / 11.1
|
||||
CUDA Capability Major/Minor version number: 7.5
|
||||
```
|
||||
|
||||
上面的 7.5 表示目标架构。注意:需把上面命令的 v10.2 换成你的 CUDA 版本。
|
||||
:::
|
||||
|
||||
3. 编译安装
|
||||
|
||||
```powershell
|
||||
(mmcv) PS C:\Users\xxx\mmcv> python setup.py build_ext # 如果成功, cl 将被启动用于编译算子
|
||||
(mmcv) PS C:\Users\xxx\mmcv> python setup.py develop # 安装
|
||||
```
|
||||
|
||||
```{note}
|
||||
如果你的 PyTorch 版本是 1.6.0,你可能会遇到一些 [issue](https://github.com/pytorch/pytorch/issues/42467) 提到的错误,你可以参考这个 [pull request](https://github.com/pytorch/pytorch/pull/43380/files) 修改本地环境的 PyTorch 源代码
|
||||
```
|
||||
|
||||
##### 验证安装
|
||||
|
||||
```powershell
|
||||
(mmcv) PS C:\Users\xxx\mmcv> python .dev_scripts/check_installation.py
|
||||
```
|
||||
|
||||
5. 编译安装
|
||||
如果上述命令没有报错,说明安装成功。如有报错,请查看[问题解决页面](../faq.md)是否已经有解决方案。
|
||||
如果没有找到解决方案,欢迎提 [issue](https://github.com/open-mmlab/mmcv/issues)。
|
||||
|
||||
```shell
|
||||
$env:MMCV_WITH_OPS = 1
|
||||
$env:MAX_JOBS = 8 # 根据你可用CPU以及内存量进行设置
|
||||
conda activate mmcv # 激活环境
|
||||
cd mmcv # 改变路径
|
||||
git checkout 2.x # 切换到 2.x 分支
|
||||
python setup.py build_ext # 如果成功, cl 将被启动用于编译算子
|
||||
python setup.py develop # 安装
|
||||
pip list # 检查是否安装成功
|
||||
### 编译 mmcv-lite
|
||||
|
||||
如果你需要使用和 PyTorch 相关的模块,请确保 PyTorch 已经成功安装在环境中,可以参考 [PyTorch 官方安装文档](https://pytorch.org/get-started/locally/#start-locally)。
|
||||
|
||||
1. 克隆代码仓库
|
||||
|
||||
```bash
|
||||
git clone https://github.com/open-mmlab/mmcv.git
|
||||
cd mmcv
|
||||
```
|
||||
|
||||
```{note}
|
||||
如果你的 PyTorch 版本是 1.6.0,你可能会遇到一些这个 [issue](https://github.com/pytorch/pytorch/issues/42467) 提到的错误,则可以参考这个 [pull request](https://github.com/pytorch/pytorch/pull/43380/files) 修改 本地环境的 PyTorch 源代码
|
||||
```
|
||||
2. 开始编译
|
||||
|
||||
如果编译安装 mmcv 的过程中遇到了问题,你也许可以在 [Frequently Asked Question](../faq.html) 找到解决方法
|
||||
```bash
|
||||
MMCV_WITH_OPS=0 pip install -e . -v
|
||||
```
|
||||
|
||||
3. 验证安装
|
||||
|
||||
```bash
|
||||
python -c 'import mmcv;print(mmcv.__version__)'
|
||||
```
|
||||
|
|
|
@ -2,181 +2,367 @@
|
|||
|
||||
MMCV 有两个版本:
|
||||
|
||||
- **mmcv**: 完整版,包含所有的特性以及丰富的开箱即用的 CUDA 算子。注意完整版本可能需要更长时间来编译。
|
||||
- **mmcv-lite**: 精简版,不包含 CUDA 算子但包含其余所有特性和功能,类似 MMCV 1.0 之前的版本。如果你不需要使用 CUDA 算子的话,精简版可以作为一个考虑选项。
|
||||
- **mmcv**: 完整版,包含所有的特性以及丰富的开箱即用的 CPU 和 CUDA 算子。注意,完整版本可能需要更长时间来编译。
|
||||
- **mmcv-lite**: 精简版,不包含 CPU 和 CUDA 算子但包含其余所有特性和功能,类似 MMCV 1.0 之前的版本。如果你不需要使用算子的话,精简版可以作为一个考虑选项。
|
||||
|
||||
```{warning}
|
||||
请不要在同一个环境中安装两个版本,否则可能会遇到类似 `ModuleNotFound` 的错误。在安装一个版本之前,需要先卸载另一个。`如果CUDA可用,强烈推荐安装 mmcv`。
|
||||
请不要在同一个环境中安装两个版本,否则可能会遇到类似 `ModuleNotFound` 的错误。在安装一个版本之前,需要先卸载另一个。`如果 CUDA 可用,强烈推荐安装 mmcv`。
|
||||
```
|
||||
|
||||
a. 安装完整版
|
||||
|
||||
在安装 mmcv 之前,请确保 PyTorch 已经成功安装在环境中,可以参考 PyTorch 官方[文档](https://pytorch.org/)。对于使用 macOS M1 的用户,请确保你的 PyTorch 是 `Nightly` 版本。
|
||||
|
||||
我们提供了 **Linux 和 Windows 平台** PyTorch 和 CUDA 版本组合的 mmcv 预编译包,可以大大简化用户安装编译过程。强烈推荐通过预编译包来安装。另外,安装完成后可以运行 [check_installation.py](https://github.com/open-mmlab/mmcv/blob/2.x/.dev_scripts/check_installation.py) 脚本检查 mmcv 是否安装成功。
|
||||
|
||||
i. 安装最新版本
|
||||
|
||||
如下是安装最新版 `mmcv` 的命令
|
||||
|
||||
```shell
|
||||
pip install 'mmcv>=2.0.0rc1' -f https://download.openmmlab.com/mmcv/dist/{cu_version}/{torch_version}/index.html
|
||||
```
|
||||
|
||||
请将链接中的 `{cu_version}` 和 `{torch_version}` 根据自身需求替换成实际的版本号,例如想安装和 `CUDA 11.1`、`PyTorch 1.9.0` 兼容的最新版 `mmcv`,使用如下替换过的命令
|
||||
|
||||
```shell
|
||||
pip install 'mmcv>=2.0.0rc1' -f https://download.openmmlab.com/mmcv/dist/cu111/torch1.9.0/index.html
|
||||
```
|
||||
### 安装 mmcv
|
||||
|
||||
```{note}
|
||||
下述安装步骤仅适用于 Linux 和 Windows 平台,如需在 macOS 平台安装 mmcv,请参考[源码安装 mmcv](build.md#在-macos-上编译-mmcv)。
|
||||
```
|
||||
|
||||
在安装 mmcv 之前,请确保 PyTorch 已经成功安装在环境中,可以参考 [PyTorch 官方安装文档](https://pytorch.org/get-started/locally/#start-locally)。可使用以下命令验证
|
||||
|
||||
```bash
|
||||
python -c 'import torch;print(torch.__version__)'
|
||||
```
|
||||
|
||||
如果输出版本信息,则表示 PyTorch 已安装。
|
||||
|
||||
#### 使用 mim 安装(推荐)
|
||||
|
||||
[mim](https://github.com/open-mmlab/mim) 是 OpenMMLab 项目的包管理工具,使用它可以很方便地安装 mmcv。
|
||||
|
||||
```bash
|
||||
pip install -U openmim
|
||||
mim install 'mmcv>=2.0.0rc1'
|
||||
```
|
||||
|
||||
如果发现上述的安装命令没有使用预编译包(以 `.whl` 结尾)而是使用源码包(以 `.tar.gz` 结尾)安装,则有可能是我们没有提供和当前环境的 PyTorch 版本、CUDA 版本相匹配的 mmcv 预编译包,此时,你可以[源码安装 mmcv](build.md)。
|
||||
|
||||
<details>
|
||||
<summary>使用预编译包的安装日志</summary>
|
||||
|
||||
Looking in links: https://download.openmmlab.com/mmcv/dist/cu102/torch1.8.0/index.html<br />
|
||||
Collecting mmcv<br />
|
||||
<b>Downloading https://download.openmmlab.com/mmcv/dist/cu102/torch1.8.0/mmcv-2.0.0rc1-cp38-cp38-manylinux1_x86_64.whl</b>
|
||||
|
||||
</details>
|
||||
|
||||
<details>
|
||||
<summary>使用源码包的安装日志</summary>
|
||||
|
||||
Looking in links: https://download.openmmlab.com/mmcv/dist/cu102/torch1.8.0/index.html<br />
|
||||
Collecting mmcv==2.0.0rc1<br />
|
||||
<b>Downloading mmcv-2.0.0rc1.tar.gz</b>
|
||||
|
||||
</details>
|
||||
|
||||
如需安装指定版本的 mmcv,例如安装 2.0.0rc1 版本的 mmcv,可使用以下命令
|
||||
|
||||
```bash
|
||||
mim install mmcv==2.0.0rc1
|
||||
```
|
||||
|
||||
:::{note}
|
||||
如果你打算使用 `opencv-python-headless` 而不是 `opencv-python`,例如在一个很小的容器环境或者没有图形用户界面的服务器中,你可以先安装 `opencv-python-headless`,这样在安装 mmcv 依赖的过程中会跳过 `opencv-python`。
|
||||
|
||||
另外,如果安装依赖库的时间过长,可以指定 pypi 源
|
||||
|
||||
```bash
|
||||
mim install 'mmcv>=2.0.0rc1' -i https://pypi.tuna.tsinghua.edu.cn/simple
|
||||
```
|
||||
|
||||
:::
|
||||
|
||||
安装完成后可以运行 [check_installation.py](https://github.com/open-mmlab/mmcv/blob/2.x/.dev_scripts/check_installation.py) 脚本检查 mmcv 是否安装成功。
|
||||
|
||||
#### 使用 pip 安装
|
||||
|
||||
使用以下命令查看 CUDA 和 PyTorch 的版本
|
||||
|
||||
```bash
|
||||
python -c 'import torch;print(torch.__version__);print(torch.version.cuda)'
|
||||
```
|
||||
|
||||
根据系统的类型、CUDA 版本、PyTorch 版本以及 MMCV 版本选择相应的安装命令
|
||||
|
||||
<html>
|
||||
<body>
|
||||
<style>
|
||||
select {
|
||||
z-index: 1000;
|
||||
position: absolute;
|
||||
top: 10px;
|
||||
width: 6.7rem;
|
||||
}
|
||||
#select-container {
|
||||
position: relative;
|
||||
height: 30px;
|
||||
}
|
||||
#select-cmd {
|
||||
background-color: #f5f6f7;
|
||||
font-size: 14px;
|
||||
margin-top: 20px;
|
||||
}
|
||||
/* 让每一个都间隔1.3rem */
|
||||
#select-os {
|
||||
/* left: 1.375rem; */
|
||||
left: 0;
|
||||
}
|
||||
#select-cuda {
|
||||
/* left: 9.375rem; 9.375 = 1.375 + 6.7 + 1.3 */
|
||||
left: 8rem;
|
||||
}
|
||||
#select-torch {
|
||||
/* left: 17.375rem; 17.375 = 9.375 + 6.7 + 1.3 */
|
||||
left: 16rem;
|
||||
}
|
||||
#select-mmcv {
|
||||
/* left: 25.375rem; 25.375 = 17.375 + 6.7 + 1.3 */
|
||||
left: 24rem;
|
||||
}
|
||||
</style>
|
||||
<div id="select-container">
|
||||
<select
|
||||
onmousedown="handleSelectMouseDown(this.id)"
|
||||
onblur="handleSelectBlur(this.id)"
|
||||
onchange="changeOS(this.value)"
|
||||
id="select-os">
|
||||
</select>
|
||||
<select
|
||||
onmousedown="handleSelectMouseDown(this.id)"
|
||||
onblur="handleSelectBlur(this.id)"
|
||||
onchange="changeCUDA(this.value)"
|
||||
id="select-cuda">
|
||||
</select>
|
||||
<select
|
||||
onmousedown="handleSelectMouseDown(this.id)"
|
||||
onblur="handleSelectBlur(this.id)"
|
||||
onchange="changeTorch(this.value)"
|
||||
id="select-torch">
|
||||
</select>
|
||||
<select
|
||||
onmousedown="handleSelectMouseDown(this.id)"
|
||||
onblur="handleSelectBlur(this.id)"
|
||||
onchange="changeMMCV(this.value)"
|
||||
id="select-mmcv">
|
||||
</select>
|
||||
</div>
|
||||
<pre id="select-cmd"></pre>
|
||||
</body>
|
||||
<script>
|
||||
// 各个select当前的值
|
||||
let osVal, cudaVal, torchVal, mmcvVal;
|
||||
function changeMMCV(val) {
|
||||
mmcvVal = val;
|
||||
change("select-mmcv");
|
||||
}
|
||||
function changeTorch(val) {
|
||||
torchVal = val;
|
||||
change("select-torch");
|
||||
}
|
||||
function changeCUDA(val) {
|
||||
cudaVal = val;
|
||||
change("select-cuda");
|
||||
}
|
||||
function changeOS(val) {
|
||||
osVal = val;
|
||||
change("select-os");
|
||||
}
|
||||
// 控制size大小相关的几个方法
|
||||
function handleSelectMouseDown(id) {
|
||||
const dom = document.getElementById(id);
|
||||
if (!dom) return;
|
||||
const len = dom?.options?.length;
|
||||
if (len >= 9) {
|
||||
dom.size = 10;
|
||||
dom.style.zIndex = 100;
|
||||
}
|
||||
}
|
||||
function handleSelectClick() {
|
||||
const selects = Array.from(document.getElementsByTagName("select"));
|
||||
selects.forEach(select => {
|
||||
select.size = 1;
|
||||
});
|
||||
}
|
||||
function handleSelectBlur(id) {
|
||||
const dom = document.getElementById(id);
|
||||
if (!dom) {
|
||||
// 如果没有指定特定的id,那就直接把所有的select都设置成size = 1
|
||||
handleSelectClick();
|
||||
return;
|
||||
}
|
||||
dom.size = 1;
|
||||
dom.style.zIndex = 1;
|
||||
}
|
||||
function changeCmd() {
|
||||
const cmd = document.getElementById("select-cmd");
|
||||
let cmdString = "pip install mmcv=={mmcv_version} -f https://download.openmmlab.com/mmcv/dist/{cu_version}/{torch_version}/index.html";
|
||||
// e.g: pip install mmcv==2.0.0rc1 -f https://download.openmmlab.com/mmcv/dist/cu111/torch1.9/index.html
|
||||
const cudaVersion = `${cudaVal === "cpu" ? cudaVal : `cu${cudaVal.split(".").join("")}`}`;
|
||||
const torchVersion = `torch${torchVal.substring(0, torchVal.length - 2)}`;
|
||||
cmdString = cmdString.replace("{cu_version}", cudaVersion).replace("{mmcv_version}", mmcvVal).replace("{torch_version}", torchVersion);
|
||||
cmd.textContent = cmdString;
|
||||
}
|
||||
// string数组去重
|
||||
function unique(arr) {
|
||||
if (!arr || !Array.isArray(arr)) return [];
|
||||
return [...new Set(arr)];
|
||||
}
|
||||
// 根据string数组生成option的DocumentFragment
|
||||
function genOptionFragment(data, id) {
|
||||
const name = id.includes("-")? id.split("-")[1] : id;
|
||||
const fragment = new DocumentFragment();
|
||||
data.forEach(option => {
|
||||
const ele = document.createElement("option");
|
||||
let text = `${name} ${option}`;
|
||||
if (name === "os" || option.toUpperCase() === "CPU") {
|
||||
text = `${option}`;
|
||||
}
|
||||
ele.textContent = text;
|
||||
// 添加value属性,方便下拉框选择时直接读到数据
|
||||
ele.value = option;
|
||||
// 添加点击事件监听
|
||||
ele.addEventListener('click', handleSelectClick);
|
||||
fragment.appendChild(ele);
|
||||
});
|
||||
return fragment;
|
||||
}
|
||||
// 在dom树中找到id对应的dom(select元素),并将生成的options添加到元素内
|
||||
function findAndAppend(data, id) {
|
||||
const fragment = genOptionFragment(data, id);
|
||||
const dom = document.getElementById(id);
|
||||
if (dom) dom.replaceChildren(fragment);
|
||||
}
|
||||
/**
|
||||
* change方法的重点在于
|
||||
* 1. 各个下拉框数据的联动
|
||||
* OS ==> cuda ==> torch ==> mmcv
|
||||
* 2. 命令行的修改
|
||||
*/
|
||||
function change(id) {
|
||||
const order = ["select-mmcv", "select-torch", "select-cuda", "select-os"];
|
||||
const idx = order.indexOf(id);
|
||||
if (idx === -1) return;
|
||||
const versionDetail = version[osVal];
|
||||
if (idx >= 3) {
|
||||
// 根据os修改cuda
|
||||
let cuda = [];
|
||||
versionDetail.forEach(v => {
|
||||
cuda.push(v.cuda);
|
||||
});
|
||||
cuda = unique(cuda);
|
||||
cudaVal = cuda[0];
|
||||
findAndAppend(cuda, "select-cuda");
|
||||
}
|
||||
if (idx >= 2) {
|
||||
// 根据cuda修改torch
|
||||
const torch = [];
|
||||
versionDetail.forEach(v => {
|
||||
if (v.cuda === cudaVal) torch.push(v.torch);
|
||||
});
|
||||
torchVal = torch[0];
|
||||
findAndAppend(torch, "select-torch");
|
||||
}
|
||||
if (idx >= 1) {
|
||||
// 根据torch修改mmcv
|
||||
let mmcv = [];
|
||||
versionDetail.forEach(v => {
|
||||
if (v.cuda === cudaVal && v.torch === torchVal) mmcv = v.mmcv;
|
||||
});
|
||||
mmcvVal = mmcv[0];
|
||||
findAndAppend(mmcv, "select-mmcv");
|
||||
}
|
||||
changeCmd();
|
||||
}
|
||||
// 初始化,处理version数据,并调用findAndAppend
|
||||
function init() {
|
||||
// 增加一个全局的click事件监听,作为select onBlur事件失效的兜底
|
||||
document.addEventListener("click", handleSelectBlur);
|
||||
const version = window.version;
|
||||
// OS
|
||||
const os = Object.keys(version);
|
||||
osVal = os[0];
|
||||
findAndAppend(os, "select-os");
|
||||
change("select-os");
|
||||
changeCmd();
|
||||
}
|
||||
// 利用xhr获取本地version数据,如果作为html直接浏览的话需要使用本地服务器打开,否则会有跨域问题
|
||||
window.onload = function () {
|
||||
const url = "../_static/version.json"
|
||||
// 申明一个XMLHttpRequest
|
||||
const request = new XMLHttpRequest();
|
||||
// 设置请求方法与路径
|
||||
request.open("get", url);
|
||||
// 不发送数据到服务器
|
||||
request.send(null);
|
||||
//XHR对象获取到返回信息后执行
|
||||
request.onload = function () {
|
||||
// 返回状态为200,即为数据获取成功
|
||||
if (request.status !== 200) return;
|
||||
const data = JSON.parse(request.responseText);
|
||||
window.version = data;
|
||||
init();
|
||||
}
|
||||
}
|
||||
</script>
|
||||
</html>
|
||||
|
||||
如果在上面的下拉框中没有找到对应的版本,则可能是没有对应 PyTorch 或者 CUDA 或者 mmcv 版本的预编译包,此时,你可以[源码安装 mmcv](build.md)。
|
||||
|
||||
:::{note}
|
||||
PyTorch 在 1.x.0 和 1.x.1 之间通常是兼容的,故 mmcv 只提供 1.x.0 的编译包。如果你
|
||||
的 PyTorch 版本是 1.x.1,你可以放心地安装在 1.x.0 版本编译的 mmcv。例如,如果你的
|
||||
PyTorch 版本是 1.8.1、CUDA 版本是 11.1,你可以使用以下命令安装 mmcv。
|
||||
PyTorch 版本是 1.8.1,你可以放心选择 1.8.x。
|
||||
:::
|
||||
|
||||
`pip install mmcv -f https://download.openmmlab.com/mmcv/dist/cu111/torch1.8.0/index.html`
|
||||
:::{note}
|
||||
如果你打算使用 `opencv-python-headless` 而不是 `opencv-python`,例如在一个很小的容器环境或者没有图形用户界面的服务器中,你可以先安装 `opencv-python-headless`,这样在安装 mmcv 依赖的过程中会跳过 `opencv-python`。
|
||||
|
||||
另外,如果安装依赖库的时间过长,可以指定 pypi 源
|
||||
|
||||
```bash
|
||||
pip install mmcv -f https://download.openmmlab.com/mmcv/dist/cu111/torch1.9.0/index.html -i https://pypi.tuna.tsinghua.edu.cn/simple
|
||||
```
|
||||
|
||||
如果想知道更多 CUDA 和 PyTorch 版本的命令,可以参考下面的表格,将链接中的 `=={mmcv_version}` 删去即可。
|
||||
:::
|
||||
|
||||
ii. 安装特定的版本
|
||||
安装完成后可以运行 [check_installation.py](https://github.com/open-mmlab/mmcv/blob/2.x/.dev_scripts/check_installation.py) 脚本检查 mmcv 是否安装成功。
|
||||
|
||||
如下是安装特定版本 `mmcv` 的命令
|
||||
#### 使用 docker 镜像
|
||||
|
||||
```shell
|
||||
pip install mmcv=={mmcv_version} -f https://download.openmmlab.com/mmcv/dist/{cu_version}/{torch_version}/index.html
|
||||
先将算法库克隆到本地再构建镜像
|
||||
|
||||
```bash
|
||||
git clone https://github.com/open-mmlab/mmcv.git && cd mmcv
|
||||
docker build -t mmcv -f docker/release/Dockerfile .
|
||||
```
|
||||
|
||||
首先请参考版本发布信息找到想要安装的版本号,将 `{mmcv_version}` 替换成该版本号,例如 `2.0.0rc1`。
|
||||
然后将链接中的 `{cu_version}` 和 `{torch_version}` 根据自身需求替换成实际的版本号,例如想安装和 `CUDA 11.1`、`PyTorch 1.9.0` 兼容的 `mmcv` 2.0.0rc1 版本,使用如下替换过的命令
|
||||
也可以直接使用下面的命令构建镜像
|
||||
|
||||
```shell
|
||||
pip install mmcv==2.0.0rc1 -f https://download.openmmlab.com/mmcv/dist/cu111/torch1.9.0/index.html
|
||||
```bash
|
||||
docker build -t mmcv https://github.com/open-mmlab/mmcv.git#2.x:docker/release
|
||||
```
|
||||
|
||||
对于更多的 PyTorch 和 CUDA 版本组合,请参考下表:
|
||||
[Dockerfile](release/Dockerfile) 默认安装最新的 mmcv,如果你想要指定版本,可以使用下面的命令
|
||||
|
||||
<table class="docutils">
|
||||
<tbody>
|
||||
<tr>
|
||||
<th width="80"> CUDA </th>
|
||||
<th valign="bottom" align="left" width="120">torch 1.12</th>
|
||||
<th valign="bottom" align="left" width="120">torch 1.11</th>
|
||||
<th valign="bottom" align="left" width="120">torch 1.10</th>
|
||||
<th valign="bottom" align="left" width="120">torch 1.9</th>
|
||||
<th valign="bottom" align="left" width="120">torch 1.8</th>
|
||||
<th valign="bottom" align="left" width="120">torch 1.7</th>
|
||||
<th valign="bottom" align="left" width="120">torch 1.6</th>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="left">11.6</td>
|
||||
<td align="left"><details><summary> 安装 </summary><pre><code>pip install mmcv-full=={mmcv_version} -f https://download.openmmlab.com/mmcv/dist/cu116/torch1.12.0/index.html</code></pre> </details></td>
|
||||
<td align="left"></td>
|
||||
<td align="left"></td>
|
||||
<td align="left"></td>
|
||||
<td align="left"></td>
|
||||
<td align="left"></td>
|
||||
<td align="left"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="left">11.5</td>
|
||||
<td align="left"></td>
|
||||
<td align="left"><details><summary> 安装 </summary><pre><code>pip install mmcv-full=={mmcv_version} -f https://download.openmmlab.com/mmcv/dist/cu115/torch1.11.0/index.html</code></pre> </details></td>
|
||||
<td align="left"></td>
|
||||
<td align="left"></td>
|
||||
<td align="left"></td>
|
||||
<td align="left"></td>
|
||||
<td align="left"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="left">11.3</td>
|
||||
<td align="left"><details><summary> 安装 </summary><pre><code>pip install mmcv-full=={mmcv_version} -f https://download.openmmlab.com/mmcv/dist/cu113/torch1.12.0/index.html</code></pre> </details></td>
|
||||
<td align="left"><details><summary> 安装 </summary><pre><code>pip install mmcv-full=={mmcv_version} -f https://download.openmmlab.com/mmcv/dist/cu113/torch1.11.0/index.html</code></pre> </details></td>
|
||||
<td align="left"><details><summary> 安装 </summary><pre><code>pip install mmcv-full=={mmcv_version} -f https://download.openmmlab.com/mmcv/dist/cu113/torch1.10.0/index.html</code></pre> </details></td>
|
||||
<td align="left"></td>
|
||||
<td align="left"></td>
|
||||
<td align="left"></td>
|
||||
<td align="left"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="left">11.1</td>
|
||||
<td align="left"></td>
|
||||
<td align="left"></td>
|
||||
<td align="left"><details><summary> 安装 </summary><pre><code>pip install mmcv-full=={mmcv_version} -f https://download.openmmlab.com/mmcv/dist/cu111/torch1.10.0/index.html</code></pre> </details> </td>
|
||||
<td align="left"><details><summary> 安装 </summary><pre><code>pip install mmcv-full=={mmcv_version} -f https://download.openmmlab.com/mmcv/dist/cu111/torch1.9.0/index.html</code></pre> </details> </td>
|
||||
<td align="left"><details><summary> 安装 </summary><pre><code>pip install mmcv-full=={mmcv_version} -f https://download.openmmlab.com/mmcv/dist/cu111/torch1.8.0/index.html</code></pre> </details> </td>
|
||||
<td align="left"> </td>
|
||||
<td align="left"> </td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="left">11.0</td>
|
||||
<td align="left"></td>
|
||||
<td align="left"></td>
|
||||
<td align="left"></td>
|
||||
<td align="left"></td>
|
||||
<td align="left"></td>
|
||||
<td align="left"><details><summary> 安装 </summary><pre><code>pip install mmcv-full=={mmcv_version} -f https://download.openmmlab.com/mmcv/dist/cu110/torch1.7.0/index.html</code></pre> </details> </td>
|
||||
<td align="left"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="left">10.2</td>
|
||||
<td align="left"><details><summary> 安装 </summary><pre><code>pip install mmcv-full=={mmcv_version} -f https://download.openmmlab.com/mmcv/dist/cu102/torch1.12.0/index.html</code></pre> </details></td>
|
||||
<td align="left"><details><summary> 安装 </summary><pre><code>pip install mmcv-full=={mmcv_version} -f https://download.openmmlab.com/mmcv/dist/cu102/torch1.11.0/index.html</code></pre> </details></td>
|
||||
<td align="left"><details><summary> 安装 </summary><pre><code>pip install mmcv-full=={mmcv_version} -f https://download.openmmlab.com/mmcv/dist/cu102/torch1.10.0/index.html</code></pre> </details></td>
|
||||
<td align="left"><details><summary> 安装 </summary><pre><code>pip install mmcv-full=={mmcv_version} -f https://download.openmmlab.com/mmcv/dist/cu102/torch1.9.0/index.html</code></pre> </details> </td>
|
||||
<td align="left"><details><summary> 安装 </summary><pre><code>pip install mmcv-full=={mmcv_version} -f https://download.openmmlab.com/mmcv/dist/cu102/torch1.8.0/index.html</code></pre> </details> </td>
|
||||
<td align="left"><details><summary> 安装 </summary><pre><code>pip install mmcv-full=={mmcv_version} -f https://download.openmmlab.com/mmcv/dist/cu102/torch1.7.0/index.html</code></pre> </details> </td>
|
||||
<td align="left"><details><summary> 安装 </summary><pre><code>pip install mmcv-full=={mmcv_version} -f https://download.openmmlab.com/mmcv/dist/cu102/torch1.6.0/index.html</code></pre> </details> </td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="left">10.1</td>
|
||||
<td align="left"></td>
|
||||
<td align="left"></td>
|
||||
<td align="left"></td>
|
||||
<td align="left"></td>
|
||||
<td align="left"><details><summary> 安装 </summary><pre><code> pip install mmcv-full=={mmcv_version} -f https://download.openmmlab.com/mmcv/dist/cu101/torch1.8.0/index.html</code></pre> </details> </td>
|
||||
<td align="left"><details><summary> 安装 </summary><pre><code> pip install mmcv-full=={mmcv_version} -f https://download.openmmlab.com/mmcv/dist/cu101/torch1.7.0/index.html</code></pre> </details> </td>
|
||||
<td align="left"><details><summary> 安装 </summary><pre><code> pip install mmcv-full=={mmcv_version} -f https://download.openmmlab.com/mmcv/dist/cu101/torch1.6.0/index.html</code></pre> </details> </td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="left">9.2</td>
|
||||
<td align="left"></td>
|
||||
<td align="left"></td>
|
||||
<td align="left"></td>
|
||||
<td align="left"></td>
|
||||
<td align="left"></td>
|
||||
<td align="left"><details><summary> 安装 </summary><pre><code> pip install mmcv-full=={mmcv_version} -f https://download.openmmlab.com/mmcv/dist/cu92/torch1.7.0/index.html</code></pre> </details> </td>
|
||||
<td align="left"><details><summary> 安装 </summary><pre><code> pip install mmcv-full=={mmcv_version} -f https://download.openmmlab.com/mmcv/dist/cu92/torch1.6.0/index.html</code></pre> </details> </td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="left">cpu</td>
|
||||
<td align="left"><details><summary> 安装 </summary><pre><code> pip install mmcv-full=={mmcv_version} -f https://download.openmmlab.com/mmcv/dist/cpu/torch1.12.0/index.html</code></pre> </details></td>
|
||||
<td align="left"><details><summary> 安装 </summary><pre><code> pip install mmcv-full=={mmcv_version} -f https://download.openmmlab.com/mmcv/dist/cpu/torch1.11.0/index.html</code></pre> </details></td>
|
||||
<td align="left"><details><summary> 安装 </summary><pre><code> pip install mmcv-full=={mmcv_version} -f https://download.openmmlab.com/mmcv/dist/cpu/torch1.10.0/index.html</code></pre> </details> </td>
|
||||
<td align="left"><details><summary> 安装 </summary><pre><code> pip install mmcv-full=={mmcv_version} -f https://download.openmmlab.com/mmcv/dist/cpu/torch1.9.0/index.html</code></pre> </details> </td>
|
||||
<td align="left"><details><summary> 安装 </summary><pre><code> pip install mmcv-full=={mmcv_version} -f https://download.openmmlab.com/mmcv/dist/cpu/torch1.8.0/index.html</code></pre> </details> </td>
|
||||
<td align="left"><details><summary> 安装 </summary><pre><code> pip install mmcv-full=={mmcv_version} -f https://download.openmmlab.com/mmcv/dist/cpu/torch1.7.0/index.html</code></pre> </details> </td>
|
||||
<td align="left"><details><summary> 安装 </summary><pre><code> pip install mmcv-full=={mmcv_version} -f https://download.openmmlab.com/mmcv/dist/cpu/torch1.6.0/index.html</code></pre> </details> </td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
```{note}
|
||||
mmcv 没有提供 Windows 平台 `cu102-torch1.8.0` 和 `cu92-torch*` 的预编译包。
|
||||
```bash
|
||||
docker image build -t mmcv -f docker/release/Dockerfile --build-arg MMCV=2.0.0rc1 .
|
||||
```
|
||||
|
||||
除了使用预编译包之外,另一种方式是在本地进行编译,直接运行下述命令
|
||||
如果你想要使用其他版本的 PyTorch 和 CUDA,你可以在构建镜像时指定它们的版本。
|
||||
|
||||
```python
|
||||
pip install 'mmcv>=2.0.0rc1'
|
||||
例如指定 PyTorch 的版本是 1.11,CUDA 的版本是 11.3
|
||||
|
||||
```bash
|
||||
docker build -t mmcv -f docker/release/Dockerfile \
|
||||
--build-arg PYTORCH=1.11.0 \
|
||||
--build-arg CUDA=11.3 \
|
||||
--build-arg CUDNN=8 \
|
||||
--build-arg MMCV=2.0.0rc1 .
|
||||
```
|
||||
|
||||
但注意本地编译可能会耗时 10 分钟以上。
|
||||
更多 PyTorch 和 CUDA 镜像可以点击 [dockerhub/pytorch](https://hub.docker.com/r/pytorch/pytorch/tags) 查看。
|
||||
|
||||
b. 安装精简版
|
||||
### 安装 mmcv-lite
|
||||
|
||||
如果你需要使用和 PyTorch 相关的模块,请确保 PyTorch 已经成功安装在环境中,可以参考 [PyTorch 官方安装文档](https://pytorch.org/get-started/locally/#start-locally)。
|
||||
|
||||
```python
|
||||
pip install mmcv-lite
|
||||
```
|
||||
|
||||
如果想从源码编译 MMCV,请参考[该文档](build.md)。
|
||||
|
|
|
@ -1,12 +1,26 @@
|
|||
## 介绍 MMCV
|
||||
|
||||
MMCV 是一个面向计算机视觉的基础库,它支持了很多开源项目,例如:
|
||||
MMCV 是一个面向计算机视觉的基础库,它提供了以下功能:
|
||||
|
||||
- [图像和视频处理](../understand_mmcv/data_process.md)
|
||||
- [图像和标注结果可视化](../understand_mmcv/visualization.md)
|
||||
- [图像变换](../understand_mmcv/data_transform.md)
|
||||
- [多种 CNN 网络结构](../understand_mmcv/cnn.md)
|
||||
- [高质量实现的常见 CUDA 算子](../understand_mmcv/ops.md)
|
||||
|
||||
MMCV 支持多种平台,包括:
|
||||
|
||||
- Linux
|
||||
- Windows
|
||||
- macOS
|
||||
|
||||
它支持的 OpenMMLab 项目:
|
||||
|
||||
- [MIM](https://github.com/open-mmlab/mim): MIM 是 OpenMMlab 项目、算法、模型的统一入口
|
||||
- [MMClassification](https://github.com/open-mmlab/mmclassification): OpenMMLab 图像分类工具箱
|
||||
- [MMDetection](https://github.com/open-mmlab/mmdetection): OpenMMLab 目标检测工具箱
|
||||
- [MMDetection3D](https://github.com/open-mmlab/mmdetection3d): OpenMMLab 新一代通用 3D 目标检测平台
|
||||
- [MMRotate](https://github.com/open-mmlab/mmrotate): OpenMMLab 旋转框检测工具箱与测试基准
|
||||
- [MMYOLO](https://github.com/open-mmlab/mmyolo): OpenMMLab YOLO 系列工具箱与测试基准
|
||||
- [MMSegmentation](https://github.com/open-mmlab/mmsegmentation): OpenMMLab 语义分割工具箱
|
||||
- [MMOCR](https://github.com/open-mmlab/mmocr): OpenMMLab 全流程文字检测识别理解工具箱
|
||||
- [MMPose](https://github.com/open-mmlab/mmpose): OpenMMLab 姿态估计工具箱
|
||||
|
@ -20,25 +34,3 @@ MMCV 是一个面向计算机视觉的基础库,它支持了很多开源项目
|
|||
- [MMEditing](https://github.com/open-mmlab/mmediting): OpenMMLab 图像视频编辑工具箱
|
||||
- [MMGeneration](https://github.com/open-mmlab/mmgeneration): OpenMMLab 图片视频生成模型工具箱
|
||||
- [MMDeploy](https://github.com/open-mmlab/mmdeploy): OpenMMLab 模型部署框架
|
||||
|
||||
MMCV 提供了如下众多功能:
|
||||
|
||||
- 通用的 IO 接口
|
||||
- 图像和视频处理
|
||||
- 图像和标注结果可视化
|
||||
- 常用小工具(进度条,计时器等)
|
||||
- 基于 PyTorch 的通用训练框架
|
||||
- 多种 CNN 网络结构
|
||||
- 高质量实现的常见 CUDA 算子
|
||||
|
||||
MMCV 支持以下的系统:
|
||||
|
||||
- Linux
|
||||
- Windows
|
||||
- macOS
|
||||
|
||||
如想了解更多特性和使用,请参考[文档](https://mmcv.readthedocs.io/zh_CN/latest)。
|
||||
|
||||
```{note}
|
||||
MMCV 需要 Python 3.6 以上版本。
|
||||
```
|
||||
|
|
|
@ -1,3 +1,3 @@
|
|||
## <a href='https://mmcv.readthedocs.io/en/latest/'>English</a>
|
||||
## <a href='https://mmcv.readthedocs.io/en/2.x/'>English</a>
|
||||
|
||||
## <a href='https://mmcv.readthedocs.io/zh_CN/latest/'>简体中文</a>
|
||||
## <a href='https://mmcv.readthedocs.io/zh_CN/2.x/'>简体中文</a>
|
||||
|
|
|
@ -1 +1,2 @@
|
|||
ninja
|
||||
psutil
|
||||
|
|
Loading…
Reference in New Issue