Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
PaddleHub
提交
790860aa
P
PaddleHub
项目概览
PaddlePaddle
/
PaddleHub
大约 1 年 前同步成功
通知
282
Star
12117
Fork
2091
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
200
列表
看板
标记
里程碑
合并请求
4
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
P
PaddleHub
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
200
Issue
200
列表
看板
标记
里程碑
合并请求
4
合并请求
4
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
790860aa
编写于
4月 28, 2020
作者:
W
wuzewu
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Remove redundant code
上级
54638fd6
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
31 addition
and
78 deletion
+31
-78
paddlehub/common/detection_config.py
paddlehub/common/detection_config.py
+31
-78
未找到文件。
paddlehub/common/detection_config.py
浏览文件 @
790860aa
...
...
@@ -13,7 +13,6 @@
# See the License for the specific language governing permissions and
# limitations under the License.
conf
=
{
"ssd"
:
{
"with_background"
:
True
,
...
...
@@ -65,7 +64,9 @@ ssd_train_ops = [
dict
(
op
=
'ArrangeSSD'
)
]
ssd_eval_fields
=
[
'image'
,
'im_shape'
,
'im_id'
,
'gt_box'
,
'gt_label'
,
'is_difficult'
]
ssd_eval_fields
=
[
'image'
,
'im_shape'
,
'im_id'
,
'gt_box'
,
'gt_label'
,
'is_difficult'
]
ssd_eval_ops
=
[
dict
(
op
=
'DecodeImage'
,
to_rgb
=
True
,
with_mixup
=
False
),
dict
(
op
=
'NormalizeBox'
),
...
...
@@ -139,9 +140,10 @@ yolo_train_ops = [
dict
(
op
=
'RandomCrop'
),
dict
(
op
=
'RandomFlipImage'
,
is_normalized
=
False
),
dict
(
op
=
'Resize'
,
target_dim
=
608
,
interp
=
'random'
),
dict
(
op
=
'NormalizePermute'
,
mean
=
[
123.675
,
116.28
,
103.53
],
std
=
[
58.395
,
57.120
,
57.375
]),
dict
(
op
=
'NormalizePermute'
,
mean
=
[
123.675
,
116.28
,
103.53
],
std
=
[
58.395
,
57.120
,
57.375
]),
dict
(
op
=
'NormalizeBox'
),
dict
(
op
=
'ArrangeYOLO'
),
]
...
...
@@ -194,18 +196,28 @@ feed_config = {
},
"rcnn"
:
{
"train"
:
{
"fields"
:
[
'image'
,
'im_info'
,
'im_id'
,
'gt_box'
,
'gt_label'
,
'is_crowd'
],
"OPS"
:
rcnn_train_ops
,
"IS_PADDING"
:
True
,
"COARSEST_STRIDE"
:
32
,
"fields"
:
[
'image'
,
'im_info'
,
'im_id'
,
'gt_box'
,
'gt_label'
,
'is_crowd'
],
"OPS"
:
rcnn_train_ops
,
"IS_PADDING"
:
True
,
"COARSEST_STRIDE"
:
32
,
},
"dev"
:
{
"fields"
:
[
'image'
,
'im_info'
,
'im_id'
,
'im_shape'
,
'gt_box'
,
'gt_label'
,
'is_difficult'
],
"OPS"
:
rcnn_eval_ops
,
"IS_PADDING"
:
True
,
"COARSEST_STRIDE"
:
32
,
"USE_PADDED_IM_INFO"
:
True
,
"fields"
:
[
'image'
,
'im_info'
,
'im_id'
,
'im_shape'
,
'gt_box'
,
'gt_label'
,
'is_difficult'
],
"OPS"
:
rcnn_eval_ops
,
"IS_PADDING"
:
True
,
"COARSEST_STRIDE"
:
32
,
"USE_PADDED_IM_INFO"
:
True
,
},
"predict"
:
{
"fields"
:
[
'image'
,
'im_info'
,
'im_id'
,
'im_shape'
],
...
...
@@ -222,8 +234,10 @@ feed_config = {
"RANDOM_SHAPES"
:
[
320
,
352
,
384
,
416
,
448
,
480
,
512
,
544
,
576
,
608
]
},
"dev"
:
{
"fields"
:
[
'image'
,
'im_size'
,
'im_id'
,
'gt_box'
,
'gt_label'
,
'is_difficult'
],
"OPS"
:
yolo_eval_ops
,
"fields"
:
[
'image'
,
'im_size'
,
'im_id'
,
'gt_box'
,
'gt_label'
,
'is_difficult'
],
"OPS"
:
yolo_eval_ops
,
},
"predict"
:
{
"fields"
:
[
'image'
,
'im_size'
,
'im_id'
],
...
...
@@ -231,64 +245,3 @@ feed_config = {
},
},
}
def
get_model_type
(
module_name
):
if
'yolo'
in
module_name
:
return
'yolo'
elif
'ssd'
in
module_name
:
return
'ssd'
elif
'rcnn'
in
module_name
:
return
'rcnn'
else
:
raise
ValueError
(
"module {} not supported"
.
format
(
module_name
))
def
get_feed_list
(
module_name
,
input_dict
,
input_dict_pred
=
None
):
pred_feed_list
=
None
if
'yolo'
in
module_name
:
img
=
input_dict
[
"image"
]
im_size
=
input_dict
[
"im_size"
]
feed_list
=
[
img
.
name
,
im_size
.
name
]
elif
'ssd'
in
module_name
:
image
=
input_dict
[
"image"
]
# image_shape = input_dict["im_shape"]
image_shape
=
input_dict
[
"im_size"
]
feed_list
=
[
image
.
name
,
image_shape
.
name
]
elif
'rcnn'
in
module_name
:
image
=
input_dict
[
'image'
]
im_info
=
input_dict
[
'im_info'
]
gt_bbox
=
input_dict
[
'gt_bbox'
]
gt_class
=
input_dict
[
'gt_class'
]
is_crowd
=
input_dict
[
'is_crowd'
]
feed_list
=
[
image
.
name
,
im_info
.
name
,
gt_bbox
.
name
,
gt_class
.
name
,
is_crowd
.
name
]
assert
input_dict_pred
is
not
None
image
=
input_dict_pred
[
'image'
]
im_info
=
input_dict_pred
[
'im_info'
]
im_shape
=
input_dict
[
'im_shape'
]
pred_feed_list
=
[
image
.
name
,
im_info
.
name
,
im_shape
.
name
]
else
:
raise
NotImplementedError
return
feed_list
,
pred_feed_list
def
get_mid_feature
(
module_name
,
output_dict
,
output_dict_pred
=
None
):
feature_pred
=
None
if
'yolo'
in
module_name
:
feature
=
output_dict
[
'head_features'
]
elif
'ssd'
in
module_name
:
feature
=
output_dict
[
'body_features'
]
elif
'rcnn'
in
module_name
:
head_feat
=
output_dict
[
'head_feat'
]
rpn_cls_loss
=
output_dict
[
'rpn_cls_loss'
]
rpn_reg_loss
=
output_dict
[
'rpn_reg_loss'
]
generate_proposal_labels
=
output_dict
[
'generate_proposal_labels'
]
feature
=
[
head_feat
,
rpn_cls_loss
,
rpn_reg_loss
,
generate_proposal_labels
]
assert
output_dict_pred
is
not
None
head_feat
=
output_dict_pred
[
'head_feat'
]
rois
=
output_dict_pred
[
'rois'
]
feature_pred
=
[
head_feat
,
rois
]
else
:
raise
NotImplementedError
return
feature
,
feature_pred
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录