Thanks for the dataset, it's a good intro data into getting started with Re-ID.
However, i've encountered an issue while following the instructions xD
# You can change these hyperparameters as you wish
datamanager = torchreid.data.ImageDataManager(
root='',
sources='synthtetic_veri_reid',
height = 256,
width = 256,
transforms =['random_flip', 'random_crop'])
The above block raises a KeyError: 3
from class VeRiDataset
car_id = label_dict[int(image.split('.jpg')[0].split('_')[-1])]
Is it that the dictionary isn't getting assigned the required key from that split
operation ?
Also, the torchreid
instructions don't have the root
empty as per the custom dataset example
torchreid
module wasn't in the condamdx_reid.yml
for which i've installed torchreid==0.2.5 through pip
I suppose the error is from the split logic or is there anything else that might be causing it ?
path_to_dataset
is pointing to the directory that contains the three data folders of gallery, query and train.
attaching the full trace-back below for reference:
##############################################################################
Building train transforms ...
- resize to 256x256
- random flip
- random crop (enlarge to 288x288 and crop 256x256)
- to torch tensor of range [0, 1]
- normalization (mean=[0.485, 0.456, 0.406], std=[0.229, 0.224, 0.225])
Building test transforms ...
- resize to 256x256
- to torch tensor of range [0, 1]
- normalization (mean=[0.485, 0.456, 0.406], std=[0.229, 0.224, 0.225])
=> Loading train (source) dataset
KeyError Traceback (most recent call last)
Input In [7], in <cell line: 2>()
1 # You can change these hyperparameters as you wish
----> 2 datamanager = torchreid.data.ImageDataManager(
3 root='reid-data',
4 sources='synthtetic_veri_reid',
5 height = 256,
6 width = 256,
7 transforms =['random_flip', 'random_crop'])
File ~/anaconda3/envs/mdx_reid/lib/python3.9/site-packages/torchreid/data/datamanager.py:195, in ImageDataManager.init(self, root, sources, targets, height, width, transforms, k_tfm, norm_mean, norm_std, use_gpu, split_id, combineall, load_train_targets, batch_size_train, batch_size_test, workers, num_instances, num_cams, num_datasets, train_sampler, train_sampler_t, cuhk03_labeled, cuhk03_classic_split, market1501_500k)
193 trainset = []
194 for name in self.sources:
--> 195 trainset_ = init_image_dataset(
196 name,
197 transform=self.transform_tr,
198 k_tfm=k_tfm,
199 mode='train',
200 combineall=combineall,
201 root=root,
202 split_id=split_id,
203 cuhk03_labeled=cuhk03_labeled,
204 cuhk03_classic_split=cuhk03_classic_split,
205 market1501_500k=market1501_500k
206 )
207 trainset.append(trainset_)
208 trainset = sum(trainset)
File ~/anaconda3/envs/mdx_reid/lib/python3.9/site-packages/torchreid/data/datasets/init.py:42, in init_image_dataset(name, **kwargs)
37 if name not in avai_datasets:
38 raise ValueError(
39 'Invalid dataset name. Received "{}", '
40 'but expected to be one of {}'.format(name, avai_datasets)
41 )
---> 42 return __image_datasetsname
Input In [4], in VeRiDataset.init(self, root, **kwargs)
46 for image in IMAGES:
47 cam_id = int(image.split('.jpg')[0].split('')[-2])
---> 48 car_id = label_dict[int(image.split('.jpg')[0].split('')[-1])]
49 query_array.append((FOLDER_PATH + dataset_type + "/" + image, car_id, cam_id))
52 train = training_array
KeyError: 3
##############################################################################
Thank you !