Created
May 3, 2021 05:50
-
-
Save Kakarot-2000/0959ef5de08660796aab3c60ad910f90 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
df1 = pd.read_csv("fer2013.csv") #make sure the file is in the root location | |
# Preprocessing | |
x_train=[] | |
x_test=[] | |
y_train=[] | |
y_test=[] | |
for i,row in df1.iterrows(): | |
k=row['pixels'].split(" ") | |
if(row['Usage']=='Training'): | |
x_train.append(np.array(k)) | |
y_train.append(row['emotion']) | |
elif(row['Usage']=='PublicTest'): | |
x_test.append(np.array(k)) | |
y_test.append(row['emotion']) | |
x_train=np.array(x_train) | |
x_test=np.array(x_test) | |
y_train=np.array(y_train) | |
y_test=np.array(y_test) | |
x_train=x_train.reshape(x_train.shape[0],48,48) | |
x_test=x_test.reshape(x_test.shape[0],48,48) | |
y_train=tf.keras.utils.to_categorical(y_train,num_classes=7) | |
y_test=tf.keras.utils.to_categorical(y_test,num_classes=7) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment