Commit 91da9643 authored by limm's avatar limm
Browse files

support v2.1.0

parent 6f674c7e
def docker_images = ["registry.cn-hangzhou.aliyuncs.com/sensetime/openmmlab:cuda10.1-cudnn7-devel-ubuntu18.04-py37-pt1.3",
"registry.cn-hangzhou.aliyuncs.com/sensetime/openmmlab:cuda10.2-cudnn7-devel-ubuntu18.04-py37-pt1.5"]
def torch_versions = ["1.3.0", "1.5.0"]
def torchvision_versions = ["0.4.2", "0.6.0"]
def get_stages(docker_image, folder) {
def pip_mirror = "-i https://mirrors.aliyun.com/pypi/simple"
stages = {
docker.image(docker_image).inside('-u root --gpus all --net host') {
sh "rm -rf ${env.WORKSPACE}-${folder} ${env.WORKSPACE}-${folder}@tmp"
sh "cp -r ${env.WORKSPACE} ${env.WORKSPACE}-${folder}"
try {
dir("${env.WORKSPACE}-${folder}") {
stage("before_install") {
sh "apt-get update && apt-get install -y ninja-build"
}
stage("dependencies") {
// torch and torchvision are pre-installed in dockers
sh "pip list | grep torch"
sh "apt-get install -y ffmpeg libturbojpeg"
sh "pip install pytest coverage lmdb PyTurboJPEG Cython ${pip_mirror}"
}
stage("build") {
sh "MMCV_WITH_OPS=1 pip install -e . ${pip_mirror}"
}
stage("test") {
sh "coverage run --branch --source=mmcv -m pytest tests/"
sh "coverage xml"
sh "coverage report -m"
}
}
} finally {
sh "rm -rf ${env.WORKSPACE}-${folder} ${env.WORKSPACE}-${folder}@tmp"
}
}
}
return stages
}
node('master') {
// fetch latest change from SCM (Source Control Management)
checkout scm
def stages = [:]
for (int i = 0; i < docker_images.size(); i++) {
def docker_image = docker_images[i]
def torch = torch_versions[i]
def torchvision = torchvision_versions[i]
def tag = docker_image + '_' + torch + '_' + torchvision
def folder = "${i}"
stages[tag] = get_stages(docker_image, folder)
}
parallel stages
}
......@@ -4,10 +4,10 @@ MMCV是计算机视觉研究的基础库,主要提供以下功能:图像处
## 安装
组件支持
+ Python 3.7、3.8、3.9
+ Python 3.7、3.8、3.9、3.10
### 1、使用pip方式安装
mmcv whl包下载目录:[https://cancon.hpccube.com:65024/4/main/mmcv/dtk23.04](https://cancon.hpccube.com:65024/4/main/mmcv/dtk23.04),选择对应的pytorch版本和python版本下载对应mmcv的whl包
mmcv whl包下载目录:[http://10.6.10.68:8000/debug/mmcv/dtk-24.04.1/](http://10.6.10.68:8000/debug/mmcv/dtk-24.04.1/),选择对应的pytorch版本和python版本下载对应mmcv的whl包
```shell
pip install mmcv* (下载的mmcv的whl包)
```
......@@ -18,7 +18,7 @@ pip install mmcv* (下载的mmcv的whl包)
1. 基于光源pytorch基础镜像环境:镜像下载地址:[https://sourcefind.cn/#/image/dcu/pytorch](https://sourcefind.cn/#/image/dcu/pytorch),根据pytorch、python、dtk及系统下载对应的镜像版本。
2. 基于现有python环境:安装pytorch,pytorch whl包下载目录:[https://cancon.hpccube.com:65024/4/main/pytorch/dtk23.04](https://cancon.hpccube.com:65024/4/main/pytorch/dtk23.04),根据python、dtk版本,下载对应pytorch的whl包。安装命令如下:
2. 基于现有python环境:安装pytorch,pytorch whl包下载目录:[http://10.6.10.68:8000/debug/pytorch/dtk24.04.1/](http://10.6.10.68:8000/debug/pytorch/dtk24.04.1/),根据python、dtk版本,下载对应pytorch的whl包。安装命令如下:
```shell
pip install torch* (下载的torch的whl包)
pip install setuptools==59.5.0 wheel
......@@ -32,18 +32,18 @@ git clone https://developer.hpccube.com/codes/aicomponent/mmcv # 根据编译需
- 提供2种源码编译方式(进入mmcv目录):
```
1. 编译whl包并安装
MMCV_WITH_OPS=1 ROCM_HOME=${ROCM_PATH} python3 setup.py -v bdist_wheel
MMCV_WITH_OPS=1 python3 setup.py -v bdist_wheel
pip install dist/mmcv*
2. 源码编译安装
MMCV_WITH_OPS=1 ROCM_HOME=${ROCM_PATH} python3 setup.py install
MMCV_WITH_OPS=1 python3 setup.py install
```
#### 注意事项
+ 若使用pip install下载安装过慢,可添加pypi清华源:-i https://pypi.tuna.tsinghua.edu.cn/simple/
+ ROCM_PATH为dtk的路径,默认为/opt/dtk
## 验证
- python -c "import mmcv; mmcv.\_\_version__",版本号与官方版本同步,查询该软件的版本号,例如2.0.0;
- python -c "import mmcv; mmcv.\_\_version__",版本号与官方版本同步,查询该软件的版本号,例如2.1.0;
## Known Issue
-
......
<div align="center">
<img src="https://raw.githubusercontent.com/open-mmlab/mmcv/master/docs/en/mmcv-logo.png" width="300"/>
<img src="https://raw.githubusercontent.com/open-mmlab/mmcv/main/docs/en/mmcv-logo.png" width="300"/>
<div>&nbsp;</div>
<div align="center">
<b><font size="5">OpenMMLab website</font></b>
......@@ -17,29 +17,45 @@
</sup>
</div>
<div>&nbsp;</div>
</div>
[![docs](https://img.shields.io/badge/docs-2.x-blue)](https://mmcv.readthedocs.io/en/2.x/)
[![platform](https://img.shields.io/badge/platform-Linux%7CWindows%7CmacOS-blue)](https://mmcv.readthedocs.io/en/2.x/get_started/installation.html)
[![platform](https://img.shields.io/badge/platform-Linux%7CWindows%7CmacOS-blue)](https://mmcv.readthedocs.io/en/latest/get_started/installation.html)
[![PyPI - Python Version](https://img.shields.io/pypi/pyversions/mmcv)](https://pypi.org/project/mmcv/)
[![pytorch](https://img.shields.io/badge/pytorch-1.6~1.13-orange)](https://pytorch.org/get-started/previous-versions/)
[![cuda](https://img.shields.io/badge/cuda-9.2~11.7-green)](https://developer.nvidia.com/cuda-downloads)
[![pytorch](https://img.shields.io/badge/pytorch-1.8~2.0-orange)](https://pytorch.org/get-started/previous-versions/)
[![cuda](https://img.shields.io/badge/cuda-10.1~11.8-green)](https://developer.nvidia.com/cuda-downloads)
[![PyPI](https://img.shields.io/pypi/v/mmcv)](https://pypi.org/project/mmcv)
[![badge](https://github.com/open-mmlab/mmcv/workflows/build/badge.svg)](https://github.com/open-mmlab/mmcv/actions)
[![codecov](https://codecov.io/gh/open-mmlab/mmcv/branch/master/graph/badge.svg)](https://codecov.io/gh/open-mmlab/mmcv)
[![license](https://img.shields.io/github/license/open-mmlab/mmcv.svg)](https://github.com/open-mmlab/mmcv/blob/master/LICENSE)
[📘Documentation](https://mmcv.readthedocs.io/en/latest/) |
[🛠️Installation](https://mmcv.readthedocs.io/en/latest/get_started/installation.html) |
[🤔Reporting Issues](https://github.com/open-mmlab/mmcv/issues/new/choose)
</div>
<div align="center">
English | [简体中文](README_zh-CN.md)
</div>
## Highlights
The OpenMMLab team released a new generation of training engine [MMEngine](https://github.com/open-mmlab/mmengine) at the World Artificial Intelligence Conference on September 1, 2022. It is a foundational library for training deep learning models. Compared with MMCV, it provides a universal and powerful runner, an open architecture with a more unified interface, and a more customizable training process.
MMCV v2.0.0 official version was released on April 6, 2023. In version 2.x, it removed components related to the training process and added a data transformation module. Also, starting from 2.x, it renamed the package names **mmcv** to **mmcv-lite** and **mmcv-full** to **mmcv**. For details, see [Compatibility Documentation](docs/en/compatibility.md).
MMCV will maintain both [1.x](https://github.com/open-mmlab/mmcv/tree/1.x) (corresponding to the original [master](https://github.com/open-mmlab/mmcv/tree/master) branch) and **2.x** (corresponding to the **main** branch, now the default branch) versions simultaneously. For details, see [Branch Maintenance Plan](README.md#branch-maintenance-plan).
## Introduction
MMCV is a foundational library for computer vision research and it provides the following functionalities:
- [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)
- [Image/Video processing](https://mmcv.readthedocs.io/en/latest/understand_mmcv/data_process.html)
- [Image and annotation visualization](https://mmcv.readthedocs.io/en/latest/understand_mmcv/visualization.html)
- [Image transformation](https://mmcv.readthedocs.io/en/latest/understand_mmcv/data_transform.html)
- [Various CNN architectures](https://mmcv.readthedocs.io/en/latest/understand_mmcv/cnn.html)
- [High-quality implementation of common CPU and CUDA ops](https://mmcv.readthedocs.io/en/latest/understand_mmcv/ops.html)
It supports the following systems:
......@@ -47,7 +63,7 @@ It supports the following systems:
- Windows
- macOS
See the [documentation](http://mmcv.readthedocs.io/en/2.x) for more features and usage.
See the [documentation](http://mmcv.readthedocs.io/en/latest) for more features and usage.
Note: MMCV requires Python 3.7+.
......@@ -68,23 +84,23 @@ The command to install mmcv:
```bash
pip install -U openmim
mim install "mmcv>=2.0.0rc1"
mim install mmcv
```
If you need to specify the version of mmcv, you can use the following command:
```bash
mim install mmcv==2.0.0rc3
mim install mmcv==2.0.0
```
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).
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/latest/get_started/build.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.0rc3-cp38-cp38-manylinux1_x86_64.whl</b>
<b>Downloading https://download.openmmlab.com/mmcv/dist/cu102/torch1.8.0/mmcv-2.0.0-cp38-cp38-manylinux1_x86_64.whl</b>
</details>
......@@ -92,12 +108,12 @@ Collecting mmcv<br />
<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.0rc3<br />
<b>Downloading mmcv-2.0.0rc3.tar.gz</b>
Collecting mmcv==2.0.0<br />
<b>Downloading mmcv-2.0.0.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).
For more installation methods, please refer to the [Installation documentation](https://mmcv.readthedocs.io/en/latest/get_started/installation.html).
### Install mmcv-lite
......@@ -105,15 +121,15 @@ If you need to use PyTorch-related modules, make sure PyTorch has been successfu
```bash
pip install -U openmim
mim install "mmcv-lite>=2.0.0rc1"
mim install mmcv-lite
```
## 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).
you may first refer to this [Frequently Asked Questions](https://mmcv.readthedocs.io/en/latest/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).
If you face installation problems or runtime issues, you may first refer to this [Frequently Asked Questions](https://mmcv.readthedocs.io/en/latest/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
......@@ -136,6 +152,16 @@ We appreciate all contributions to improve MMCV. Please refer to [CONTRIBUTING.m
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.
## Branch Maintenance Plan
MMCV currently has four branches, namely main, 1.x, master, and 2.x, where 2.x is an alias for the main branch, and master is an alias for the 1.x branch. The 2.x and master branches will be deleted in the future. MMCV's branches go through the following three stages:
| Phase | Time | Branch | description |
| -------------------- | --------------------- | ----------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------ |
| RC Period | 2022.9.1 - 2023.4.5 | Release candidate code (2.x version) will be released on 2.x branch. Default master branch is still 1.x version | Master and 2.x branches iterate normally |
| Compatibility Period | 2023.4.6 - 2023.12.31 | **The 2.x branch has been renamed to the main branch and set as the default branch**, and 1.x branch will correspond to 1.x version | We still maintain the old version 1.x, respond to user needs, but try not to introduce changes that break compatibility; main branch iterates normally |
| Maintenance Period | From 2024/1/1 | Default main branch corresponds to 2.x version and 1.x branch is 1.x version | 1.x branch is in maintenance phase, no more new feature support; main branch is iterating normally |
## Projects in OpenMMLab
- [MMEngine](https://github.com/open-mmlab/mmengine): OpenMMLab foundational library for training deep learning models.
......
<div align="center">
<img src="https://raw.githubusercontent.com/open-mmlab/mmcv/master/docs/en/mmcv-logo.png" width="300"/>
<img src="https://raw.githubusercontent.com/open-mmlab/mmcv/main/docs/en/mmcv-logo.png" width="300"/>
<div>&nbsp;</div>
<div align="center">
<b><font size="5">OpenMMLab 官网</font></b>
......@@ -17,29 +17,65 @@
</sup>
</div>
<div>&nbsp;</div>
</div>
[![docs](https://img.shields.io/badge/docs-2.x-blue)](https://mmcv.readthedocs.io/zh_CN/2.x/)
[![platform](https://img.shields.io/badge/platform-Linux%7CWindows%7CmacOS-blue)](https://mmcv.readthedocs.io/zh_CN/2.x/get_started/installation.html)
[![platform](https://img.shields.io/badge/platform-Linux%7CWindows%7CmacOS-blue)](https://mmcv.readthedocs.io/zh_CN/latest/get_started/installation.html)
[![PyPI - Python Version](https://img.shields.io/pypi/pyversions/mmcv)](https://pypi.org/project/mmcv/)
[![pytorch](https://img.shields.io/badge/pytorch-1.6~1.13-orange)](https://pytorch.org/get-started/previous-versions/)
[![cuda](https://img.shields.io/badge/cuda-9.2~11.7-green)](https://developer.nvidia.com/cuda-downloads)
[![pytorch](https://img.shields.io/badge/pytorch-1.8~2.0-orange)](https://pytorch.org/get-started/previous-versions/)
[![cuda](https://img.shields.io/badge/cuda-10.1~11.8-green)](https://developer.nvidia.com/cuda-downloads)
[![PyPI](https://img.shields.io/pypi/v/mmcv)](https://pypi.org/project/mmcv)
[![badge](https://github.com/open-mmlab/mmcv/workflows/build/badge.svg)](https://github.com/open-mmlab/mmcv/actions)
[![codecov](https://codecov.io/gh/open-mmlab/mmcv/branch/master/graph/badge.svg)](https://codecov.io/gh/open-mmlab/mmcv)
[![license](https://img.shields.io/github/license/open-mmlab/mmcv.svg)](https://github.com/open-mmlab/mmcv/blob/master/LICENSE)
[📘使用文档](https://mmcv.readthedocs.io/zh_CN/latest/) |
[🛠️安装教程](https://mmcv.readthedocs.io/zh_CN/latest/get_started/installation.html) |
[🤔报告问题](https://github.com/open-mmlab/mmcv/issues/new/choose)
</div>
<div align="center">
[English](README.md) | 简体中文
</div>
<div align="center">
<a href="https://openmmlab.medium.com/" style="text-decoration:none;">
<img src="https://user-images.githubusercontent.com/25839884/219255827-67c1a27f-f8c5-46a9-811d-5e57448c61d1.png" width="3%" alt="" /></a>
<img src="https://user-images.githubusercontent.com/25839884/218346358-56cc8e2f-a2b8-487f-9088-32480cceabcf.png" width="3%" alt="" />
<a href="https://discord.gg/raweFPmdzG" style="text-decoration:none;">
<img src="https://user-images.githubusercontent.com/25839884/218347213-c080267f-cbb6-443e-8532-8e1ed9a58ea9.png" width="3%" alt="" /></a>
<img src="https://user-images.githubusercontent.com/25839884/218346358-56cc8e2f-a2b8-487f-9088-32480cceabcf.png" width="3%" alt="" />
<a href="https://twitter.com/OpenMMLab" style="text-decoration:none;">
<img src="https://user-images.githubusercontent.com/25839884/218346637-d30c8a0f-3eba-4699-8131-512fb06d46db.png" width="3%" alt="" /></a>
<img src="https://user-images.githubusercontent.com/25839884/218346358-56cc8e2f-a2b8-487f-9088-32480cceabcf.png" width="3%" alt="" />
<a href="https://www.youtube.com/openmmlab" style="text-decoration:none;">
<img src="https://user-images.githubusercontent.com/25839884/218346691-ceb2116a-465a-40af-8424-9f30d2348ca9.png" width="3%" alt="" /></a>
<img src="https://user-images.githubusercontent.com/25839884/218346358-56cc8e2f-a2b8-487f-9088-32480cceabcf.png" width="3%" alt="" />
<a href="https://space.bilibili.com/1293512903" style="text-decoration:none;">
<img src="https://user-images.githubusercontent.com/25839884/219026751-d7d14cce-a7c9-4e82-9942-8375fca65b99.png" width="3%" alt="" /></a>
<img src="https://user-images.githubusercontent.com/25839884/218346358-56cc8e2f-a2b8-487f-9088-32480cceabcf.png" width="3%" alt="" />
<a href="https://www.zhihu.com/people/openmmlab" style="text-decoration:none;">
<img src="https://user-images.githubusercontent.com/25839884/219026120-ba71e48b-6e94-4bd4-b4e9-b7d175b5e362.png" width="3%" alt="" /></a>
</div>
## Highlights
OpenMMLab 团队于 2022 年 9 月 1 日在世界人工智能大会发布了新一代训练引擎 [MMEngine](https://github.com/open-mmlab/mmengine),它是一个用于训练深度学习模型的基础库。相比于 MMCV,它提供了更高级且通用的训练器、接口更加统一的开放架构以及可定制化程度更高的训练流程。
MMCV v2.0.0 正式版本于 2023 年 4 月 6 日发布。在 2.x 版本中,它删除了和训练流程相关的组件,并新增了数据变换模块。另外,从 2.x 版本开始,重命名包名 **mmcv****mmcv-lite** 以及 **mmcv-full****mmcv**。详情见[兼容性文档](docs/zh_cn/compatibility.md)
MMCV 会同时维护 [1.x](https://github.com/open-mmlab/mmcv/tree/1.x) (对应原 [master](https://github.com/open-mmlab/mmcv/tree/master) 分支) 和 **2.x**(对应 **main** 分支,现为默认分支)版本,详情见[分支维护计划](README_zh-CN.md#分支维护计划)
## 简介
MMCV 是一个面向计算机视觉的基础库,它提供了以下功能:
- [图像和视频处理](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)
- [图像和视频处理](https://mmcv.readthedocs.io/zh_CN/latest/understand_mmcv/data_process.html)
- [图像和标注结果可视化](https://mmcv.readthedocs.io/zh_CN/latest/understand_mmcv/visualization.html)
- [图像变换](https://mmcv.readthedocs.io/zh_CN/latest/understand_mmcv/data_transform.html)
- [多种 CNN 网络结构](https://mmcv.readthedocs.io/zh_CN/latest/understand_mmcv/cnn.html)
- [高质量实现的常见 CUDA 算子](https://mmcv.readthedocs.io/zh_CN/latest/understand_mmcv/ops.html)
MMCV 支持多种平台,包括:
......@@ -47,7 +83,7 @@ MMCV 支持多种平台,包括:
- Windows
- macOS
如想了解更多特性和使用,请参考[文档](http://mmcv.readthedocs.io/zh_CN/2.x)
如想了解更多特性和使用,请参考[文档](http://mmcv.readthedocs.io/zh_CN/latest)
提示: MMCV 需要 Python 3.7 以上版本。
......@@ -68,23 +104,23 @@ MMCV 有两个版本:
```bash
pip install -U openmim
mim install "mmcv>=2.0.0rc1"
mim install mmcv
```
如果需要指定 mmcv 的版本,可以使用以下命令
```bash
mim install mmcv==2.0.0rc3
mim install mmcv==2.0.0
```
如果发现上述的安装命令没有使用预编译包(以 `.whl` 结尾)而是使用源码包(以 `.tar.gz` 结尾)安装,则有可能是我们没有提供和当前环境的 PyTorch 版本、CUDA 版本相匹配的 mmcv 预编译包,此时,你可以[源码安装 mmcv](https://mmcv.readthedocs.io/zh_CN/2.x/get_started/build.html)
如果发现上述的安装命令没有使用预编译包(以 `.whl` 结尾)而是使用源码包(以 `.tar.gz` 结尾)安装,则有可能是我们没有提供和当前环境的 PyTorch 版本、CUDA 版本相匹配的 mmcv 预编译包,此时,你可以[源码安装 mmcv](https://mmcv.readthedocs.io/zh_CN/latest/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.0rc3-cp38-cp38-manylinux1_x86_64.whl</b>
<b>Downloading https://download.openmmlab.com/mmcv/dist/cu102/torch1.8.0/mmcv-2.0.0-cp38-cp38-manylinux1_x86_64.whl</b>
</details>
......@@ -92,12 +128,12 @@ Collecting mmcv<br />
<summary>使用源码包的安装日志</summary>
Looking in links: https://download.openmmlab.com/mmcv/dist/cu102/torch1.8.0/index.html<br />
Collecting mmcv==2.0.0rc3<br />
<b>Downloading mmcv-2.0.0rc3.tar.gz</b>
Collecting mmcv==2.0.0<br />
<b>Downloading mmcv-2.0.0.tar.gz</b>
</details>
更多安装方式请参考[安装文档](https://mmcv.readthedocs.io/zh_CN/2.x/get_started/installation.html)
更多安装方式请参考[安装文档](https://mmcv.readthedocs.io/zh_CN/latest/get_started/installation.html)
### 安装 mmcv-lite
......@@ -105,12 +141,12 @@ Collecting mmcv==2.0.0rc3<br />
```bash
pip install -U openmim
mim install "mmcv-lite>=2.0.0rc1"
mim install mmcv-lite
```
## FAQ
如果你遇到了安装问题或者运行时问题,请查看[问题解决页面](https://mmcv.readthedocs.io/zh_CN/2.x/faq.html)是否已有解决方案。如果问题仍然没有解决,欢迎提 [issue](https://github.com/open-mmlab/mmcv/issues)
如果你遇到了安装问题或者运行时问题,请查看[问题解决页面](https://mmcv.readthedocs.io/zh_CN/latest/faq.html)是否已有解决方案。如果问题仍然没有解决,欢迎提 [issue](https://github.com/open-mmlab/mmcv/issues)
## 贡献指南
......@@ -120,6 +156,16 @@ mim install "mmcv-lite>=2.0.0rc1"
`MMCV` 目前以 Apache 2.0 的许可证发布,但是其中有一部分功能并不是使用的 Apache2.0 许可证,我们在 [许可证](LICENSES.md) 中详细地列出了这些功能以及他们对应的许可证,如果您正在从事盈利性活动,请谨慎参考此文档。
## 分支维护计划
MMCV 目前有四个分支,分别是 main、1.x、master 和 2.x,其中 2.x 为 main 分支的别名,master 为 1.x 分支的别名,2.x 和 master 这两个分支在将来会被删除。MMCV 的分支经历以下三个阶段:
| 阶段 | 时间 | 分支 | 说明 |
| ------ | --------------------- | --------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------ |
| 公测期 | 2022.9.1 - 2023.4.5 | 公测版代码发布在 2.x 分支;默认主分支 master 仍对应 1.x 版本 | master 和 2.x 分支正常进行迭代 |
| 兼容期 | 2023.4.6 - 2023.12.31 | **2.x 分支重命名为 main 分支并设置为默认分支**;1.x 分支对应 1.x 版本 | 保持对旧版本 1.x 的维护和开发,响应用户需求,但尽量不引进破坏旧版本兼容性的改动;main 分支正常进行迭代 |
| 维护期 | 2024.1.1 - 待定 | 默认主分支 main 为 2.x 版本;1.x 分支对应 1.x 版本 | 1.x 分支进入维护阶段,不再进行新功能支持;main 分支正常进行迭代 |
## OpenMMLab 的其他项目
- [MMEngine](https://github.com/open-mmlab/mmengine): OpenMMLab 深度学习模型训练基础库
......
{
"Linux": [
{
"cuda": "11.8",
"torch": "2.0.x",
"mmcv": [
"2.0.0"
]
},
{
"cuda": "11.7",
"torch": "2.0.x",
"mmcv": [
"2.0.0"
]
},
{
"cuda": "11.7",
"torch": "1.13.x",
"mmcv": [
"2.0.0rc3"
"2.0.0rc4",
"2.0.0rc3",
"2.0.0"
]
},
{
"cuda": "11.6",
"torch": "1.13.x",
"mmcv": [
"2.0.0rc3"
"2.0.0rc4",
"2.0.0rc3",
"2.0.0"
]
},
{
"cuda": "11.6",
"torch": "1.12.x",
"mmcv": [
"2.0.0rc4",
"2.0.0rc3",
"2.0.0rc2",
"2.0.0rc1"
"2.0.0rc1",
"2.0.0"
]
},
{
"cuda": "11.5",
"torch": "1.11.x",
"mmcv": [
"2.0.0rc4",
"2.0.0rc3",
"2.0.0rc2",
"2.0.0rc1"
"2.0.0rc1",
"2.0.0"
]
},
{
"cuda": "11.3",
"torch": "1.12.x",
"mmcv": [
"2.0.0rc4",
"2.0.0rc3",
"2.0.0rc2",
"2.0.0rc1"
"2.0.0rc1",
"2.0.0"
]
},
{
"cuda": "11.3",
"torch": "1.11.x",
"mmcv": [
"2.0.0rc4",
"2.0.0rc3",
"2.0.0rc2",
"2.0.0rc1"
"2.0.0rc1",
"2.0.0"
]
},
{
"cuda": "11.3",
"torch": "1.10.x",
"mmcv": [
"2.0.0rc4",
"2.0.0rc3",
"2.0.0rc2",
"2.0.0rc1"
"2.0.0rc1",
"2.0.0"
]
},
{
"cuda": "11.1",
"torch": "1.10.x",
"mmcv": [
"2.0.0rc4",
"2.0.0rc3",
"2.0.0rc2",
"2.0.0rc1"
"2.0.0rc1",
"2.0.0"
]
},
{
"cuda": "11.1",
"torch": "1.9.x",
"mmcv": [
"2.0.0rc4",
"2.0.0rc3",
"2.0.0rc2",
"2.0.0rc1"
"2.0.0rc1",
"2.0.0"
]
},
{
"cuda": "11.1",
"torch": "1.8.x",
"mmcv": [
"2.0.0rc4",
"2.0.0rc3",
"2.0.0rc2",
"2.0.0rc1"
"2.0.0rc1",
"2.0.0"
]
},
{
"cuda": "11.0",
"torch": "1.7.x",
"mmcv": [
"2.0.0rc4",
"2.0.0rc3",
"2.0.0rc2",
"2.0.0rc1"
......@@ -99,51 +134,62 @@
"cuda": "10.2",
"torch": "1.12.x",
"mmcv": [
"2.0.0rc4",
"2.0.0rc3",
"2.0.0rc2",
"2.0.0rc1"
"2.0.0rc1",
"2.0.0"
]
},
{
"cuda": "10.2",
"torch": "1.11.x",
"mmcv": [
"2.0.0rc4",
"2.0.0rc3",
"2.0.0rc2",
"2.0.0rc1"
"2.0.0rc1",
"2.0.0"
]
},
{
"cuda": "10.2",
"torch": "1.10.x",
"mmcv": [
"2.0.0rc4",
"2.0.0rc3",
"2.0.0rc2",
"2.0.0rc1"
"2.0.0rc1",
"2.0.0"
]
},
{
"cuda": "10.2",
"torch": "1.9.x",
"mmcv": [
"2.0.0rc4",
"2.0.0rc3",
"2.0.0rc2",
"2.0.0rc1"
"2.0.0rc1",
"2.0.0"
]
},
{
"cuda": "10.2",
"torch": "1.8.x",
"mmcv": [
"2.0.0rc4",
"2.0.0rc3",
"2.0.0rc2",
"2.0.0rc1"
"2.0.0rc1",
"2.0.0"
]
},
{
"cuda": "10.2",
"torch": "1.7.x",
"mmcv": [
"2.0.0rc4",
"2.0.0rc3",
"2.0.0rc2",
"2.0.0rc1"
......@@ -153,6 +199,7 @@
"cuda": "10.2",
"torch": "1.6.x",
"mmcv": [
"2.0.0rc4",
"2.0.0rc3",
"2.0.0rc2",
"2.0.0rc1"
......@@ -162,15 +209,18 @@
"cuda": "10.1",
"torch": "1.8.x",
"mmcv": [
"2.0.0rc4",
"2.0.0rc3",
"2.0.0rc2",
"2.0.0rc1"
"2.0.0rc1",
"2.0.0"
]
},
{
"cuda": "10.1",
"torch": "1.7.x",
"mmcv": [
"2.0.0rc4",
"2.0.0rc3",
"2.0.0rc2",
"2.0.0rc1"
......@@ -180,6 +230,7 @@
"cuda": "10.1",
"torch": "1.6.x",
"mmcv": [
"2.0.0rc4",
"2.0.0rc3",
"2.0.0rc2",
"2.0.0rc1"
......@@ -189,6 +240,7 @@
"cuda": "9.2",
"torch": "1.7.x",
"mmcv": [
"2.0.0rc4",
"2.0.0rc3",
"2.0.0rc2",
"2.0.0rc1"
......@@ -198,67 +250,88 @@
"cuda": "9.2",
"torch": "1.6.x",
"mmcv": [
"2.0.0rc4",
"2.0.0rc3",
"2.0.0rc2",
"2.0.0rc1"
]
},
{
"cuda": "cpu",
"torch": "2.0.x",
"mmcv": [
"2.0.0"
]
},
{
"cuda": "cpu",
"torch": "1.13.x",
"mmcv": [
"2.0.0rc3"
"2.0.0rc4",
"2.0.0rc3",
"2.0.0"
]
},
{
"cuda": "cpu",
"torch": "1.12.x",
"mmcv": [
"2.0.0rc4",
"2.0.0rc3",
"2.0.0rc2",
"2.0.0rc1"
"2.0.0rc1",
"2.0.0"
]
},
{
"cuda": "cpu",
"torch": "1.11.x",
"mmcv": [
"2.0.0rc4",
"2.0.0rc3",
"2.0.0rc2",
"2.0.0rc1"
"2.0.0rc1",
"2.0.0"
]
},
{
"cuda": "cpu",
"torch": "1.10.x",
"mmcv": [
"2.0.0rc4",
"2.0.0rc3",
"2.0.0rc2",
"2.0.0rc1"
"2.0.0rc1",
"2.0.0"
]
},
{
"cuda": "cpu",
"torch": "1.9.x",
"mmcv": [
"2.0.0rc4",
"2.0.0rc3",
"2.0.0rc2",
"2.0.0rc1"
"2.0.0rc1",
"2.0.0"
]
},
{
"cuda": "cpu",
"torch": "1.8.x",
"mmcv": [
"2.0.0rc4",
"2.0.0rc3",
"2.0.0rc2",
"2.0.0rc1"
"2.0.0rc1",
"2.0.0"
]
},
{
"cuda": "cpu",
"torch": "1.7.x",
"mmcv": [
"2.0.0rc4",
"2.0.0rc3",
"2.0.0rc2",
"2.0.0rc1"
......@@ -268,6 +341,7 @@
"cuda": "cpu",
"torch": "1.6.x",
"mmcv": [
"2.0.0rc4",
"2.0.0rc3",
"2.0.0rc2",
"2.0.0rc1"
......@@ -275,123 +349,164 @@
}
],
"Windows": [
{
"cuda": "11.8",
"torch": "2.0.x",
"mmcv": [
"2.0.0"
]
},
{
"cuda": "11.7",
"torch": "2.0.x",
"mmcv": [
"2.0.0"
]
},
{
"cuda": "11.7",
"torch": "1.13.x",
"mmcv": [
"2.0.0rc3"
"2.0.0rc4",
"2.0.0rc3",
"2.0.0"
]
},
{
"cuda": "11.6",
"torch": "1.13.x",
"mmcv": [
"2.0.0rc3"
"2.0.0rc4",
"2.0.0rc3",
"2.0.0"
]
},
{
"cuda": "11.6",
"torch": "1.12.x",
"mmcv": [
"2.0.0rc4",
"2.0.0rc3",
"2.0.0rc2",
"2.0.0rc1"
"2.0.0rc1",
"2.0.0"
]
},
{
"cuda": "11.5",
"torch": "1.11.x",
"mmcv": [
"2.0.0rc4",
"2.0.0rc3",
"2.0.0rc2",
"2.0.0rc1"
"2.0.0rc1",
"2.0.0"
]
},
{
"cuda": "11.3",
"torch": "1.12.x",
"mmcv": [
"2.0.0rc4",
"2.0.0rc3",
"2.0.0rc2",
"2.0.0rc1"
"2.0.0rc1",
"2.0.0"
]
},
{
"cuda": "11.3",
"torch": "1.11.x",
"mmcv": [
"2.0.0rc4",
"2.0.0rc3",
"2.0.0rc2",
"2.0.0rc1"
"2.0.0rc1",
"2.0.0"
]
},
{
"cuda": "11.3",
"torch": "1.10.x",
"mmcv": [
"2.0.0rc4",
"2.0.0rc3",
"2.0.0rc2",
"2.0.0rc1"
"2.0.0rc1",
"2.0.0"
]
},
{
"cuda": "11.1",
"torch": "1.10.x",
"mmcv": [
"2.0.0rc4",
"2.0.0rc3",
"2.0.0rc2",
"2.0.0rc1"
"2.0.0rc1",
"2.0.0"
]
},
{
"cuda": "11.1",
"torch": "1.9.x",
"mmcv": [
"2.0.0rc4",
"2.0.0rc3",
"2.0.0rc2",
"2.0.0rc1"
"2.0.0rc1",
"2.0.0"
]
},
{
"cuda": "11.1",
"torch": "1.8.x",
"mmcv": [
"2.0.0rc4",
"2.0.0rc3",
"2.0.0rc2",
"2.0.0rc1"
"2.0.0rc1",
"2.0.0"
]
},
{
"cuda": "10.2",
"torch": "1.10.x",
"mmcv": [
"2.0.0rc4",
"2.0.0rc3",
"2.0.0rc2",
"2.0.0rc1"
"2.0.0rc1",
"2.0.0"
]
},
{
"cuda": "10.2",
"torch": "1.9.x",
"mmcv": [
"2.0.0rc4",
"2.0.0rc3",
"2.0.0rc2",
"2.0.0rc1"
"2.0.0rc1",
"2.0.0"
]
},
{
"cuda": "10.2",
"torch": "1.8.x",
"mmcv": [
"2.0.0rc4",
"2.0.0rc3",
"2.0.0rc2",
"2.0.0rc1"
"2.0.0rc1",
"2.0.0"
]
},
{
"cuda": "10.2",
"torch": "1.7.x",
"mmcv": [
"2.0.0rc4",
"2.0.0rc3"
]
},
......@@ -399,6 +514,7 @@
"cuda": "10.2",
"torch": "1.6.x",
"mmcv": [
"2.0.0rc4",
"2.0.0rc3",
"2.0.0rc2",
"2.0.0rc1"
......@@ -408,15 +524,18 @@
"cuda": "10.1",
"torch": "1.8.x",
"mmcv": [
"2.0.0rc4",
"2.0.0rc3",
"2.0.0rc2",
"2.0.0rc1"
"2.0.0rc1",
"2.0.0"
]
},
{
"cuda": "10.1",
"torch": "1.7.x",
"mmcv": [
"2.0.0rc4",
"2.0.0rc3"
]
},
......@@ -424,67 +543,88 @@
"cuda": "10.1",
"torch": "1.6.x",
"mmcv": [
"2.0.0rc4",
"2.0.0rc3",
"2.0.0rc2",
"2.0.0rc1"
]
},
{
"cuda": "cpu",
"torch": "2.0.x",
"mmcv": [
"2.0.0"
]
},
{
"cuda": "cpu",
"torch": "1.13.x",
"mmcv": [
"2.0.0rc3"
"2.0.0rc4",
"2.0.0rc3",
"2.0.0"
]
},
{
"cuda": "cpu",
"torch": "1.12.x",
"mmcv": [
"2.0.0rc4",
"2.0.0rc3",
"2.0.0rc2",
"2.0.0rc1"
"2.0.0rc1",
"2.0.0"
]
},
{
"cuda": "cpu",
"torch": "1.11.x",
"mmcv": [
"2.0.0rc4",
"2.0.0rc3",
"2.0.0rc2",
"2.0.0rc1"
"2.0.0rc1",
"2.0.0"
]
},
{
"cuda": "cpu",
"torch": "1.10.x",
"mmcv": [
"2.0.0rc4",
"2.0.0rc3",
"2.0.0rc2",
"2.0.0rc1"
"2.0.0rc1",
"2.0.0"
]
},
{
"cuda": "cpu",
"torch": "1.9.x",
"mmcv": [
"2.0.0rc4",
"2.0.0rc3",
"2.0.0rc2",
"2.0.0rc1"
"2.0.0rc1",
"2.0.0"
]
},
{
"cuda": "cpu",
"torch": "1.8.x",
"mmcv": [
"2.0.0rc4",
"2.0.0rc3",
"2.0.0rc2",
"2.0.0rc1"
"2.0.0rc1",
"2.0.0"
]
},
{
"cuda": "cpu",
"torch": "1.7.x",
"mmcv": [
"2.0.0rc4",
"2.0.0rc3",
"2.0.0rc2",
"2.0.0rc1"
......@@ -494,6 +634,7 @@
"cuda": "cpu",
"torch": "1.6.x",
"mmcv": [
"2.0.0rc4",
"2.0.0rc3",
"2.0.0rc2",
"2.0.0rc1"
......@@ -501,17 +642,27 @@
}
],
"macOS": [
{
"cuda": "cpu",
"torch": "2.0.x",
"mmcv": [
"2.0.0"
]
},
{
"cuda": "cpu",
"torch": "1.13.x",
"mmcv": [
"2.0.0rc3"
"2.0.0rc4",
"2.0.0rc3",
"2.0.0"
]
},
{
"cuda": "mps",
"torch": "1.13.x",
"mmcv": [
"2.0.0rc4",
"2.0.0rc3"
]
},
......@@ -519,46 +670,57 @@
"cuda": "cpu",
"torch": "1.12.x",
"mmcv": [
"2.0.0rc4",
"2.0.0rc3",
"2.0.0rc2"
"2.0.0rc2",
"2.0.0"
]
},
{
"cuda": "cpu",
"torch": "1.11.x",
"mmcv": [
"2.0.0rc4",
"2.0.0rc3",
"2.0.0rc2"
"2.0.0rc2",
"2.0.0"
]
},
{
"cuda": "cpu",
"torch": "1.10.x",
"mmcv": [
"2.0.0rc4",
"2.0.0rc3",
"2.0.0rc2"
"2.0.0rc2",
"2.0.0"
]
},
{
"cuda": "cpu",
"torch": "1.9.x",
"mmcv": [
"2.0.0rc4",
"2.0.0rc3",
"2.0.0rc2"
"2.0.0rc2",
"2.0.0"
]
},
{
"cuda": "cpu",
"torch": "1.8.x",
"mmcv": [
"2.0.0rc4",
"2.0.0rc3",
"2.0.0rc2"
"2.0.0rc2",
"2.0.0"
]
},
{
"cuda": "cpu",
"torch": "1.7.x",
"mmcv": [
"2.0.0rc4",
"2.0.0rc3",
"2.0.0rc2"
]
......@@ -567,6 +729,7 @@
"cuda": "cpu",
"torch": "1.6.x",
"mmcv": [
"2.0.0rc4",
"2.0.0rc3",
"2.0.0rc2"
]
......
......@@ -96,16 +96,16 @@ git commit -m "xxx" --no-verify
#### 3. Create a development branch
After configuring the pre-commit, we should create a branch based on the master branch to develop the new feature or fix the bug. The proposed branch name is `username/pr_name`
After configuring the pre-commit, we should create a branch based on the main branch to develop the new feature or fix the bug. The proposed branch name is `username/pr_name`
```shell
git checkout -b yhc/refactor_contributing_doc
```
In subsequent development, if the master branch of the local repository is behind the master branch of "upstream", we need to pull the upstream for synchronization, and then execute the above command:
In subsequent development, if the main branch of the local repository is behind the main branch of "upstream", we need to pull the upstream for synchronization, and then execute the above command:
```shell
git pull upstream master
git pull upstream main
```
#### 4. Commit the code and pass the unit test
......@@ -168,18 +168,18 @@ MMCV will run unit test for the posted Pull Request on different platforms (Linu
#### 7. Resolve conflicts
If your local branch conflicts with the latest master branch of "upstream", you'll need to resolove them. There are two ways to do this:
If your local branch conflicts with the latest main branch of "upstream", you'll need to resolove them. There are two ways to do this:
```shell
git fetch --all --prune
git rebase upstream/master
git rebase upstream/main
```
or
```shell
git fetch --all --prune
git merge upstream/master
git merge upstream/main
```
If you are very good at handling conflicts, then you can use rebase to resolve conflicts, as this will keep your commit logs tidy. If you are not familiar with `rebase`, then you can use `merge` to resolve conflicts.
......@@ -188,7 +188,7 @@ If you are very good at handling conflicts, then you can use rebase to resolve c
#### Unit test
If you cannot run the unit test of some modules for lacking of some dependencies, such as [video](https://github.com/open-mmlab/mmcv/tree/master/mmcv/video) module, you can try to install the following dependencies:
If you cannot run the unit test of some modules for lacking of some dependencies, such as [video](https://github.com/open-mmlab/mmcv/tree/main/mmcv/video) module, you can try to install the following dependencies:
```shell
# Linux
......
### v2.0.0
The OpenMMLab team released a new generation of training engine [MMEngine](https://github.com/open-mmlab/mmengine) at the World Artificial Intelligence Conference on September 1, 2022. It is a foundational library for training deep learning models. Compared with MMCV, it provides a universal and powerful runner, an open architecture with a more unified interface, and a more customizable training process.
The OpenMMLab team released MMCV v2.0.0 on April 6, 2023. In the 2.x version, it has the following significant changes:
(1) It removed the following components:
- `mmcv.fileio` module, removed in PR [#2179](https://github.com/open-mmlab/mmcv/pull/2179). FileIO module from mmengine will be used wherever required.
- `mmcv.runner`, `mmcv.parallel`, `mmcv. engine` and `mmcv.device`, removed in PR [#2216](https://github.com/open-mmlab/mmcv/pull/2216).
- All classes in `mmcv.utils` (eg `Config` and `Registry`) and many functions, removed in PR [#2217](https://github.com/open-mmlab/mmcv/pull/2217). Only a few functions related to mmcv are reserved.
- `mmcv.onnx`, `mmcv.tensorrt` modules and related functions, removed in PR [#2225](https://github.com/open-mmlab/mmcv/pull/2225).
- Removed all root registrars in MMCV and registered classes or functions to the [root registrar](https://github.com/open-mmlab/mmengine/blob/main/mmengine/registry/root.py) in MMEngine.
(2) It added the [`mmcv.transforms`](https://github.com/open-mmlab/mmcv/tree/main/mmcv/transforms) data transformation module.
(3) It renamed the package name **mmcv** to **mmcv-lite** and **mmcv-full** to **mmcv** in PR [#2235](https://github.com/open-mmlab/mmcv/pull/2235). Also, change the default value of the environment variable `MMCV_WITH_OPS` from 0 to 1.
<table class="docutils">
<thead>
<tr>
<th align="center">MMCV < 2.0</th>
<th align="center">MMCV >= 2.0 </th>
<tbody>
<tr>
<td valign="top">
```bash
# Contains ops, because the highest version of mmcv-full is less than 2.0.0, so there is no need to add version restrictions
pip install openmim
mim install mmcv-full
# do not contain ops
pip install openmim
mim install "mmcv < 2.0.0"
```
</td>
<td valign="top">
```bash
# Contains ops
pip install openmim
mim install mmcv
# Ops are not included, because the starting version of mmcv-lite is 2.0.0rc1, so there is no need to add version restrictions
pip install openmim
mim install mmcv-lite
```
</td>
</tr>
</thead>
</table>
### v1.3.18
Some ops have different implementations on different devices. Lots of macros and type checks are scattered in several files, which makes the code hard to maintain. For example:
......
......@@ -473,7 +473,7 @@ Read [PSANet: Point-wise Spatial Attention Network for Scene Parsing](https://hs
Filter out boxes has high IoU overlap with previously selected boxes or low score. Output the indices of valid boxes.
Note this definition is slightly different with [onnx: NonMaxSuppression](https://github.com/onnx/onnx/blob/master/docs/Operators.md#nonmaxsuppression)
Note this definition is slightly different with [onnx: NonMaxSuppression](https://github.com/onnx/onnx/blob/main/docs/Operators.md#nonmaxsuppression)
### Parameters
......
......@@ -290,3 +290,60 @@ If you need to use PyTorch-related modules, make sure PyTorch has been successfu
```bash
python -c 'import mmcv;print(mmcv.__version__)'
```
### Build mmcv-full on Cambricon MLU Devices
#### Install torch_mlu
##### Option1: Install mmcv-full based on Cambricon docker image
Firstly, install and pull Cambricon docker image (please email service@cambricon.com for the latest release docker):
```bash
docker pull ${docker image}
```
Run and attach to the docker, [Install mmcv-full on MLU device](#install-mmcv\-full-on-cambricon-mlu-device) and [make sure you've installed mmcv-full on MLU device successfully](#test-code)
##### Option2: Install mmcv-full from compiling Cambricon PyTorch source code
Please email service@cambricon.com or contact with Cambricon engineers for a suitable version of CATCH package. After you get the suitable version of CATCH package, please follow the steps in ${CATCH-path}/CONTRIBUTING.md to install Cambricon PyTorch.
#### Install mmcv-full on Cambricon MLU device
Clone the repo
```bash
git clone https://github.com/open-mmlab/mmcv.git
```
The mlu-ops library will be downloaded to the default directory (mmcv/mlu-ops) while building MMCV. You can also set `MMCV_MLU_OPS_PATH` to an existing mlu-ops library before building as follows:
```bash
export MMCV_MLU_OPS_PATH=/xxx/xxx/mlu-ops
```
Install mmcv-full
```bash
cd mmcv
export MMCV_WITH_OPS=1
export FORCE_MLU=1
python setup.py install
```
#### Test Code
After finishing previous steps, you can run the following python code to make sure that you've installed mmcv-full on MLU device successfully
```python
import torch
import torch_mlu
from mmcv.ops import sigmoid_focal_loss
x = torch.randn(3, 10).mlu()
x.requires_grad = True
y = torch.tensor([1, 5, 3]).mlu()
w = torch.ones(10).float().mlu()
output = sigmoid_focal_loss(x, y, 2.0, 0.25, w, 'none')
print(output)
```
......@@ -25,7 +25,7 @@ If version information is output, then PyTorch is installed.
```bash
pip install -U openmim
mim install "mmcv>=2.0.0rc1"
mim 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](build.md).
......@@ -35,7 +35,7 @@ If you find that the above installation command does not use a pre-built package
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.0rc3-cp38-cp38-manylinux1_x86_64.whl</b>
<b>Downloading https://download.openmmlab.com/mmcv/dist/cu102/torch1.8.0/mmcv-2.0.0-cp38-cp38-manylinux1_x86_64.whl</b>
</details>
......@@ -43,15 +43,15 @@ Collecting mmcv<br />
<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.0rc3<br />
<b>Downloading mmcv-2.0.0rc3.tar.gz</b>
Collecting mmcv==2.0.0<br />
<b>Downloading mmcv-2.0.0.tar.gz</b>
</details>
To install a specific version of mmcv, for example, mmcv version 2.0.0rc3, you can use the following command
To install a specific version of mmcv, for example, mmcv version 2.0.0, you can use the following command
```bash
mim install mmcv==2.0.0rc3
mim install mmcv==2.0.0
```
:::{note}
......@@ -62,12 +62,12 @@ you can first install it before installing MMCV to skip the installation of `ope
Alternatively, if it takes too long to install a dependency library, you can specify the pypi source
```bash
mim install "mmcv>=2.0.0rc3" -i https://pypi.tuna.tsinghua.edu.cn/simple
mim install mmcv -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.
You can run [check_installation.py](https://github.com/open-mmlab/mmcv/blob/main/.dev_scripts/check_installation.py) to check the installation of mmcv-full after running the installation commands.
#### Install with pip
......@@ -297,12 +297,12 @@ you can first install it before installing MMCV to skip the installation of `ope
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
mim install mmcv -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 after running the installation commands.
You can run [check_installation.py](https://github.com/open-mmlab/mmcv/blob/main/.dev_scripts/check_installation.py) to check the installation of mmcv after running the installation commands.
#### Using mmcv with Docker
......@@ -316,13 +316,13 @@ docker build -t mmcv -f docker/release/Dockerfile .
Or build with remote repository
```bash
docker build -t mmcv https://github.com/open-mmlab/mmcv.git#2.x:docker/release
docker build -t mmcv https://github.com/open-mmlab/mmcv.git#main:docker/release
```
The [Dockerfile](release/Dockerfile) installs latest released version of mmcv-full by default, but you can specify mmcv versions to install expected versions.
```bash
docker image build -t mmcv -f docker/release/Dockerfile --build-arg MMCV=2.0.0rc1 .
docker image build -t mmcv -f docker/release/Dockerfile --build-arg MMCV=2.0.0 .
```
If you also want to use other versions of PyTorch and CUDA, you can also pass them when building docker images.
......@@ -334,7 +334,7 @@ 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 .
--build-arg MMCV=2.0.0 .
```
More available versions of PyTorch and CUDA can be found at [dockerhub/pytorch](https://hub.docker.com/r/pytorch/pytorch/tags).
......
......@@ -77,44 +77,3 @@ conv = ConvModule(3, 8, 3, padding=1, act_cfg=dict(type='LeakyReLU'))
conv = ConvModule(
3, 8, 2, norm_cfg=dict(type='BN'), order=('norm', 'conv', 'act'))
```
### Model Zoo
Besides torchvision pre-trained models, we also provide pre-trained models of following CNN:
- VGG Caffe
- ResNet Caffe
- ResNeXt
- ResNet with Group Normalization
- ResNet with Group Normalization and Weight Standardization
- HRNetV2
- Res2Net
- RegNet
#### Model URLs in JSON
The model zoo links in MMCV are managed by JSON files.
The json file consists of key-value pair of model name and its url or path.
An example json file could be like:
```json
{
"model_a": "https://example.com/models/model_a_9e5bac.pth",
"model_b": "pretrain/model_b_ab3ef2c.pth"
}
```
The default links of the pre-trained models hosted on OpenMMLab AWS could be found [here](https://github.com/open-mmlab/mmcv/blob/master/mmcv/model_zoo/open_mmlab.json).
You may override default links by putting `open-mmlab.json` under `MMCV_HOME`. If `MMCV_HOME` is not found in your environment, `~/.cache/mmcv` will be used by default. You may use your own path with `export MMCV_HOME=/your/path`.
The external json files will be merged into default one. If the same key presents in both external json and default json, the external one will be used.
#### Load Checkpoint
The following types are supported for `filename` of `mmcv.load_checkpoint()`.
- filepath: The filepath of the checkpoint.
- `http://xxx` and `https://xxx`: The link to download the checkpoint. The `SHA256` postfix should be contained in the filename.
- `torchvision://xxx`: The model links in `torchvision.models`. Please refer to [torchvision](https://pytorch.org/docs/stable/torchvision/models.html) for details.
- `open-mmlab://xxx`: The model links or filepath provided in default and additional json files.
......@@ -4,12 +4,12 @@ We implement common ops used in detection, segmentation, etc.
| Device | CPU | CUDA | MLU | MPS | Ascend |
| ---------------------------- | --- | ---- | --- | --- | ------ |
| ActiveRotatedFilter | √ | √ | | | |
| ActiveRotatedFilter | √ | √ | | | |
| AssignScoreWithK | | √ | | | |
| BallQuery | | √ | | | |
| BallQuery | | √ | | | |
| BBoxOverlaps | | √ | √ | √ | √ |
| BorderAlign | | √ | | | |
| BoxIouRotated | √ | √ | | | |
| BoxIouRotated | √ | √ | | | |
| BoxIouQuadri | √ | √ | | | |
| CARAFE | | √ | √ | | |
| ChamferDistance | | √ | | | |
......@@ -18,10 +18,10 @@ We implement common ops used in detection, segmentation, etc.
| ConvexIoU | | √ | | | |
| CornerPool | | √ | | | |
| Correlation | | √ | | | |
| Deformable Convolution v1/v2 | √ | √ | | | √ |
| Deformable Convolution v1/v2 | √ | √ | | | √ |
| Deformable RoIPool | | √ | √ | | √ |
| DiffIoURotated | | √ | | | |
| DynamicScatter | | √ | | | |
| DiffIoURotated | | √ | | | |
| DynamicScatter | | √ | | | |
| FurthestPointSample | | √ | | | |
| FurthestPointSampleWithDist | | √ | | | |
| FusedBiasLeakyrelu | | √ | | | √ |
......@@ -32,33 +32,33 @@ We implement common ops used in detection, segmentation, etc.
| MaskedConv | | √ | √ | | √ |
| MergeCells | | √ | | | |
| MinAreaPolygon | | √ | | | |
| ModulatedDeformConv2d | √ | √ | | | √ |
| ModulatedDeformConv2d | √ | √ | | | √ |
| MultiScaleDeformableAttn | | √ | √ | | |
| NMS | √ | √ | √ | | √ |
| NMSRotated | √ | √ | | | √ |
| NMSRotated | √ | √ | | | √ |
| NMSQuadri | √ | √ | | | |
| PixelGroup | √ | | | | |
| PointsInBoxes | √ | √ | | | |
| PointsInPolygons | | √ | | | |
| PointsInPolygons | | √ | | | |
| PSAMask | √ | √ | √ | | √ |
| RotatedFeatureAlign | √ | √ | | | |
| RotatedFeatureAlign | √ | √ | | | |
| RoIPointPool3d | | √ | √ | | |
| RoIPool | | √ | √ | | √ |
| RoIAlignRotated | √ | √ | √ | | |
| RiRoIAlignRotated | | √ | | | |
| RoIAlign | √ | √ | √ | | |
| RoIAlign | √ | √ | √ | | |
| RoIAwarePool3d | | √ | √ | | |
| SAConv2d | | √ | | | |
| SigmoidFocalLoss | | √ | √ | | √ |
| SoftmaxFocalLoss | | √ | | | √ |
| SoftNMS | | √ | | | |
| Sparse Convolution | | √ | | | |
| Sparse Convolution | | √ | | | |
| Synchronized BatchNorm | | √ | | | |
| ThreeInterpolate | | √ | | | |
| ThreeNN | | √ | √ | | |
| TINShift | | √ | √ | | |
| UpFirDn2d | | √ | | | |
| Voxelization | √ | √ | | | √ |
| Voxelization | √ | √ | | | √ |
| PrRoIPool | | √ | | | |
| BezierAlign | √ | √ | | | |
| BiasAct | | √ | | | |
......
{
"Linux": [
{
"cuda": "11.8",
"torch": "2.0.x",
"mmcv": [
"2.0.0"
]
},
{
"cuda": "11.7",
"torch": "2.0.x",
"mmcv": [
"2.0.0"
]
},
{
"cuda": "11.7",
"torch": "1.13.x",
"mmcv": [
"2.0.0rc3"
"2.0.0rc4",
"2.0.0rc3",
"2.0.0"
]
},
{
"cuda": "11.6",
"torch": "1.13.x",
"mmcv": [
"2.0.0rc3"
"2.0.0rc4",
"2.0.0rc3",
"2.0.0"
]
},
{
"cuda": "11.6",
"torch": "1.12.x",
"mmcv": [
"2.0.0rc4",
"2.0.0rc3",
"2.0.0rc2",
"2.0.0rc1"
"2.0.0rc1",
"2.0.0"
]
},
{
"cuda": "11.5",
"torch": "1.11.x",
"mmcv": [
"2.0.0rc4",
"2.0.0rc3",
"2.0.0rc2",
"2.0.0rc1"
"2.0.0rc1",
"2.0.0"
]
},
{
"cuda": "11.3",
"torch": "1.12.x",
"mmcv": [
"2.0.0rc4",
"2.0.0rc3",
"2.0.0rc2",
"2.0.0rc1"
"2.0.0rc1",
"2.0.0"
]
},
{
"cuda": "11.3",
"torch": "1.11.x",
"mmcv": [
"2.0.0rc4",
"2.0.0rc3",
"2.0.0rc2",
"2.0.0rc1"
"2.0.0rc1",
"2.0.0"
]
},
{
"cuda": "11.3",
"torch": "1.10.x",
"mmcv": [
"2.0.0rc4",
"2.0.0rc3",
"2.0.0rc2",
"2.0.0rc1"
"2.0.0rc1",
"2.0.0"
]
},
{
"cuda": "11.1",
"torch": "1.10.x",
"mmcv": [
"2.0.0rc4",
"2.0.0rc3",
"2.0.0rc2",
"2.0.0rc1"
"2.0.0rc1",
"2.0.0"
]
},
{
"cuda": "11.1",
"torch": "1.9.x",
"mmcv": [
"2.0.0rc4",
"2.0.0rc3",
"2.0.0rc2",
"2.0.0rc1"
"2.0.0rc1",
"2.0.0"
]
},
{
"cuda": "11.1",
"torch": "1.8.x",
"mmcv": [
"2.0.0rc4",
"2.0.0rc3",
"2.0.0rc2",
"2.0.0rc1"
"2.0.0rc1",
"2.0.0"
]
},
{
"cuda": "11.0",
"torch": "1.7.x",
"mmcv": [
"2.0.0rc4",
"2.0.0rc3",
"2.0.0rc2",
"2.0.0rc1"
......@@ -99,51 +134,62 @@
"cuda": "10.2",
"torch": "1.12.x",
"mmcv": [
"2.0.0rc4",
"2.0.0rc3",
"2.0.0rc2",
"2.0.0rc1"
"2.0.0rc1",
"2.0.0"
]
},
{
"cuda": "10.2",
"torch": "1.11.x",
"mmcv": [
"2.0.0rc4",
"2.0.0rc3",
"2.0.0rc2",
"2.0.0rc1"
"2.0.0rc1",
"2.0.0"
]
},
{
"cuda": "10.2",
"torch": "1.10.x",
"mmcv": [
"2.0.0rc4",
"2.0.0rc3",
"2.0.0rc2",
"2.0.0rc1"
"2.0.0rc1",
"2.0.0"
]
},
{
"cuda": "10.2",
"torch": "1.9.x",
"mmcv": [
"2.0.0rc4",
"2.0.0rc3",
"2.0.0rc2",
"2.0.0rc1"
"2.0.0rc1",
"2.0.0"
]
},
{
"cuda": "10.2",
"torch": "1.8.x",
"mmcv": [
"2.0.0rc4",
"2.0.0rc3",
"2.0.0rc2",
"2.0.0rc1"
"2.0.0rc1",
"2.0.0"
]
},
{
"cuda": "10.2",
"torch": "1.7.x",
"mmcv": [
"2.0.0rc4",
"2.0.0rc3",
"2.0.0rc2",
"2.0.0rc1"
......@@ -153,6 +199,7 @@
"cuda": "10.2",
"torch": "1.6.x",
"mmcv": [
"2.0.0rc4",
"2.0.0rc3",
"2.0.0rc2",
"2.0.0rc1"
......@@ -162,15 +209,18 @@
"cuda": "10.1",
"torch": "1.8.x",
"mmcv": [
"2.0.0rc4",
"2.0.0rc3",
"2.0.0rc2",
"2.0.0rc1"
"2.0.0rc1",
"2.0.0"
]
},
{
"cuda": "10.1",
"torch": "1.7.x",
"mmcv": [
"2.0.0rc4",
"2.0.0rc3",
"2.0.0rc2",
"2.0.0rc1"
......@@ -180,6 +230,7 @@
"cuda": "10.1",
"torch": "1.6.x",
"mmcv": [
"2.0.0rc4",
"2.0.0rc3",
"2.0.0rc2",
"2.0.0rc1"
......@@ -189,6 +240,7 @@
"cuda": "9.2",
"torch": "1.7.x",
"mmcv": [
"2.0.0rc4",
"2.0.0rc3",
"2.0.0rc2",
"2.0.0rc1"
......@@ -198,67 +250,88 @@
"cuda": "9.2",
"torch": "1.6.x",
"mmcv": [
"2.0.0rc4",
"2.0.0rc3",
"2.0.0rc2",
"2.0.0rc1"
]
},
{
"cuda": "cpu",
"torch": "2.0.x",
"mmcv": [
"2.0.0"
]
},
{
"cuda": "cpu",
"torch": "1.13.x",
"mmcv": [
"2.0.0rc3"
"2.0.0rc4",
"2.0.0rc3",
"2.0.0"
]
},
{
"cuda": "cpu",
"torch": "1.12.x",
"mmcv": [
"2.0.0rc4",
"2.0.0rc3",
"2.0.0rc2",
"2.0.0rc1"
"2.0.0rc1",
"2.0.0"
]
},
{
"cuda": "cpu",
"torch": "1.11.x",
"mmcv": [
"2.0.0rc4",
"2.0.0rc3",
"2.0.0rc2",
"2.0.0rc1"
"2.0.0rc1",
"2.0.0"
]
},
{
"cuda": "cpu",
"torch": "1.10.x",
"mmcv": [
"2.0.0rc4",
"2.0.0rc3",
"2.0.0rc2",
"2.0.0rc1"
"2.0.0rc1",
"2.0.0"
]
},
{
"cuda": "cpu",
"torch": "1.9.x",
"mmcv": [
"2.0.0rc4",
"2.0.0rc3",
"2.0.0rc2",
"2.0.0rc1"
"2.0.0rc1",
"2.0.0"
]
},
{
"cuda": "cpu",
"torch": "1.8.x",
"mmcv": [
"2.0.0rc4",
"2.0.0rc3",
"2.0.0rc2",
"2.0.0rc1"
"2.0.0rc1",
"2.0.0"
]
},
{
"cuda": "cpu",
"torch": "1.7.x",
"mmcv": [
"2.0.0rc4",
"2.0.0rc3",
"2.0.0rc2",
"2.0.0rc1"
......@@ -268,6 +341,7 @@
"cuda": "cpu",
"torch": "1.6.x",
"mmcv": [
"2.0.0rc4",
"2.0.0rc3",
"2.0.0rc2",
"2.0.0rc1"
......@@ -275,123 +349,164 @@
}
],
"Windows": [
{
"cuda": "11.8",
"torch": "2.0.x",
"mmcv": [
"2.0.0"
]
},
{
"cuda": "11.7",
"torch": "2.0.x",
"mmcv": [
"2.0.0"
]
},
{
"cuda": "11.7",
"torch": "1.13.x",
"mmcv": [
"2.0.0rc3"
"2.0.0rc4",
"2.0.0rc3",
"2.0.0"
]
},
{
"cuda": "11.6",
"torch": "1.13.x",
"mmcv": [
"2.0.0rc3"
"2.0.0rc4",
"2.0.0rc3",
"2.0.0"
]
},
{
"cuda": "11.6",
"torch": "1.12.x",
"mmcv": [
"2.0.0rc4",
"2.0.0rc3",
"2.0.0rc2",
"2.0.0rc1"
"2.0.0rc1",
"2.0.0"
]
},
{
"cuda": "11.5",
"torch": "1.11.x",
"mmcv": [
"2.0.0rc4",
"2.0.0rc3",
"2.0.0rc2",
"2.0.0rc1"
"2.0.0rc1",
"2.0.0"
]
},
{
"cuda": "11.3",
"torch": "1.12.x",
"mmcv": [
"2.0.0rc4",
"2.0.0rc3",
"2.0.0rc2",
"2.0.0rc1"
"2.0.0rc1",
"2.0.0"
]
},
{
"cuda": "11.3",
"torch": "1.11.x",
"mmcv": [
"2.0.0rc4",
"2.0.0rc3",
"2.0.0rc2",
"2.0.0rc1"
"2.0.0rc1",
"2.0.0"
]
},
{
"cuda": "11.3",
"torch": "1.10.x",
"mmcv": [
"2.0.0rc4",
"2.0.0rc3",
"2.0.0rc2",
"2.0.0rc1"
"2.0.0rc1",
"2.0.0"
]
},
{
"cuda": "11.1",
"torch": "1.10.x",
"mmcv": [
"2.0.0rc4",
"2.0.0rc3",
"2.0.0rc2",
"2.0.0rc1"
"2.0.0rc1",
"2.0.0"
]
},
{
"cuda": "11.1",
"torch": "1.9.x",
"mmcv": [
"2.0.0rc4",
"2.0.0rc3",
"2.0.0rc2",
"2.0.0rc1"
"2.0.0rc1",
"2.0.0"
]
},
{
"cuda": "11.1",
"torch": "1.8.x",
"mmcv": [
"2.0.0rc4",
"2.0.0rc3",
"2.0.0rc2",
"2.0.0rc1"
"2.0.0rc1",
"2.0.0"
]
},
{
"cuda": "10.2",
"torch": "1.10.x",
"mmcv": [
"2.0.0rc4",
"2.0.0rc3",
"2.0.0rc2",
"2.0.0rc1"
"2.0.0rc1",
"2.0.0"
]
},
{
"cuda": "10.2",
"torch": "1.9.x",
"mmcv": [
"2.0.0rc4",
"2.0.0rc3",
"2.0.0rc2",
"2.0.0rc1"
"2.0.0rc1",
"2.0.0"
]
},
{
"cuda": "10.2",
"torch": "1.8.x",
"mmcv": [
"2.0.0rc4",
"2.0.0rc3",
"2.0.0rc2",
"2.0.0rc1"
"2.0.0rc1",
"2.0.0"
]
},
{
"cuda": "10.2",
"torch": "1.7.x",
"mmcv": [
"2.0.0rc4",
"2.0.0rc3"
]
},
......@@ -399,6 +514,7 @@
"cuda": "10.2",
"torch": "1.6.x",
"mmcv": [
"2.0.0rc4",
"2.0.0rc3",
"2.0.0rc2",
"2.0.0rc1"
......@@ -408,15 +524,18 @@
"cuda": "10.1",
"torch": "1.8.x",
"mmcv": [
"2.0.0rc4",
"2.0.0rc3",
"2.0.0rc2",
"2.0.0rc1"
"2.0.0rc1",
"2.0.0"
]
},
{
"cuda": "10.1",
"torch": "1.7.x",
"mmcv": [
"2.0.0rc4",
"2.0.0rc3"
]
},
......@@ -424,67 +543,88 @@
"cuda": "10.1",
"torch": "1.6.x",
"mmcv": [
"2.0.0rc4",
"2.0.0rc3",
"2.0.0rc2",
"2.0.0rc1"
]
},
{
"cuda": "cpu",
"torch": "2.0.x",
"mmcv": [
"2.0.0"
]
},
{
"cuda": "cpu",
"torch": "1.13.x",
"mmcv": [
"2.0.0rc3"
"2.0.0rc4",
"2.0.0rc3",
"2.0.0"
]
},
{
"cuda": "cpu",
"torch": "1.12.x",
"mmcv": [
"2.0.0rc4",
"2.0.0rc3",
"2.0.0rc2",
"2.0.0rc1"
"2.0.0rc1",
"2.0.0"
]
},
{
"cuda": "cpu",
"torch": "1.11.x",
"mmcv": [
"2.0.0rc4",
"2.0.0rc3",
"2.0.0rc2",
"2.0.0rc1"
"2.0.0rc1",
"2.0.0"
]
},
{
"cuda": "cpu",
"torch": "1.10.x",
"mmcv": [
"2.0.0rc4",
"2.0.0rc3",
"2.0.0rc2",
"2.0.0rc1"
"2.0.0rc1",
"2.0.0"
]
},
{
"cuda": "cpu",
"torch": "1.9.x",
"mmcv": [
"2.0.0rc4",
"2.0.0rc3",
"2.0.0rc2",
"2.0.0rc1"
"2.0.0rc1",
"2.0.0"
]
},
{
"cuda": "cpu",
"torch": "1.8.x",
"mmcv": [
"2.0.0rc4",
"2.0.0rc3",
"2.0.0rc2",
"2.0.0rc1"
"2.0.0rc1",
"2.0.0"
]
},
{
"cuda": "cpu",
"torch": "1.7.x",
"mmcv": [
"2.0.0rc4",
"2.0.0rc3",
"2.0.0rc2",
"2.0.0rc1"
......@@ -494,6 +634,7 @@
"cuda": "cpu",
"torch": "1.6.x",
"mmcv": [
"2.0.0rc4",
"2.0.0rc3",
"2.0.0rc2",
"2.0.0rc1"
......@@ -501,17 +642,27 @@
}
],
"macOS": [
{
"cuda": "cpu",
"torch": "2.0.x",
"mmcv": [
"2.0.0"
]
},
{
"cuda": "cpu",
"torch": "1.13.x",
"mmcv": [
"2.0.0rc3"
"2.0.0rc4",
"2.0.0rc3",
"2.0.0"
]
},
{
"cuda": "mps",
"torch": "1.13.x",
"mmcv": [
"2.0.0rc4",
"2.0.0rc3"
]
},
......@@ -519,46 +670,57 @@
"cuda": "cpu",
"torch": "1.12.x",
"mmcv": [
"2.0.0rc4",
"2.0.0rc3",
"2.0.0rc2"
"2.0.0rc2",
"2.0.0"
]
},
{
"cuda": "cpu",
"torch": "1.11.x",
"mmcv": [
"2.0.0rc4",
"2.0.0rc3",
"2.0.0rc2"
"2.0.0rc2",
"2.0.0"
]
},
{
"cuda": "cpu",
"torch": "1.10.x",
"mmcv": [
"2.0.0rc4",
"2.0.0rc3",
"2.0.0rc2"
"2.0.0rc2",
"2.0.0"
]
},
{
"cuda": "cpu",
"torch": "1.9.x",
"mmcv": [
"2.0.0rc4",
"2.0.0rc3",
"2.0.0rc2"
"2.0.0rc2",
"2.0.0"
]
},
{
"cuda": "cpu",
"torch": "1.8.x",
"mmcv": [
"2.0.0rc4",
"2.0.0rc3",
"2.0.0rc2"
"2.0.0rc2",
"2.0.0"
]
},
{
"cuda": "cpu",
"torch": "1.7.x",
"mmcv": [
"2.0.0rc4",
"2.0.0rc3",
"2.0.0rc2"
]
......@@ -567,6 +729,7 @@
"cuda": "cpu",
"torch": "1.6.x",
"mmcv": [
"2.0.0rc4",
"2.0.0rc3",
"2.0.0rc2"
]
......
......@@ -99,16 +99,16 @@ git commit -m "xxx" --no-verify
#### 3. 创建开发分支
安装完 pre-commit 之后,我们需要基于 master 创建开发分支,建议的分支命名规则为 `username/pr_name`
安装完 pre-commit 之后,我们需要基于 main 创建开发分支,建议的分支命名规则为 `username/pr_name`
```shell
git checkout -b yhc/refactor_contributing_doc
```
在后续的开发中,如果本地仓库的 master 分支落后于 upstream 的 master 分支,我们需要先拉取 upstream 的代码进行同步,再执行上面的命令
在后续的开发中,如果本地仓库的 main 分支落后于 upstream 的 main 分支,我们需要先拉取 upstream 的代码进行同步,再执行上面的命令
```shell
git pull upstream master
git pull upstream main
```
#### 4. 提交代码并在本地通过单元测试
......@@ -178,14 +178,14 @@ MMCV 会在不同的平台(Linux、Window、Mac),基于不同版本的 Pyt
```shell
git fetch --all --prune
git rebase upstream/master
git rebase upstream/main
```
或者
```shell
git fetch --all --prune
git merge upstream/master
git merge upstream/main
```
如果你非常善于处理冲突,那么可以使用 rebase 的方式来解决冲突,因为这能够保证你的 commit log 的整洁。如果你不太熟悉 `rebase` 的使用,那么可以使用 `merge` 的方式来解决冲突。
......@@ -194,7 +194,7 @@ git merge upstream/master
#### 单元测试
如果你无法正常执行部分模块的单元测试,例如 [video](https://github.com/open-mmlab/mmcv/tree/master/mmcv/video) 模块,可能是你的当前环境没有安装以下依赖
如果你无法正常执行部分模块的单元测试,例如 [video](https://github.com/open-mmlab/mmcv/tree/main/mmcv/video) 模块,可能是你的当前环境没有安装以下依赖
```shell
# Linux
......
### v2.0.0
OpenMMLab 团队于 2022 年 9 月 1 日在世界人工智能大会发布了新一代训练引擎 [MMEngine](https://github.com/open-mmlab/mmengine),它是一个用于训练深度学习模型的基础库。相比于 MMCV,它提供了更高级且通用的训练器、接口更加统一的开放架构以及可定制化程度更高的训练流程。
OpenMMLab 团队于 2023 年 4 月 6 日发布 MMCV [v2.0.0](https://github.com/open-mmlab/mmcv/releases/tag/v2.0.0)。在 2.x 版本中,它有以下重大变化:
(1)删除了以下组件:
- `mmcv.fileio` 模块,删除于 PR [#2179](https://github.com/open-mmlab/mmcv/pull/2179)。在需要使用 FileIO 的地方使用 mmengine 中的 FileIO 模块
- `mmcv.runner``mmcv.parallel``mmcv.engine``mmcv.device`,删除于 PR [#2216](https://github.com/open-mmlab/mmcv/pull/2216)
- `mmcv.utils` 的所有类(例如 `Config``Registry`)和大部分函数,删除于 PR [#2217](https://github.com/open-mmlab/mmcv/pull/2217),只保留少数和 mmcv 相关的函数
- `mmcv.onnx``mmcv.tensorrt` 模块以及相关的函数,删除于 PR [#2225](https://github.com/open-mmlab/mmcv/pull/2225)
- 删除 MMCV 所有的根注册器并将类或者函数注册到 MMEngine 的[根注册器](https://github.com/open-mmlab/mmengine/blob/main/mmengine/registry/root.py)
(2)新增了 [`mmcv.transforms`](https://github.com/open-mmlab/mmcv/tree/main/mmcv/transforms) 数据变换模块
(3)在 PR [#2235](https://github.com/open-mmlab/mmcv/pull/2235) 中将包名 **mmcv** 重命名为 **mmcv-lite****mmcv-full** 重命名为 **mmcv**。此外,将环境变量 `MMCV_WITH_OPS` 的默认值从 0 改为 1
<table class="docutils">
<thead>
<tr>
<th align="center">MMCV < 2.0</th>
<th align="center">MMCV >= 2.0 </th>
<tbody>
<tr>
<td valign="top">
```bash
# 包含算子,因为 mmcv-full 的最高版本小于 2.0.0,所以无需加版本限制
pip install openmim
mim install mmcv-full
# 不包含算子
pip install openmim
mim install "mmcv < 2.0.0"
```
</td>
<td valign="top">
```bash
# 包含算子
pip install openmim
mim install mmcv
# 不包含算子,因为 mmcv-lite 的起始版本为 2.0.0,所以无需加版本限制
pip install openmim
mim install mmcv-lite
```
</td>
</tr>
</thead>
</table>
### v1.3.18
部分自定义算子对于不同的设备有不同实现,为此添加的大量宏命令与类型检查使得代码变得难以维护。例如:
......
......@@ -298,3 +298,107 @@ mmcv 有两个版本:
```bash
python -c 'import mmcv;print(mmcv.__version__)'
```
### 在寒武纪 MLU 机器编译 mmcv-full
#### 安装 torch_mlu
##### 选项1: 基于寒武纪 docker image 安装
首先请下载并且拉取寒武纪 docker (请向 service@cambricon.com 发邮件以获得最新的寒武纪 pytorch 发布 docker)。
```
docker pull ${docker image}
```
进入 docker, [编译 MMCV MLU](#编译mmcv-mlu)[进行验证](#验证是否成功安装)
##### 选项2:基于 cambricon pytorch 源码编译安装
请向 service@cambricon.com 发送邮件或联系 Cambricon 工程师以获取合适版本的 CATCH 软件包,在您获得合适版本的 CATCH 软件包后,请参照 ${CATCH-path}/CONTRIBUTING.md 中的步骤安装 CATCH。
#### 编译 MMCV
克隆代码仓库
```bash
git clone https://github.com/open-mmlab/mmcv.git
```
算子库 mlu-ops 在编译 MMCV 时自动下载到默认路径(mmcv/mlu-ops),你也可以在编译前设置环境变量 MMCV_MLU_OPS_PATH 指向已经存在的 mlu-ops 算子库路径。
```bash
export MMCV_MLU_OPS_PATH=/xxx/xxx/mlu-ops
```
开始编译
```bash
cd mmcv
export MMCV_WITH_OPS=1
export FORCE_MLU=1
python setup.py install
```
#### 验证是否成功安装
完成上述安装步骤之后,您可以尝试运行下面的 Python 代码以测试您是否成功在 MLU 设备上安装了 mmcv-full
```python
import torch
import torch_mlu
from mmcv.ops import sigmoid_focal_loss
x = torch.randn(3, 10).mlu()
x.requires_grad = True
y = torch.tensor([1, 5, 3]).mlu()
w = torch.ones(10).float().mlu()
output = sigmoid_focal_loss(x, y, 2.0, 0.25, w, 'none')
```
### 在昇腾 NPU 机器编译 mmcv
在编译 mmcv 前,需要安装 torch_npu,完整安装教程详见 [PyTorch 安装指南](https://gitee.com/ascend/pytorch/blob/master/docs/zh/PyTorch%E5%AE%89%E8%A3%85%E6%8C%87%E5%8D%97/PyTorch%E5%AE%89%E8%A3%85%E6%8C%87%E5%8D%97.md#pytorch%E5%AE%89%E8%A3%85%E6%8C%87%E5%8D%97)
#### 选项 1: 使用 NPU 设备源码编译安装 mmcv (推荐方式)
- 拉取 [MMCV 源码](https://github.com/open-mmlab/mmcv.git)
```bash
git pull https://github.com/open-mmlab/mmcv.git
```
- 编译
```bash
MMCV_WITH_OPS=1 MAX_JOBS=8 FORCE_NPU=1 python setup.py build_ext
```
- 安装
```bash
MMCV_WITH_OPS=1 FORCE_NPU=1 python setup.py develop
```
#### 选项 2: 使用 pip 安装 Ascend 编译版本的 mmcv
Ascend 编译版本的 mmcv 在 mmcv >= 1.7.0 时已经支持直接 pip 安装
```bash
pip install mmcv -f https://download.openmmlab.com/mmcv/dist/ascend/torch1.8.0/index.html
```
#### 验证
```python
import torch
import torch_npu
from mmcv.ops import softmax_focal_loss
# Init tensor to the NPU
x = torch.randn(3, 10).npu()
y = torch.tensor([1, 5, 3]).npu()
w = torch.ones(10).float().npu()
output = softmax_focal_loss(x, y, 2.0, 0.25, w, 'none')
print(output)
```
......@@ -25,7 +25,7 @@ python -c 'import torch;print(torch.__version__)'
```bash
pip install -U openmim
mim install "mmcv>=2.0.0rc1"
mim install mmcv
```
如果发现上述的安装命令没有使用预编译包(以 `.whl` 结尾)而是使用源码包(以 `.tar.gz` 结尾)安装,则有可能是我们没有提供和当前环境的 PyTorch 版本、CUDA 版本相匹配的 mmcv 预编译包,此时,你可以[源码安装 mmcv](build.md)
......@@ -35,7 +35,7 @@ mim install "mmcv>=2.0.0rc1"
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.0rc3-cp38-cp38-manylinux1_x86_64.whl</b>
<b>Downloading https://download.openmmlab.com/mmcv/dist/cu102/torch1.8.0/mmcv-2.0.0-cp38-cp38-manylinux1_x86_64.whl</b>
</details>
......@@ -43,15 +43,15 @@ Collecting mmcv<br />
<summary>使用源码包的安装日志</summary>
Looking in links: https://download.openmmlab.com/mmcv/dist/cu102/torch1.8.0/index.html<br />
Collecting mmcv==2.0.0rc3<br />
<b>Downloading mmcv-2.0.0rc3.tar.gz</b>
Collecting mmcv==2.0.0<br />
<b>Downloading mmcv-2.0.0.tar.gz</b>
</details>
如需安装指定版本的 mmcv,例如安装 2.0.0rc3 版本的 mmcv,可使用以下命令
如需安装指定版本的 mmcv,例如安装 2.0.0 版本的 mmcv,可使用以下命令
```bash
mim install mmcv==2.0.0rc3
mim install mmcv==2.0.0
```
:::{note}
......@@ -65,7 +65,7 @@ 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 是否安装成功。
安装完成后可以运行 [check_installation.py](https://github.com/open-mmlab/mmcv/blob/main/.dev_scripts/check_installation.py) 脚本检查 mmcv 是否安装成功。
#### 使用 pip 安装
......@@ -318,12 +318,12 @@ PyTorch 版本是 1.8.1,你可以放心选择 1.8.x。
另外,如果安装依赖库的时间过长,可以指定 pypi 源
```bash
pip install "mmcv>=2.0.0rc1" -f https://download.openmmlab.com/mmcv/dist/cu111/torch1.9.0/index.html -i https://pypi.tuna.tsinghua.edu.cn/simple
pip install mmcv -f https://download.openmmlab.com/mmcv/dist/cu111/torch1.9.0/index.html -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 是否安装成功。
安装完成后可以运行 [check_installation.py](https://github.com/open-mmlab/mmcv/blob/main/.dev_scripts/check_installation.py) 脚本检查 mmcv 是否安装成功。
#### 使用 docker 镜像
......@@ -337,13 +337,13 @@ docker build -t mmcv -f docker/release/Dockerfile .
也可以直接使用下面的命令构建镜像
```bash
docker build -t mmcv https://github.com/open-mmlab/mmcv.git#2.x:docker/release
docker build -t mmcv https://github.com/open-mmlab/mmcv.git#main:docker/release
```
[Dockerfile](release/Dockerfile) 默认安装最新的 mmcv,如果你想要指定版本,可以使用下面的命令
```bash
docker image build -t mmcv -f docker/release/Dockerfile --build-arg MMCV=2.0.0rc1 .
docker image build -t mmcv -f docker/release/Dockerfile --build-arg MMCV=2.0.0 .
```
如果你想要使用其他版本的 PyTorch 和 CUDA,你可以在构建镜像时指定它们的版本。
......@@ -355,7 +355,7 @@ 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 .
--build-arg MMCV=2.0.0 .
```
更多 PyTorch 和 CUDA 镜像可以点击 [dockerhub/pytorch](https://hub.docker.com/r/pytorch/pytorch/tags) 查看。
......
......@@ -73,42 +73,3 @@ conv = ConvModule(3, 8, 3, padding=1, act_cfg=dict(type='LeakyReLU'))
conv = ConvModule(
3, 8, 2, norm_cfg=dict(type='BN'), order=('norm', 'conv', 'act'))
```
### Model Zoo
除了`torchvision`的预训练模型,我们还提供以下 CNN 的预训练模型:
- VGG Caffe
- ResNet Caffe
- ResNeXt
- ResNet with Group Normalization
- ResNet with Group Normalization and Weight Standardization
- HRNetV2
- Res2Net
- RegNet
#### Model URLs in JSON
MMCV中的Model Zoo Link 由 JSON 文件管理。 json 文件由模型名称及其url或path的键值对组成,一个json文件可能类似于:
```json
{
"model_a": "https://example.com/models/model_a_9e5bac.pth",
"model_b": "pretrain/model_b_ab3ef2c.pth"
}
```
可以在[此处](https://github.com/open-mmlab/mmcv/blob/master/mmcv/model_zoo/open_mmlab.json)找到托管在 OpenMMLab AWS 上的预训练模型的默认链接。
你可以通过将 `open-mmlab.json` 放在 `MMCV_HOME`下来覆盖默认链接,如果在环境中找不到`MMCV_HOME`,则默认使用 `~/.cache/mmcv`。当然你也可以使用命令 `export MMCV_HOME=/your/path`来设置自己的路径。
外部的json文件将被合并为默认文件,如果相同的键出现在外部`json`和默认`json`中,则将使用外部`json`
#### Load Checkpoint
`mmcv.load_checkpoint()`的参数`filename`支持以下类型:
- filepath: `checkpoint`路径
- `http://xxx` and `https://xxx`: 下载checkpoint的链接,文件名中必需包含`SHA256`后缀
- `torchvision://xxx`: `torchvision.models`中的模型链接,更多细节参考 [torchvision](https://pytorch.org/docs/stable/torchvision/models.html)
- `open-mmlab://xxx`: 默认和其他 json 文件中提供的模型链接或文件路径
......@@ -4,12 +4,12 @@ MMCV 提供了检测、分割等任务中常用的算子
| Device | CPU | CUDA | MLU | MPS | Ascend |
| ---------------------------- | --- | ---- | --- | --- | ------ |
| ActiveRotatedFilter | √ | √ | | | |
| ActiveRotatedFilter | √ | √ | | | |
| AssignScoreWithK | | √ | | | |
| BallQuery | | √ | | | |
| BallQuery | | √ | | | |
| BBoxOverlaps | | √ | √ | √ | √ |
| BorderAlign | | √ | | | |
| BoxIouRotated | √ | √ | | | |
| BoxIouRotated | √ | √ | | | |
| BoxIouQuadri | √ | √ | | | |
| CARAFE | | √ | √ | | |
| ChamferDistance | | √ | | | |
......@@ -18,10 +18,10 @@ MMCV 提供了检测、分割等任务中常用的算子
| ConvexIoU | | √ | | | |
| CornerPool | | √ | | | |
| Correlation | | √ | | | |
| Deformable Convolution v1/v2 | √ | √ | | | √ |
| Deformable Convolution v1/v2 | √ | √ | | | √ |
| Deformable RoIPool | | √ | √ | | √ |
| DiffIoURotated | | √ | | | |
| DynamicScatter | | √ | | | |
| DiffIoURotated | | √ | | | |
| DynamicScatter | | √ | | | |
| FurthestPointSample | | √ | | | |
| FurthestPointSampleWithDist | | √ | | | |
| FusedBiasLeakyrelu | | √ | | | √ |
......@@ -32,33 +32,33 @@ MMCV 提供了检测、分割等任务中常用的算子
| MaskedConv | | √ | √ | | √ |
| MergeCells | | √ | | | |
| MinAreaPolygon | | √ | | | |
| ModulatedDeformConv2d | √ | √ | | | √ |
| ModulatedDeformConv2d | √ | √ | | | √ |
| MultiScaleDeformableAttn | | √ | √ | | |
| NMS | √ | √ | √ | | √ |
| NMSRotated | √ | √ | | | √ |
| NMSRotated | √ | √ | | | √ |
| NMSQuadri | √ | √ | | | |
| PixelGroup | √ | | | | |
| PointsInBoxes | √ | √ | | | |
| PointsInPolygons | | √ | | | |
| PSAMask | √ | √ | √ | | √ |
| RotatedFeatureAlign | √ | √ | | | |
| RotatedFeatureAlign | √ | √ | | | |
| RoIPointPool3d | | √ | √ | | |
| RoIPool | | √ | √ | | √ |
| RoIAlignRotated | √ | √ | √ | | |
| RiRoIAlignRotated | | √ | | | |
| RoIAlign | √ | √ | √ | | |
| RoIAlign | √ | √ | √ | | |
| RoIAwarePool3d | | √ | √ | | |
| SAConv2d | | √ | | | |
| SigmoidFocalLoss | | √ | √ | | √ |
| SoftmaxFocalLoss | | √ | | | √ |
| SoftNMS | | √ | | | |
| Sparse Convolution | | √ | | | |
| Sparse Convolution | | √ | | | |
| Synchronized BatchNorm | | √ | | | |
| ThreeInterpolate | | √ | | | |
| ThreeNN | | √ | √ | | |
| TINShift | | √ | √ | | |
| UpFirDn2d | | √ | | | |
| Voxelization | √ | √ | | | √ |
| Voxelization | √ | √ | | | √ |
| PrRoIPool | | √ | | | |
| BezierAlign | √ | √ | | | |
| BiasAct | | √ | | | |
......
# Copyright (c) OpenMMLab. All rights reserved.
import inspect
from typing import Dict, Optional
from mmengine.registry import MODELS
......@@ -35,7 +36,8 @@ def build_conv_layer(cfg: Optional[Dict], *args, **kwargs) -> nn.Module:
cfg_ = cfg.copy()
layer_type = cfg_.pop('type')
if inspect.isclass(layer_type):
return layer_type(*args, **kwargs, **cfg_) # type: ignore
# Switch registry to the target scope. If `conv_layer` cannot be found
# in the registry, fallback to search `conv_layer` in the
# mmengine.MODELS.
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment