bugfix for veriwild and vehicleid

Change `camids` from string to int when evaluation, otherwise, it will raise AttributeError

#497
pull/525/head
liaoxingyu 2021-06-17 16:52:47 +08:00
parent ac6256887c
commit d792a69f3f
2 changed files with 8 additions and 4 deletions

View File

@ -58,9 +58,11 @@ class VehicleID(ImageDataset):
line = line.strip()
vid = int(line.split(' ')[1])
imgid = line.split(' ')[0]
img_path = osp.join(self.image_dir, imgid + '.jpg')
img_path = osp.join(self.image_dir, f"{imgid}.jpg")
imgid = int(imgid)
if is_train:
vid = self.dataset_name + '_' + str(vid)
vid = f"{self.dataset_name}_{vid}"
imgid = f"{self.dataset_name}_{imgid}"
dataset.append((img_path, vid, imgid))
if is_train: return dataset

View File

@ -64,9 +64,11 @@ class VeRiWild(ImageDataset):
line = line.strip()
vid = int(line.split('/')[0])
imgid = line.split('/')[1].split('.')[0]
camid = int(self.imgid2camid[imgid])
if is_train:
vid = self.dataset_name + '_' + str(vid)
dataset.append((self.imgid2imgpath[imgid], vid, self.imgid2camid[imgid]))
vid = f"{self.dataset_name}_{vid}"
camid = f"{self.dataset_name}_{camid}"
dataset.append((self.imgid2imgpath[imgid], vid, camid))
assert len(dataset) == len(img_list_lines)
return dataset