0

我有以下用于创建简单分类器的 IBM Watson Visual Recognition Python SDK:

with open(os.path.dirname("/home/xxx/Desktop/Husky.zip/"), 'rb') as dogs, \ 
    open(os.path.dirname("/home/xxx/Desktop/Husky.zip/"), 'rb') as cats:
    print(json.dumps(visual_recognition.create_classifier('Dogs Vs Cats',dogs_positive_examples=dogs,negative_examples=cats), indent=2))

带有新分类器 ID 及其状态的响应如下:

{
  "status": "training", 
  "name": "Dogs Vs Cats", 
  "created": "2016-06-23T06:30:00.115Z", 
  "classes": [
    {
      "class": "dogs"
    }
  ], 
  "owner": "840ad7db-1e17-47bd-9961-fc43f35d2ad0", 
  "classifier_id": "DogsVsCats_250748237"
}

训练状态显示失败。

打印(json.dumps(visual_recognition.list_classifiers(),缩进=4))

{
    "classifiers": [
        {
            "status": "failed", 
            "classifier_id": "DogsVsCats_250748237", 
            "name": "Dogs Vs Cats"
        }
    ]
}

这是什么原因?

4

2 回答 2

1
with open(os.path.dirname("/home/xxx/Desktop/Husky.zip/"), 'rb') as dogs, \ 
    open(os.path.dirname("/home/xxx/Desktop/Husky.zip/"), 'rb') as cats:
    print(json.dumps(visual_recognition.create_classifier('Dogs Vs Cats',dogs_positive_examples=dogs,negative_examples=cats), indent=2))

您正在发送相同的文件内容“Husky.zip”供服务用作正面和负面示例。但是,该系统至少需要 10 个正例图像和 10 个负例图像,它们是唯一的。该服务在训练之前比较图像文件内容的哈希码,并将任何重复项仅保留在正集中。所以,去重后你的负集是空的,导致训练失败。在分类器详细信息的详细列表中应该有一个名为“解释”的附加字段,说明这可能是问题所在。

于 2016-08-09T00:19:47.400 回答
1

训练调用和数据有大小限制:

The service accepts a maximum of 10,000 images or 100 MB per .zip file

The service requires a minimum of 10 images per .zip file.

The service accepts a maximum of 256 MB per training call.

分类调用也有大小限制:

The POST /v3/classify methods accept a maximum of 20 images per batch.

The POST /v3/detect_faces methods accept a maximum of 15 images per batch.

The POST /v3/recognize_text methods accept a maximum of 10 images per batch.

请参阅http://www.ibm.com/smarterplanet/us/en/ibmwatson/developercloud/doc/visual-recognition/customizing.shtml

于 2016-06-23T12:58:09.530 回答