Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
wangsen
paddle_dbnet
Commits
c0b4cefd
Commit
c0b4cefd
authored
Dec 09, 2020
by
LDOUBLEV
Browse files
fix comments and transform to transforms
parent
5f2f08a0
Changes
7
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
13 additions
and
8 deletions
+13
-8
configs/det/ch_ppocr_v1.1/ch_det_mv3_db.yml
configs/det/ch_ppocr_v1.1/ch_det_mv3_db.yml
+0
-0
configs/det/ch_ppocr_v1.1/ch_det_res18_db.yml
configs/det/ch_ppocr_v1.1/ch_det_res18_db.yml
+1
-1
ppocr/modeling/architectures/base_model.py
ppocr/modeling/architectures/base_model.py
+1
-1
ppocr/modeling/backbones/det_mobilenet_v3.py
ppocr/modeling/backbones/det_mobilenet_v3.py
+3
-2
ppocr/modeling/transforms/__init__.py
ppocr/modeling/transforms/__init__.py
+0
-0
ppocr/modeling/transforms/tps.py
ppocr/modeling/transforms/tps.py
+0
-0
ppocr/postprocess/db_postprocess.py
ppocr/postprocess/db_postprocess.py
+8
-4
No files found.
configs/det/ch_det_mv3_db.yml
→
configs/det/ch_
ppocr_v1.1/ch_
det_mv3_db.yml
View file @
c0b4cefd
File moved
configs/det/ch_det_res18_db.yml
→
configs/det/ch_
ppocr_v1.1/ch_
det_res18_db.yml
View file @
c0b4cefd
...
...
@@ -10,7 +10,7 @@ Global:
# if pretrained_model is saved in static mode, load_static_weights must set to True
load_static_weights
:
True
cal_metric_during_train
:
False
pretrained_model
:
./pretrain_models/
MobileNetV3_large_x0_5
_pretrained
pretrained_model
:
./pretrain_models/
ResNet18_vd
_pretrained
checkpoints
:
#./output/det_db_0.001_DiceLoss_256_pp_config_2.0b_4gpu/best_accuracy
save_inference_dir
:
use_visualdl
:
False
...
...
ppocr/modeling/architectures/base_model.py
View file @
c0b4cefd
...
...
@@ -16,7 +16,7 @@ from __future__ import division
from
__future__
import
print_function
from
paddle
import
nn
from
ppocr.modeling.transform
import
build_transform
from
ppocr.modeling.transform
s
import
build_transform
from
ppocr.modeling.backbones
import
build_backbone
from
ppocr.modeling.necks
import
build_neck
from
ppocr.modeling.heads
import
build_head
...
...
ppocr/modeling/backbones/det_mobilenet_v3.py
View file @
c0b4cefd
...
...
@@ -111,6 +111,7 @@ class MobileNetV3(nn.Layer):
i
=
0
inplanes
=
make_divisible
(
inplanes
*
scale
)
for
(
k
,
exp
,
c
,
se
,
nl
,
s
)
in
cfg
:
se
=
se
and
not
self
.
disable_se
if
s
==
2
and
i
>
2
:
self
.
out_channels
.
append
(
inplanes
)
self
.
stages
.
append
(
nn
.
Sequential
(
*
block_list
))
...
...
@@ -231,7 +232,7 @@ class ResidualUnit(nn.Layer):
if_act
=
True
,
act
=
act
,
name
=
name
+
"_depthwise"
)
if
self
.
if_se
and
not
self
.
disable_se
:
if
self
.
if_se
:
self
.
mid_se
=
SEModule
(
mid_channels
,
name
=
name
+
"_se"
)
self
.
linear_conv
=
ConvBNLayer
(
in_channels
=
mid_channels
,
...
...
@@ -246,7 +247,7 @@ class ResidualUnit(nn.Layer):
def
forward
(
self
,
inputs
):
x
=
self
.
expand_conv
(
inputs
)
x
=
self
.
bottleneck_conv
(
x
)
if
self
.
if_se
and
not
self
.
disable_se
:
if
self
.
if_se
:
x
=
self
.
mid_se
(
x
)
x
=
self
.
linear_conv
(
x
)
if
self
.
if_shortcut
:
...
...
ppocr/modeling/transform/__init__.py
→
ppocr/modeling/transform
s
/__init__.py
View file @
c0b4cefd
File moved
ppocr/modeling/transform/tps.py
→
ppocr/modeling/transform
s
/tps.py
View file @
c0b4cefd
File moved
ppocr/postprocess/db_postprocess.py
View file @
c0b4cefd
...
...
@@ -33,13 +33,14 @@ class DBPostProcess(object):
box_thresh
=
0.7
,
max_candidates
=
1000
,
unclip_ratio
=
2.0
,
use_dilation
=
False
,
**
kwargs
):
self
.
thresh
=
thresh
self
.
box_thresh
=
box_thresh
self
.
max_candidates
=
max_candidates
self
.
unclip_ratio
=
unclip_ratio
self
.
min_size
=
3
self
.
dilation_kernel
=
np
.
array
(
[[
1
,
1
],
[
1
,
1
]]
)
self
.
dilation_kernel
=
None
if
not
use_dilation
else
[[
1
,
1
],
[
1
,
1
]]
def
boxes_from_bitmap
(
self
,
pred
,
_bitmap
,
dest_width
,
dest_height
):
'''
...
...
@@ -140,9 +141,12 @@ class DBPostProcess(object):
boxes_batch
=
[]
for
batch_index
in
range
(
pred
.
shape
[
0
]):
height
,
width
=
shape_list
[
batch_index
]
if
self
.
dilation_kernel
is
not
None
:
mask
=
cv2
.
dilate
(
np
.
array
(
segmentation
[
batch_index
]).
astype
(
np
.
uint8
),
self
.
dilation_kernel
)
else
:
mask
=
segmentation
[
batch_index
]
boxes
,
scores
=
self
.
boxes_from_bitmap
(
pred
[
batch_index
],
mask
,
width
,
height
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment