The intersection between Software Engineering and Knitting
In honor of the Brooklyn Yarn Crawl, which is taking place (in person!) in Brooklyn, NY this weekend, my blog this week will be on the intersection between coding and knitting. While the two may seem opposites in their nature, there is actually a good deal they have in common.
At a glance
Let’s start with knitting. Knitting can be done by hand, or by machine. It involves a length of yarn that is strung between needles and threaded through itself to form a fabric. Hand knitting can create an intricate piece of material with a variety of stitches. Machine knitting is a bit more limited in the complexity of the stitches that it creates, but can create fabric much faster and with more uniformity than hand knitting. There is a right and wrong side to a piece of fabric (an outside and an inside if you are looking at the sweater that you are currently wearing). Each stitch has an inverse, depending upon if you are knitting on the right or wrong side. For simplicity’s sake, we will only look at one pair of stitches: knit and purl. Knit is the stitch that makes the little v on your sweater, and purl is the line you see on the inside. The combination of these two stitches can create a variety of patterns on the final product.
Most knitting comes with a pattern. These patterns lay out directions in a uniform way to let knitters know exactly what they need to do to construct their final product. If you look at the hem or sleeve cuffs of a sweater, you will commonly see what is called ribbing; the elastic, vertically columned edge. If you are looking at a knitting pattern, the directions for that ribbing would look something like this:
Row 1: *k2, p2; rep from *
This indicates to knit two stitches and then purl two stitches, repeating this until the end of the row.
These directions are remarkably similar to code. They tell the knitter exactly what to do in a shortened and extremely specific (there are standard naming conventions and most patterns provide a key for the abbreviation of each stitch) directions with little to no extra explanation. Directions are sequential, but can lead you back to previous sections or loop you through a series of stitches as seen in the above example.
Real world implications
While forming this connection made me excited to try to convert my knitting friends into coders (or coding friends into knitters!), there are more important real world implications that are being explored at MIT and Carnegie Mellon University.
Researchers at MIT’s Computer Science and Artificial Intelligence Laboratory have developed a system called “InverseKnit” that translates photos of knitted patterns to instructions, that are then provided to a knitting machine, which makes the final garment. No need of knitting patterns is required as the system has a dataset of knitting instructions matched with photos of the finished product. The system is trained to match photos with patterns.
Computer scientists at Carnegie Mellon University are working to develop a system that can translate 3-D shapes into patterns, in a similar way to 3-D printers. Their goal is to simplify the process of garment production, and to allow for more customization. Current machine knitting produces uniform garments, and the people designing the clothing that is made on them rarely have experience or knowledge on how to program them. With further work, customizable garments could be created at mass scale on knitting machines with ease.
Both the MIT and Carnegie Mellon University research has extensive implications, not only on the garment and fashion industry, but also on computer science in advances in image recognition and in product usability. While I do not see myself making the shift from hand to machine knitting any time soon, it is exciting to know that work is being done to make garment creation more accessible for everyone.