"tests/implicitron/vscode:/vscode.git/clone" did not exist on "c311a4cbb93be458f8f48e7b269c6d3ee7fc2cf4"
README.md 3.06 KB
Newer Older
fengzch-das's avatar
fengzch-das committed
1
# <div align="center"><strong>Dlib</strong></div>
2

fengzch-das's avatar
fengzch-das committed
3
## 1 简介
4

fengzch-das's avatar
fengzch-das committed
5
Dlib 是一个现代化的 C++ 工具包,包含机器学习算法和用于创建复杂 C++ 软件的工具,旨在解决现实世界中的问题。
6

fengzch-das's avatar
fengzch-das committed
7
## 2 安装
8

fengzch-das's avatar
fengzch-das committed
9
组件支持组合
10

fengzch-das's avatar
fengzch-das committed
11
12
13
14
| PyTorch版本 | fastpt版本 | cuBVH版本     | DTK版本  | Python版本      | 推荐编译方式 |
| ----------- | ---------- | ------------- | -------- | --------------- | ------------ |
| 2.5.1       | 2.1.0      | main-eeb9d5fa | >= 25.04 | 3.8、3.10、3.11 | fastpt不转码 |
| 2.4.1       | 2.0.1      | main-eeb9d5fa | >= 25.04 | 3.8、3.10、3.11 | fastpt不转码 |
15

fengzch-das's avatar
fengzch-das committed
16
+ pytorch 版本大于 2.4.1 && dtk 版本大于 25.04 推荐使用 fastpt 不转码编译。
17

fengzch-das's avatar
fengzch-das committed
18
### 2.1 使用pip方式安装
19

fengzch-das's avatar
fengzch-das committed
20
dlib whl 包下载目录:[光和开发者社区](https://download.sourcefind.cn:65024/4/main),选择对应的 pytorch 版本和 python 版本下载对应 dlib 的 whl 包: 
fengzch-das's avatar
fengzch-das committed
21
22
23
24
25

```shell
pip install torch* # 下载torch的whl包
pip install fastpt* --no-deps # 下载fastpt的whl包
source  /usr/local/bin/fastpt -E
fengzch-das's avatar
fengzch-das committed
26
pip install dlib* # 下载的 dlib-fastpt 的 whl 包
27
28
```

fengzch-das's avatar
fengzch-das committed
29
### 2.2 使用源码编译方式安装
30

fengzch-das's avatar
fengzch-das committed
31
#### 2.2.1 编译环境准备
32

fengzch-das's avatar
fengzch-das committed
33
提供基于 fastpt 不转码编译:
34

fengzch-das's avatar
fengzch-das committed
35
36
1. 基于光源 pytorch 基础镜像环境:镜像下载地址:[光合开发者社区](https://sourcefind.cn/#/image/dcu/pytorch),根据 pytorch、python、dtk 及系统下载对应的镜像版本。
2. 基于现有 python 环境:安装 pytorch,fastpt whl 包下载目录:[光合开发者社区](https://sourcefind.cn/#/image/dcu/pytorch),根据 python、dtk 版本,下载对应 pytorch 的 whl 包。安装命令如下:
37

fengzch-das's avatar
fengzch-das committed
38
39
40
41
```shell
pip install torch* # 下载torch的whl包
pip install fastpt* --no-deps # 下载fastpt的whl包, 安装顺序,先安装torch,后安装fastpt
pip install setuptools==59.5.0 wheel pytest
42
43
```

fengzch-das's avatar
fengzch-das committed
44
#### 2.2.2 源码编译安装
45

fengzch-das's avatar
fengzch-das committed
46
- 代码下载
47

fengzch-das's avatar
fengzch-das committed
48
49
```shell
git clone http://developer.sourcefind.cn/codes/OpenDAS/dlib.git # 根据编译需要切换分支
50
51
```

fengzch-das's avatar
fengzch-das committed
52
53
54
55
56
- 提供2种源码编译方式(进入 dlib 目录):
  - 源码编译安装:

    ```bash
    source /usr/local/bin/fastpt -C
57

fengzch-das's avatar
fengzch-das committed
58
59
    python setup.py build
    python setup.py install
60

fengzch-das's avatar
fengzch-das committed
61
62
    ```
  - whl 包构建安装:
63

fengzch-das's avatar
fengzch-das committed
64
65
66
67
68
69
70
71
72
73
74
75
76
77
    ```bash
    source /usr/local/bin/fastpt -C

    python setup.py bdist_wheel # 该指令用于编译whl包
    pip install dist/dlib-19.24.0-cp310-cp310-linux_x86_64.whl
    ```

#### 2.2.3 注意事项

+ ROCM_PATH 为 dtk 的路径,默认为 /opt/dtk;
+ 在 pytorch2.5.1 环境下编译需要支持 c++17 语法,打开setup.py文件,把文件中的 -std=c++14 修改为 -std=c++17。

## 3 验证
- 执行下面的命令获取版本号:
78
```bash
fengzch-das's avatar
fengzch-das committed
79
80
81
82
83
84
source /usr/local/bin/fastpt -E

python
>>> import dlib
>>> print(dlib.__version__)
19.24.0
85
86
```

fengzch-das's avatar
fengzch-das committed
87
88
89
90
91
92
93
94
95
- 执行下面的命令测试组件:

```bash
source /usr/local/bin/fastpt -E

cd python_examples
python svm_rank.py
python svm_struct.py
```
96

fengzch-das's avatar
fengzch-das committed
97
## 4 Known Issue
98

fengzch-das's avatar
fengzch-das committed
99
-
100

fengzch-das's avatar
fengzch-das committed
101
## 5 参考资料
102

fengzch-das's avatar
fengzch-das committed
103
104
- [README_ORIGIN](README_ORIGIN.md)
- [https://github.com/davisking/dlib.git](https://github.com/davisking/dlib.git)