Project: Is it edible?
Exams are over, so I’ve decided to post some of the projects I’ve made, but haven’t posted on here.
This was one that I made at SB Hacks, my first hackathon! Great times, new friends, and so much cool stuff! It was definitely an experience I won’t forget!
Anyway, I was playing around with the Clarifai API, which does image recognition, and I got the idea to combine this API with Wordnet, to create a program that can tell if something is edible.
Basically, it takes in an image, uses Clarifai to generate a set of terms that it thinks best describes the image (Computer Vision is awesome!), then looks it up in Wordnet, finds out if these words are in the “Food” category, then returns the probability that it’s edible.
An example: Let’s say I have this cake image in the same folder as the code, named “cake.jpg”
Then, I can run the code as so:
It will give the output:
The first line of output is a list of possible objects in the image, which it is surprisingly accurate about. The second line is the calculated probility that the object depicted in the image is edible, and it’s right! Of course a cake is perfectly edible!
This was just a fun little experiment; nothing too difficult. So here’s the code: