CNN Project for handwritten math recognition

I am starting a project, which will use Convolutional Neural Networks to recognize/segment handwritten math characters, and convert it into LaTeX. I am very much a beginner to this realm of programming, and I am having trouble loading my data into Google Colab. I used a helpful website, [7 ways to load external data into Google Colab | by B. Chen | Towards Data Science], which helped me download a dataset from Kaggle. However, when I tried to unzip the Kaggle dataset, some of the examples were extracted, but the rest were stuck in data.rar, which I tried to “unrar”, but it said there were no files to extract.

I figured it out, and extracted the data to another folder. However, I still have another problem. I don’t know how to convert a black/white image into an array. Typically, matplotlib would convert it into an array with 3 channels, but that is a waste of data, so I would not like to do that.

1 Like

Hey @sickopickle,
Please check this thread out. Let me know if this helps.

Cheers,
Elemento

I tried using opencv, but when i did images =cv2.imread(‘image’, 0), like it said, the background of the picture became yellow, and the object turned blue (from black)

cv2.IMREAD_GRAYSCALE (=0) may be platform dependent.
Please try to read as a color (BGR), and convert it to GRAY like cv2.cvtColor(img, cv2.COLOR_BGR2GRAY).

I tried that already, which works, but it gives me a 3 channel array, and i only want 1 channel (black & white)

All of my test images are completely binary, and so will the drawing interface be.

Can anyone help? Of all the methods I tried, one of two things happened:

  1. It was 3 channels not 1
  2. It changed the color of the image from black and white to yellow

I figured it out. https://stackoverflow.com/questions/41265576/plt-imshow-shows-color-images-for-grayscale-images-in-ipython

Hey @sickopickle,
We are glad that you were able to figure it out by yourself. After all, there is nothing better than that :nerd_face:

Cheers,
Elemento