From 590fda8467353f65e9850c565fc77492adb58038 Mon Sep 17 00:00:00 2001 From: Martin Kozlovsky Date: Tue, 14 Jan 2025 11:28:09 +0100 Subject: [PATCH] fix native parser file paths --- luxonis_ml/data/parsers/native_parser.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/luxonis_ml/data/parsers/native_parser.py b/luxonis_ml/data/parsers/native_parser.py index b000c168..d941a57f 100644 --- a/luxonis_ml/data/parsers/native_parser.py +++ b/luxonis_ml/data/parsers/native_parser.py @@ -66,7 +66,13 @@ def from_split(self, annotation_path: Path) -> ParserOutput: """ def generator() -> DatasetIterator: - yield from json.loads(annotation_path.read_text()) + for record in json.loads(annotation_path.read_text()): + if "file" not in record: + raise ValueError( + "The annotation record must contain 'file' key." + ) + record["file"] = annotation_path.parent / record["file"] + yield record added_images = self._get_added_images(generator())