I have a flow which I use to get an image from the IBM Object storage and pass it to a Watson Visual Recognition node for classification using a custom classifier I had trained. A few weeks earlier it stopped working and the visual recognition node would throw an error saying "Invalid JSON parameter received. Unable to parse.". I used "change" nodes to set the parameters of the message to be classified as shown here: I noticed that if I delete the node in which I set the Classifier Id, then I get no error and the image is classified using the default classifier. I tried using a function node to set the parameters using the following code, but I got the same error:
msg.params = {};
msg.params["detect_mode"] = "classify";
msg.params["classifier_ids"] = "person_705615375";
msg.params["threshold"] = 0;
return msg;
In addition, if I set the classifier to "Default" the image should be classified using the default classifier according to the visual recognition node's info page. However I still get the same error. Here is an example of a message passed for classification:
Some extra info from the visual recognition node's result:
result: object
error: object
message: "Invalid JSON parameter received. Unable to parse."
stack: "Error: Invalid JSON parameter received. Unable to parse.↵ at Request._callback (/home/vcap/app/node_modules/node-red-node-watson/node_modules/watson-developer-cloud/lib/requestwrapper.js:85:15)↵ at Request.self.callback (/home/vcap/app/node_modules/node-red-node-watson/node_modules/watson-developer-cloud/node_modules/request/request.js:186:22)↵ at emitTwo (events.js:87:13)↵ at Request.emit (events.js:172:7)↵ at Request.<anonymous> (/home/vcap/app/node_modules/node-red-node-watson/node_modules/watson-developer-cloud/node_modules/request/request.js:1163:10)↵ at emitOne (events.js:77:13)↵ at Request.emit (events.js:169:7)↵ at IncomingMessage.<anonymous> (/home/vcap/app/node_modules/node-red-node-watson/node_modules/watson-developer-cloud/node_modules/request/request.js:1085:12)↵ at IncomingMessage.g (events.js:260:16)↵ at emitNone (events.js:72:20)↵ at IncomingMessage.emit (events.js:166:7)↵ at endReadableNT (_stream_readable.js:923:12)↵ at nextTickC..."
code: 400
images_processed: 0
error: "Invalid JSON parameter received. Unable to parse."
description: "Invalid JSON parameter received. Unable to parse."
error_id: "parameter_error"
I got the same error.
Try this way. Rewrite function node like this:
msg.params={"classifier_ids":["person_705615375"],"threshold":0};
return msg;
"detect_mode" can be set in Visual Recognition node.