I am fooling around with Watson VR, and attempting to train, then execute a trivial custom classifier against the same picture added as positive example in one of the zip files.
My code to create the classifier:
ClassifierOptions cOptions = new ClassifierOptions.Builder()
.classifierName("Mena")
.addClass("Mena", new File("/the/path/to/my_face.zip"))
.addClass("Mena2", new File("/the/path/to/my_face_new.zip"))
.build();
VisualClassifier classifier = VR_SERVICE.createClassifier(cOptions).execute();
The .zip
files contain two different images (.jpg
) of my face - one each.
The image file names contain no special characters.
I then run the classification service as follows:
ClassifyImagesOptions ciOptions = new ClassifyImagesOptions.Builder()
.classifierIds(classifier.getId())
.images(new File("/the/path/to/my_face.jpg")) // same file as one of the images
// uploaded previously in zip
.threshold(0d) // tried specifying explicitly but changes nothing
.build();
VisualClassification result = VR_SERVICE.classify(ciOptions).execute();
Unfortunately, when I print out the result, no joy:
{
"images_processed": 1,
"images": [
{
"classifiers": [],
"image": "my_face.jpg"
}
]
}
Considering I'm using the exact same copy of one of the pictures added to the classifier, I am under the impression that I'm doing something completely wrong, especially given the "classifiers": []
part.
Any pointers?
The .zip files contain two different images (.jpg) of my face - one each.
When training, the zip files containing examples must have at least 10 unique examples in each. (Uniqueness is determined by the hashcode of each image file's contents.)
Did you check the returned result from the training request? I suspect it returned a 400 code and message about the minimum number of examples.
Also, classes within a classifier are meant to be mutually exclusive, since the classifier training process is learning what makes class 1 different from the rest. For example, "broken window" vs "normal window". The system is also not optimized for face recognition, either (it is intended for general scenes) but providing pictures of the same individual in multiple classes will (i nth ebest case) lead it to find whatever random differences distinguish the two sets of examples, such as clothing or lighting conditions.