Problem when creating labels

Since I’m now able to create a new topic, I’ll move my question here from the general chat -topic:

I’m trying to do a face detection model and encountering some difficulties when trying to write a .csv file with the file names and labels.

Here are the functions I use:

##Attachhing label to correct file names

item_list = 

glob.glob('data/dest/celeba/faces/*/*.jpg'.  )

item_df = 

pd.DataFrame({'image_name':pd.Series(item_list).apply(lambda x: '/'.join(x.split('/')[-2]))})

istem_df['image_id'] = item_df.image_name.apply(lambda x: x.split('/')[1])

## Creating final label set

label_df = 


label_df = label_df.merge(item_df, on='image_id', how='inner')

label_df.rename(columns={'label':'tags'}, inplace=True)

label_df.loc[:,['image_name','tags']].to_csv('data/dest/celeba/labels1.csv', index=False)

So the “labels.csv” is way it should be, I think. Here’s a couple of lines from the start of the file:

0,000001.jpg,Arched_Eyebrows Attractive Brown_Hair Heavy_Makeup High_Cheekbones Mouth_Slightly_Open No_Beard Pointy_Nose Smiling Straight_Hair Wearing_Earrings Wearing_Lipstick Young
1,000002.jpg,Bags_Under_Eyes Big_Nose Brown_Hair High_Cheekbones Mouth_Slightly_Open No_Beard Smiling Young

This should be written again with “tags”. But the labels1.csv looks like this:


Otherwise it’s empty. Can anyone help me please so I could get all the labels from the first csv-file. What am I doing wrong?