Commit 09494783 authored by fengzch-das's avatar fengzch-das
Browse files

update readme

parent 6097093a
# dlib C++ library [![Travis Status](https://travis-ci.com/davisking/dlib.svg?branch=master)](https://app.travis-ci.com/github/davisking/dlib) [![GitHub Actions C++ Status](https://github.com/davisking/dlib/actions/workflows/build_cpp.yml/badge.svg)](https://github.com/davisking/dlib/actions/workflows/build_cpp.yml) [![GitHub Actions Python Status](https://github.com/davisking/dlib/actions/workflows/build_python.yml/badge.svg)](https://github.com/davisking/dlib/actions/workflows/build_python.yml) # <div align="center"><strong>Dlib</strong></div>
Dlib is a modern C++ toolkit containing machine learning algorithms and tools for creating complex software in C++ to solve real world problems. See [http://dlib.net](http://dlib.net) for the main project documentation and API reference. ## 1 简介
Dlib 是一个现代化的 C++ 工具包,包含机器学习算法和用于创建复杂 C++ 软件的工具,旨在解决现实世界中的问题。
## 2 安装
## Compiling dlib C++ example programs 组件支持组合
Go into the examples folder and type: | 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不转码 |
```bash + pytorch 版本大于 2.4.1 && dtk 版本大于 25.04 推荐使用 fastpt 不转码编译。
mkdir build; cd build; cmake .. ; cmake --build .
```
That will build all the examples. ### 2.1 使用pip方式安装
If you have a CPU that supports AVX instructions then turn them on like this:
```bash causal-conv1d whl 包下载目录:[光和开发者社区](https://download.sourcefind.cn:65024/4/main),选择对应的 pytorch 版本和 python 版本下载对应 dlib 的 whl 包:
mkdir build; cd build; cmake .. -DUSE_AVX_INSTRUCTIONS=1; cmake --build .
```shell
pip install torch* # 下载torch的whl包
pip install fastpt* --no-deps # 下载fastpt的whl包
source /usr/local/bin/fastpt -E
pip install dlib*
``` ```
Doing so will make some things run faster. ### 2.2 使用源码编译方式安装
Finally, Visual Studio users should usually do everything in 64bit mode. By default Visual Studio is 32bit, both in its outputs and its own execution, so you have to explicitly tell it to use 64bits. Since it's not the 1990s anymore you probably want to use 64bits. Do that with a cmake invocation like this: #### 2.2.1 编译环境准备
```bash
cmake .. -G "Visual Studio 14 2015 Win64" -T host=x64
```
## Compiling your own C++ programs that use dlib 提供基于 fastpt 不转码编译:
The examples folder has a [CMake tutorial](https://github.com/davisking/dlib/blob/master/examples/CMakeLists.txt) that tells you what to do. There are also additional instructions on the [dlib web site](http://dlib.net/compile.html). 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 包。安装命令如下:
Alternatively, if you are using the [vcpkg](https://github.com/Microsoft/vcpkg/) dependency manager you can download and install dlib with CMake integration in a single command: ```shell
```bash pip install torch* # 下载torch的whl包
vcpkg install dlib pip install fastpt* --no-deps # 下载fastpt的whl包, 安装顺序,先安装torch,后安装fastpt
pip install setuptools==59.5.0 wheel pytest
``` ```
## Compiling dlib Python API #### 2.2.2 源码编译安装
Before you can run the Python example programs you must compile dlib. Type: - 代码下载
```bash ```shell
python setup.py install git clone http://developer.sourcefind.cn/codes/OpenDAS/dlib.git # 根据编译需要切换分支
``` ```
- 提供2种源码编译方式(进入 dlib 目录):
- 源码编译安装:
```bash
source /usr/local/bin/fastpt -C
## Running the unit test suite python setup.py build
python setup.py install
Type the following to compile and run the dlib unit test suite: ```
- whl 包构建安装:
```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 验证
- 执行下面的命令获取版本号:
```bash ```bash
cd dlib/test source /usr/local/bin/fastpt -E
mkdir build
cd build python
cmake .. >>> import dlib
cmake --build . --config Release >>> print(dlib.__version__)
./dtest --runall 19.24.0
``` ```
Note that on windows your compiler might put the test executable in a subfolder called `Release`. If that's the case then you have to go to that folder before running the test. - 执行下面的命令测试组件:
```bash
source /usr/local/bin/fastpt -E
cd python_examples
python svm_rank.py
python svm_struct.py
```
This library is licensed under the Boost Software License, which can be found in [dlib/LICENSE.txt](https://github.com/davisking/dlib/blob/master/dlib/LICENSE.txt). The long and short of the license is that you can use dlib however you like, even in closed source commercial software. ## 4 Known Issue
## dlib sponsors -
This research is based in part upon work supported by the Office of the Director of National Intelligence (ODNI), Intelligence Advanced Research Projects Activity (IARPA) under contract number 2014-14071600010. The views and conclusions contained herein are those of the authors and should not be interpreted as necessarily representing the official policies or endorsements, either expressed or implied, of ODNI, IARPA, or the U.S. Government. ## 5 参考资料
- [README_ORIGIN](README_ORIGIN.md)
- [https://github.com/davisking/dlib.git](https://github.com/davisking/dlib.git)
# dlib C++ library [![Travis Status](https://travis-ci.com/davisking/dlib.svg?branch=master)](https://app.travis-ci.com/github/davisking/dlib) [![GitHub Actions C++ Status](https://github.com/davisking/dlib/actions/workflows/build_cpp.yml/badge.svg)](https://github.com/davisking/dlib/actions/workflows/build_cpp.yml) [![GitHub Actions Python Status](https://github.com/davisking/dlib/actions/workflows/build_python.yml/badge.svg)](https://github.com/davisking/dlib/actions/workflows/build_python.yml)
Dlib is a modern C++ toolkit containing machine learning algorithms and tools for creating complex software in C++ to solve real world problems. See [http://dlib.net](http://dlib.net) for the main project documentation and API reference.
## Compiling dlib C++ example programs
Go into the examples folder and type:
```bash
mkdir build; cd build; cmake .. ; cmake --build .
```
That will build all the examples.
If you have a CPU that supports AVX instructions then turn them on like this:
```bash
mkdir build; cd build; cmake .. -DUSE_AVX_INSTRUCTIONS=1; cmake --build .
```
Doing so will make some things run faster.
Finally, Visual Studio users should usually do everything in 64bit mode. By default Visual Studio is 32bit, both in its outputs and its own execution, so you have to explicitly tell it to use 64bits. Since it's not the 1990s anymore you probably want to use 64bits. Do that with a cmake invocation like this:
```bash
cmake .. -G "Visual Studio 14 2015 Win64" -T host=x64
```
## Compiling your own C++ programs that use dlib
The examples folder has a [CMake tutorial](https://github.com/davisking/dlib/blob/master/examples/CMakeLists.txt) that tells you what to do. There are also additional instructions on the [dlib web site](http://dlib.net/compile.html).
Alternatively, if you are using the [vcpkg](https://github.com/Microsoft/vcpkg/) dependency manager you can download and install dlib with CMake integration in a single command:
```bash
vcpkg install dlib
```
## Compiling dlib Python API
Before you can run the Python example programs you must compile dlib. Type:
```bash
python setup.py install
```
## Running the unit test suite
Type the following to compile and run the dlib unit test suite:
```bash
cd dlib/test
mkdir build
cd build
cmake ..
cmake --build . --config Release
./dtest --runall
```
Note that on windows your compiler might put the test executable in a subfolder called `Release`. If that's the case then you have to go to that folder before running the test.
This library is licensed under the Boost Software License, which can be found in [dlib/LICENSE.txt](https://github.com/davisking/dlib/blob/master/dlib/LICENSE.txt). The long and short of the license is that you can use dlib however you like, even in closed source commercial software.
## dlib sponsors
This research is based in part upon work supported by the Office of the Director of National Intelligence (ODNI), Intelligence Advanced Research Projects Activity (IARPA) under contract number 2014-14071600010. The views and conclusions contained herein are those of the authors and should not be interpreted as necessarily representing the official policies or endorsements, either expressed or implied, of ODNI, IARPA, or the U.S. Government.
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