Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

IBM Watson Visual Recognition Service in Bluemix always returning empty content

I'm trying to test the IBM Watson Visual Recognition Service in Bluemix using the API tester.

1st I want to get the list of valid labels:

  1. I open the API tester: http://www.ibm.com/smarterplanet/us/en/ibmwatson/developercloud/apis/#!/visual-recognition/getLabelService
  2. I issue an empty string
  3. Response Body: no content, Response Code: 0

While reading the source code of the demo app I was inferring the labels, e.g. "Animal"

  1. I open this link: http://www.ibm.com/smarterplanet/us/en/ibmwatson/developercloud/apis/#!/visual-recognition/recognizeLabelsService
  2. I upload an images and set label to "Animal"
  3. Response Body: no content, Response Code: 0

Any idea what I'm doing wrong?

The demo app seems to work quite well, at least it recognizes an image of Obama as "person, president, obama" :)

like image 731
Romeo Kienzler Avatar asked Jul 31 '15 08:07

Romeo Kienzler


1 Answers

Check out the following links for some examples on how to use the service.

If you were to use the image http://visual-recognition-demo.mybluemix.net/images/63992.jpg. The post request to Watson would look like the following.

form data for watson

All the code on the server side (Node.Js) is doing is streaming the image to Watson.

    function(req, res) {

        var stream = fs.createReadStream(req.files.imgFile.path);
        var params = {
            image_file: stream
        };

        visualRecognition.recognize(params, function(error, result) {
            if (error) {
                return res.status(error.error ? error.error.code || 500 : 500).json({ error: error });
            } else {
                return res.json(result);
            }
        });
    }

Demo allowing you to upload your own image and identify it

The code for the above app is available here.

like image 180
Jeff Sloyer Avatar answered Oct 10 '22 22:10

Jeff Sloyer