Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
s920243400
PaddleDetection
提交
52438b30
P
PaddleDetection
项目概览
s920243400
/
PaddleDetection
与 Fork 源项目一致
Fork自
PaddlePaddle / PaddleDetection
通知
2
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
P
PaddleDetection
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
未验证
提交
52438b30
编写于
1月 27, 2021
作者:
G
Guanghua Yu
提交者:
GitHub
1月 27, 2021
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix dygraph getting_started doc (#2128)
上级
13f0b561
变更
6
隐藏空白更改
内联
并排
Showing
6 changed file
with
64 addition
and
34 deletion
+64
-34
dygraph/docs/tutorials/GETTING_STARTED_cn.md
dygraph/docs/tutorials/GETTING_STARTED_cn.md
+60
-13
dygraph/requirements.txt
dygraph/requirements.txt
+0
-2
dygraph/tools/eval.py
dygraph/tools/eval.py
+1
-4
dygraph/tools/export_model.py
dygraph/tools/export_model.py
+1
-1
dygraph/tools/infer.py
dygraph/tools/infer.py
+1
-1
dygraph/tools/train.py
dygraph/tools/train.py
+1
-13
未找到文件。
dygraph/docs/tutorials/GETTING_STARTED_cn.md
浏览文件 @
52438b30
...
...
@@ -2,33 +2,80 @@
## 安装
`dygraph`
分支需要安装每日版本的PaddlePaddle,PaddlePaddle中
`c0a991c8740b413559bfc894aa5ae1d5ed3704b5`
这个commit会影响精度,建议安装这个commit之前的版本。
关于安装配置运行环境,请参考
[
安装指南
](
INSTALL_cn.md
)
## 准备数据
请按照
[
如何准备训练数据
](
PrepareDataSet.md
)
准备训练
数据。
数据准备好之后,设置数据配置文件
`configs/_base_/datasets/coco.yml`
中的数据路径。
-
首先按照
[
准备数据文档
](
PrepareDataSet.md
)
准备
数据。
-
然后设置
`configs/datasets`
中相应的coco或voc等数据配置文件
中的数据路径。
## 训练/评估/预测
PaddleDetection提供了训练/评估/预测,支持通过不同可选参数实现特定功能
PaddleDetection在
[
tools
](
https://github.com/PaddlePaddle/PaddleDetection/tree/master/dygraph/tools
)
中提供了
`训练`
/
`评估`
/
`预测`
/
`导出模型`
等功能,支持通过传入不同可选参数实现特定功能
### 参数列表
以下列表可以通过
`--help`
查看
| FLAG | 支持脚本 | 用途 | 默认值 | 备注 |
| :----------------------: | :------------: | :---------------: | :--------------: | :-----------------: |
| -c | ALL | 指定配置文件 | None |
**必选**
,例如-c configs/ppyolo/ppyolo_r50vd_dcn_1x_coco.yml |
| --eval | train | 是否边训练边测试 | False | 可选,如需指定,直接
`--eval`
即可 |
| -o | ALL | 设置或更改配置文件里的参数内容 | None | 可选,例如:
`-o use_gpu=False`
|
| --slim_config | ALL | 模型压缩策略配置文件 | None | 可选,例如
`--slim_config configs/slim/prune/yolov3_prune_l1_norm.yml`
|
| --output_dir | infer/export_model | 预测后结果或导出模型保存路径 |
`./output`
| 可选,例如
`--output_dir=output`
|
| --draw_threshold | infer | 可视化时分数阈值 | 0.5 | 可选,
`--draw_threshold=0.7`
|
| --infer_dir | infer | 用于预测的图片文件夹路径 | None | 可选 |
| --infer_img | infer | 用于预测的图片路径 | None | 可选,
`--infer_img`
和
`--infer_dir`
必须至少设置一个 |
### 训练
-
单卡训练
```
bash
# 通过CUDA_VISIBLE_DEVICES指定GPU卡号
export
CUDA_VISIBLE_DEVICES
=
0
python tools/train.py
-c
configs/faster_rcnn/faster_rcnn_r50_fpn_1x_coco.yml
```
-
多卡训练
#### 训练
```
bash
# GPU训练 支持单卡,多卡训练,通过CUDA_VISIBLE_DEVICES指定卡号
export
CUDA_VISIBLE_DEVICES
=
0,1,2,3,4,5,6,7
python
-m
paddle.distributed.launch
--selected_gpus
0,1,2,3,4,5,6,7 tools/train.py
-c
configs/faster_rcnn_r50_fpn_1x_coco.yml
python
-m
paddle.distributed.launch
--gpus
0,1,2,3,4,5,6,7 tools/train.py
-c
configs/faster_rcnn/faster_rcnn_r50_fpn_1x_coco.yml
```
-
边训练边评估
```
bash
python tools/train.py
-c
configs/faster_rcnn/faster_rcnn_r50_fpn_1x_coco.yml
--eval
```
###
#
评估
### 评估
```
bash
#
使用
单卡评估
CUDA_VISIBLE_DEVICES
=
0 python tools/eval.py
-c
configs/faster_rcnn_r50_fpn_1x_coco.yml
#
目前只支持
单卡评估
CUDA_VISIBLE_DEVICES
=
0 python tools/eval.py
-c
configs/faster_rcnn
/faster_rcnn
_r50_fpn_1x_coco.yml
```
###
#
预测
### 预测
```
bash
# 预测
CUDA_VISIBLE_DEVICES
=
0 python tools/infer.py
-c
configs/faster_rcnn_r50_fpn_1x_coco.yml
--infer_img
=
demo/000000570688.jpg
CUDA_VISIBLE_DEVICES
=
0 python tools/infer.py
-c
configs/faster_rcnn/faster_rcnn_r50_fpn_1x_coco.yml
--infer_img
={
IMAGE_PATH
}
```
## 预测部署
(1)导出模型
```
bash
python tools/export_model.py
-c
configs/faster_rcnn/faster_rcnn_r50_fpn_1x_coco.yml
\
-o
weights
=
output/faster_rcnn_r50_fpn_1x_coco/model_final
\
--output_dir
=
output_inference
```
(2)预测部署
参考
[
预测部署文档
](
https://github.com/PaddlePaddle/PaddleDetection/tree/master/dygraph/deploy
)
。
## 模型压缩
参考
[
模型压缩文档
](
https://github.com/PaddlePaddle/PaddleDetection/tree/master/dygraph/configs/slim
)
。
dygraph/requirements.txt
浏览文件 @
52438b30
...
...
@@ -4,5 +4,3 @@ visualdl>=2.0.0b
opencv-python
PyYAML
shapely
llvmlite==0.33
numba==0.50
dygraph/tools/eval.py
浏览文件 @
52438b30
...
...
@@ -22,7 +22,7 @@ parent_path = os.path.abspath(os.path.join(__file__, *(['..'] * 2)))
if
parent_path
not
in
sys
.
path
:
sys
.
path
.
append
(
parent_path
)
# ignore
numba warnin
g
# ignore
warning lo
g
import
warnings
warnings
.
filterwarnings
(
'ignore'
)
...
...
@@ -55,9 +55,6 @@ def parse_args():
type
=
str
,
help
=
"Configuration file of slim method."
)
parser
.
add_argument
(
'--use_gpu'
,
action
=
'store_true'
,
default
=
False
,
help
=
''
)
args
=
parser
.
parse_args
()
return
args
...
...
dygraph/tools/export_model.py
浏览文件 @
52438b30
...
...
@@ -21,7 +21,7 @@ parent_path = os.path.abspath(os.path.join(__file__, *(['..'] * 2)))
if
parent_path
not
in
sys
.
path
:
sys
.
path
.
append
(
parent_path
)
# ignore
numba warnin
g
# ignore
warning lo
g
import
warnings
warnings
.
filterwarnings
(
'ignore'
)
...
...
dygraph/tools/infer.py
浏览文件 @
52438b30
...
...
@@ -21,7 +21,7 @@ parent_path = os.path.abspath(os.path.join(__file__, *(['..'] * 2)))
if
parent_path
not
in
sys
.
path
:
sys
.
path
.
append
(
parent_path
)
# ignore
numba warnin
g
# ignore
warning lo
g
import
warnings
warnings
.
filterwarnings
(
'ignore'
)
import
glob
...
...
dygraph/tools/train.py
浏览文件 @
52438b30
...
...
@@ -22,7 +22,7 @@ parent_path = os.path.abspath(os.path.join(__file__, *(['..'] * 2)))
if
parent_path
not
in
sys
.
path
:
sys
.
path
.
append
(
parent_path
)
# ignore
numba warnin
g
# ignore
warning lo
g
import
warnings
warnings
.
filterwarnings
(
'ignore'
)
import
random
...
...
@@ -49,16 +49,6 @@ def parse_args():
type
=
str
,
help
=
"Loading Checkpoints only support 'pretrain', 'finetune', 'resume'."
)
parser
.
add_argument
(
"--fp16"
,
action
=
'store_true'
,
default
=
False
,
help
=
"Enable mixed precision training."
)
parser
.
add_argument
(
"--loss_scale"
,
default
=
8.
,
type
=
float
,
help
=
"Mixed precision training loss scale."
)
parser
.
add_argument
(
"--eval"
,
action
=
'store_true'
,
...
...
@@ -75,8 +65,6 @@ def parse_args():
default
=
False
,
help
=
"If set True, enable continuous evaluation job."
"This flag is only used for internal test."
)
parser
.
add_argument
(
"--use_gpu"
,
action
=
'store_true'
,
default
=
False
,
help
=
"data parallel"
)
args
=
parser
.
parse_args
()
return
args
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录