Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
PaddleOCR
提交
67ae525e
P
PaddleOCR
项目概览
PaddlePaddle
/
PaddleOCR
1 年多 前同步成功
通知
1535
Star
32963
Fork
6643
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
108
列表
看板
标记
里程碑
合并请求
7
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
P
PaddleOCR
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
108
Issue
108
列表
看板
标记
里程碑
合并请求
7
合并请求
7
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
67ae525e
编写于
10月 10, 2022
作者:
z37757
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
删除backbone里的pretrained_model字段
上级
03802c7f
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
1 addition
and
32 deletion
+1
-32
configs/det/det_r50_drrg_ctw.yml
configs/det/det_r50_drrg_ctw.yml
+1
-3
ppocr/modeling/backbones/det_resnet_vd.py
ppocr/modeling/backbones/det_resnet_vd.py
+0
-29
未找到文件。
configs/det/det_r50_drrg_ctw.yml
浏览文件 @
67ae525e
...
...
@@ -8,7 +8,7 @@ Global:
# evaluation is run every 1260 iterations
eval_batch_step
:
[
37800
,
1260
]
cal_metric_during_train
:
False
pretrained_model
:
pretrained_model
:
./pretrain_models/ResNet50_vd_ssld_pretrained.pdparams
checkpoints
:
save_inference_dir
:
use_visualdl
:
False
...
...
@@ -23,8 +23,6 @@ Architecture:
Backbone
:
name
:
ResNet_vd
layers
:
50
pretrained_model
:
./pretrain_models/ResNet50_vd_ssld_pretrained.pdparams
Neck
:
name
:
FPN_UNet
in_channels
:
[
256
,
512
,
1024
,
2048
]
...
...
ppocr/modeling/backbones/det_resnet_vd.py
浏览文件 @
67ae525e
...
...
@@ -16,8 +16,6 @@ from __future__ import absolute_import
from
__future__
import
division
from
__future__
import
print_function
import
os
import
paddle
from
paddle
import
ParamAttr
import
paddle.nn
as
nn
...
...
@@ -27,8 +25,6 @@ from paddle.vision.ops import DeformConv2D
from
paddle.regularizer
import
L2Decay
from
paddle.nn.initializer
import
Normal
,
Constant
,
XavierUniform
from
ppocr.utils.logging
import
get_logger
__all__
=
[
"ResNet_vd"
,
"ConvBNLayer"
,
"DeformableConvV2"
]
...
...
@@ -250,7 +246,6 @@ class ResNet_vd(nn.Layer):
layers
=
50
,
dcn_stage
=
None
,
out_indices
=
None
,
pretrained_model
=
None
,
**
kwargs
):
super
(
ResNet_vd
,
self
).
__init__
()
...
...
@@ -344,30 +339,6 @@ class ResNet_vd(nn.Layer):
self
.
out_channels
.
append
(
num_filters
[
block
])
self
.
stages
.
append
(
nn
.
Sequential
(
*
block_list
))
if
pretrained_model
is
not
None
:
self
.
load_pretrained_params
(
pretrained_model
)
def
load_pretrained_params
(
self
,
path
):
logger
=
get_logger
()
if
path
.
endswith
(
'.pdparams'
):
path
=
path
.
replace
(
'.pdparams'
,
''
)
assert
os
.
path
.
exists
(
path
+
".pdparams"
),
\
"The {}.pdparams does not exists!"
.
format
(
path
)
params
=
paddle
.
load
(
path
+
'.pdparams'
)
state_dict
=
self
.
state_dict
()
new_state_dict
=
{}
for
k1
,
k2
in
zip
(
state_dict
.
keys
(),
params
.
keys
()):
if
list
(
state_dict
[
k1
].
shape
)
==
list
(
params
[
k2
].
shape
):
new_state_dict
[
k1
]
=
params
[
k2
]
else
:
logger
.
info
(
f
"The shape of model params
{
k1
}
{
state_dict
[
k1
].
shape
}
not matched with loaded params
{
k2
}
{
params
[
k2
].
shape
}
!"
)
self
.
set_state_dict
(
new_state_dict
)
logger
.
info
(
f
"loaded backbone pretrained_model successful from
{
path
}
"
)
def
forward
(
self
,
inputs
):
y
=
self
.
conv1_1
(
inputs
)
y
=
self
.
conv1_2
(
y
)
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录