'ValueError: cannot reshape array of size 1502 into shape (48,48)
I have been stuck with this problem for a very long time and I could not find the solution.
ValueError: cannot reshape array of size 1502 into shape (48,48)
#converting dtype of pixels to string
df['pixels'] = df['pixels'].astype("string")
pixels = df['pixels'].tolist() #Making list of pixels
width, height = 48, 48 # initializing image shape
# Converting to array and dimension for transfer Learning
faces = []
faces = np.asarray(faces)
faces = np.expand_dims(faces, -1)
faces /= 127.5 # normalizing the data
faces -= 1.
# Converting Emotions to NumPy array
emotions = pd.get_dummies(df['emotion']).to_numpy()
Solution 1:[1]
face has 1502 elements. and what you are doing is, you want to change face shape to 48x48 since 48x48=2304. you need the same total value from before to after
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | dimas krisrianto |

