Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
models
提交
8152934d
M
models
项目概览
PaddlePaddle
/
models
大约 2 年 前同步成功
通知
232
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看板
提交
8152934d
编写于
3月 19, 2019
作者:
D
dengkaipeng
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
refine code.
上级
7c7b0c4d
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
21 addition
and
20 deletion
+21
-20
fluid/PaddleCV/yolov3/config.py
fluid/PaddleCV/yolov3/config.py
+10
-0
fluid/PaddleCV/yolov3/models/darknet.py
fluid/PaddleCV/yolov3/models/darknet.py
+0
-3
fluid/PaddleCV/yolov3/models/yolov3.py
fluid/PaddleCV/yolov3/models/yolov3.py
+11
-17
未找到文件。
fluid/PaddleCV/yolov3/config.py
浏览文件 @
8152934d
...
@@ -64,6 +64,16 @@ _C.pixel_means = [0.485, 0.456, 0.406]
...
@@ -64,6 +64,16 @@ _C.pixel_means = [0.485, 0.456, 0.406]
# pixel std values
# pixel std values
_C
.
pixel_stds
=
[
0.229
,
0.224
,
0.225
]
_C
.
pixel_stds
=
[
0.229
,
0.224
,
0.225
]
# anchors box weight and height
_C
.
anchors
=
[
10
,
13
,
16
,
30
,
33
,
23
,
30
,
61
,
62
,
45
,
59
,
119
,
116
,
90
,
156
,
198
,
373
,
326
]
# anchor mask of each yolo layer
_C
.
anchor_masks
=
[[
6
,
7
,
8
],
[
3
,
4
,
5
],
[
0
,
1
,
2
]]
# IoU threshold to ignore objectness loss of pred box
_C
.
ignore_thresh
=
.
7
#
#
# SOLVER options
# SOLVER options
#
#
...
...
fluid/PaddleCV/yolov3/models/darknet.py
浏览文件 @
8152934d
...
@@ -86,14 +86,11 @@ def add_DarkNet53_conv_body(body_input, is_test=True):
...
@@ -86,14 +86,11 @@ def add_DarkNet53_conv_body(body_input, is_test=True):
conv1
=
conv_bn_layer
(
conv1
=
conv_bn_layer
(
body_input
,
ch_out
=
32
,
filter_size
=
3
,
stride
=
1
,
padding
=
1
,
is_test
=
is_test
,
name
=
"yolo_input"
)
body_input
,
ch_out
=
32
,
filter_size
=
3
,
stride
=
1
,
padding
=
1
,
is_test
=
is_test
,
name
=
"yolo_input"
)
downsample_
=
downsample
(
conv1
,
ch_out
=
conv1
.
shape
[
1
]
*
2
,
is_test
=
is_test
,
name
=
"yolo_input.downsample"
)
downsample_
=
downsample
(
conv1
,
ch_out
=
conv1
.
shape
[
1
]
*
2
,
is_test
=
is_test
,
name
=
"yolo_input.downsample"
)
index
=
2
blocks
=
[]
blocks
=
[]
for
i
,
stage
in
enumerate
(
stages
):
for
i
,
stage
in
enumerate
(
stages
):
block
=
layer_warp
(
block_func
,
downsample_
,
32
*
(
2
**
i
),
stage
,
is_test
=
is_test
,
name
=
"stage.{}"
.
format
(
i
))
block
=
layer_warp
(
block_func
,
downsample_
,
32
*
(
2
**
i
),
stage
,
is_test
=
is_test
,
name
=
"stage.{}"
.
format
(
i
))
blocks
.
append
(
block
)
blocks
.
append
(
block
)
index
+=
3
*
stage
if
i
<
len
(
stages
)
-
1
:
# do not downsaple in the last stage
if
i
<
len
(
stages
)
-
1
:
# do not downsaple in the last stage
downsample_
=
downsample
(
block
,
ch_out
=
block
.
shape
[
1
]
*
2
,
is_test
=
is_test
,
name
=
"stage.{}.downsample"
.
format
(
i
))
downsample_
=
downsample
(
block
,
ch_out
=
block
.
shape
[
1
]
*
2
,
is_test
=
is_test
,
name
=
"stage.{}.downsample"
.
format
(
i
))
index
+=
1
return
blocks
[
-
1
:
-
4
:
-
1
]
return
blocks
[
-
1
:
-
4
:
-
1
]
fluid/PaddleCV/yolov3/models/yolov3.py
浏览文件 @
8152934d
...
@@ -62,8 +62,6 @@ class YOLOv3(object):
...
@@ -62,8 +62,6 @@ class YOLOv3(object):
self
.
outputs
=
[]
self
.
outputs
=
[]
self
.
losses
=
[]
self
.
losses
=
[]
self
.
downsample
=
32
self
.
downsample
=
32
self
.
ignore_thresh
=
.
7
self
.
class_num
=
80
def
build_input
(
self
):
def
build_input
(
self
):
self
.
image_shape
=
[
3
,
cfg
.
input_size
,
cfg
.
input_size
]
self
.
image_shape
=
[
3
,
cfg
.
input_size
,
cfg
.
input_size
]
...
@@ -132,16 +130,8 @@ class YOLOv3(object):
...
@@ -132,16 +130,8 @@ class YOLOv3(object):
route
=
upsample
(
route
)
route
=
upsample
(
route
)
anchor_mask
=
[
6
,
7
,
8
,
3
,
4
,
5
,
0
,
1
,
2
]
for
i
,
out
in
enumerate
(
self
.
outputs
):
anchors
=
[
10
,
13
,
16
,
30
,
33
,
23
,
30
,
61
,
62
,
45
,
59
,
119
,
116
,
90
,
156
,
198
,
373
,
326
]
anchor_mask
=
cfg
.
anchor_masks
[
i
]
for
i
,
out
in
enumerate
(
self
.
outputs
):
mask
=
anchor_mask
[
i
*
3
:
(
i
+
1
)
*
3
]
mask_anchors
=
[]
for
m
in
mask
:
mask_anchors
.
append
(
anchors
[
2
*
m
])
mask_anchors
.
append
(
anchors
[
2
*
m
+
1
])
class_num
=
int
(
self
.
class_num
)
if
self
.
is_train
:
if
self
.
is_train
:
ignore_thresh
=
float
(
self
.
ignore_thresh
)
ignore_thresh
=
float
(
self
.
ignore_thresh
)
...
@@ -150,20 +140,24 @@ class YOLOv3(object):
...
@@ -150,20 +140,24 @@ class YOLOv3(object):
gtbox
=
self
.
gtbox
,
gtbox
=
self
.
gtbox
,
gtlabel
=
self
.
gtlabel
,
gtlabel
=
self
.
gtlabel
,
gtscore
=
self
.
gtscore
,
gtscore
=
self
.
gtscore
,
anchors
=
anchors
,
anchors
=
cfg
.
anchors
,
anchor_mask
=
mask
,
anchor_mask
=
anchor_
mask
,
class_num
=
class_num
,
class_num
=
c
fg
.
c
lass_num
,
ignore_thresh
=
ignore_thresh
,
ignore_thresh
=
cfg
.
ignore_thresh
,
downsample_ratio
=
self
.
downsample
,
downsample_ratio
=
self
.
downsample
,
use_label_smooth
=
cfg
.
label_smooth
,
use_label_smooth
=
cfg
.
label_smooth
,
name
=
"yolo_loss"
+
str
(
i
))
name
=
"yolo_loss"
+
str
(
i
))
self
.
losses
.
append
(
fluid
.
layers
.
reduce_mean
(
loss
))
self
.
losses
.
append
(
fluid
.
layers
.
reduce_mean
(
loss
))
else
:
else
:
mask_anchors
=
[]
for
m
in
anchor_mask
:
mask_anchors
.
append
(
cfg
.
anchors
[
2
*
m
])
mask_anchors
.
append
(
cfg
.
anchors
[
2
*
m
+
1
])
boxes
,
scores
=
fluid
.
layers
.
yolo_box
(
boxes
,
scores
=
fluid
.
layers
.
yolo_box
(
x
=
out
,
x
=
out
,
img_size
=
self
.
im_shape
,
img_size
=
self
.
im_shape
,
anchors
=
mask_anchors
,
anchors
=
mask_anchors
,
class_num
=
class_num
,
class_num
=
c
fg
.
c
lass_num
,
conf_thresh
=
cfg
.
valid_thresh
,
conf_thresh
=
cfg
.
valid_thresh
,
downsample_ratio
=
self
.
downsample
,
downsample_ratio
=
self
.
downsample
,
name
=
"yolo_box"
+
str
(
i
))
name
=
"yolo_box"
+
str
(
i
))
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录