# How to train feedforward network to recognize images?

Context

I'm trying to create network for digits recognition. All digits are the same font and size of 40x40. I know that I can use feedforward network or CNN. I'd like to use the first one.

Issue

I cannot get decent results. I've tried depth/width manipulation as well as batch size and epochs changing. Results might seem okay with that ~96% of accuracy but it does not work well on unseen data. I'm passing this unseen data as (-1, 40, 40, 1) vector. Should I reshape it to (-1, 1600 ,1) before passing to prediction?

Can You give me some advice how to create this network properly?

My network

X = np.array(X).reshape(-1, IMG_WIDTH, IMG_HEIGHT, 1)
y = np.array(y)
X, test_X, y, test_y = train_test_split(X, y, test_size=0.25, random_state=42)
self.model = Sequential()