Skip to content

Commit

Permalink
Fixes search for label dir when using multiple dirs for training.
Browse files Browse the repository at this point in the history
  • Loading branch information
knoppmyth authored and Chilicyy committed Oct 14, 2022
1 parent 58713d4 commit 61f12fe
Showing 1 changed file with 13 additions and 3 deletions.
16 changes: 13 additions & 3 deletions yolov6/data/datasets.py
Original file line number Diff line number Diff line change
Expand Up @@ -265,10 +265,20 @@ def get_imgs_labels(self, img_dir):
json.dump(cache_info, f)

# check and load anns
label_dir = osp.join(
base_dir = osp.basename(img_dir)
if base_dir != "":
label_dir = osp.join(
osp.dirname(osp.dirname(img_dir)), "labels", osp.basename(img_dir)
)
assert osp.exists(label_dir), f"{label_dir} is an invalid directory path!"
)
assert osp.exists(label_dir), f"{label_dir} is an invalid directory path!"
else:
sub_dirs= []
label_dir = img_dir
for rootdir, dirs, files in os.walk(label_dir):
for subdir in dirs:
sub_dirs.append(subdir)
assert "labels" in sub_dirs, f"Could not find a labels directory!"


# Look for labels in the save relative dir that the images are in
def _new_rel_path_with_ext(base_path: str, full_path: str, new_ext: str):
Expand Down

0 comments on commit 61f12fe

Please sign in to comment.