Once a month, Unsplash organizes Makeday, a one or two day period to build cool stuff that is not on the roadmap. Makeday allows anyone to express creativity and create awesome side projects.
At Unsplash, we work with a huge amount of quality photos, uploaded by photographers to create their portfolio and share their amazing work.
Since I studied image analysis a couple of years ago, I thought it would be cool to study our photos and extract new data that is not provided by the camera or the photographer.
And just like that, Unsplash Landmarks is born.
Google provides an API to analyze photos and extract information based on what’s actually pictured. Note that Amazon also has a similar solution.
Google Vision API
Google Vision API can analyze a photo and detect:
- Dominant colors
- Key elements in the photo
I thought I would focus the API usage on landmarks detection. So I decided to analyse Unsplash photos and gather the landmarks detection data.
It’s not 100% accurate and I didn’t setup any validation system so we might get some false positives.
I didn’t want to process all of the Unsplash photos at once, because it could be harsh on our servers and if we want to change something, we would have to reprocess everything.
Instead, a processing script is run every couple of minutes and processes 5 unprocessed photos, continuously. The script is still running, and will … forever !
The detection results are stored in a Postgres database and an API endpoint to serve them has been created.
Landmarks on a map
Vision API not only gives you the landmark name but also its geolocation. So we can actually pin all of the detected landmarks on a map. And if a landmark appears on multiple photos, then we can cycle through the corresponding photos when clicking on the landmark.
The geolocation, landmarks and photo URLs are obtained by querying our API endpoint and the front-end work consists in pinning the results on the map.
Nothing major on the map. It’s using Mapbox with a theme based on the well known light-v9 theme.
I figured that some cities possess a lot of landmarks and the map can get messy with overlapping markers. To solve this, I used markers clustering, a very nice feature from Mapbox. A single cluster can represent multiple markers that will spread when zooming on the cluster icon.
As of today, only a really small portion of the photos have been processed and about 120 landmarks were detected.
The next steps are :
- Process more photos, faster
- Manual/community validation system for the landmarks detection
- Bring the landmarks data to unsplash.com to help search and tagging
Wow, the community took photos of landmarks all around the world. It’s even more impressive when you know that we only processed a really small percentage of the available photos on Unsplash.
Unsplash photographers are travelling and they are sharing their view of our beautiful world with you. Enjoy !