Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
D
DAN
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Package Registry
Container Registry
Operate
Terraform modules
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Automatic Text Recognition
DAN
Commits
d5373154
Commit
d5373154
authored
1 year ago
by
Manon Blanco
Browse files
Options
Downloads
Patches
Plain Diff
Replace utils pairwise function by itertools pariwise
parent
14a54602
No related branches found
Branches containing commit
No related tags found
1 merge request
!159
Replace utils pairwise function by itertools pariwise
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
dan/predict/prediction.py
+2
-1
2 additions, 1 deletion
dan/predict/prediction.py
dan/utils.py
+0
-12
0 additions, 12 deletions
dan/utils.py
with
2 additions
and
13 deletions
dan/predict/prediction.py
+
2
−
1
View file @
d5373154
...
@@ -2,6 +2,7 @@
...
@@ -2,6 +2,7 @@
import
os
import
os
import
pickle
import
pickle
from
itertools
import
pairwise
from
pathlib
import
Path
from
pathlib
import
Path
import
cv2
import
cv2
...
@@ -20,7 +21,7 @@ from dan.predict.attention import (
...
@@ -20,7 +21,7 @@ from dan.predict.attention import (
plot_attention
,
plot_attention
,
split_text_and_confidences
,
split_text_and_confidences
,
)
)
from
dan.utils
import
pairwise
,
read_image
from
dan.utils
import
read_image
class
DAN
:
class
DAN
:
...
...
This diff is collapsed.
Click to expand it.
dan/utils.py
+
0
−
12
View file @
d5373154
# -*- coding: utf-8 -*-
# -*- coding: utf-8 -*-
from
itertools
import
tee
import
cv2
import
cv2
import
numpy
as
np
import
numpy
as
np
import
torch
import
torch
...
@@ -154,13 +152,3 @@ def round_floats(float_list, decimals=2):
...
@@ -154,13 +152,3 @@ def round_floats(float_list, decimals=2):
Round list of floats with fixed decimals
Round list of floats with fixed decimals
"""
"""
return
[
np
.
around
(
num
,
decimals
)
for
num
in
float_list
]
return
[
np
.
around
(
num
,
decimals
)
for
num
in
float_list
]
def
pairwise
(
iterable
):
"""
Not necessary when using 3.10. See https://docs.python.org/3/library/itertools.html#itertools.pairwise.
"""
# pairwise('ABCDEFG') --> AB BC CD DE EF FG
a
,
b
=
tee
(
iterable
)
next
(
b
,
None
)
return
zip
(
a
,
b
)
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment