"vscode:/vscode.git/clone" did not exist on "52ce350b7aecd4bce9c42fe4aac1d85e47a6d774"
README.md 3.36 KB
Newer Older
xiabo's avatar
xiabo committed
1
# <div align="center"><strong>MMCV</strong></div>
xiabo's avatar
xiabo committed
2
## 简介
limm's avatar
limm committed
3
MMCV是计算机视觉研究的基础库,主要提供以下功能:图像处理、图像和标注结果可视化、图像转换、多种CNN网络结构、高质量实现的常见CUDA算子。DAS软件栈中的MMCV版本,不仅保证了组件核心功能在DCU加速卡的可用性,还针对DCU特有的硬件架构进行了深度定制优化。这使得开发者能够以极低的成本,轻松实现应用程序在DCU加速卡上的快速迁移和性能提升。
xiabo's avatar
xiabo committed
4
5

## 安装
limm's avatar
limm committed
6
7
组件支持组合

dcuai's avatar
dcuai committed
8
9
10
11
12
   | PyTorch版本 | fastpt版本  |MMCV版本      | DTK版本                  | Python版本       | 推荐编译方式 |
   | ----------- | ----------- | ----------- | ------------------------ | -----------------| ------------ |
   | 2.5.1       | 2.1.0       |2.2.0        | >= 25.04                 | 3.8、3.10、3.11  | fastpt不转码 |
   | 2.4.1       | 2.0.1       |2.2.0        | >= 25.04                 | 3.8、3.10、3.11  | fastpt不转码 |
   | 其他        | 其他         | 其他        | 其他                     | 3.8、3.10、3.11  | hip转码      |
limm's avatar
limm committed
13
14

+ pytorch版本大于2.4.1 && dtk版本大于25.04 推荐使用fastpt不转码编译。
xiabo's avatar
xiabo committed
15

dcuai's avatar
dcuai committed
16
### 1、使用pip方式安装
dcuai's avatar
dcuai committed
17
mmcv whl包下载目录:[光和开发者社区](https://download.sourcefind.cn:65024/4/main/mmcv),选择对应的pytorch版本和python版本下载对应mmcv的whl包
xiabo's avatar
xiabo committed
18
```shell
dcuai's avatar
dcuai committed
19
20
21
22
pip install torch* (下载torch的whl包)
pip install fastpt* --no-deps (下载fastpt的whl包)
source  /usr/local/bin/fastpt -E
pip install mmcv* (下载的mmcv-fastpt的whl包)
23
```
dcuai's avatar
dcuai committed
24
### 2、使用源码编译方式安装
25

xiabo's avatar
xiabo committed
26
#### 编译环境准备
limm's avatar
limm committed
27
提供基于fastpt不转码编译:
xiabo's avatar
xiabo committed
28

29
1. 基于光源pytorch基础镜像环境:镜像下载地址:[光合开发者社区](https://sourcefind.cn/#/image/dcu/pytorch),根据pytorch、python、dtk及系统下载对应的镜像版本。
xiabo's avatar
xiabo committed
30

dcuai's avatar
dcuai committed
31
2. 基于现有python环境:安装pytorch,fastpt whl包下载目录:[光合开发者社区](https://sourcefind.cn/#/image/dcu/pytorch),根据python、dtk版本,下载对应pytorch的whl包。安装命令如下:
xiabo's avatar
xiabo committed
32
```shell
dcuai's avatar
dcuai committed
33
34
pip install torch* (下载torch的whl包)
pip install fastpt* --no-deps (下载fastpt的whl包, 安装顺序,先安装torch,后安装fastpt)
xiabo's avatar
xiabo committed
35
pip install setuptools==59.5.0 wheel
Zaida Zhou's avatar
Zaida Zhou committed
36
37
```

xiabo's avatar
xiabo committed
38
39
#### 源码编译安装
- 代码下载
xiabo's avatar
xiabo committed
40
```shell
dcuai's avatar
dcuai committed
41
git clone http://developer.sourcefind.cn/codes/OpenDAS/mmcv.git # 根据编译需要切换分支
xiabo's avatar
xiabo committed
42
```
huchen's avatar
huchen committed
43
- 提供2种源码编译方式(进入mmcv目录):
xiabo's avatar
xiabo committed
44
```
limm's avatar
limm committed
45
1. 设置不转码编译环境变量
46
47
export FORCE_CUDA=1
source /usr/local/bin/fastpt -C
limm's avatar
limm committed
48
49

2. 编译whl包并安装
limm's avatar
limm committed
50
MMCV_WITH_OPS=1 python3 setup.py -v bdist_wheel
xiabo's avatar
xiabo committed
51
pip install dist/mmcv*
xiabo's avatar
xiabo committed
52

limm's avatar
limm committed
53
3. 源码编译安装
limm's avatar
limm committed
54
MMCV_WITH_OPS=1 python3 setup.py install
Zaida Zhou's avatar
Zaida Zhou committed
55
```
dcuai's avatar
dcuai committed
56
#### 注意事项
dcuai's avatar
dcuai committed
57
58
+ 若使用pip install下载安装过慢,可添加pypi清华源:-i https://pypi.tuna.tsinghua.edu.cn/simple/
+ ROCM_PATH为dtk的路径,默认为/opt/dtk
59
+ 在pytorch2.5.1环境下编译需要支持c++17语法,打开setup.py文件,把文件中的 -std=c++14 修改为 -std=c++17
xiabo's avatar
xiabo committed
60

dcuai's avatar
dcuai committed
61
## 验证
limm's avatar
limm committed
62
- python -c "import mmcv; mmcv.\_\_version__",版本号与官方版本同步,查询该软件的版本号,例如2.1.0;
Zaida Zhou's avatar
Zaida Zhou committed
63

huchen's avatar
huchen committed
64
65
## Known Issue
-
xiabo's avatar
xiabo committed
66

dcuai's avatar
dcuai committed
67
## 参考资料
xiabo's avatar
xiabo committed
68
- [README_ORIGIN](README_ORIGIN.md)
huchen's avatar
huchen committed
69
- [README_zh-CN](README_zh-CN.md)
dcuai's avatar
dcuai committed
70
- [https://github.com/open-mmlab/mmcv](https://github.com/open-mmlab/mmcv)