Sign in
coral
/
edgetpuvision
/
70a1f9c663f566292ded50ffe41739947531b55f
/
.
/
edgetpuvision
/
utils.py
blob: 2e2e7c9ca2942b936c2e87605be70d6c71952686 [
file
] [
log
] [
blame
]
import
re
def
load_labels
(
path
):
p
=
re
.
compile
(
r
'\s*(\d+)(.+)'
)
with
open
(
path
,
'r'
,
encoding
=
'utf-8'
)
as
f
:
lines
=
(
p
.
match
(
line
).
groups
()
for
line
in
f
.
readlines
())
return
{
int
(
num
):
text
.
strip
()
for
num
,
text
in
lines
}