diff --git a/config.properties.enc b/config.properties.enc index 67c33f77a15..82f1693e7e4 100644 Binary files a/config.properties.enc and b/config.properties.enc differ diff --git a/visual-recognition/src/main/java/com/ibm/watson/developer_cloud/visual_recognition/v3/VisualRecognition.java b/visual-recognition/src/main/java/com/ibm/watson/developer_cloud/visual_recognition/v3/VisualRecognition.java index b880d2ee7b1..6ca4e72e906 100644 --- a/visual-recognition/src/main/java/com/ibm/watson/developer_cloud/visual_recognition/v3/VisualRecognition.java +++ b/visual-recognition/src/main/java/com/ibm/watson/developer_cloud/visual_recognition/v3/VisualRecognition.java @@ -164,13 +164,14 @@ public ServiceCall classify() { /** * Detect faces in images. * - * **Important:** On April 2, 2018, the identity information in the response to calls to the Face model will be - * removed. The identity information refers to the `name` of the person, `score`, and `type_hierarchy` knowledge - * graph. For details about the enhanced Face model, see the [Release - * notes](https://console.bluemix.net/docs/services/visual-recognition/release-notes.html#23february2018). Analyze and - * get data about faces in images. Responses can include estimated age and gender, and the service can identify - * celebrities. This feature uses a built-in classifier, so you do not train it on custom classifiers. The Detect - * faces method does not support general biometric facial recognition. + * **Important:** On April 2, 2018, the identity information in the response to calls to the Face model was removed. + * The identity information refers to the `name` of the person, `score`, and `type_hierarchy` knowledge graph. For + * details about the enhanced Face model, see the [Release + * notes](https://console.bluemix.net/docs/services/visual-recognition/release-notes.html#2april2018). Analyze and get + * data about faces in images. Responses can include estimated age and gender. This feature uses a built-in model, so + * no training is necessary. The Detect faces method does not support general biometric facial recognition. Supported + * image formats include .gif, .jpg, .png, and .tif. The maximum image size is 10 MB. The minimum recommended pixel + * density is 32X32 pixels per inch. * * @param detectFacesOptions the {@link DetectFacesOptions} containing the options for the call * @return a {@link ServiceCall} with a response type of {@link DetectedFaces} @@ -201,23 +202,6 @@ public ServiceCall detectFaces(DetectFacesOptions detectFacesOpti return createServiceCall(builder.build(), ResponseConverterUtils.getObject(DetectedFaces.class)); } - /** - * Detect faces in images. - * - * **Important:** On April 2, 2018, the identity information in the response to calls to the Face model will be - * removed. The identity information refers to the `name` of the person, `score`, and `type_hierarchy` knowledge - * graph. For details about the enhanced Face model, see the [Release - * notes](https://console.bluemix.net/docs/services/visual-recognition/release-notes.html#23february2018). Analyze and - * get data about faces in images. Responses can include estimated age and gender, and the service can identify - * celebrities. This feature uses a built-in classifier, so you do not train it on custom classifiers. The Detect - * faces method does not support general biometric facial recognition. - * - * @return a {@link ServiceCall} with a response type of {@link DetectedFaces} - */ - public ServiceCall detectFaces() { - return detectFaces(null); - } - /** * Create a classifier. * diff --git a/visual-recognition/src/main/java/com/ibm/watson/developer_cloud/visual_recognition/v3/model/ClassResult.java b/visual-recognition/src/main/java/com/ibm/watson/developer_cloud/visual_recognition/v3/model/ClassResult.java index 1468c162137..c24b1111369 100644 --- a/visual-recognition/src/main/java/com/ibm/watson/developer_cloud/visual_recognition/v3/model/ClassResult.java +++ b/visual-recognition/src/main/java/com/ibm/watson/developer_cloud/visual_recognition/v3/model/ClassResult.java @@ -52,7 +52,7 @@ public Float getScore() { /** * Gets the typeHierarchy. * - * Knowledge graph of the property. For example, `People/Leaders/Presidents/USA/Barack Obama`. Included only if + * Knowledge graph of the property. For example, `/fruit/pome/apple/eating apple/Granny Smith`. Included only if * identified. * * @return the typeHierarchy diff --git a/visual-recognition/src/main/java/com/ibm/watson/developer_cloud/visual_recognition/v3/model/ClassifyOptions.java b/visual-recognition/src/main/java/com/ibm/watson/developer_cloud/visual_recognition/v3/model/ClassifyOptions.java index ee3cde5074e..5018db8e40d 100644 --- a/visual-recognition/src/main/java/com/ibm/watson/developer_cloud/visual_recognition/v3/model/ClassifyOptions.java +++ b/visual-recognition/src/main/java/com/ibm/watson/developer_cloud/visual_recognition/v3/model/ClassifyOptions.java @@ -353,11 +353,11 @@ public List owners() { /** * Gets the classifierIds. * - * Which classifiers to apply. Overrides the **owners** parameter. You can specify both custom and built-in - * classifiers. The built-in `default` classifier is used if both **classifier_ids** and **owners** parameters are - * empty. The following built-in classifier IDs require no training: - `default`: Returns classes from thousands of - * general tags. - `food`: (Beta) Enhances specificity and accuracy for images of food items. - `explicit`: (Beta) - * Evaluates whether the image might be pornographic. + * Which classifiers to apply. Overrides the **owners** parameter. You can specify both custom and built-in classifier + * IDs. The built-in `default` classifier is used if both **classifier_ids** and **owners** parameters are empty. The + * following built-in classifier IDs require no training: - `default`: Returns classes from thousands of general tags. + * - `food`: (Beta) Enhances specificity and accuracy for images of food items. - `explicit`: (Beta) Evaluates whether + * the image might be pornographic. * * @return the classifierIds */ diff --git a/visual-recognition/src/main/java/com/ibm/watson/developer_cloud/visual_recognition/v3/model/DetectFacesBetaOptions.java b/visual-recognition/src/main/java/com/ibm/watson/developer_cloud/visual_recognition/v3/model/DetectFacesBetaOptions.java deleted file mode 100644 index b0b4a10f4e8..00000000000 --- a/visual-recognition/src/main/java/com/ibm/watson/developer_cloud/visual_recognition/v3/model/DetectFacesBetaOptions.java +++ /dev/null @@ -1,183 +0,0 @@ -/* - * Copyright 2018 IBM Corp. All Rights Reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ -package com.ibm.watson.developer_cloud.visual_recognition.v3.model; - -import java.io.File; -import java.io.FileInputStream; -import java.io.FileNotFoundException; -import java.io.InputStream; - -import com.ibm.watson.developer_cloud.service.model.GenericModel; - -/** - * The detectFacesBeta options. - */ -public class DetectFacesBetaOptions extends GenericModel { - - private InputStream imagesFile; - private String imagesFilename; - private String url; - private String imagesFileContentType; - - /** - * Builder. - */ - public static class Builder { - private InputStream imagesFile; - private String imagesFilename; - private String url; - private String imagesFileContentType; - - private Builder(DetectFacesBetaOptions detectFacesBetaOptions) { - imagesFile = detectFacesBetaOptions.imagesFile; - imagesFilename = detectFacesBetaOptions.imagesFilename; - url = detectFacesBetaOptions.url; - imagesFileContentType = detectFacesBetaOptions.imagesFileContentType; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Builds a DetectFacesBetaOptions. - * - * @return the detectFacesBetaOptions - */ - public DetectFacesBetaOptions build() { - return new DetectFacesBetaOptions(this); - } - - /** - * Set the imagesFile. - * - * @param imagesFile the imagesFile - * @return the DetectFacesBetaOptions builder - */ - public Builder imagesFile(InputStream imagesFile) { - this.imagesFile = imagesFile; - return this; - } - - /** - * Set the imagesFilename. - * - * @param imagesFilename the imagesFilename - * @return the DetectFacesBetaOptions builder - */ - public Builder imagesFilename(String imagesFilename) { - this.imagesFilename = imagesFilename; - return this; - } - - /** - * Set the url. - * - * @param url the url - * @return the DetectFacesBetaOptions builder - */ - public Builder url(String url) { - this.url = url; - return this; - } - - /** - * Set the imagesFileContentType. - * - * @param imagesFileContentType the imagesFileContentType - * @return the DetectFacesBetaOptions builder - */ - public Builder imagesFileContentType(String imagesFileContentType) { - this.imagesFileContentType = imagesFileContentType; - return this; - } - - /** - * Set the imagesFile. - * - * @param imagesFile the imagesFile - * @return the DetectFacesBetaOptions builder - * - * @throws FileNotFoundException if the file could not be found - */ - public Builder imagesFile(File imagesFile) throws FileNotFoundException { - this.imagesFile = new FileInputStream(imagesFile); - this.imagesFilename = imagesFile.getName(); - return this; - } - } - - private DetectFacesBetaOptions(Builder builder) { - imagesFile = builder.imagesFile; - imagesFilename = builder.imagesFilename; - url = builder.url; - imagesFileContentType = builder.imagesFileContentType; - } - - /** - * New builder. - * - * @return a DetectFacesBetaOptions builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the imagesFile. - * - * An image file or .zip file with images. Limit the .zip file to 100 MB. You can include a maximum of 15 images in a - * request. Encode the image and .zip file names in UTF-8 if they contain non-ASCII characters. The service assumes - * UTF-8 encoding if it encounters non-ASCII characters. - * - * @return the imagesFile - */ - public InputStream imagesFile() { - return imagesFile; - } - - /** - * Gets the imagesFilename. - * - * The filename for imagesFile. - * - * @return the imagesFilename - */ - public String imagesFilename() { - return imagesFilename; - } - - /** - * Gets the url. - * - * A string with the image URL to analyze. Redirects are followed, so you can use a shortened URL. - * - * @return the url - */ - public String url() { - return url; - } - - /** - * Gets the imagesFileContentType. - * - * The content type of imagesFile. Values for this parameter can be obtained from the HttpMediaType class. - * - * @return the imagesFileContentType - */ - public String imagesFileContentType() { - return imagesFileContentType; - } -} diff --git a/visual-recognition/src/main/java/com/ibm/watson/developer_cloud/visual_recognition/v3/model/DetectFacesOptions.java b/visual-recognition/src/main/java/com/ibm/watson/developer_cloud/visual_recognition/v3/model/DetectFacesOptions.java index 014f98e0f8d..fea0f2f9a27 100644 --- a/visual-recognition/src/main/java/com/ibm/watson/developer_cloud/visual_recognition/v3/model/DetectFacesOptions.java +++ b/visual-recognition/src/main/java/com/ibm/watson/developer_cloud/visual_recognition/v3/model/DetectFacesOptions.java @@ -156,9 +156,10 @@ public Builder newBuilder() { /** * Gets the imagesFile. * - * An image file (.jpg, .png) or .zip file with images. Include no more than 15 images. All faces are detected, but if - * there are more than 10 faces in an image, age and gender confidence scores might return scores of 0. You can also - * include an image with the **url** parameter. + * An image file (gif, .jpg, .png, .tif.) or .zip file with images. Limit the .zip file to 100 MB. You can include a + * maximum of 15 images in a request. Encode the image and .zip file names in UTF-8 if they contain non-ASCII + * characters. The service assumes UTF-8 encoding if it encounters non-ASCII characters. You can also include an + * image with the **url** parameter. * * @return the imagesFile */ @@ -180,9 +181,9 @@ public String imagesFilename() { /** * Gets the url. * - * The URL of an image to analyze. Must be in .jpg, or .png format. The minimum recommended pixel density is 32X32 - * pixels per inch, and the maximum image size is 2 MB. You can also include images with the **images_file** - * parameter. + * The URL of an image to analyze. Must be in .gif, .jpg, .png, or .tif format. The minimum recommended pixel density + * is 32X32 pixels per inch, and the maximum image size is 10 MB. Redirects are followed, so you can use a shortened + * URL. You can also include images with the **images_file** parameter. * * @return the url */ diff --git a/visual-recognition/src/main/java/com/ibm/watson/developer_cloud/visual_recognition/v3/model/Face.java b/visual-recognition/src/main/java/com/ibm/watson/developer_cloud/visual_recognition/v3/model/Face.java index c12eb9a4bac..22dd1218fe3 100644 --- a/visual-recognition/src/main/java/com/ibm/watson/developer_cloud/visual_recognition/v3/model/Face.java +++ b/visual-recognition/src/main/java/com/ibm/watson/developer_cloud/visual_recognition/v3/model/Face.java @@ -24,7 +24,6 @@ public class Face extends GenericModel { private FaceGender gender; @SerializedName("face_location") private FaceLocation faceLocation; - private FaceIdentity identity; /** * Gets the age. @@ -52,13 +51,4 @@ public FaceGender getGender() { public FaceLocation getFaceLocation() { return faceLocation; } - - /** - * Gets the identity. - * - * @return the identity - */ - public FaceIdentity getIdentity() { - return identity; - } } diff --git a/visual-recognition/src/main/java/com/ibm/watson/developer_cloud/visual_recognition/v3/model/FaceAge.java b/visual-recognition/src/main/java/com/ibm/watson/developer_cloud/visual_recognition/v3/model/FaceAge.java index 0f9d9b30a09..a0de0913a77 100644 --- a/visual-recognition/src/main/java/com/ibm/watson/developer_cloud/visual_recognition/v3/model/FaceAge.java +++ b/visual-recognition/src/main/java/com/ibm/watson/developer_cloud/visual_recognition/v3/model/FaceAge.java @@ -15,8 +15,7 @@ import com.ibm.watson.developer_cloud.service.model.GenericModel; /** - * Provides age information about a face. If there are more than 10 faces in an image, the response might return the - * confidence score `0`. + * Provides age information about a face. */ public class FaceAge extends GenericModel { @@ -49,8 +48,8 @@ public Long getMax() { /** * Gets the score. * - * Confidence score for the property in the range of 0 to 1. A higher score indicates greater likelihood that the - * class is depicted in the image. The default threshold for returning scores from a classifier is 0.5. + * Confidence score in the range of 0 to 1. A higher score indicates greater confidence in the estimated value for the + * property. * * @return the score */ diff --git a/visual-recognition/src/main/java/com/ibm/watson/developer_cloud/visual_recognition/v3/model/FaceFaceLocation.java b/visual-recognition/src/main/java/com/ibm/watson/developer_cloud/visual_recognition/v3/model/FaceFaceLocation.java deleted file mode 100644 index 8d7a6936c22..00000000000 --- a/visual-recognition/src/main/java/com/ibm/watson/developer_cloud/visual_recognition/v3/model/FaceFaceLocation.java +++ /dev/null @@ -1,106 +0,0 @@ -/* - * Copyright 2017 IBM Corp. All Rights Reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ -package com.ibm.watson.developer_cloud.visual_recognition.v3.model; - -import com.ibm.watson.developer_cloud.service.model.GenericModel; - -/** - * FaceFaceLocation. - */ -public class FaceFaceLocation extends GenericModel { - - private Double width; - private Double height; - private Double left; - private Double top; - - /** - * Gets the width. - * - * Width in pixels of face region. - * - * @return the width - */ - public Double getWidth() { - return width; - } - - /** - * Gets the height. - * - * Height in pixels of face region. - * - * @return the height - */ - public Double getHeight() { - return height; - } - - /** - * Gets the left. - * - * x-position of top-left pixel of face region. - * - * @return the left - */ - public Double getLeft() { - return left; - } - - /** - * Gets the top. - * - * y-position of top-left pixel of face region. - * - * @return the top - */ - public Double getTop() { - return top; - } - - /** - * Sets the width. - * - * @param width the new width - */ - public void setWidth(final Double width) { - this.width = width; - } - - /** - * Sets the height. - * - * @param height the new height - */ - public void setHeight(final Double height) { - this.height = height; - } - - /** - * Sets the left. - * - * @param left the new left - */ - public void setLeft(final Double left) { - this.left = left; - } - - /** - * Sets the top. - * - * @param top the new top - */ - public void setTop(final Double top) { - this.top = top; - } -} diff --git a/visual-recognition/src/main/java/com/ibm/watson/developer_cloud/visual_recognition/v3/model/FaceGender.java b/visual-recognition/src/main/java/com/ibm/watson/developer_cloud/visual_recognition/v3/model/FaceGender.java index eca3ae32277..0a15c91e53f 100644 --- a/visual-recognition/src/main/java/com/ibm/watson/developer_cloud/visual_recognition/v3/model/FaceGender.java +++ b/visual-recognition/src/main/java/com/ibm/watson/developer_cloud/visual_recognition/v3/model/FaceGender.java @@ -15,8 +15,7 @@ import com.ibm.watson.developer_cloud.service.model.GenericModel; /** - * Provides information about the gender of the face. If there are more than 10 faces in an image, the response might - * return the confidence score 0. + * Provides information about the gender of the face. */ public class FaceGender extends GenericModel { @@ -37,8 +36,8 @@ public String getGender() { /** * Gets the score. * - * Confidence score for the property in the range of 0 to 1. A higher score indicates greater likelihood that the - * class is depicted in the image. The default threshold for returning scores from a classifier is 0.5. + * Confidence score in the range of 0 to 1. A higher score indicates greater confidence in the estimated value for the + * property. * * @return the score */ diff --git a/visual-recognition/src/main/java/com/ibm/watson/developer_cloud/visual_recognition/v3/model/FaceIdentity.java b/visual-recognition/src/main/java/com/ibm/watson/developer_cloud/visual_recognition/v3/model/FaceIdentity.java deleted file mode 100644 index 73e5afcbb5b..00000000000 --- a/visual-recognition/src/main/java/com/ibm/watson/developer_cloud/visual_recognition/v3/model/FaceIdentity.java +++ /dev/null @@ -1,62 +0,0 @@ -/* - * Copyright 2018 IBM Corp. All Rights Reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ -package com.ibm.watson.developer_cloud.visual_recognition.v3.model; - -import com.google.gson.annotations.SerializedName; -import com.ibm.watson.developer_cloud.service.model.GenericModel; - -/** - * Provides information about a celebrity who is detected in the image. Not returned when a celebrity is not detected. - */ -public class FaceIdentity extends GenericModel { - - private String name; - private Float score; - @SerializedName("type_hierarchy") - private String typeHierarchy; - - /** - * Gets the name. - * - * Name of the person. - * - * @return the name - */ - public String getName() { - return name; - } - - /** - * Gets the score. - * - * Confidence score for the property in the range of 0 to 1. A higher score indicates greater likelihood that the - * class is depicted in the image. The default threshold for returning scores from a classifier is 0.5. - * - * @return the score - */ - public Float getScore() { - return score; - } - - /** - * Gets the typeHierarchy. - * - * Knowledge graph of the property. For example, `People/Leaders/Presidents/USA/Barack Obama`. Included only if - * identified. - * - * @return the typeHierarchy - */ - public String getTypeHierarchy() { - return typeHierarchy; - } -} diff --git a/visual-recognition/src/test/java/com/ibm/watson/developer_cloud/visual_recognition/v3/VisualRecognitionIT.java b/visual-recognition/src/test/java/com/ibm/watson/developer_cloud/visual_recognition/v3/VisualRecognitionIT.java index d8d57d4cd93..4fa0115aa54 100644 --- a/visual-recognition/src/test/java/com/ibm/watson/developer_cloud/visual_recognition/v3/VisualRecognitionIT.java +++ b/visual-recognition/src/test/java/com/ibm/watson/developer_cloud/visual_recognition/v3/VisualRecognitionIT.java @@ -56,6 +56,7 @@ public class VisualRecognitionIT extends WatsonServiceTest { private static final String IMAGE_URL = "https://watson-test-resources.mybluemix.net/resources/car.png"; private static final String SINGLE_IMAGE_FILE = "src/test/resources/visual_recognition/car.png"; + private String classifierId; private VisualRecognition service; private void assertClassifyImage(ClassifiedImages result, ClassifyOptions options) { @@ -107,6 +108,8 @@ public void setUp() throws Exception { Assume.assumeFalse("config.properties doesn't have valid credentials.", (apiKey == null) || apiKey.equals("API_KEY")); + classifierId = getProperty("visual_recognition.v3.classifier_id"); + service = new VisualRecognition("2016-05-20"); service.setApiKey(apiKey); service.setDefaultHeaders(getDefaultHeaders()); @@ -259,8 +262,11 @@ public void testCreateClassifier() throws FileNotFoundException, InterruptedExce public void testDeleteAllClassifiers() { List classifiers = service.listClassifiers(null).execute().getClassifiers(); for (Classifier classifier : classifiers) { - DeleteClassifierOptions deleteOptions = new DeleteClassifierOptions.Builder(classifier.getClassifierId()).build(); - service.deleteClassifier(deleteOptions).execute(); + if (!classifier.getClassifierId().equals(classifierId)) { + DeleteClassifierOptions deleteOptions = new DeleteClassifierOptions.Builder(classifier.getClassifierId()) + .build(); + service.deleteClassifier(deleteOptions).execute(); + } } }