From e100c4178c899a3930f336c641c9b61e4f5da411 Mon Sep 17 00:00:00 2001 From: Logan Patino Date: Thu, 5 Apr 2018 16:03:30 -0400 Subject: [PATCH 1/2] feat(visual recognition): Update Visual Recognition service --- config.properties.enc | Bin 3376 -> 3456 bytes .../v3/VisualRecognition.java | 32 +++++------------- .../v3/model/ClassResult.java | 2 +- .../v3/model/ClassifyOptions.java | 10 +++--- .../v3/model/DetectFacesOptions.java | 13 +++---- .../visual_recognition/v3/model/Face.java | 10 ------ .../visual_recognition/v3/model/FaceAge.java | 7 ++-- .../v3/model/FaceGender.java | 7 ++-- .../v3/VisualRecognitionIT.java | 10 ++++-- 9 files changed, 35 insertions(+), 56 deletions(-) diff --git a/config.properties.enc b/config.properties.enc index 67c33f77a153bdebc92c7d7fde1b3bb9ea67af57..82f1693e7e4fc3c573ad9511b17ed3f22e444aed 100644 GIT binary patch literal 3456 zcmV-`4S(|S(jToBlx}dw5i3ub3jU>PZ#!h--f}z@eSVyO%*Bk$Ve$p4MLew;Rb4GT z6vem|CQ=*Y=NZJjy!;@Fay?9PH%~5d+>uu0K5FJH$N)7NL>nn+UA}!fF23Ip2Sr0j_ zYSi&XaQfX0h<2|i96A!16=sFKg1~?RzB(f_1VEfE<-eVV}23`87`yx1_x&WdU))EVvEi^ZdYNM34M2^9~J3Co6e(@;m9Ah+3)6^y1v7OEWvU1`UnReQ*BdS%Bo`_yNFGfht{+;q@(djml+0c$LgLJ&LowH ze_ZyPnG>2&mMCffXOUmH7IWgmg)bE36keO?k|bS>RR-Uw4PS9ae1L`CpLYacv-OISIC<01xYZK>>k<8i#Tj_}vXYnjX$JI#N|wIgDd zk`0@L^)7clU4+bZ({EKbc)M;SHQ<8>bi|AjUgTt%vPZApRP8E-_@PWW~~Df2j36pt1m28)0_-~+w*(yDq!|I zt0embP6y7?gQ>i~ZPgWNc^YK8qp^e!0JUmBC;g@J+pSN}D`^*T5PL>Cjp;;?Y`yu+ z1aihoqAcVY({^c4hi&NS3^0hnk5vX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ee zo$?|e?fx~VI!m|(6`Eh=B`lSTNzo%1lw>`;XcZ_Gv|xs!9X(Aeh_FhHZz9}fTclK% zN3`=qGn%)%*~iN%b@cT@L^#%rsyTF}WJGTD>$o)xUweIMk4)KB||OkU-CKw6C{v^*!LFhg`68^Hb6pu4($X z*Vt&!Invp@ZC{#GfTy!BCXY>~Kq_hv1%%wdha{LpG);Fme+%+Yv!NoQv=R2TSfwc+ zzMbB@`6l&?Cfnzwys=0I)jlhD1ibu9rQ5()n%Otg{8usk>K3abJ+922b( z3Lm~VcEE;6l@TvXsoBNjO_<(cGK?+1arBu6vz9^fUktJu+ir4U%pwW9Hx#j@=-nm% zF2o{$I*JkOIYkE<5137CLcXa=$3~R=6V7iAnq#ctzAHh~kb_I}2fs?`0iJuocc%`K zWMe+TdaB)e)tBgo!~|hpk?b9`9J)StJM|Da&*qABo)K}vCTc; zg?TE0YF-1Hnb9y9kPqVwj|hm*@Xy$(zoJr0oGO+O6b2ln2kd~=BD6K-5^&F^To$?^ zD=pPD$~w_XJy|^>5;CNa#cn48kxk$PGSjm{uH5oc3f5VpGn;X>6?pkUAcc0e^3K$e Go`HF@hJITB 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/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/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/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(); + } } } From ae2eec8905021a3885dfd82e956e34ca8d3af0fd Mon Sep 17 00:00:00 2001 From: Logan Patino Date: Thu, 5 Apr 2018 16:11:56 -0400 Subject: [PATCH 2/2] refactor(visual-recognition): Remove unnecessary models --- .../v3/model/DetectFacesBetaOptions.java | 183 ------------------ .../v3/model/FaceFaceLocation.java | 106 ---------- .../v3/model/FaceIdentity.java | 62 ------ 3 files changed, 351 deletions(-) delete mode 100644 visual-recognition/src/main/java/com/ibm/watson/developer_cloud/visual_recognition/v3/model/DetectFacesBetaOptions.java delete mode 100644 visual-recognition/src/main/java/com/ibm/watson/developer_cloud/visual_recognition/v3/model/FaceFaceLocation.java delete mode 100644 visual-recognition/src/main/java/com/ibm/watson/developer_cloud/visual_recognition/v3/model/FaceIdentity.java 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/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/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; - } -}