Use read_label_file from pycoral Bug: 193903231 Change-Id: I27649ae487589397fe7ab3c23908ddb3f3ef7617
diff --git a/debian/changelog b/debian/changelog index 2205fbb..f4de0f4 100644 --- a/debian/changelog +++ b/debian/changelog
@@ -1,3 +1,9 @@ +edgetpuvision (8-1) mendel-eagle; urgency=medium + + * Use read_label_file from python3-pycoral. + + -- Coral <coral-support@google.com> Mon, 04 Oct 2021 12:22:57 -0700 + edgetpuvision (7-1) mendel-eagle; urgency=medium * Switching from python3-edgetpu to python3-pycoral.
diff --git a/edgetpuvision/utils.py b/edgetpuvision/utils.py index 8a06c05..63027d8 100644 --- a/edgetpuvision/utils.py +++ b/edgetpuvision/utils.py
@@ -19,13 +19,11 @@ from pycoral.adapters import common from pycoral.utils import edgetpu +from pycoral.utils import dataset -LABEL_PATTERN = re.compile(r'\s*(\d+)(.+)') def load_labels(path): - with open(path, 'r', encoding='utf-8') as f: - lines = (LABEL_PATTERN.match(line).groups() for line in f.readlines()) - return {int(num): text.strip() for num, text in lines} + return dataset.read_label_file(path) def input_image_size(interpreter): return common.input_size(interpreter)