Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
models
提交
e8db86d7
M
models
项目概览
PaddlePaddle
/
models
接近 2 年 前同步成功
通知
229
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看板
提交
e8db86d7
编写于
6月 27, 2019
作者:
S
SunAhong1993
提交者:
qingqing01
6月 27, 2019
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Add create_list.py and fix some ssd bug (#2567)
上级
209cfdaa
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
89 addition
and
3 deletion
+89
-3
PaddleCV/object_detection/ppdet/data/data_feed.py
PaddleCV/object_detection/ppdet/data/data_feed.py
+2
-2
PaddleCV/object_detection/ppdet/modeling/architectures/ssd.py
...leCV/object_detection/ppdet/modeling/architectures/ssd.py
+1
-1
PaddleCV/object_detection/ppdet/utils/create_list.py
PaddleCV/object_detection/ppdet/utils/create_list.py
+86
-0
未找到文件。
PaddleCV/object_detection/ppdet/data/data_feed.py
浏览文件 @
e8db86d7
...
...
@@ -688,14 +688,14 @@ class SSDTrainFeed(DataFeed):
brightness_upper
=
1.125
,
is_order
=
True
),
ExpandImage
(
max_ratio
=
4
,
prob
=
0.5
),
CropImage
([[
1
,
1
,
1.0
,
1.0
,
1.0
,
1.0
,
0.0
,
0.0
],
CropImage
(
batch_sampler
=
[[
1
,
1
,
1.0
,
1.0
,
1.0
,
1.0
,
0.0
,
0.0
],
[
1
,
50
,
0.3
,
1.0
,
0.5
,
2.0
,
0.1
,
0.0
],
[
1
,
50
,
0.3
,
1.0
,
0.5
,
2.0
,
0.3
,
0.0
],
[
1
,
50
,
0.3
,
1.0
,
0.5
,
2.0
,
0.5
,
0.0
],
[
1
,
50
,
0.3
,
1.0
,
0.5
,
2.0
,
0.7
,
0.0
],
[
1
,
50
,
0.3
,
1.0
,
0.5
,
2.0
,
0.9
,
0.0
],
[
1
,
50
,
0.3
,
1.0
,
0.5
,
2.0
,
0.0
,
1.0
]],
satisfy_all
=
False
),
satisfy_all
=
False
,
avoid_no_bbox
=
False
),
ResizeImage
(
target_size
=
300
,
use_cv2
=
False
,
interp
=
1
),
RandomFlipImage
(
is_normalized
=
True
),
Permute
(),
...
...
PaddleCV/object_detection/ppdet/modeling/architectures/ssd.py
浏览文件 @
e8db86d7
...
...
@@ -94,4 +94,4 @@ class SSD(object):
return
self
.
_forward
(
feed_vars
,
'eval'
)
def
test
(
self
,
feed_vars
):
return
self
.
_forward
(
'test'
)
return
self
.
_forward
(
feed_vars
,
'test'
)
PaddleCV/object_detection/ppdet/utils/create_list.py
0 → 100644
浏览文件 @
e8db86d7
# Copyright (c) 2019 PaddlePaddle Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
import
os
import
os.path
as
osp
import
re
import
random
import
shutil
devkit_dir
=
'./VOCdevkit'
years
=
[
'2007'
,
'2012'
]
def
get_dir
(
devkit_dir
,
year
,
type
):
return
osp
.
join
(
devkit_dir
,
'VOC'
+
year
,
type
)
def
walk_dir
(
devkit_dir
,
year
):
filelist_dir
=
get_dir
(
devkit_dir
,
year
,
'ImageSets/Main'
)
annotation_dir
=
get_dir
(
devkit_dir
,
year
,
'Annotations'
)
img_dir
=
get_dir
(
devkit_dir
,
year
,
'JPEGImages'
)
trainval_list
=
[]
test_list
=
[]
added
=
set
()
for
_
,
_
,
files
in
os
.
walk
(
filelist_dir
):
for
fname
in
files
:
img_ann_list
=
[]
if
re
.
match
(
'[a-z]+_trainval\.txt'
,
fname
):
img_ann_list
=
trainval_list
elif
re
.
match
(
'[a-z]+_test\.txt'
,
fname
):
img_ann_list
=
test_list
else
:
continue
fpath
=
osp
.
join
(
filelist_dir
,
fname
)
for
line
in
open
(
fpath
):
name_prefix
=
line
.
strip
().
split
()[
0
]
if
name_prefix
in
added
:
continue
added
.
add
(
name_prefix
)
ann_path
=
osp
.
join
(
annotation_dir
,
name_prefix
+
'.xml'
)
img_path
=
osp
.
join
(
img_dir
,
name_prefix
+
'.jpg'
)
new_ann_path
=
osp
.
join
(
'./VOCdevkit/VOC_all/Annotations/'
,
name_prefix
+
'.xml'
)
new_img_path
=
osp
.
join
(
'./VOCdevkit/VOC_all/JPEGImages/'
,
name_prefix
+
'.jpg'
)
shutil
.
copy
(
ann_path
,
new_ann_path
)
shutil
.
copy
(
img_path
,
new_img_path
)
img_ann_list
.
append
(
name_prefix
)
return
trainval_list
,
test_list
def
prepare_filelist
(
devkit_dir
,
years
,
output_dir
):
os
.
makedirs
(
'./VOCdevkit/VOC_all/Annotations/'
)
os
.
makedirs
(
'./VOCdevkit/VOC_all/ImageSets/Main/'
)
os
.
makedirs
(
'./VOCdevkit/VOC_all/JPEGImages/'
)
trainval_list
=
[]
test_list
=
[]
for
year
in
years
:
trainval
,
test
=
walk_dir
(
devkit_dir
,
year
)
trainval_list
.
extend
(
trainval
)
test_list
.
extend
(
test
)
random
.
shuffle
(
trainval_list
)
with
open
(
osp
.
join
(
output_dir
,
'train.txt'
),
'w'
)
as
ftrainval
:
for
item
in
trainval_list
:
ftrainval
.
write
(
item
+
'
\n
'
)
with
open
(
osp
.
join
(
output_dir
,
'val.txt'
),
'w'
)
as
fval
:
with
open
(
osp
.
join
(
output_dir
,
'test.txt'
),
'w'
)
as
ftest
:
ct
=
0
for
item
in
test_list
:
ct
+=
1
fval
.
write
(
item
+
'
\n
'
)
if
ct
<=
1000
:
ftest
.
write
(
item
+
'
\n
'
)
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录