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
81a42fee
"...en/git@developer.sourcefind.cn:OpenDAS/mmdetection3d.git" did not exist on "2dad86c23fed102e7bf107b41b13e9363d4704e4"
Commit
81a42fee
authored
Aug 03, 2021
by
WenmuZhou
Browse files
del use code
parent
aca8820f
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
23 deletions
+7
-23
ppocr/postprocess/pse_postprocess/pse_postprocess.py
ppocr/postprocess/pse_postprocess/pse_postprocess.py
+7
-23
No files found.
ppocr/postprocess/pse_postprocess/pse_postprocess.py
View file @
81a42fee
...
@@ -60,18 +60,17 @@ class PSEPostProcess(object):
...
@@ -60,18 +60,17 @@ class PSEPostProcess(object):
boxes_batch
=
[]
boxes_batch
=
[]
for
batch_index
in
range
(
pred
.
shape
[
0
]):
for
batch_index
in
range
(
pred
.
shape
[
0
]):
src_h
,
src_w
,
ratio_h
,
ratio_w
=
shape_list
[
batch_index
]
boxes
,
scores
=
self
.
boxes_from_bitmap
(
score
[
batch_index
],
kernels
[
batch_index
],
shape_list
[
batch_index
])
boxes
,
scores
=
self
.
boxes_from_bitmap
(
score
[
batch_index
],
kernels
[
batch_index
],
src_h
,
src_w
)
boxes_batch
.
append
({
'points'
:
boxes
,
'scores'
:
scores
})
boxes_batch
.
append
({
'points'
:
boxes
,
'scores'
:
scores
})
return
boxes_batch
return
boxes_batch
def
boxes_from_bitmap
(
self
,
score
,
kernels
,
s
rc_h
,
src_w
):
def
boxes_from_bitmap
(
self
,
score
,
kernels
,
s
hape
):
label
=
pse
(
kernels
,
self
.
min_area
)
label
=
pse
(
kernels
,
self
.
min_area
)
return
self
.
generate_box
(
score
,
label
,
s
rc_h
,
src_w
)
return
self
.
generate_box
(
score
,
label
,
s
hape
)
def
generate_box
(
self
,
score
,
label
,
s
rc_h
,
src_w
):
def
generate_box
(
self
,
score
,
label
,
s
hape
):
height
,
width
=
label
.
shape
src_h
,
src_w
,
ratio_h
,
ratio_w
=
shape
label_num
=
np
.
max
(
label
)
+
1
label_num
=
np
.
max
(
label
)
+
1
boxes
=
[]
boxes
=
[]
...
@@ -105,24 +104,9 @@ class PSEPostProcess(object):
...
@@ -105,24 +104,9 @@ class PSEPostProcess(object):
raise
NotImplementedError
raise
NotImplementedError
bbox
[:,
0
]
=
np
.
clip
(
bbox
[:,
0
]
=
np
.
clip
(
np
.
round
(
bbox
[:,
0
]
/
width
*
src
_w
),
0
,
src_w
)
np
.
round
(
bbox
[:,
0
]
/
ratio
_w
),
0
,
src_w
)
bbox
[:,
1
]
=
np
.
clip
(
bbox
[:,
1
]
=
np
.
clip
(
np
.
round
(
bbox
[:,
1
]
/
height
*
src_h
),
0
,
src_h
)
np
.
round
(
bbox
[:,
1
]
/
ratio_h
),
0
,
src_h
)
boxes
.
append
(
bbox
)
boxes
.
append
(
bbox
)
scores
.
append
(
score_i
)
scores
.
append
(
score_i
)
return
boxes
,
scores
return
boxes
,
scores
if
__name__
==
'__main__'
:
post
=
PSEPostProcess
(
thresh
=
0.5
,
box_thresh
=
0.85
,
min_area
=
16
,
box_type
=
'poly'
,
scale
=
4
)
out
=
np
.
load
(
'/Users/zhoujun20/Desktop/工作相关/OCR/论文复现/pan_pp.pytorch/out.npy'
)
res
=
np
.
load
(
'/Users/zhoujun20/Desktop/工作相关/OCR/论文复现/pan_pp.pytorch/det_res.npy'
,
allow_pickle
=
True
).
tolist
()
out
=
{
'maps'
:
paddle
.
to_tensor
(
out
)}
det_res
=
post
(
out
,
shape_list
=
[[
720
,
1280
,
1
,
1
]])
print
(
det_res
)
print
(
res
)
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