text_html_output_1.png
from keras.preprocessing.image import ImageDataGenerator, array_to_img, img_to_array, load_img

import matplotlib.pyplot as plt

import pandas as pd

main_folder = '../input/celeba-dataset/'
images_folder = main_folder + 'img_align_celeba/img_align_celeba/'
example_pic = images_folder + '000506.jpg'
training_sample = 10000
validation_sample = 2000
test_sample = 2000
img_width = 178
img_height = 218
batch_size = 16
num_epochs = 5

df_attr = pd.read_csv(main_folder + 'list_attr_celeba.csv')
df_attr.set_index('image_id', inplace=True)
df_attr.replace(to_replace=-1, value=0, inplace=True)

df_attr.columns

df_attr.isnull().sum()

df_attr.shape

img = load_img(example_pic)
df_attr.loc[example_pic.split('/')[-1]][['Smiling', 'Male', 'Young']]

df_partition = pd.read_csv(main_folder + 'list_eval_partition.csv')

df_partition.sample(100)

df_partition.set_index('image_id', inplace=True)
df_par_attr = df_partition.join(df_attr['Male'], how='inner')
df_par_attr.head(5)