28mm / Fovea

unified cli for various saas image classification apis.
MIT License
40 stars 5 forks source link

Clarifai support #7

Open 28mm opened 7 years ago

28mm commented 7 years ago

Clarifai has a free tier that supports < 5000 requests / month. Clarifai offers a set of features that overlaps with other services:

  1. General image classification
  2. Face detection
  3. Celebrity recogntion (also: Microsoft, Watson)
  4. Dominant Color determination (also: Microsoft)
  5. NSFW Image detection (also: Microsoft)

As well as some interesting models that offer greater specificity within a restricted domain:

  1. Travel
  2. Wedding
  3. Food
  4. Apparel

In addition, Clarifai has

  1. the ability to train custom models, which would be an interesting feature addition.
  2. multiple language support.

https://developer.clarifai.com/models https://developer.clarifai.com/pricing

28mm commented 7 years ago

A 1st pass at multiple/selectable models.

[user@host]$ fovea --provider clarifai --model nsfw-v1.0 --model travel-v1.0  ../ex/petit\ soldat.jpg
0.9975989   sfw
0.002401174 nsfw
0.81481314  Wardrobe
0.7422658   Couch
0.5821117   Massage
0.5710578   People
0.45137754  Television
0.43034348  Lamp
0.34137008  Details
0.311964    Animals
0.30856794  Wedding
0.30099514  Chair
0.2610772   Telephone
0.23296061  Daytime
0.2257206   In-Room Kitchenette
0.22352721  Bathroom Shower
0.19117762  Bathroom Bathtub
0.13685365  Bathroom Sink
0.12062782  Bunk Beds
0.10399384  Desk
0.103389286 Coffee Machine
0.089739025 Minibar
28mm commented 7 years ago

list available models with --list-models:

[user@host]$ fovea --provider clarifai --list-models
general-v1.3    aaa03c23b3724a16a56b629203edc62c
food-items-v1.0 ecf02b31ad884d6785a9bd950f8e986c
apparel e0be3b9d6a454f0493ac3a30784001ff
weddings-v1.0   c386b7a870114f4a87477c0824499348
travel-v1.0 eee28c313d69466f836ab83287a54ed9
celeb-v1.3  e466caa0619f444ab97497640cefc4dc
color   eeed0b6733a644cea07cf4c60f87ebb7
nsfw-v1.0   e9576d86d2004ed1a38ba0cf39ecb4b1

Find new models with .../utilities/clarifai/clarifai-models.py:

[user@host]$ ./clarfai-models.py
weddings-v1.0   beaecb4d63b2485689d9b5aa95a33e40    2017-02-15T00:19:30.306957Z
food-items-v1.0 ecf02b31ad884d6785a9bd950f8e986c    2017-02-15T00:19:30.306957Z
nsfw-v1.0   ebfdb56692f34e18b88ff9ae258e756f    2017-02-15T00:19:30.306957Z
apparel aeae096937544d1e9e24545590004caa    2017-02-15T00:19:30.306957Z
travel-v1.0 aa59a3a6a5ed43c49ac99dccbfd97c10    2017-02-15T00:19:30.306957Z
age_gender_ethnicity    c0c0ac362b03416da06ab3fa36fb58e3    2016-12-23T06:08:44.271674Z
apparel e0be3b9d6a454f0493ac3a30784001ff    2016-12-20T22:43:29.831402Z
celeb-v1.3  e466caa0619f444ab97497640cefc4dc    2016-10-25T19:30:38.541073Z
face-v1.3   a403429f2ddf4b49b307e318f00e528b    2016-10-25T19:30:38.541073Z
face-v1.3   d02b4508df58432fbb84e800597b8959    2016-10-25T19:30:38.541073Z
weddings-v1.0   c386b7a870114f4a87477c0824499348    2016-09-22T19:14:51.993209Z
nsfw-v1.0   e9576d86d2004ed1a38ba0cf39ecb4b1    2016-09-17T22:18:59.955626Z
travel-v1.0 eee28c313d69466f836ab83287a54ed9    2016-09-17T22:18:59.955626Z
food-items-v1.0 bd367be194cf45149e75f01d59f77ba7    2016-09-17T22:18:59.955626Z
general-v1.3    cccbe437d6e54e2bb911c6aa292fb072    2016-06-17T22:01:04.144732Z
general-v1.3    bbb5f41425b8468d9b7a554ff10f8581    2016-06-17T22:01:04.144732Z
color   eeed0b6733a644cea07cf4c60f87ebb7    2016-05-11T18:05:45.924367Z
general-v1.3    aaa03c23b3724a16a56b629203edc62c    2016-03-09T17:11:39.608845Z
28mm commented 7 years ago

Celebrity face recognition. left-x, top-y, length, width, confidence, id, name...

fovea --provider clarifai --celebrities https://upload.wikimedia.org/wikipedia/en/1/15/Edward_Said.jpg
83  70  88  88  0.61    ai_90xmCG20 james cromwell
83  70  88  88  0.07    ai_5MZwFQSw richard portnow
28mm commented 7 years ago
[patrick@fausto]$ fovea --color --provider clarifai ~/Desktop/Alejandro+Valverde+b9UASwuiGQHm.jpg
0.11    #2c2a27 #000000 Black
0.61    #4b7ea7 #4682b4 SteelBlue
0.07    #da3037 #dc143c Crimson
0.09    #a6beb9 #c0c0c0 Silver
0.01    #ddbf3f #daa520 Goldenrod
0.10    #a27b67 #bc8f8f RosyBrown