I'm in a situation where I need to match a lot of socks after washing, once again. And this is just half of it! Last time I did this manually, it took me ten long torturous minutes. So, I decided to do the only rational thing and use machine learning to match the socks. However, I gave myself only 10-minutes to get the job done, so it won't be costlier than manual matching. In this video, I will let machines take over my chores!
Outline of this video:
0:00 The "Socks Matching" Problem
1:01 The ML Solution With OpenCV
4:19 The Results
5:02 The Future
OpenCV (computer vision) library that I used in this project:
https://opencv.org
https://github.com/opencv/opencv
To replicate my project:
https://docs.opencv.org/master/d5/d6f... (The "feature matching" example that I copy pasted from in this video. It is one of the top Google search results when you search for "image pattern matching")
Using your package manager, install following packages: opencv, opencv-contrib, cmake, make
Create a directory named "Matcher".
Copy the example code to a file named "Matcher.cpp" inside that directory.
Execute following commands inside that directory: "cmake . && make && ./Matcher"
Done! You now have a working image pattern matcher app.
Above example uses brute force matching using Scale-invariant feature transform (https://en.wikipedia.org/wiki/Scale-i.... If you have time, you can try the deep-learning module of OpenCV and get even better results.
My "Cleanest Linux Productivity and Development Environment using Manjaro Linux" video which you can use to setup a similar machine-learning environment as I used in this video:
• Cleanest Linux Productivity and Devel...
My "Software Engineering" Playlist:
• Software Engineering
- - - - - - - - - -
/ quanticdev
/ quantic_dev
https://quanticdev.com
- - - - - - - - - -
Abstract:
For this project, I decided to use machine learning to find matching pairs of my socks. I only gave myself ten minutes to complete the project. Ten minutes is about how much it takes me to sort my socks manually. As a senior software engineer, it is only fair that I should be able to automate the same task within only ten minutes, using machine learning (aka AI).
Since I had only ten minutes to complete the entire project, I had to take shortcuts. For that reason, I decided not to use a machine learning framework like PyTorch or TensorFlow. Instead, I simply googled for "image pattern matching" and discovered OpenCV. OpenCV is a computer vision library which is based on various pre-trained models and machine learning algorithms. As I have discovered, when it comes to image processing and recognition, it is the pinnacle of AI (artificial intelligence).
Using OpenCV documentation, I managed to come up with a working sock sorting app quickly. If you want to learn exactly how I did that, check out the midsection of the video. Making socks matching app using OpenCV on Manjaro Linux was a breeze. I completed the entire project in only eight minutes. I assume it would be similarly fast to build a mobile ML app using OpenCV. That is what I am going to try on the next washing cycle. And I will document it too. So watch out for my next video!