Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
weixin_41840029
PaddleOCR
提交
5a5d627d
P
PaddleOCR
项目概览
weixin_41840029
/
PaddleOCR
与 Fork 源项目一致
Fork自
PaddlePaddle / PaddleOCR
通知
1
Star
1
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
P
PaddleOCR
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
未验证
提交
5a5d627d
编写于
1月 26, 2021
作者:
Z
zhoujun
提交者:
GitHub
1月 26, 2021
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #1829 from PaddlePaddle/revert-1827-dyg/fix_mv3
Revert "fix mv3 to adapt to paddle2.0"
上级
95ad4d10
493027d3
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
42 addition
and
43 deletion
+42
-43
ppocr/modeling/backbones/det_mobilenet_v3.py
ppocr/modeling/backbones/det_mobilenet_v3.py
+23
-24
ppocr/modeling/backbones/rec_mobilenet_v3.py
ppocr/modeling/backbones/rec_mobilenet_v3.py
+19
-19
未找到文件。
ppocr/modeling/backbones/det_mobilenet_v3.py
浏览文件 @
5a5d627d
...
@@ -58,15 +58,15 @@ class MobileNetV3(nn.Layer):
...
@@ -58,15 +58,15 @@ class MobileNetV3(nn.Layer):
[
5
,
72
,
40
,
True
,
'relu'
,
2
],
[
5
,
72
,
40
,
True
,
'relu'
,
2
],
[
5
,
120
,
40
,
True
,
'relu'
,
1
],
[
5
,
120
,
40
,
True
,
'relu'
,
1
],
[
5
,
120
,
40
,
True
,
'relu'
,
1
],
[
5
,
120
,
40
,
True
,
'relu'
,
1
],
[
3
,
240
,
80
,
False
,
'hardswish'
,
2
],
[
3
,
240
,
80
,
False
,
'hard
_
swish'
,
2
],
[
3
,
200
,
80
,
False
,
'hardswish'
,
1
],
[
3
,
200
,
80
,
False
,
'hard
_
swish'
,
1
],
[
3
,
184
,
80
,
False
,
'hardswish'
,
1
],
[
3
,
184
,
80
,
False
,
'hard
_
swish'
,
1
],
[
3
,
184
,
80
,
False
,
'hardswish'
,
1
],
[
3
,
184
,
80
,
False
,
'hard
_
swish'
,
1
],
[
3
,
480
,
112
,
True
,
'hardswish'
,
1
],
[
3
,
480
,
112
,
True
,
'hard
_
swish'
,
1
],
[
3
,
672
,
112
,
True
,
'hardswish'
,
1
],
[
3
,
672
,
112
,
True
,
'hard
_
swish'
,
1
],
[
5
,
672
,
160
,
True
,
'hardswish'
,
2
],
[
5
,
672
,
160
,
True
,
'hard
_
swish'
,
2
],
[
5
,
960
,
160
,
True
,
'hardswish'
,
1
],
[
5
,
960
,
160
,
True
,
'hard
_
swish'
,
1
],
[
5
,
960
,
160
,
True
,
'hardswish'
,
1
],
[
5
,
960
,
160
,
True
,
'hard
_
swish'
,
1
],
]
]
cls_ch_squeeze
=
960
cls_ch_squeeze
=
960
elif
model_name
==
"small"
:
elif
model_name
==
"small"
:
...
@@ -75,14 +75,14 @@ class MobileNetV3(nn.Layer):
...
@@ -75,14 +75,14 @@ class MobileNetV3(nn.Layer):
[
3
,
16
,
16
,
True
,
'relu'
,
2
],
[
3
,
16
,
16
,
True
,
'relu'
,
2
],
[
3
,
72
,
24
,
False
,
'relu'
,
2
],
[
3
,
72
,
24
,
False
,
'relu'
,
2
],
[
3
,
88
,
24
,
False
,
'relu'
,
1
],
[
3
,
88
,
24
,
False
,
'relu'
,
1
],
[
5
,
96
,
40
,
True
,
'hardswish'
,
2
],
[
5
,
96
,
40
,
True
,
'hard
_
swish'
,
2
],
[
5
,
240
,
40
,
True
,
'hardswish'
,
1
],
[
5
,
240
,
40
,
True
,
'hard
_
swish'
,
1
],
[
5
,
240
,
40
,
True
,
'hardswish'
,
1
],
[
5
,
240
,
40
,
True
,
'hard
_
swish'
,
1
],
[
5
,
120
,
48
,
True
,
'hardswish'
,
1
],
[
5
,
120
,
48
,
True
,
'hard
_
swish'
,
1
],
[
5
,
144
,
48
,
True
,
'hardswish'
,
1
],
[
5
,
144
,
48
,
True
,
'hard
_
swish'
,
1
],
[
5
,
288
,
96
,
True
,
'hardswish'
,
2
],
[
5
,
288
,
96
,
True
,
'hard
_
swish'
,
2
],
[
5
,
576
,
96
,
True
,
'hardswish'
,
1
],
[
5
,
576
,
96
,
True
,
'hard
_
swish'
,
1
],
[
5
,
576
,
96
,
True
,
'hardswish'
,
1
],
[
5
,
576
,
96
,
True
,
'hard
_
swish'
,
1
],
]
]
cls_ch_squeeze
=
576
cls_ch_squeeze
=
576
else
:
else
:
...
@@ -102,7 +102,7 @@ class MobileNetV3(nn.Layer):
...
@@ -102,7 +102,7 @@ class MobileNetV3(nn.Layer):
padding
=
1
,
padding
=
1
,
groups
=
1
,
groups
=
1
,
if_act
=
True
,
if_act
=
True
,
act
=
'hardswish'
,
act
=
'hard
_
swish'
,
name
=
'conv1'
)
name
=
'conv1'
)
self
.
stages
=
[]
self
.
stages
=
[]
...
@@ -137,7 +137,7 @@ class MobileNetV3(nn.Layer):
...
@@ -137,7 +137,7 @@ class MobileNetV3(nn.Layer):
padding
=
0
,
padding
=
0
,
groups
=
1
,
groups
=
1
,
if_act
=
True
,
if_act
=
True
,
act
=
'hardswish'
,
act
=
'hard
_
swish'
,
name
=
'conv_last'
))
name
=
'conv_last'
))
self
.
stages
.
append
(
nn
.
Sequential
(
*
block_list
))
self
.
stages
.
append
(
nn
.
Sequential
(
*
block_list
))
self
.
out_channels
.
append
(
make_divisible
(
scale
*
cls_ch_squeeze
))
self
.
out_channels
.
append
(
make_divisible
(
scale
*
cls_ch_squeeze
))
...
@@ -191,11 +191,10 @@ class ConvBNLayer(nn.Layer):
...
@@ -191,11 +191,10 @@ class ConvBNLayer(nn.Layer):
if
self
.
if_act
:
if
self
.
if_act
:
if
self
.
act
==
"relu"
:
if
self
.
act
==
"relu"
:
x
=
F
.
relu
(
x
)
x
=
F
.
relu
(
x
)
elif
self
.
act
==
"hardswish"
:
elif
self
.
act
==
"hard
_
swish"
:
x
=
F
.
hard
swish
(
x
)
x
=
F
.
activation
.
hard_
swish
(
x
)
else
:
else
:
print
(
"The activation function({}) is selected incorrectly."
.
print
(
"The activation function is selected incorrectly."
)
format
(
self
.
act
))
exit
()
exit
()
return
x
return
x
...
@@ -282,5 +281,5 @@ class SEModule(nn.Layer):
...
@@ -282,5 +281,5 @@ class SEModule(nn.Layer):
outputs
=
self
.
conv1
(
outputs
)
outputs
=
self
.
conv1
(
outputs
)
outputs
=
F
.
relu
(
outputs
)
outputs
=
F
.
relu
(
outputs
)
outputs
=
self
.
conv2
(
outputs
)
outputs
=
self
.
conv2
(
outputs
)
outputs
=
F
.
hardsigmoid
(
outputs
,
slope
=
0.2
,
offset
=
0.5
)
outputs
=
F
.
activation
.
hard_sigmoid
(
outputs
)
return
inputs
*
outputs
return
inputs
*
outputs
ppocr/modeling/backbones/rec_mobilenet_v3.py
浏览文件 @
5a5d627d
...
@@ -51,15 +51,15 @@ class MobileNetV3(nn.Layer):
...
@@ -51,15 +51,15 @@ class MobileNetV3(nn.Layer):
[
5
,
72
,
40
,
True
,
'relu'
,
(
large_stride
[
2
],
1
)],
[
5
,
72
,
40
,
True
,
'relu'
,
(
large_stride
[
2
],
1
)],
[
5
,
120
,
40
,
True
,
'relu'
,
1
],
[
5
,
120
,
40
,
True
,
'relu'
,
1
],
[
5
,
120
,
40
,
True
,
'relu'
,
1
],
[
5
,
120
,
40
,
True
,
'relu'
,
1
],
[
3
,
240
,
80
,
False
,
'hardswish'
,
1
],
[
3
,
240
,
80
,
False
,
'hard
_
swish'
,
1
],
[
3
,
200
,
80
,
False
,
'hardswish'
,
1
],
[
3
,
200
,
80
,
False
,
'hard
_
swish'
,
1
],
[
3
,
184
,
80
,
False
,
'hardswish'
,
1
],
[
3
,
184
,
80
,
False
,
'hard
_
swish'
,
1
],
[
3
,
184
,
80
,
False
,
'hardswish'
,
1
],
[
3
,
184
,
80
,
False
,
'hard
_
swish'
,
1
],
[
3
,
480
,
112
,
True
,
'hardswish'
,
1
],
[
3
,
480
,
112
,
True
,
'hard
_
swish'
,
1
],
[
3
,
672
,
112
,
True
,
'hardswish'
,
1
],
[
3
,
672
,
112
,
True
,
'hard
_
swish'
,
1
],
[
5
,
672
,
160
,
True
,
'hardswish'
,
(
large_stride
[
3
],
1
)],
[
5
,
672
,
160
,
True
,
'hard
_
swish'
,
(
large_stride
[
3
],
1
)],
[
5
,
960
,
160
,
True
,
'hardswish'
,
1
],
[
5
,
960
,
160
,
True
,
'hard
_
swish'
,
1
],
[
5
,
960
,
160
,
True
,
'hardswish'
,
1
],
[
5
,
960
,
160
,
True
,
'hard
_
swish'
,
1
],
]
]
cls_ch_squeeze
=
960
cls_ch_squeeze
=
960
elif
model_name
==
"small"
:
elif
model_name
==
"small"
:
...
@@ -68,14 +68,14 @@ class MobileNetV3(nn.Layer):
...
@@ -68,14 +68,14 @@ class MobileNetV3(nn.Layer):
[
3
,
16
,
16
,
True
,
'relu'
,
(
small_stride
[
0
],
1
)],
[
3
,
16
,
16
,
True
,
'relu'
,
(
small_stride
[
0
],
1
)],
[
3
,
72
,
24
,
False
,
'relu'
,
(
small_stride
[
1
],
1
)],
[
3
,
72
,
24
,
False
,
'relu'
,
(
small_stride
[
1
],
1
)],
[
3
,
88
,
24
,
False
,
'relu'
,
1
],
[
3
,
88
,
24
,
False
,
'relu'
,
1
],
[
5
,
96
,
40
,
True
,
'hardswish'
,
(
small_stride
[
2
],
1
)],
[
5
,
96
,
40
,
True
,
'hard
_
swish'
,
(
small_stride
[
2
],
1
)],
[
5
,
240
,
40
,
True
,
'hardswish'
,
1
],
[
5
,
240
,
40
,
True
,
'hard
_
swish'
,
1
],
[
5
,
240
,
40
,
True
,
'hardswish'
,
1
],
[
5
,
240
,
40
,
True
,
'hard
_
swish'
,
1
],
[
5
,
120
,
48
,
True
,
'hardswish'
,
1
],
[
5
,
120
,
48
,
True
,
'hard
_
swish'
,
1
],
[
5
,
144
,
48
,
True
,
'hardswish'
,
1
],
[
5
,
144
,
48
,
True
,
'hard
_
swish'
,
1
],
[
5
,
288
,
96
,
True
,
'hardswish'
,
(
small_stride
[
3
],
1
)],
[
5
,
288
,
96
,
True
,
'hard
_
swish'
,
(
small_stride
[
3
],
1
)],
[
5
,
576
,
96
,
True
,
'hardswish'
,
1
],
[
5
,
576
,
96
,
True
,
'hard
_
swish'
,
1
],
[
5
,
576
,
96
,
True
,
'hardswish'
,
1
],
[
5
,
576
,
96
,
True
,
'hard
_
swish'
,
1
],
]
]
cls_ch_squeeze
=
576
cls_ch_squeeze
=
576
else
:
else
:
...
@@ -96,7 +96,7 @@ class MobileNetV3(nn.Layer):
...
@@ -96,7 +96,7 @@ class MobileNetV3(nn.Layer):
padding
=
1
,
padding
=
1
,
groups
=
1
,
groups
=
1
,
if_act
=
True
,
if_act
=
True
,
act
=
'hardswish'
,
act
=
'hard
_
swish'
,
name
=
'conv1'
)
name
=
'conv1'
)
i
=
0
i
=
0
block_list
=
[]
block_list
=
[]
...
@@ -124,7 +124,7 @@ class MobileNetV3(nn.Layer):
...
@@ -124,7 +124,7 @@ class MobileNetV3(nn.Layer):
padding
=
0
,
padding
=
0
,
groups
=
1
,
groups
=
1
,
if_act
=
True
,
if_act
=
True
,
act
=
'hardswish'
,
act
=
'hard
_
swish'
,
name
=
'conv_last'
)
name
=
'conv_last'
)
self
.
pool
=
nn
.
MaxPool2D
(
kernel_size
=
2
,
stride
=
2
,
padding
=
0
)
self
.
pool
=
nn
.
MaxPool2D
(
kernel_size
=
2
,
stride
=
2
,
padding
=
0
)
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录