Hi there,
I am using Prototypical Network for my small dataset classification.:
transforms =[partial(convert_dict, ‘class’),
partial(load_class_images,split=split),
partial(extract_episode, n_support, n_query)]
if opt[‘data.cuda’]:
transforms.append(CudaTransform())
transforms = compose(transforms)
class_names = []
with open(os.path.join(split_dir, "{:s}_image_list.txt".format(split)), 'r') as f:
for class_name in f.readlines():
class_name = class_name.rstrip('\n').split('-')[-1].split('.')[0] # Extracting the class name from the image name
class_names.append(class_name)
class_names.sort()
print(class_names)
ds = TransformDataset(ListDataset(class_names), transforms)
in this part of code : transforms =[partial(convert_dict, ‘class’), when it reads the labels in class_names list starts from index=1 and then 2 and then 0
and i think it cause low accuracy for my result and i checked when i chnage the random seed it chnages the order if reading in class_names list.
what can i do to slove this and make it read my list from index 0?