I am attempting to create a list which shuffles 2 lists together. The code that I have written is provided for your reference:
def __init__(self, path, split_ratio, x, y, color_space='rgb'):
self.x = x
self.y = y
self.path = path
self.color_space = color_space
self.path_train_images = path + "train/images/"
self.path_train_labels = path + "train/labels/"
self.path_test_images = path + "test/images/"
self.path_test_labels = path + "test/labels/"
self.image_file_list = get_png_filename_list(self.path_train_images)
self.label_file_list = get_png_filename_list(self.path_train_labels)
self.image_file_list[:], self.label_file_list[:] = self.shuffle_image_label_lists_together()
I am getting ValueError
which states:
self.image_file_list[:], self.label_file_list[:] = self.shuffle_image_label_lists_together()
ValueError: not enough values to unpack (expected 2, got 0)
function shuffle_image_label_lists_together
is suggested below
def shuffle_image_label_lists_together(self):
combined = list(zip(self.image_file_list, self.label_file_list))
random.shuffle(combined)
return zip(*combined)
It seems self.shuffle_image_label_lists_together()
is empty and that is the reason for the error. Could you let me know if my syntax is accurate?