28mm / Fovea

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

IBM Watson Support #4

Open 28mm opened 7 years ago

28mm commented 7 years ago

IBM Watson's Visual Recognition service has a free tier that supports < 250 requests / day. It does image classification and face detection, as well as supporting a category schema like Microsoft's. It appears to support celebrity detection via the same category system.

https://www.ibm.com/watson/developercloud/doc/visual-recognition/getting-started.html

Example Image Classification:

{
 "custom_classes": 0,
  "images": [
    {
        "classifiers": [
            {
                "classes": [
                    {
                        "class": "banana",
                        "score": 0.81,
                        "type_hierarchy": "/fruit/banana"
                    },
                    {
                        "class": "fruit",
                        "score": 0.922
                    },
                    {
                        "class": "mango",
                        "score": 0.554,
                        "type_hierarchy": "/fruit/mango"
                    },
                    {
                        "class": "olive color"
                        "score": 0.951
                    },
                    {
                        "class": "olive green color"
                        "score": 0.747
                    }
                ],
                "classifier_id": "default",
                "name": "default"
            }
        ],
        "image": "fruitbowl.jpg"
    }
  ],
  "images_processed": 1
}

Example face and Identity detection:

{
  "images": [
    {
      "faces": [
        {
          "age": {
            "max": 54,
            "min": 45,
            "score": 0.364876
          },
          "face_location": {
            "height": 117,
            "left": 406,
            "top": 149,
            "width": 108
          },
          "gender": {
            "gender": "MALE",
            "score": 0.993307
          },
          "identity": {
            "name": "Barack Obama",
            "score": 0.982014
            "type_hierarchy": "/people/politicians/democrats/barack obama"
          }
        }
      ],
      "image": "prez.jpg"
    }
  ],
  "images_processed": 1
}
28mm commented 7 years ago

With the foregoing commits, the --labels and --faces features work with the watson provider. Still to do:

  1. --celebrities: this should come for free with face detection as the identity field. Watson gives a canonical name for the detected celebrity, its confidence, and the celebrity's type hierarchy. Some thought required to handle this last piece, which is unavailable via Microsoft's celebrity detection feature.
  2. Documentation updates: readme.md, .../examples
  3. Custom classifiers. Watson supports custom classifiers, as does Clarifai. How should support for this look?
28mm commented 7 years ago

The daily transaction limit for Watson's free plan is set fairly low.

{
    "labels": {
        "status": "ERROR",
        "statusInfo": "daily-transaction-limit-exceeded"
    }
}