无法在Node-Red Watson Visual Recognition节点中使用自定义分类器

时间:2017-12-26 18:20:03

标签: node-red watson visual-recognition

我有一个流程,用于从IBM Object存储中获取图像,并使用我训练过的自定义分类器将其传递给Watson Visual Recognition节点进行分类。几周前它停止工作,视觉识别节点会抛出一个错误,说“接收到无效的JSON参数”。无法解析。"。我使用"改变"节点设置要分类的消息参数,如下所示:enter image description here 我注意到如果我删除了我在其中设置分类器ID的节点,那么我没有得到任何错误,并且使用默认分类器对图像进行分类。我尝试使用函数节点使用以下代码设置参数,但我得到了同样的错误:

msg.params = {};
msg.params["detect_mode"] = "classify";
msg.params["classifier_ids"] = "person_705615375";
msg.params["threshold"] = 0;
return msg;

此外,如果我将分类器设置为"默认"应根据视觉识别节点的信息页面使用默认分类器对图像进行分类。但是我仍然得到同样的错误。以下是传递用于分类的消息示例:

enter image description here

来自视觉识别节点的一些额外信息的结果:

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"

1 个答案:

答案 0 :(得分:2)

我得到了同样的错误。

试试这种方式。 像这样重写函数节点:

private List<Product> _selectedProducts;

        public List<Product> SelectedProducts
        {
            get
            {
                return _selectedProducts;
            }
        }

        public string ProductName { get; set; }

        public string ProductCategory { get; set; }

        private void frmSearchProducts_Load(object sender, EventArgs e)
        {
            _selectedProducts = new List<Product>();

            this.KeyPreview = true;

            //TODO: do search product            
        }

        protected override void OnKeyDown(KeyEventArgs e)
        {
            base.OnKeyDown(e);

            switch (e.KeyCode)
            {
                case Keys.Enter:
                    {
                        //TODO: Get your selected on gridview...
                        _selectedProducts = new List<Product>();

                        // set dialog result
                        DialogResult = DialogResult.OK;

                        // close form
                        Hide();
                    }
                    break;

            }
        }

&#34; detect_mode&#34;可以在视觉识别节点中设置。