I would like to ask for help. I have a dataset which has a column called pixels (I loaded with Pandas):
I would like to train this image classification dataset. So, I used split function inside apply pandas function
dfemotrain['pic']=dfemotrain['pixels'].apply(lambda x: np.array(x.split()).reshape(48, 48))
Later on, I used train_test_split from sklearn
X = dfemotrain['pic'].values
y = dfemotrain['emotion'].values
X_train, X_val, y_train, y_val = train_test_split(X, y, test_size=0.25, stratify=y, random_state=42)
print(X_train.shape, X_val.shape, y_train.shape, y_val.shape)
I got (21750,) (7250,) (21750,) (7250,) and I am not sure how to convert to a numpy array n_samplesx48x48 to input to a Deep Learning model
Please any suggestion to solve this issue. Thanks in advance


X = np.array(dfemotrain['pic'].astype('int').to_list())np.array(x.split(),dtype=int)should turn those cell values into numeric arrays. What did youloadthis from? From acsv? The frame cells contain strings, not lists or arrays. Did you create the source file yourself, or get it from someone else?scikit-learnortensorflow, therefore the tags are removed. Please try not to use irrelevant tags.