Skip to content

Commit

Permalink
Create labels dir on labels save (#12551)
Browse files Browse the repository at this point in the history
* 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>
  • Loading branch information
3 people committed Dec 26, 2023
1 parent 63555c8 commit ba63208
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion val.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit ba63208

Please sign in to comment.