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
3d692957
Unverified
Commit
3d692957
authored
Mar 28, 2022
by
MissPenguin
Committed by
GitHub
Mar 28, 2022
Browse files
Merge pull request #5805 from MissPenguin/dygraph
fix order_points_clockwise
parents
4348fc35
fabfaaba
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
22 deletions
+8
-22
tools/infer/predict_det.py
tools/infer/predict_det.py
+8
-22
No files found.
tools/infer/predict_det.py
View file @
3d692957
...
@@ -150,27 +150,13 @@ class TextDetector(object):
...
@@ -150,27 +150,13 @@ class TextDetector(object):
logger
=
logger
)
logger
=
logger
)
def
order_points_clockwise
(
self
,
pts
):
def
order_points_clockwise
(
self
,
pts
):
"""
rect
=
np
.
zeros
((
4
,
2
),
dtype
=
"float32"
)
reference from: https://github.com/jrosebr1/imutils/blob/master/imutils/perspective.py
s
=
pts
.
sum
(
axis
=
1
)
# sort the points based on their x-coordinates
rect
[
0
]
=
pts
[
np
.
argmin
(
s
)]
"""
rect
[
2
]
=
pts
[
np
.
argmax
(
s
)]
xSorted
=
pts
[
np
.
argsort
(
pts
[:,
0
]),
:]
diff
=
np
.
diff
(
pts
,
axis
=
1
)
rect
[
1
]
=
pts
[
np
.
argmin
(
diff
)]
# grab the left-most and right-most points from the sorted
rect
[
3
]
=
pts
[
np
.
argmax
(
diff
)]
# x-roodinate points
leftMost
=
xSorted
[:
2
,
:]
rightMost
=
xSorted
[
2
:,
:]
# now, sort the left-most coordinates according to their
# y-coordinates so we can grab the top-left and bottom-left
# points, respectively
leftMost
=
leftMost
[
np
.
argsort
(
leftMost
[:,
1
]),
:]
(
tl
,
bl
)
=
leftMost
rightMost
=
rightMost
[
np
.
argsort
(
rightMost
[:,
1
]),
:]
(
tr
,
br
)
=
rightMost
rect
=
np
.
array
([
tl
,
tr
,
br
,
bl
],
dtype
=
"float32"
)
return
rect
return
rect
def
clip_det_res
(
self
,
points
,
img_height
,
img_width
):
def
clip_det_res
(
self
,
points
,
img_height
,
img_width
):
...
...
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