Menu

ML Shape detection App

It was so fun to complete my first ML project for perfect shape detection from hand-drawn shapes 🥳.
Right now I’m working on an iPad drawing app that will be, in shaa Allah, on the App Store by the end of this year. I want to add a shape detection feature so that when you draw any shape, it detects it and replaces it with a perfect geometric shape (circle, oval, rectangle, square, triangle, line).
I first tried to do this with math, but it was very difficult and used too much CPU/GPU to calculate the stroke path and find the right perfect shape to replace it with.
Then, alhamdulillah, I got the idea to do this using Apple Core ML. I searched the internet for any available model to use, but there was almost nothing. I found only one model, and it was very small and did not work for me.
So I started developing my own ML project: I draw shapes myself and label them with the correct perfect shape. If the model is wrong, I teach it the right answer. So far I’ve created more than 600 shapes that I drew myself and labeled with the correct shapes.
Now it works, alhamdulillah, really well. It can detect any shape, no matter the size or rotation. I’m very happy that it finally worked, so I can continue training it with other shape types, like stars, hearts, and more.
Nice to share this with you.

ML Shape detection App - image 1 - student project