视觉识别错误400:无法执行学习任务,未提供分类器名称 [英] Visual Recognition error 400: Cannot execute learning task no classifier name given
问题描述
我正在使用视觉识别curl命令向图像添加分类:
I am using Visual Recognition curl command to add a classification to an image:
curl -u "user":"password" \
-X POST \
-F "images_file=@image0.jpg" \
-F "classifier_ids=classifierlist.json" \
"https://gateway.watsonplatform.net/visual-recognition-beta/api/v2/classifiers?version=2015-12-02"
json文件:
{
"classifiers": [
{
"name": "tomato",
"classifier_id": "tomato_1",
"created": "2016-03-23T17:43:11+00:00",
"owner": "xyz"
}
]
}
(也尝试不使用分类器数组.出现相同的错误) 并得到一个错误: {代码":400,错误":无法执行学习任务:未指定分类器名称"}
(Also tried without the classifiers array. Got the same error) and getting an error: {"code":400,"error":"Cannot execute learning task : no classifier name given"}
json出问题了吗?
Is something wrong with the json?
推荐答案
要指定要使用的分类器,您需要发送类似于以下内容的JSON对象:
To specify the classifiers you want to use you need to send a JSON object similar to:
{"classifier_ids": ["Black"]}
在CURL中使用Black
作为分类ID的示例:
An example using Black
as classifier id in CURL:
curl -u "user":"password" \
-X POST \
-F "images_file=@image0.jpg" \
-F "classifier_ids={\"classifier_ids\":[\"Black\"]}"
"https://gateway.watsonplatform.net/visual-recognition-beta/api/v2/classify?version=2015-12-02"
如果要在JSON文件中列出分类ID,则:
If you want to list the classifier ids in a JSON file then:
curl -u "user":"password" \
-X POST \
-F "images_file=@image0.jpg" \
-F "classifier_ids=@classifier_ids.json"
"https://gateway.watsonplatform.net/visual-recognition-beta/api/v2/classify?version=2015-12-02"
classifier_ids.json
具有的位置:
{
"classifier_ids": ["Black"]
}
您可以在 API资源管理器.
在文档中了解有关该服务的更多信息.
You can test the Visual Recognition API in the API Explorer.
Learn more about the service in the documentation.
这篇关于视觉识别错误400:无法执行学习任务,未提供分类器名称的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!