From ba63208025fb27df31f4f02265631f72bbbba6a5 Mon Sep 17 00:00:00 2001 From: Ryan <35791309+Gary55555@users.noreply.github.com> Date: Wed, 27 Dec 2023 06:58:32 +0800 Subject: [PATCH] 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 * [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 Co-authored-by: Glenn Jocher Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> --- val.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/val.py b/val.py index 8da3ef7667aa..b3d05f4305ce 100644 --- a/val.py +++ b/val.py @@ -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