Building a Vinyl Image Recognition and Recommendation Application using Python

Photo by Mick Haupt on Unsplash

Building a Vinyl Image Recognition and Recommendation Application using Python

·

4 min read

If you’re a music lover, you probably at some point in life have listened to vinyl on a record player. Or maybe you’re old fashioned like me or just a hipster with your own tiny collection. As someone who’s a little fed up with all the curated playlists from different musicians on streaming services, I’ve recently fallen back on my craving for fully-packaged and cohesive albums.

Vinyls are the perfect antidote for streaming fatigue. However, we’ve been pretty spoiled when it comes to finding new music. These days we can pretty much type any artist into a search bar and listen to their entire discography at the drop of a hat. You can’t do that with vinyl shopping. When you walk into a store, you can’t just swipe on an album cover to hear the beat. You can’t really gauge the mood or acoustics from the album art. It’s the world of analogue (and that’s part of the charm). But what’s a music nerd to do if I want a little guided help with the world of vinyls?

Crate Scanner to the rescue! In sum, Crate Scanner is an application that detects vinyl covers and returns streaming samples in the form of Spotify widgets, reviews and prices pulled from Discogs, and music recommendations generated through a K-nearest-neighbor algorithm. This project was built by a team of four (author included) as a final capstone project for Le Wagon's Data Science course. You can view the full repository here on Github.

(Want to watch a live demonstration of the application? Check it out here! Continue reading below for an explanation of how it works behind the scenes.)

Here's a walk through of how the app works.

On our homepage, the user has the option to upload a pre-existing photo or capture a new one: 3.png

We decided to go with this little gem. Let's see if Crate Scanner knows anything about the wall:

4.png

This whole process takes a couple seconds so we have to give the user some fancy loading graphics : )

5.png

And then the moment of truth!

6.png

The Dataset

The initial dataset was taken from BestEverAlbums.com where we were able to pull all the basic and meta information for each vinyl. However, missing from the dataset was information such as the Spotify ID which would later be used to generate widgets for each album, as well as the album’s audio features which is crucial to having a recommendation system. If you’re interested in learning about the process of setting up a Spotify Developer account and utilizing the amazing Spotify API, you should read through a similar music exploration project of mine here.

Image recognition

For image processing, we used a tool from the mysterious world of Deep Learning called convulsional neural networks. CNN is the go to method for image processing. It scans over the image in blocks and then interprets these into what we call vectors. With transfer learning, we extract features from the images such as shapes and lines and other objects. So basically, we transform the images into sets of numbers and then compare those numbers to find a match. We essentially are digitizing an image through its vectors. And then we use those numbers to find the closest numerical match in our database.

Screen Shot 2022-04-06 at 8.39.40 PM.png

Web Scraping and Recommendations

So our model returns an album name and an artist name. But we are still missing the price and user review! We know we could find this information on two different websites. So we decided to go with web scraping (writing a piece of code to extract all the information needed from the website.) When the album was chosen, it hen needed to find some similar albums. We passed the selected albums audio features to our KNN model which retrieved the closest sounding albums from our dataset.

Screen Shot 2022-04-06 at 8.39.58 PM.png

Below is a graphic representation of the entire process.

Screen Shot 2022-04-06 at 8.48.01 PM.png