Search code examples
ibm-cloudibm-watsonvisual-recognition

What are the rules for class names in IBM Watson Visual Recognition service?


I'm exploring IBM Watson Visual Recognition service and when I create a classifier using classnames like 'black-dog' (i.e. black-dog_positive_example), this classname is later returned as 'black_dog' (with underscore replacing dash) when I classify an image using the /v3/classify endpoint.

But when I retrieve the classifier details with the /v3/classifiers/{classifier_id} the class is correctly listed as 'black-dog'.

So, my result for GET /v3/classifiers/{classifier_id} is like:

{
    "classifier_id": "dog_561932172",
    "name": "dog",
    "owner": "xxxxxxxx-xxx-xxx-xxx-xxxxxxxxxxxx",
    "status": "ready",
    "created": "2016-07-30T22:06:39.327Z",
    "classes": [
        {"class": "black-dog"}
    ]
}

While my result for GET /v3/classify is

{
  "custom_classes": 1,
  "images": [
    {
      "classifiers": [
        {
          "classes": [
            {
              "class": "black_dog",
              "score": 0.546941
            }
          ],
          "classifier_id": "dog_561932172",
          "name": "dog"
        }
      ],
      "image": "20160620_142113.jpg"
    }
  ],
  "images_processed": 1
}

So is this expected or a defect? Should I avoid using "-" in class names? Are there any other rules for the value of a classname?


Solution

  • Are there any other rules for the value of a classname?

    We made an update, and the service should no longer modify any class names like replacing a dash with an underscore. Instead, it will not accept class names with any of these characters for custom learning: \,|,*,{,},$,-,/,',`,"

    (You'll see the dash is included in there.) Spaces are acceptable. The update is not retroactive, so existing class names that were modified during training are not affected.