Choosing your artist is one of the most important parts of getting a tattoo. You’re trusting someone with the creation and application of something that will presumably be on your body for the rest of your life. But choosing your artist can be a daunting, sometimes overwhelming process, especially if you’re a first timer, or new to an area and unfamiliar with local artists.
“When I moved to San Francisco, I didn’t know anything about the local tattoo scene,” said Lee Murray, Data Scientist in Residence at Galvanize. “I knew I would want another tattoo eventually, and I wanted a way to familiarize myself with the artists in San Francisco.”
To that end, Murray built a web app called InkQuick that lets you input a picture of a tattoo—Instagram images are preferred—analyzes it using a convolutional neural net, and returns a list of artists with a similar artistic style.
The brain of InkQuick is a four-layer neural network that looks at an image and, effectively, simply answers “is this a tattoo or not?”
The Tech Behind InkQuick
To start, Murray needed a dataset of tattoo images to train InkQuick’s neural net. Many tattoo artists use Instagram as a sort of digital portfolio to showcase their work, so Murray used a combination of Yelp listings, geotags, and hashtags to generate a list of some 20,000 potential Instagram accounts. But of that huge list, only a few hundred had more than one tattoo image posted—most were images posted by clients or friends, not the artists themselves.
After filtering the list down by hand to 198 accounts, Murray had a second problem. Many tattoo artists use their Instagram as both a personal feed of life images in addition to tattoo pictures, and Murray didn’t want an artist’s vacation photos or a snapshot of their dinner to be included in the dataset. He crowdsourced tattoo classification with a simple Flask app he distributed among friends and colleagues. The app would grab an image from the filtered list of artists and ask “is this a tattoo or not?”
Murray ended up with a set of 750 “yes” and 750 “no” images that he used to train the neural network. The net does four convolution steps, where it breaks the photo up into sub-chunks, called filters, and each filter teaches the net based on useful information.
“The whole idea of convolutional nets is that they should learn to find things in images,” Murray said. “What they’re doing is on one layer picking out shapes, maybe lines, and then on a different layer they can recognize more distinct stuff like ‘is this a dog.'”
In other words, the network takes an image and converts it into a number—or, a string of 250 numbers to be more specific. The final layer of the net then takes that string of numbers and uses it to classify the image as a tattoo or not—with around 85% accuracy.
Working Up to Recommendations
Now that Murray had a dataset of images to give as results, it was time to start offering recommendations. Instead of building an entirely new neural net to compare submitted images with the dataset, he used the extracted features from the classification network—a process known as transfer learning—to determine similarity.
Murray’s network was built to answer the question “is this a tattoo or not?” therefore, it knows a great deal about all the factors within an image that make it a tattoo. When a user inputs an image into InkQuick, Murray’s network runs it through that same neural network, converting the image into a string of 250 numbers.
But instead of carrying the image through the final layer of the net, (which would assign a score to classify it as a tattoo or not), it takes that 250 number string and compares it to the number string of every image in the dataset. The lower the cosine distance between the two numbers, the more similar the images. InkQuick then averages across each artist in the dataset and returns the Instagram accounts of the 10 artists with the closest scores.
Of course, InkQuick isn’t perfect. Of the list of 10 returned artists, more than a few often seem rather out of place. This is because though InkQuick is comparing an image of a tattoo with a database of tattoo images, there’s a lot in those images that have nothing to do with tattoo style that are also being compared. Things like background color, how much skin is showing, or what body part the tattoo is located on.
One of the biggest current issues is that user with less photos have a higher return rate, something Lee hopes to fix in the future. Another potential improvement would involve adding some sort of user feedback that could be used to further train the neural net.
Even so, InkQuick still works well. “Better than I thought it would,” Murray said.
While the app was built by Lee Murray, Sean Sall, Galvanize Data Scientist in Residence, helped us host the app on Galvanize. Thanks Sean!
You can get tattoo artist recommendations at Galvanize.com/tattoo
Want more data science tutorials and content? Subscribe to our data science newsletter.