Image Processing For Machine Learning!

Anyone who’s done any machine learning knows you need some data.

I have lots of embroidery files that I’ve converted into lists of (x, y) positions and flags for jumping and changing colors, basically direct translations from machine code to a .csv human-understandable-at-a-glance format.

When you buy embroidery patterns, or hell, just peruse them, good vendors have pictures of the finished project with an attractive thread selection. Trouble is, most machine learning algorithms expect really consistent images if you’re doing image processing like I’m trying to do: images that are all the same size and directly correlate to the (x,y) needle placements. Or rather, as direct as possible, given that embroidery also gets distorted during a stitch-out.

So I made a web app that lets me overlay the image on top of a loaded stitch file. The app lets me resize and move the image to overlap with the stitches as closely as I can, as well as letting me pick colors from the real image in order to color the stitch simulation’s lines (in case color ends up helping the machine learning at some point).
I save two versions (really, four files): a 1000×1000 large size of the image/stitch placements because this is the resolution at which the embroidery machine makes needle placements. Each pixel is a valid position at which a needle can touchdown within a 4in x 4in hoop. The second version is 227×227 pixels, the size my partner on this project says the algorithm we’re using will take source images. The resolution for needle placement seems really crappy, but maybe it’ll be easier/faster/good enough?

Anyhow, it took a lot of fiddly programming to get the app to do what I wanted to as quickly/easily as I could, but I like how it is now. I just need to work on the machine learning side of it, get back into Ubuntuing and seeing if our LSTM can stand on its legs. If I can get it to run at all, then I’ll keep processing data to get as much as I can before doing a proper run. If I can’t, then… I’ll need to look to an open source library like OpenCV for other techniques.

c2864c2864_tiny  c2864_bigOc2864_big

The following images are of my rainbow color scheme. It helps me know the order in which to pick colors (Red-Yellow-Green-Blue-Purple). It gets hard when there are a LOT of colors (10+) but it works really well most of the time. Also, the far left image shows needle placements, an option I can toggle to see jump stitches, for example.



ut1185 ut1185_tinyut1185_bigOut1185_big

I love Urban Thread’s work so much. Much of my data is from designs I’ve bought on their sales. Full support 1000%!


1 thought on “Image Processing For Machine Learning!”

  1. In such cases, semi-supervised learning techniques can be used that incorporate labeled data to reduce the amount of images that need to be trained by an operator while improving the accuracy of unsupervised clustering.

Leave a Reply

Your email address will not be published. Required fields are marked *