How can I centre/detect the digits for MNIST Handwritten Digit Prediction?

Question:

I have a big issue with my CNN TensorFlow model, it seems to not be very good at its job, and I think it’s not the model’s fault but rather that the tensors being sent don’t have the digits centred.

Here is a picture of a 6 which the model predicted as an 8

So, the question: Is there a library in python I can use to detect the digits in the cells rather than the current manual method?

Asked By: GS343597

||

Answers:

Thanks to NickODell’s helpful comments, my solution is going to be to find the centre of mass of each image and shift the images to centre them.

Here is the link to the python solution I’m using:

center of mass of pixels in grayscale image

Answered By: GS343597