diff --git a/lib/core/postprocess.py b/lib/core/postprocess.py index 9b56fc5ccd..1ffe4cd130 100644 --- a/lib/core/postprocess.py +++ b/lib/core/postprocess.py @@ -71,7 +71,7 @@ def build_targets(cfg, predictions, targets, model): # Append a = t[:, 6].long() # anchor indices - indices.append((b, a, gj.clamp_(0, gain[3] - 1), gi.clamp_(0, gain[2] - 1))) # image, anchor, grid indices + indices.append((b, a, gj.clamp_(0, gain[3].long() - 1), gi.clamp_(0, gain[2].long() - 1))) # image, anchor, grid indices tbox.append(torch.cat((gxy - gij, gwh), 1)) # box anch.append(anchors[a]) # anchors tcls.append(c) # class diff --git a/lib/dataset/bdd.py b/lib/dataset/bdd.py index 538ab4d5ca..71a8bc7cf9 100644 --- a/lib/dataset/bdd.py +++ b/lib/dataset/bdd.py @@ -4,6 +4,7 @@ from .AutoDriveDataset import AutoDriveDataset from .convert import convert, id_dict, id_dict_single from tqdm import tqdm +from os.path import exists single_cls = True # just detect vehicle @@ -33,6 +34,8 @@ def _get_db(self): mask_path = str(mask) label_path = mask_path.replace(str(self.mask_root), str(self.label_root)).replace(".png", ".json") image_path = mask_path.replace(str(self.mask_root), str(self.img_root)).replace(".png", ".jpg") + if not exists(image_path): + continue lane_path = mask_path.replace(str(self.mask_root), str(self.lane_root)) with open(label_path, 'r') as f: label = json.load(f)