Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
PaddleClas
提交
670c2bfb
P
PaddleClas
项目概览
PaddlePaddle
/
PaddleClas
接近 2 年 前同步成功
通知
116
Star
4999
Fork
1114
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
19
列表
看板
标记
里程碑
合并请求
6
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
P
PaddleClas
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
19
Issue
19
列表
看板
标记
里程碑
合并请求
6
合并请求
6
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
未验证
提交
670c2bfb
编写于
5月 27, 2021
作者:
F
Felix
提交者:
GitHub
5月 27, 2021
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Update inception_v3.py
上级
96d3d5e4
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
31 addition
and
8 deletion
+31
-8
ppcls/arch/backbone/legendary_models/inception_v3.py
ppcls/arch/backbone/legendary_models/inception_v3.py
+31
-8
未找到文件。
ppcls/arch/backbone/legendary_models/inception_v3.py
浏览文件 @
670c2bfb
...
...
@@ -26,12 +26,16 @@ from paddle.nn.initializer import Uniform
import
math
from
ppcls.arch.backbone.base.theseus_layer
import
TheseusLayer
from
ppcls.utils.save_load
import
load_dygraph_pretrain
__all__
=
[
"InceptionV3"
]
# InceptionV3 config
# key: inception blocks
# value: conv num in different blocks
NET_CONFIG
=
{
'inception_a'
:[[
192
,
256
,
288
],
[
32
,
64
,
64
]],
'inception_a'
:[[
192
,
256
,
288
],
[
32
,
64
,
64
]],
'inception_b'
:[
288
],
'inception_c'
:[[
768
,
768
,
768
,
768
],
[
128
,
160
,
160
,
192
]],
'inception_d'
:[
768
],
...
...
@@ -39,11 +43,6 @@ NET_CONFIG = {
}
def
InceptionV3
(
**
kwargs
):
model
=
Inception_V3
(
NET_CONFIG
,
**
kwargs
)
return
model
class
ConvBNLayer
(
TheseusLayer
):
def
__init__
(
self
,
num_channels
,
...
...
@@ -158,7 +157,6 @@ class InceptionA(TheseusLayer):
branch3x3dbl
=
self
.
branch3x3dbl_3
(
branch3x3dbl
)
branch_pool
=
self
.
branch_pool
(
x
)
branch_pool
=
self
.
branch_pool_conv
(
branch_pool
)
outputs
=
paddle
.
concat
([
branch1x1
,
branch5x5
,
branch3x3dbl
,
branch_pool
],
axis
=
1
)
return
outputs
...
...
@@ -208,6 +206,8 @@ class InceptionC(TheseusLayer):
num_filters
=
192
,
filter_size
=
1
,
act
=
"relu"
)
self
.
branch7x7_1
=
ConvBNLayer
(
num_channels
=
num_channels
,
num_filters
=
channels_7x7
,
filter_size
=
1
,
...
...
@@ -396,7 +396,12 @@ class InceptionE(TheseusLayer):
class
Inception_V3
(
TheseusLayer
):
def
__init__
(
self
,
config
,
class_num
=
1000
,
**
kwargs
):
def
__init__
(
self
,
config
,
class_num
=
1000
,
pretrained
=
False
,
**
kwargs
):
super
(
Inception_V3
,
self
).
__init__
()
self
.
inception_a_list
=
config
[
'inception_a'
]
...
...
@@ -440,6 +445,9 @@ class Inception_V3(TheseusLayer):
initializer
=
Uniform
(
-
stdv
,
stdv
)),
bias_attr
=
ParamAttr
())
if
pretrained
is
not
None
:
load_dygraph_pretrain
(
self
,
pretrained
)
def
forward
(
self
,
x
):
y
=
self
.
inception_stem
(
x
)
for
inception_block
in
self
.
inception_block_list
:
...
...
@@ -451,3 +459,18 @@ class Inception_V3(TheseusLayer):
return
y
def
InceptionV3
(
**
kwargs
):
"""
InceptionV3
Args:
kwargs:
class_num: int=1000. Output dim of last fc layer.
pretrained:
Returns:
model: nn.Layer. Specific `InceptionV3` model
"""
model
=
Inception_V3
(
NET_CONFIG
,
**
kwargs
)
return
model
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录