Digit Identifier: a Basic Machine Learning Model Deployed

ยท

4 min read

Digit Identifier: a Basic Machine Learning Model Deployed

How did it Start?

I've been reading a book on machine learning for more than a month now. Never at a point did I feel capable of being able to build a simple model and deploying it. I was basically just rewriting the codes in the book and trying to understand them with the explanations offered by the text.

Recently, I watched this live stram by Daniel Bourke in which he built a food-not-food classifier from scratch and deployed it at the end to a website. This sparked an idea. Suddenly, I felt I could also do same. Of course, my knowledge was limited. He was using a neural network and the only thing I knew how to use at that moment was sklearn. Probably debatable, even ๐Ÿ˜‚.

In the book I was using, they talked about the MNIST dataset that sklearn comes with. Then I figured I'd use that dataset to train some sort of digit identifier given an image of it. The idea started to establish itself more and more in my head, so I decided to start and here's how I went about it.

Planning Out

I'm not the type that'd write out my plans when taking on project but for this one, I felt it'd be a great idea. I opened up notion and wrote out exactly what I planned to achieve. Digit Identifier.jpg

Now the Real Business

After planning out, it felt like I knew what I was going to do entirely, but honestly, I didn't.

Regardless, I decided to start.

Data Preparation and Model Training

I didn't really have to do much work preparing the data. Data was already ready.

Initially, I loaded it and trained a SVC (Support Vector Classifier) with it. Even though it was working, I didn't really feel content with it. Using data augmentation, I was able to extend the dataset and got a better model.

The final model I decided on was by no means the most optimized or the best, but for this particular project, It's just right.

I used pickle to save the model as soon as it had finished training. It took more than an hour to fit the final model I deployed and I wouldn't want to wait that long again.

Getting Website Ready

I was building the model while recording myself. I figured It'd be an interesting video to upload to my channel. I thought It'd help other beginners like myself.

After I finished that section of the video, I decided to start building the website off-camera. I didn't think it was something to add to the video.

I didn't know much about web development. I looked up a couple of tutorials on flask and how to use it to build a website that is capable of taking images from the user. It was really involving but I eventually got it working.

I wasn't too focused on the frontend but I think I did a pretty okay job ๐Ÿ˜…๐Ÿ˜….

Deployment and Finishing Touches

Eventually, I had to complete the work off-camera.

Honestly, there were a lot of things I had to research on.

It took me days to figure out how to get flask working well. It was another work finding out how to deploy on heroku.

After all these, I can confidently say that I've been able to learn a great deal from this project.

Honestly, I'm really happy! ๐Ÿ˜„

My goal for taking on this project was to be able to go through and have a feel of the whole processes involved in building and deploying good machines learning models in order to make it available for everyone. Now, I can confidently say that I get what it entails.

Overall, this project has been insightful and has helped me improve my skills in python, flask, machine learning and general problem solving abilities. It'll serve as a starting point for more improvements in my ML journey.

Click here: identifydigit.herokuapp.com to try out my model. Feedbacks are definitely welcomed.

And oh, the full length video of me building the thing is down here (including the stress)

BTW, checkout my other videos on the channel. I'd really appreciate your SUB ๐Ÿ˜‰


As always, the name is Treve; Paul Treve.

Connect with me on twitter: trevenue44. I like to meet new people and share ideas.

Do check out my YouTube channels: trevenue44 and Math plus Tech.

Thank you for reading up to this point. I really hope it was helpful.

ย