Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
PaddleHub
提交
3fbf8b4c
P
PaddleHub
项目概览
PaddlePaddle
/
PaddleHub
大约 2 年 前同步成功
通知
285
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看板
提交
3fbf8b4c
编写于
5月 28, 2020
作者:
W
wuzewu
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Fixed the bug where multiple call contexts caused parameter names to alternate in retinanet module
上级
abc05deb
变更
1
显示空白变更内容
内联
并排
Showing
1 changed file
with
93 addition
and
87 deletion
+93
-87
hub_module/modules/image/object_detection/retinanet_resnet50_fpn_coco2017/module.py
...bject_detection/retinanet_resnet50_fpn_coco2017/module.py
+93
-87
未找到文件。
hub_module/modules/image/object_detection/retinanet_resnet50_fpn_coco2017/module.py
浏览文件 @
3fbf8b4c
...
...
@@ -69,7 +69,7 @@ class RetinaNetResNet50FPN(hub.Module):
num_classes
=
81
,
trainable
=
True
,
pretrained
=
True
,
get_prediction
=
False
):
phase
=
'train'
):
"""
Distill the Head Features, so as to perform transfer learning.
...
...
@@ -77,7 +77,7 @@ class RetinaNetResNet50FPN(hub.Module):
num_classes (int): number of classes.
trainable (bool): whether to set parameters trainable.
pretrained (bool): whether to load default pretrained model.
get_prediction (bool): whether to get prediction
.
phase (str): optional choices are 'train' and 'predict'
.
Returns:
inputs(dict): the input variables.
...
...
@@ -87,6 +87,7 @@ class RetinaNetResNet50FPN(hub.Module):
context_prog
=
fluid
.
Program
()
startup_program
=
fluid
.
Program
()
with
fluid
.
program_guard
(
context_prog
,
startup_program
):
with
fluid
.
unique_name
.
guard
():
var_prefix
=
'@HUB_{}@'
.
format
(
self
.
name
)
# image
image
=
fluid
.
layers
.
data
(
...
...
@@ -139,14 +140,16 @@ class RetinaNetResNet50FPN(hub.Module):
'image'
:
var_prefix
+
image
.
name
,
'im_info'
:
var_prefix
+
im_info
.
name
}
if
get_prediction
:
if
phase
==
'predict'
:
pred
=
retina_head
.
get_prediction
(
body_feats
,
spatial_scale
,
im_info
)
outputs
=
{
'bbox_out'
:
var_prefix
+
pred
.
name
}
else
:
outputs
=
{
'body_features'
:
[
var_prefix
+
var
.
name
for
key
,
var
in
body_feats
.
items
()]
'body_features'
:
[
var_prefix
+
var
.
name
for
key
,
var
in
body_feats
.
items
()
]
}
# add_vars_prefix
...
...
@@ -154,7 +157,10 @@ class RetinaNetResNet50FPN(hub.Module):
add_vars_prefix
(
fluid
.
default_startup_program
(),
var_prefix
)
global_vars
=
context_prog
.
global_block
().
vars
inputs
=
{
key
:
global_vars
[
value
]
for
key
,
value
in
inputs
.
items
()}
inputs
=
{
key
:
global_vars
[
value
]
for
key
,
value
in
inputs
.
items
()
}
outputs
=
{
key
:
global_vars
[
value
]
if
not
isinstance
(
value
,
list
)
else
[
global_vars
[
var
]
for
var
in
value
]
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录