I am trying to create three separate lists (training, testing, and validation) for a CNN.
I have three lists (train_data, test_data, val_data) that ONLY contain the image names
train_data = ["img_1.png", "img_2.png"]
test_data = ["image_3.png", "img_4.png"]
val_data = ["img_5.png", "img_6.png"]
I have another nested list that contains all the images names and associated labels for a deep learning model
image_annotations = [['img_1.png', 432, 662, 554, 749, 'class'],
['img_1.png', 647, 456, 754, 594, 'class'], ['img_2.png', 598, 659, 897,
302, 'class']]
I would like to run a loop through my image_annotations list and if the image name is the same as an image name in my train_data, test_data, val_data lists then I want to append the four following numbers and class name to that list. The image_annotations list has multiple listings of the same image but with different bounding box numbers.
I imagine that this might be quite simple, but I can't figure it out.