From d792a69f3f69159ba3ca6341a8be0e6da2b31633 Mon Sep 17 00:00:00 2001 From: liaoxingyu Date: Thu, 17 Jun 2021 16:52:47 +0800 Subject: [PATCH] bugfix for veriwild and vehicleid Change `camids` from string to int when evaluation, otherwise, it will raise AttributeError #497 --- fastreid/data/datasets/vehicleid.py | 6 ++++-- fastreid/data/datasets/veriwild.py | 6 ++++-- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/fastreid/data/datasets/vehicleid.py b/fastreid/data/datasets/vehicleid.py index 4a0ab9e..5263d0b 100644 --- a/fastreid/data/datasets/vehicleid.py +++ b/fastreid/data/datasets/vehicleid.py @@ -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 diff --git a/fastreid/data/datasets/veriwild.py b/fastreid/data/datasets/veriwild.py index ba20bcc..269a507 100644 --- a/fastreid/data/datasets/veriwild.py +++ b/fastreid/data/datasets/veriwild.py @@ -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