1
votes

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?

2
Looks like a defect to me, so thanks for bringing this up. A good way to avoid this would to not use dashes. However, let me get in contact with the Visual Recognition team to verify whether or not this is expected behavior. I looked in the API reference and couldn't find any rules regarding the classname.joe

2 Answers

1
votes

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.

2
votes

Update:

Updated via Matt's answer.


Talked with the support team, and it is indeed a bug. Here was their response:

Thanks for pointing this out. I reproduced and confirmed with dev team, and we do consider this inconsistency between the listed class name and the class name in results is a bug.

And this is because the class name been altered in result from what is submitted.

I have raised a ticket for tracking on this. According to developer, currently the output can be either a document to list the substitutions or find a way to remove them.

...so they are currently working on it.