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
ea0ff9c3
Commit
ea0ff9c3
authored
Mar 25, 2022
by
LDOUBLEV
Browse files
fix html
parent
85a64cb0
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
26 additions
and
15 deletions
+26
-15
tools/end2end/draw_html.py
tools/end2end/draw_html.py
+26
-15
No files found.
tools/end2end/draw_html.py
View file @
ea0ff9c3
...
@@ -13,9 +13,29 @@
...
@@ -13,9 +13,29 @@
# limitations under the License.
# limitations under the License.
import
os
import
os
import
argparse
def
draw_debug_img
(
html_path
):
def
str2bool
(
v
):
return
v
.
lower
()
in
(
"true"
,
"t"
,
"1"
)
def
init_args
():
parser
=
argparse
.
ArgumentParser
()
parser
.
add_argument
(
"--image_dir"
,
type
=
str
,
default
=
""
)
parser
.
add_argument
(
"--save_html_path"
,
type
=
str
,
default
=
"./default.html"
)
parser
.
add_argument
(
"--width"
,
type
=
int
,
default
=
640
)
return
parser
def
parse_args
():
parser
=
init_args
()
return
parser
.
parse_args
()
def
draw_debug_img
(
args
):
html_path
=
args
.
save_html_path
err_cnt
=
0
err_cnt
=
0
with
open
(
html_path
,
'w'
)
as
html
:
with
open
(
html_path
,
'w'
)
as
html
:
...
@@ -25,23 +45,14 @@ def draw_debug_img(html_path):
...
@@ -25,23 +45,14 @@ def draw_debug_img(html_path):
"<meta http-equiv=
\"
Content-Type
\"
content=
\"
text/html; charset=utf-8
\"
/>"
"<meta http-equiv=
\"
Content-Type
\"
content=
\"
text/html; charset=utf-8
\"
/>"
)
)
image_list
=
[]
image_list
=
[]
path
=
"./det_results/310_gt/"
path
=
args
.
image_dir
for
i
,
filename
in
enumerate
(
sorted
(
os
.
listdir
(
path
))):
for
i
,
filename
in
enumerate
(
sorted
(
os
.
listdir
(
path
))):
if
filename
.
endswith
(
"txt"
):
continue
if
filename
.
endswith
(
"txt"
):
continue
print
(
filename
)
# The image path
# The image path
base
=
"{}/{}"
.
format
(
path
,
filename
)
base
=
"{}/{}"
.
format
(
path
,
filename
)
base_2
=
"../PaddleOCR/det_results/ch_PPOCRV2_infer/{}"
.
format
(
filename
)
base_3
=
"../PaddleOCR/det_results/ch_ppocr_mobile_infer/{}"
.
format
(
filename
)
html
.
write
(
"<tr>
\n
"
)
html
.
write
(
"<tr>
\n
"
)
html
.
write
(
f
'<td>
{
filename
}
\n
GT'
)
html
.
write
(
f
'<td>
{
filename
}
\n
GT'
)
html
.
write
(
'<td>GT
\n
<img src="%s" width=640></td>'
%
(
base
))
html
.
write
(
f
'<td>GT
\n
<img src="
{
base
}
" width=
{
args
.
width
}
></td>'
)
html
.
write
(
'<td>PPOCRV2
\n
<img src="%s" width=640></td>'
%
(
base_2
))
html
.
write
(
'<td>ppocr_mobile
\n
<img src="%s" width=640></td>'
%
(
base_3
))
html
.
write
(
"</tr>
\n
"
)
html
.
write
(
"</tr>
\n
"
)
html
.
write
(
'<style>
\n
'
)
html
.
write
(
'<style>
\n
'
)
...
@@ -51,12 +62,12 @@ def draw_debug_img(html_path):
...
@@ -51,12 +62,12 @@ def draw_debug_img(html_path):
html
.
write
(
'</style>
\n
'
)
html
.
write
(
'</style>
\n
'
)
html
.
write
(
'</table>
\n
'
)
html
.
write
(
'</table>
\n
'
)
html
.
write
(
'</html>
\n
</body>
\n
'
)
html
.
write
(
'</html>
\n
</body>
\n
'
)
print
(
"ok
"
)
print
(
f
"The html file saved in
{
html_path
}
"
)
return
return
if
__name__
==
"__main__"
:
if
__name__
==
"__main__"
:
html_path
=
"sys_visual_iou_310.html"
args
=
parse_args
()
draw_debug_img
()
draw_debug_img
(
args
)
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