1

When I try to train a classifier with two positive classes and with the API key (each class contains around 1200 images) in Watson Visual Recognition, it returns that "no classifier name is given" - but that I have already provided. This is the code:

     $ curl -X POST -F "blank_positive_examples=@C:\Users\rahansen\Desktop\Altmuligt\training\no_ocd\no_ocd.zip" -F "OCD_positive_examples=@C:\Users\rahansen\Desktop\Altmuligt\training\ocd\ocd.zip" -F "name=disease" "https://gateway-a.watsonplatform.net/visual-recognition/api/v3/classifiers?api_key={X}&version=2016-05-20"

     {"code":400,"error":"Cannot execute learning task.  : no classifier name given"}

What I have done so far:

  1. Removed all special characters in the file names as I thought that might be the problem:
  2. Tried to give other names for the classifeir, e.g. "name=ocd"
  3. I also tried to train it on a smaller dataset, like 40 images in each positive class and then it actually works fine. So maybe the size of the dataset is the problem. However, according to Watson training guidelines, I comply with the size regulations: https://www.ibm.com/watson/developercloud/doc/visual-recognition/customizing.html I have a free subscription.

Do anyone has any recommendations for how to solve this classifier training problem?

Radiodef
  • 37,180
  • 14
  • 90
  • 125

2 Answers2

2

This can occur when there's a problem processing the zip files. I would try simplifying your training files. For instance, use just 100 examples for class, then you can add more via retraining later. It's always good to train then measure performance and then add more training samples.

Matt Hill
  • 1,081
  • 6
  • 4
  • Thanks Matt. i will implement your training prodedure going forward. Also, I tried to change my internet connection and the training now works! I have no idea if the problem was due to the connection or bacause I had "send too many training requests" to Watson, that i somehow reached a limit. – Rasmus Hansen Jul 30 '17 at 13:48
0

@Rasmus, you should verify the name their picture neatly, meaning no special symbols, spaces or etc. in the file name of images. It appears to be related to special characters in the input. This API expects only characters and numbers in the alphabet as classifier names. It also requires that the images in your zip files end with a file extension for images like .jpg, .jpeg, .gif or .png

So, after you rename the images, check if all have the correct formats, like .jpg, .png, and supported formats for Visual Recognition.

Replace {api-key} with the service credentials you copied in the first step. Modify the location of the {class}_positive_examples to point to where you saved the .zip files.

And, use your cURL like:

curl -X POST
 -F "blank_positive_examples=@C:\Users\rahansen\Desktop\Altmuligt\training\no_ocd\no_ocd.zip"
 -F "OCD_positive_examples=@C:\Users\rahansen\Desktop\Altmuligt\training\ocd\ocd.zip"
 -F "name=disease"
 "https://gateway-a.watsonplatform.net/visual-recognition/api/v3/classifiers?api_key={api-key}&version=2016-05-20"

Obs. Can be other problem, see Other ask about error with classifier name.

My example working in my PC computer:

 curl -X POST -F "dog_positive_examples=c:\Dogs.zip" -F "negative_examples=c:\Cats.zip" -F "name=dogs" "https://gateway-a.watsonplatform.net/visual-recognition/api/v3/classifiers?api_key={API KEY}&version=2016-05-20"

See the official reference here.

Sayuri Mizuguchi
  • 5,250
  • 3
  • 26
  • 53
  • Thanks Sayuri. I have already tried to get rid of special characters and spaces in the file names. I only use characters, numbers, underscor and .jpg (for all the files in the end) in the file names now. Still it returns the same problem. – Rasmus Hansen Jul 28 '17 at 12:15
  • Do you see the [Guidelines for good trainning](https://www.ibm.com/watson/developercloud/doc/visual-recognition/customizing.html#guidelines-for-good-training)? Try to copy the original files to one folder, and after it, use the same command just with the zip like: `curl -X POST -F "blank_positive_examples=@no_ocd.zip" `. With this example we'll check if the problem is with the path – Sayuri Mizuguchi Jul 28 '17 at 12:47