Skip to content

Commit

Permalink
no longer assuming every image in the validation set has an annotatio…
Browse files Browse the repository at this point in the history
…n for every class
  • Loading branch information
Abe404 committed Jul 17, 2023
1 parent c528ba2 commit 7b14aa0
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions trainer/datasets.py
Original file line number Diff line number Diff line change
Expand Up @@ -288,12 +288,12 @@ def get_annots_for_image(self, annot_fname):
annots = []
for annot_dir in self.annot_dirs:
annot_path = os.path.join(annot_dir, annot_fname)

annot = im_utils.load_with_retry(im_utils.load_image, annot_path)
classes.append(Path(annot_dir).parts[-2])

# pad to provide annotation at same size as input image.
annot = np.pad(annot, ((0, 0), (17, 17), (17, 17), (17, 17)), mode='constant')
annots.append(annot)
if os.path.isfile(annot_path):
annot = im_utils.load_with_retry(im_utils.load_image, annot_path)
classes.append(Path(annot_dir).parts[-2])
# pad to provide annotation at same size as input image.
annot = np.pad(annot, ((0, 0), (17, 17), (17, 17), (17, 17)), mode='constant')
annots.append(annot)
return annots, classes

0 comments on commit 7b14aa0

Please sign in to comment.