Create labels dir on labels save (#12551)

* Update val.py

When saving predicted labels, create a folder named labels.

Signed-off-by: Ryan <35791309+Gary55555@users.noreply.github.com>

* Update val.py

Signed-off-by: Glenn Jocher <glenn.jocher@ultralytics.com>

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

---------

Signed-off-by: Ryan <35791309+Gary55555@users.noreply.github.com>
Signed-off-by: Glenn Jocher <glenn.jocher@ultralytics.com>
Co-authored-by: Glenn Jocher <glenn.jocher@ultralytics.com>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
This commit is contained in:
authored and GitHub committed 2023-12-26 17:58:32 -05:00
1 parent 63555c8e22
commit ba63208025
1 file changed
+3 -1
+3 -1
View File
@@ -72,7 +72,8 @@ def save_one_json(predn, jdict, path, class_map):
def process_batch(detections, labels, iouv):
"""
Return correct prediction matrix
Return correct prediction matrix.
Arguments:
detections (array[N, 6]), x1, y1, x2, y2, conf, class
labels (array[M, 5]), class, x1, y1, x2, y2
@@ -258,6 +259,7 @@ def run(
# Save/log
if save_txt:
(save_dir / 'labels').mkdir(parents=True, exist_ok=True)
save_one_txt(predn, save_conf, shape, file=save_dir / 'labels' / f'{path.stem}.txt')
if save_json:
save_one_json(predn, jdict, path, class_map) # append to COCO-JSON dictionary