I was thinking, you could probably train a neural network to learn how to remove gridlines from the image also.