I have a subset of more then 30000 images and I am trying this code but it is taking forever.
labels=[]
for _,data in train_set:
    labels.append(data['labels'])
print(labels)

Is there any faster way of doing this?