Thumbs Up for Watson’s Visual Recognition Service

Update 06/06/16: Check out this article for new functionality in the Watson Visual Recognition Service.

Watson’s Visual Recognition (beta) service on Bluemix understands the contents of images. Since the beginning of this month you can train this service with your own classifications. Below is a simple sample how to train Watson to recognize the thumbs up gesture.

This functionality could be used for example in the selfie drone scenario to steer drones using gestures and not only via web user interfaces and speech recognition. There are many more scenarios where this service could be valuable, for example damage recognition of buildings and vehicles, tourist guides or tagging of photos.

In order to train the service you need to provide at least 50 images which are positive examples and 50 images which are negative examples. You can try the service online and use predefined sets of images or upload your own images, in my case 100 images with hands.

thumbs1

After 4-5 minutes the Watson service has been trained and you can upload other images to test the new classifier. I used this picture:

thumbs3

Watson returned a confidence score of 85%.

thumbs2

In order to use this functionality in your apps you need to create your own service instance on Bluemix to get your own credentials. To create classifiers you can use REST APIs, Java or Node.js APIs or simply curl commands. The positive and negative sample pictures need to be put in zip files.

curl -u "{username}":"{password}" -X POST -F "positive_examples=@up.zip" -F "negative_examples=@not.zip" -F "name=thumbup" "https://gateway.watsonplatform.net/visual-recognition-beta/api/v2/classifiers?version=2015-12-02"

thumbs4

In order to request classifications of an image you need to provide a JSON file “classifierlist.json” with the classifier ids.

{
	"classifier_ids": [
		"thumbup_1207786847" 
	]
}

After this you can invoke this command.

curl -u "{username}":"{password}" -X POST -F "images_file=@thumbs3.JPG" -F "classifier_ids=<classifierlist.json" "https://gateway.watsonplatform.net/visual-recognition-beta/api/v2/classify?version=2015-12-02"

thumbs5

  • Wyatt Roberts

    I just started using this yesterday, and it’s amazing. Yesterday, I trained it to recognize restroom fixtures (I’m a real estate appraiser).

  • Yuning

    Hi, I tried to create a classifier and train it using the command you mentioned above, but I received error message: code 400, cannot execute learning task : no classifier name given.
    Could you help me solve this issue?

    here is my curl command:

    curl -u “0xxxxxxxxxxx”:”vxxxxxxxxxxxxxx”

    -X POST

    -F “positive_examples=@bottle-positive.zip”

    -F “negative_examples=@bottle-negative.zip”

    -F “name=plasticbottle”

    -k “https://gateway.watsonplatform.net/visual-recognition-beta/api/v2/classifiers?version=2015-12-02”

    • Niklas Heidloff

      Sorry, don’t know from the top of my head. Could you ask that question on StackOverflow?

      • Yuning

        Sure, thank you for the advice

  • kasha

    hi there… i was able to train it but i am not sure now what do i do to invoke it, exactly what image i pass i: images_file=@thumbs3.JPG.. from which file.. i tried uploading one of the images from one of the folders i tested and its telling me: “curl: (26) couldn’t open file “images_5.jpg”.. any help please:)

    • Niklas Heidloff

      What do you mean with uploading? Did you send our test picture with the curl command above?