January 6, 2016

Automatically Sort Photos on Hard-drive Using Clarifai’s API

Table of Contents:

One of the top requests we’ve gotten since the launch of our mobile photo discovery app Forevery has been a desktop version that will automatically tag and sort photos on a hard drive. While we’re hard at work making that request into a real product, we’ve had some eager developers hacking away at their own versions of a desktop photo organizer using Clarifai’s API.


ImgSort was created by Nirupama Suneel and Nathan Wong at Dubhacks 2015. Their app automatically sorts images on your computer into different folders based on categories that the you set … so, if you ever wanted a folder of only cat photos, your dream is about to come true. Check out the GitHub repo to try it for yourself!


WHY WE ❤ IT
It’s such a hassle to sort and categorize photos manually no matter what device you’re storing your images on, so the functionality of this Clarifai Featured hack really resonated with us.

HOW YOU DO IT
We asked Nathan Wong of the ImgSort team to share how they created their app. Here’s what they had to say!

Clarifai: What inspired your idea for such a handy tool?
Nathan: Our team didn’t have a clue of what to build when we arrived at Dubhacks 2015. We attended Clarifai’s machine learning workshop where we got to see your machine learning and image recognition APIs in action. We felt that the image recognition aspect of the Clarifai API was incredibly powerful and easy to use, and we decided to design a project based around that functionality.

C: How does the app work?
N: After tinkering around with the Clarifai Java client, we had the idea of creating a sorting algorithm that could sort image files by content rather than lexicographically. When you have a massive folder of images on your computer, it’s such a hassle to sort them into categories by hand! To solve this problem, we built a program called ImgSort that can automatically sort a folder of images on a computer’s local file system into categories that the user defines.

C: What’s the magic sauce behind your Clarifai implementation?
N: We accomplished this by generating tags for each image using Clarifai’s API and cross-referencing them with the names of the categories and related words such as synonyms and hyponyms. The program works pretty well! However, it generally works best with generic category names such as “food”, “people”, and “buildings”. We hope to improve the program by using Clarifai’s machine learning concept models to find a way to sort the images so that the user doesn’t even have to declare new category names.


Thanks for sharing, Nathan!


To learn more, check out our documentation and sign-up for a free Clarifai account to start using our API – all it takes is three lines of code to get up and running! We’re super excited to share all the cool things built by our developer community, so don’t forget to tweet @Clarifai to show us your apps.