public class VisualRecognition extends WatsonService
| Modifier and Type | Field and Description |
|---|---|
static String |
VERSION_DATE_2015_12_02
The version date: 2015-12-02.
|
VERSION| Constructor and Description |
|---|
VisualRecognition(String versionDate)
Instantiates a new Visual Recognition V2 service.
|
| Modifier and Type | Method and Description |
|---|---|
VisualClassification |
classify(File imagesFile)
Classifies the image/s against all the classifiers.
|
VisualClassification |
classify(File imagesFile,
VisualClassifier... classifiers)
Classifies the images against the label groups and labels.
|
VisualClassification |
classify(String filename,
InputStream imagesInputStream,
VisualClassifier... classifiers)
Classifies the image/s against the Classifiers.
|
VisualClassifier |
createClassifier(String name,
File positiveImages,
File negativeImages)
Train a new classifier on the uploaded image data.
|
void |
deleteClassifier(String classifierId)
Deletes a classifier.
|
VisualClassifier |
getClassifier(String classifierId)
Retrieves a classifier.
|
List<VisualClassifier> |
getClassifiers()
Retrieves the list of classifiers.
|
configureHttpClient, execute, executeRequest, executeWithoutResponse, getApiKey, getEndPoint, getName, getToken, setApiKey, setAuthentication, setDefaultHeaders, setEndPoint, setUsernameAndPassword, toStringpublic static final String VERSION_DATE_2015_12_02
public VisualRecognition(String versionDate)
versionDate - The version date (yyyy-MM-dd) of the REST API to use. Specifying this value
will keep your API calls from failing when the service introduces breaking changes.public VisualClassification classify(File imagesFile)
VisualRecognition service = new VisualRecognition("2015-12-02");
service.setUsernameAndPassword("<username>", "<password>");
File image = new File("car.png");
VisualClassification result = service.classify(image);
System.out.println(result);
imagesFile - the image/s to classifypublic VisualClassification classify(File imagesFile, VisualClassifier... classifiers)
VisualRecognition service = new VisualRecognition("2015-12-02");
service.setUsernameAndPassword("<username>", "<password>");
File image = new File("car.png");
VisualClassifier car = new VisualClassifier("Car");
VisualClassification result = service.classify(image, car);
System.out.println(result);
imagesFile - the image/s to classifyclassifiers - the classifierspublic VisualClassification classify(String filename, InputStream imagesInputStream, VisualClassifier... classifiers)
VisualRecognition service = new VisualRecognition("2015-12-02");
service.setUsernameAndPassword("<username>", "<password>");
FileInputStream image = new FileInputStream("car.png");
VisualClassifier car = new VisualClassifier("Car");
VisualClassification result = service.classify("foo.png", image, car);
System.out.println(result);
filename - The file nameimagesInputStream - the image/s input stream to classifyclassifiers - the classifiersClassificationpublic VisualClassifier createClassifier(String name, File positiveImages, File negativeImages)
VisualRecognition service = new VisualRecognition("2015-12-02");
service.setUsernameAndPassword("<username>", "<password>");
File positiveImages = new File("positive.zip"); // zip file with at least 10 images
File negativeImages = new File("negative.zip");
VisualClassifier foo = service.createClassifier("foo", positiveImages, negativeImages);
System.out.println(foo);
name - the classifier namepositiveImages - A compressed (.zip) file of images which prominently depict the visual
subject for a new classifier. Must contain a minimum of 10 images.negativeImages - A compressed (.zip) file of images which do not depict the subject for a
new classifier. Must contain a minimum of 10 images.VisualClassifierVisualClassifierpublic void deleteClassifier(String classifierId)
classifierId - the classifier ID to deleteVisualClassifierpublic VisualClassifier getClassifier(String classifierId)
classifierId - the classifier IDVisualClassifierpublic List<VisualClassifier> getClassifiers()
VisualClassifierCopyright © 2015–2016. All rights reserved.