Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
models
提交
6296090d
M
models
项目概览
PaddlePaddle
/
models
大约 1 年 前同步成功
通知
222
Star
6828
Fork
2962
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
602
列表
看板
标记
里程碑
合并请求
255
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
M
models
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
602
Issue
602
列表
看板
标记
里程碑
合并请求
255
合并请求
255
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
6296090d
编写于
5月 11, 2018
作者:
X
Xingyuan Bu
提交者:
qingqing01
5月 11, 2018
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Hotfix paralle nccl args (#903)
* fix parallel * typo * fix data best_map parameter bug
上级
4ce1f3ae
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
15 addition
and
11 deletion
+15
-11
fluid/object_detection/README.md
fluid/object_detection/README.md
+8
-8
fluid/object_detection/eval_coco_map.py
fluid/object_detection/eval_coco_map.py
+3
-2
fluid/object_detection/train.py
fluid/object_detection/train.py
+4
-1
未找到文件。
fluid/object_detection/README.md
浏览文件 @
6296090d
...
...
@@ -52,22 +52,22 @@ Declaration: the MobileNet-v1 SSD model is converted by [TensorFlow model](https
#### Train on PASCAL VOC
-
Train on one device (/GPU).
```
python
env
CUDA_VISI
A
BLE_DEVICES
=
0
python
-
u
train
.
py
--
parallel
=
False
--
dataset
=
'pascalvoc'
--
pretrained_model
=
'pretrained/ssd_mobilenet_v1_coco/'
env
CUDA_VISIBLE_DEVICES
=
0
python
-
u
train
.
py
--
parallel
=
False
--
dataset
=
'pascalvoc'
--
pretrained_model
=
'pretrained/ssd_mobilenet_v1_coco/'
```
-
Train on multi devices (/GPUs).
```
python
env
CUDA_VISI
A
BLE_DEVICES
=
0
,
1
python
-
u
train
.
py
--
batch_size
=
64
--
dataset
=
'pascalvoc'
--
pretrained_model
=
'pretrained/ssd_mobilenet_v1_coco/'
env
CUDA_VISIBLE_DEVICES
=
0
,
1
python
-
u
train
.
py
--
batch_size
=
64
--
dataset
=
'pascalvoc'
--
pretrained_model
=
'pretrained/ssd_mobilenet_v1_coco/'
```
#### Train on MS-COCO
-
Train on one device (/GPU).
```
python
env
CUDA_VISI
A
BLE_DEVICES
=
0
python
-
u
train
.
py
--
parallel
=
False
--
dataset
=
'coco2014'
--
pretrained_model
=
'pretrained/mobilenet_imagenet/'
env
CUDA_VISIBLE_DEVICES
=
0
python
-
u
train
.
py
--
parallel
=
False
--
dataset
=
'coco2014'
--
pretrained_model
=
'pretrained/mobilenet_imagenet/'
```
-
Train on multi devices (/GPUs).
```
python
env
CUDA_VISI
A
BLE_DEVICES
=
0
,
1
python
-
u
train
.
py
--
batch_size
=
64
--
dataset
=
'coco2014'
--
pretrained_model
=
'pretrained/mobilenet_imagenet/'
env
CUDA_VISIBLE_DEVICES
=
0
,
1
python
-
u
train
.
py
--
batch_size
=
64
--
dataset
=
'coco2014'
--
pretrained_model
=
'pretrained/mobilenet_imagenet/'
```
TBD
...
...
@@ -90,13 +90,13 @@ Note we set the defualt test list to the dataset's test/val list, you can use yo
#### Evaluate on PASCAL VOC
```
python
env
CUDA_VISI
A
BLE_DEVICES
=
0
python
eval
.
py
--
dataset
=
'pascalvoc'
--
model_dir
=
'train_pascal_model/90'
--
data_dir
=
'data/pascalvoc'
--
test_list
=
'test.txt'
--
ap_version
=
'11point'
env
CUDA_VISIBLE_DEVICES
=
0
python
eval
.
py
--
dataset
=
'pascalvoc'
--
model_dir
=
'train_pascal_model/90'
--
data_dir
=
'data/pascalvoc'
--
test_list
=
'test.txt'
--
ap_version
=
'11point'
```
#### Evaluate on MS-COCO
```
python
env
CUDA_VISI
A
BLE_DEVICES
=
0
python
eval
.
py
--
dataset
=
'coco2014'
--
nms_threshold
=
0.5
--
model_dir
=
'train_coco_model/40'
--
test_list
=
'annotations/instances_minival2014.json'
--
ap_version
=
'integral'
env
CUDA_VISI
A
BLE_DEVICES
=
0
python
eval_coco_map
.
py
--
dataset
=
'coco2017'
--
nms_threshold
=
0.5
--
model_dir
=
'train_coco_model/40'
--
test_list
=
'annotations/instances_minival2017.json'
env
CUDA_VISIBLE_DEVICES
=
0
python
eval
.
py
--
dataset
=
'coco2014'
--
nms_threshold
=
0.5
--
model_dir
=
'train_coco_model/40'
--
test_list
=
'annotations/instances_minival2014.json'
--
ap_version
=
'integral'
env
CUDA_VISIBLE_DEVICES
=
0
python
eval_coco_map
.
py
--
dataset
=
'coco2017'
--
nms_threshold
=
0.5
--
model_dir
=
'train_coco_model/40'
--
test_list
=
'annotations/instances_minival2017.json'
```
TBD
...
...
@@ -104,7 +104,7 @@ TBD
### Infer and Visualize
```
python
env
CUDA_VISI
A
BLE_DEVICES
=
0
python
infer
.
py
--
model_dir
=
'train_coco_model/20'
--
image_path
=
'./data/coco/val2014/COCO_val2014_000000000139.jpg'
env
CUDA_VISIBLE_DEVICES
=
0
python
infer
.
py
--
model_dir
=
'train_coco_model/20'
--
image_path
=
'./data/coco/val2014/COCO_val2014_000000000139.jpg'
```
Below is the examples after running python infer.py to inference and visualize the model result.
<p
align=
"center"
>
...
...
fluid/object_detection/eval_coco_map.py
浏览文件 @
6296090d
...
...
@@ -69,7 +69,7 @@ def eval(args, data_args, test_list, batch_size, model_dir=None):
place
=
place
,
feed_list
=
[
image
,
gt_box
,
gt_label
,
gt_iscrowd
,
gt_image_info
])
def
get_dt_res
(
nmsed_out_v
):
def
get_dt_res
(
nmsed_out_v
,
data
):
dts_res
=
[]
lod
=
nmsed_out_v
[
0
].
lod
()[
0
]
nmsed_out_v
=
np
.
array
(
nmsed_out_v
[
0
])
...
...
@@ -100,6 +100,7 @@ def eval(args, data_args, test_list, batch_size, model_dir=None):
'score'
:
score
}
dts_res
.
append
(
dt_res
)
return
dts_res
def
test
():
dts_res
=
[]
...
...
@@ -111,7 +112,7 @@ def eval(args, data_args, test_list, batch_size, model_dir=None):
return_numpy
=
False
)
if
batch_id
%
20
==
0
:
print
(
"Batch {0}"
.
format
(
batch_id
))
dts_res
+=
get_dt_res
(
nmsed_out_v
)
dts_res
+=
get_dt_res
(
nmsed_out_v
,
data
)
with
open
(
"detection_result.json"
,
'w'
)
as
outfile
:
json
.
dump
(
dts_res
,
outfile
)
...
...
fluid/object_detection/train.py
浏览文件 @
6296090d
...
...
@@ -18,6 +18,8 @@ add_arg('learning_rate', float, 0.001, "Learning rate.")
add_arg
(
'batch_size'
,
int
,
32
,
"Minibatch size."
)
add_arg
(
'num_passes'
,
int
,
120
,
"Epoch number."
)
add_arg
(
'use_gpu'
,
bool
,
True
,
"Whether use GPU."
)
add_arg
(
'parallel'
,
bool
,
True
,
"Parallel."
)
add_arg
(
'use_nccl'
,
bool
,
True
,
"NCCL."
)
add_arg
(
'dataset'
,
str
,
'pascalvoc'
,
"coco2014, coco2017, and pascalvoc."
)
add_arg
(
'model_save_dir'
,
str
,
'model'
,
"The path to save model."
)
add_arg
(
'pretrained_model'
,
str
,
'pretrained/ssd_mobilenet_v1_coco/'
,
"The init model path."
)
...
...
@@ -274,6 +276,7 @@ def parallel_exe(args,
best_map
=
test_map
[
0
]
save_model
(
'best_model'
)
print
(
"Pass {0}, test map {1}"
.
format
(
pass_id
,
test_map
[
0
]))
return
best_map
for
pass_id
in
range
(
num_passes
):
start_time
=
time
.
time
()
...
...
@@ -295,7 +298,7 @@ def parallel_exe(args,
if
batch_id
%
20
==
0
:
print
(
"Pass {0}, batch {1}, loss {2}, time {3}"
.
format
(
pass_id
,
batch_id
,
loss_v
,
start_time
-
prev_start_time
))
test
(
pass_id
,
best_map
)
best_map
=
test
(
pass_id
,
best_map
)
if
pass_id
%
10
==
0
or
pass_id
==
num_passes
-
1
:
save_model
(
str
(
pass_id
))
print
(
"Best test map {0}"
.
format
(
best_map
))
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录