Skip to content

Commit ce5b4be

Browse files
committed
relative or absolute paths
1 parent d529da3 commit ce5b4be

File tree

2 files changed

+9
-4
lines changed

2 files changed

+9
-4
lines changed

luxonis_ml/data/README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ Each data entry should be a dictionary with one of the following structures, dep
112112

113113
```python
114114
{
115-
"file": str, # absolute path to the image file
115+
"file": str, # path to the image file
116116
"task_name": Optional[str], # task for this annotation
117117
"annotation": Optional[dict] # annotation of the instance in the file
118118
}
@@ -122,7 +122,7 @@ Each data entry should be a dictionary with one of the following structures, dep
122122

123123
```python
124124
{
125-
"files": dict[str, str], # mapping from input source name to absolute file path
125+
"files": dict[str, str], # mapping from input source name to file path
126126
"task_name": Optional[str], # task for this annotation
127127
"annotation": Optional[dict] # annotation of the instance in the files
128128
}
@@ -133,8 +133,8 @@ In the multi-input format, the keys in the `files` dictionary are arbitrary stri
133133
```python
134134
{
135135
"files": {
136-
"img_rgb": "absolute/path/to/rgb_image.png",
137-
"img_ir": "absolute/path/to/infrared_image.png"
136+
"img_rgb": "path/to/rgb_image.png",
137+
"img_ir": "path/to/infrared_image.png"
138138
},
139139
"task_name": "detection",
140140
"annotation": {

luxonis_ml/data/datasets/annotation.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -561,6 +561,11 @@ def validate_files(cls, values: dict[str, Any]) -> dict[str, Any]:
561561
values = deepcopy(values)
562562
if "file" in values:
563563
values["files"] = {"image": values.pop("file")}
564+
if "files" in values:
565+
files_dict = values["files"]
566+
values["files"] = {
567+
k: Path(v).resolve() for k, v in files_dict.items()
568+
}
564569
return values
565570

566571
def to_parquet_rows(self) -> Iterable[ParquetRecord]:

0 commit comments

Comments
 (0)