Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
OpenDAS
detectron2
Commits
54f22639
Commit
54f22639
authored
May 30, 2025
by
limm
Browse files
Update README.md
parent
eadd775b
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
47 additions
and
37 deletions
+47
-37
README.md
README.md
+47
-37
No files found.
README.md
View file @
54f22639
...
...
@@ -3,70 +3,80 @@
Detectron2 是 Facebook AI Research 的下一代软件系统实现最先进的对象检测算法
## 安装
### 使用pip方式安装
-
detectron2 whl包下载目录:
[
http://10.6.10.68:8000/customized/detectron2/dtk2310/
](
http://10.6.10.68:8000/customized/detectron2/dtk2310/
)
. 目前只提供有python3.8, pytorch2.1版本的安装包 (内网whl包安装, 不保证链接一直有效,无安装包推荐源码编译)
```
shell
pip
install
detectron2
*
(
下载的detectron2的whl包
)
```
组件支持组合
-
也可以在光合
[
光合开发者社区
](
https://developer.hpccube.com/tool/#sdk
)
AI 生态包中获取最新的 detectron2 Release 版本(需对应 DCU Toolkit 版本与 p
ython
版本
)
```
bash
python3
-m
pip
install
detectron2-0.1.3-cp38-cp38-linux_x86_64.whl
```
### 使用源码编译方式安装
| PyTorch版本 | fastpt版本 |Detectron2版本 | DTK版本 | P
ython版本
| 推荐编译方式 |
| ----------- | ----------- | ---------------- | -------------- | ---------------- | ------------ |
| 2.5.1 | 2.1.0 |v0.6 | >= 25.04 | 3.8、3.10、3.11 | fastpt不转码 |
| 2.4.1 | 2.0.1 |v0.6 | >= 25.04 | 3.8、3.10、3.11 | fastpt不转码 |
| 其他 | 其他 |其他 | 其他 | 3.8、3.10、3.11 | hip转码 |
#### 编译环境准备
-
安装相关依赖
+
pytorch版本大于2.4.1 && dtk版本大于25.04 推荐使用fastpt不转码编译。
安装相关依赖
```
shell
pip
install
numpy
pip
install
'urllib3==1.26.14'
pip
install
wheel
pip install opencv-python
```
-
拉取 detectron2 代码
```
git clone -b v0.6-fastpt http://developer.hpccube.com/codes/OpenDAS/detectron2.git
### 1、使用pip方式安装
detectron2 whl包下载目录:
[
光和开发者社区
](
https://download.sourcefind.cn:65024/4/main/
)
. 选择对应的pytorch版本和python版本下载对应detectron2的whl包
```
shell
pip
install
torch
*
(
下载torch的whl包
)
pip
install
fastpt
*
--no-deps
(
下载fastpt的whl包
)
source
/usr/local/bin/fastpt
-E
pip
install
detectron2
*
(
下载的detectron2的whl包
)
```
### 2、使用源码编译方式安装
#### 编译环境准备
提供基于fastpt不转码编译:
-
在首页 | 光合开发者社区下载 dtk25.04 解压在 /opt/ 路径下,并建立软连接,例如:
在
[
开发者社区
](
https://developer.hpccube.com/tool/#sdk
)
DCU Toolkit 中下载 DTK-25.04 解压至 /opt/ 路径下,并建立软链接
```
cd /opt && ln -s dtk-25.04 dtk
```
1.
基于光源pytorch基础镜像环境:镜像下载地址:
[
光合开发者社区
](
https://sourcefind.cn/#/image/dcu/pytorch
)
,根据pytorch、python、dtk及系统下载对应的镜像版本。
-
安装pytorch. fastpt whl包下载目录:
[
开发者社区
](
https://das.sourcefind.cn:55011/portal/#/home
)
. 根据需求下载对应的版本,
以torch whl包为例
[
http://10.16.4.1:8000/debug/pytorch/dtk25.04/
](
http://10.16.4.1:8000/debug/pytorch/dtk25.04/
)
只提供例子,具体需要根据环境安装不同的whl包 安装如下:
2.
基于现有python环境:安装pytorch,fastpt whl包下载目录:
[
光合开发者社区
](
https://sourcefind.cn/#/image/dcu/pytorch
)
,根据python、dtk版本,下载对应pytorch的whl包。安装命令如下:
```
shell
pip
install
torch
*
(
下载
的
torch的whl包
)
pip
install
fastpt
*
(
下载
的
fastpt的whl包
,fastpt包
安装
在
torch
包后面
)
pip
install
torch
*
(
下载torch的whl包
)
pip
install
fastpt
*
--no-deps
(
下载fastpt的whl包
, 安装顺序,先
安装torch
,后安装fastpt
)
```
#### 源码编译
#### 源码编译安装
-
代码下载
```
shell
http://developer.sourcefind.cn/codes/OpenDAS/detectron2.git
# 根据编译需要切换分支
```
-
提供2种源码编译方式(进入detectron2目录):
1, 设置不转码编译环境变量
```
shell
export
FORCE_CUDA
=
1
source
/usr/local/bin/fastpt
-C
```
-
方案一 (优先推荐方案一)
-
方案一 源码编译安装
```
shell
python
-m
pip
install
-e
detectron2
或者
cd
detectron2
&&
pip
install
-e
.
python
-m
pip
install
-e
detectron2
```
-
方案二, 编译whl包
```
```
shell
cd
detectron2
pip
install
-e
.
python setup.py
install
--user
bdist_wheel
pip
install
dist/detectron2
*
```
#### 注意事项
+
若使用pip install下载安装过慢,可添加pypi清华源:-i https://pypi.tuna.tsinghua.edu.cn/simple/
+
ROCM_PATH为dtk的路径,默认为/opt/dtk
## 验证
-
python -c "import detectron2; detectron2.
\_\_
version__",版本号与官方版本同步,查询该软件的版本号,例如v0.6;
## 单侧
```
shell
cd
detectron2
python
-m
unittest discover
-v
-s
./tests
```
```
shell
cd
detectron2
python
-m
unittest discover
-v
-s
./tests
```
## Known Issue
```
无
```
-
无
## 参考资料
-
[
README_ORIGIN
](
README_ORIGIN.md
)
-
[
https://github.com/facebookresearch/detectron2.git
](
https://github.com/facebookresearch/detectron2.git
)
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment