How I built a Pose Inspiration App with AI— P1.Explore Clarifai API
subTitle Here
Preface
In the age of AI, there should be some AI tools to turn anybody into a good photographer. My girlfriend and I have visited more than 10 cities in past five years and we just figured out there aren’t many photos we feel proud of sharing on instagram. I know it is because I am a bad photographer, but I am learning to be a good one. In the meantime, we think there should be an App that helps boyfriends take great picture of girlfriends. We have got our motivation, and we decide to build it together.
Why?
Yesterday, my girlfriend showed me a post titled “How it feels like traveling with a boyfriend who sucks at taking your picture”.
Basic idea is like, you want a picture like this:

His picture is like that:

Where is my arm?

What am I doing?

With a quick search, you can find lots of articles like: How to Teach Your Non-Photographer boyfriend to Take Instagram-Worthy Photos, 10 Reason Men Suck at Taking your Picture…
I started to question myself, do men suck at taking pictures? — Probably , yes…
But, come on, we live in the era of AI. We have AI powered Autonomous Vehicles, Alpha Go, Amazon Go…There should be some products do men a favor taking nice pictures.
Clarifai API
Clarifai is a company founded in 2013 by Matthew Zeiler, a foremost expect in machine learning, Clarifai has been a market leader since winning the top five places in image classification at the ImageNet 2013 competition. Clarifai’s powerful image and video recognition solutions are built on the most advanced machine learning platform, and made easily accessible via API, device SDK, and on-permise, empowering business all over the world to build a new generation of intelligent applications.
A simple use case of their image API is to predict what is contained in an image ant its relevant possibility score. An example is like:

You can try to play with it: https://clarifai.com/demo
Let’s write some simple code to test how its API works
We use this photo below for test purpose.

And result we got is:
20
nature 0.9924043416976929
park 0.9785789251327515
summer 0.9617379903793335
flower 0.9560338854789734
tree 0.9427242279052734
sun 0.9328286647796631
fall 0.9319279193878174
beautiful 0.9287429451942444
fair weather 0.9273874759674072
grass 0.9049245119094849
outdoors 0.8856868743896484
girl 0.8722184896469116
fashion 0.8584886789321899
season 0.8522093296051025
relaxation 0.8392550945281982
bright 0.8176108598709106
leaf 0.8167992234230042
fun 0.8098653554916382
woman 0.8014916181564331
color 0.7773510217666626
[{'id': 'ai_tBcWlsCp', 'name': 'nature', 'value': 0.9924043416976929, 'app_id': 'main'}, {'id': 'ai_PBTpj0kl', 'name': 'park', 'value': 0.9785789251327515, 'app_id': 'main'}, {'id': 'ai_FsT0Zqdb', 'name': 'summer', 'value': 0.9617379903793335, 'app_id': 'main'}, {'id': 'ai_5WfQcbMp', 'name': 'flower', 'value': 0.9560338854789734, 'app_id': 'main'}, {'id': 'ai_TjbmxC6B', 'name': 'tree', 'value': 0.9427242279052734, 'app_id': 'main'}, {'id': 'ai_1d4Qk7Nr', 'name': 'sun', 'value': 0.9328286647796631, 'app_id': 'main'}, {'id': 'ai_LmFtHz7q', 'name': 'fall', 'value': 0.9319279193878174, 'app_id': 'main'}, {'id': 'ai_vz98nDK9', 'name': 'beautiful', 'value': 0.9287429451942444, 'app_id': 'main'}, {'id': 'ai_41s912fX', 'name': 'fair weather', 'value': 0.9273874759674072, 'app_id': 'main'}, {'id': 'ai_mp9KG5QH', 'name': 'grass', 'value': 0.9049245119094849, 'app_id': 'main'}, {'id': 'ai_Zmhsv0Ch', 'name': 'outdoors', 'value': 0.8856868743896484, 'app_id': 'main'}, {'id': 'ai_xQbBc1zb', 'name': 'girl', 'value': 0.8722184896469116, 'app_id': 'main'}, {'id': 'ai_dngMN46t', 'name': 'fashion', 'value': 0.8584886789321899, 'app_id': 'main'}, {'id': 'ai_Qp0fHhgG', 'name': 'season', 'value': 0.8522093296051025, 'app_id': 'main'}, {'id': 'ai_DqkHZlVW', 'name': 'relaxation', 'value': 0.8392550945281982, 'app_id': 'main'}, {'id': 'ai_LxrzLJmf', 'name': 'bright', 'value': 0.8176108598709106, 'app_id': 'main'}, {'id': 'ai_wBCrHPDb', 'name': 'leaf', 'value': 0.8167992234230042, 'app_id': 'main'}, {'id': 'ai_V2F286Wn', 'name': 'fun', 'value': 0.8098653554916382, 'app_id': 'main'}, {'id': 'ai_RQccV41p', 'name': 'woman', 'value': 0.8014916181564331, 'app_id': 'main'}, {'id': 'ai_0JbWBDPd', 'name': 'color', 'value': 0.7773510217666626, 'app_id': 'main'}]Cool, it seems to work and output is basically the same as result in the demo. Clarifai predicting API returns a list of 20 tags and shows score of possibility of each tag.
I think this is already good enough for us to recommend similar pictures based on a new picture. We will write more code and do some idea validation in next chapter.
II