Skip to content

Commit 9fcf1f3

Browse files
Merge pull request #2179 from awsmobilesdk/models-update-rekognitio202010159sEWV25V761
rekognition Update models to latest
2 parents 291afc5 + 1d35978 commit 9fcf1f3

29 files changed

+4057
-4
lines changed

aws-android-sdk-rekognition/src/main/java/com/amazonaws/services/rekognition/AmazonRekognition.java

Lines changed: 97 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -946,6 +946,102 @@ DetectModerationLabelsResult detectModerationLabels(
946946
DetectModerationLabelsRequest detectModerationLabelsRequest)
947947
throws AmazonClientException, AmazonServiceException;
948948

949+
/**
950+
* <p>
951+
* Detects Personal Protective Equipment (PPE) worn by people detected in an
952+
* image. Amazon Rekognition can detect the following types of PPE.
953+
* </p>
954+
* <ul>
955+
* <li>
956+
* <p>
957+
* Face cover
958+
* </p>
959+
* </li>
960+
* <li>
961+
* <p>
962+
* Hand cover
963+
* </p>
964+
* </li>
965+
* <li>
966+
* <p>
967+
* Head cover
968+
* </p>
969+
* </li>
970+
* </ul>
971+
* <p>
972+
* You pass the input image as base64-encoded image bytes or as a reference
973+
* to an image in an Amazon S3 bucket. The image must be either a PNG or JPG
974+
* formatted file.
975+
* </p>
976+
* <p>
977+
* <code>DetectProtectiveEquipment</code> detects PPE worn by up to 15
978+
* persons detected in an image.
979+
* </p>
980+
* <p>
981+
* For each person detected in the image the API returns an array of body
982+
* parts (face, head, left-hand, right-hand). For each body part, an array
983+
* of detected items of PPE is returned, including an indicator of whether
984+
* or not the PPE covers the body part. The API returns the confidence it
985+
* has in each detection (person, PPE, body part and body part coverage). It
986+
* also returns a bounding box (<a>BoundingBox</a>) for each detected person
987+
* and each detected item of PPE.
988+
* </p>
989+
* <p>
990+
* You can optionally request a summary of detected PPE items with the
991+
* <code>SummarizationAttributes</code> input parameter. The summary
992+
* provides the following information.
993+
* </p>
994+
* <ul>
995+
* <li>
996+
* <p>
997+
* The persons detected as wearing all of the types of PPE that you specify.
998+
* </p>
999+
* </li>
1000+
* <li>
1001+
* <p>
1002+
* The persons detected as not wearing all of the types PPE that you
1003+
* specify.
1004+
* </p>
1005+
* </li>
1006+
* <li>
1007+
* <p>
1008+
* The persons detected where PPE adornment could not be determined.
1009+
* </p>
1010+
* </li>
1011+
* </ul>
1012+
* <p>
1013+
* This is a stateless API operation. That is, the operation does not
1014+
* persist any data.
1015+
* </p>
1016+
* <p>
1017+
* This operation requires permissions to perform the
1018+
* <code>rekognition:DetectProtectiveEquipment</code> action.
1019+
* </p>
1020+
*
1021+
* @param detectProtectiveEquipmentRequest
1022+
* @return detectProtectiveEquipmentResult The response from the
1023+
* DetectProtectiveEquipment service method, as returned by Amazon
1024+
* Rekognition.
1025+
* @throws InvalidS3ObjectException
1026+
* @throws InvalidParameterException
1027+
* @throws ImageTooLargeException
1028+
* @throws AccessDeniedException
1029+
* @throws InternalServerErrorException
1030+
* @throws ThrottlingException
1031+
* @throws ProvisionedThroughputExceededException
1032+
* @throws InvalidImageFormatException
1033+
* @throws AmazonClientException If any internal errors are encountered
1034+
* inside the client while attempting to make the request or
1035+
* handle the response. For example if a network connection is
1036+
* not available.
1037+
* @throws AmazonServiceException If an error response is returned by Amazon
1038+
* Rekognition indicating either a problem with the data in the
1039+
* request, or a server side issue.
1040+
*/
1041+
DetectProtectiveEquipmentResult detectProtectiveEquipment(
1042+
DetectProtectiveEquipmentRequest detectProtectiveEquipmentRequest)
1043+
throws AmazonClientException, AmazonServiceException;
1044+
9491045
/**
9501046
* <p>
9511047
* Detects text in the input image and converts it into machine-readable
@@ -1777,6 +1873,7 @@ GetTextDetectionResult getTextDetection(GetTextDetectionRequest getTextDetection
17771873
* @throws ProvisionedThroughputExceededException
17781874
* @throws ResourceNotFoundException
17791875
* @throws InvalidImageFormatException
1876+
* @throws ServiceQuotaExceededException
17801877
* @throws AmazonClientException If any internal errors are encountered
17811878
* inside the client while attempting to make the request or
17821879
* handle the response. For example if a network connection is

aws-android-sdk-rekognition/src/main/java/com/amazonaws/services/rekognition/AmazonRekognitionClient.java

Lines changed: 125 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -339,6 +339,7 @@ private void init() {
339339
jsonErrorUnmarshallers.add(new ResourceInUseExceptionUnmarshaller());
340340
jsonErrorUnmarshallers.add(new ResourceNotFoundExceptionUnmarshaller());
341341
jsonErrorUnmarshallers.add(new ResourceNotReadyExceptionUnmarshaller());
342+
jsonErrorUnmarshallers.add(new ServiceQuotaExceededExceptionUnmarshaller());
342343
jsonErrorUnmarshallers.add(new ThrottlingExceptionUnmarshaller());
343344
jsonErrorUnmarshallers.add(new VideoTooLargeExceptionUnmarshaller());
344345
jsonErrorUnmarshallers.add(new JsonErrorUnmarshaller());
@@ -1700,6 +1701,129 @@ public DetectModerationLabelsResult detectModerationLabels(
17001701
}
17011702
}
17021703

1704+
/**
1705+
* <p>
1706+
* Detects Personal Protective Equipment (PPE) worn by people detected in an
1707+
* image. Amazon Rekognition can detect the following types of PPE.
1708+
* </p>
1709+
* <ul>
1710+
* <li>
1711+
* <p>
1712+
* Face cover
1713+
* </p>
1714+
* </li>
1715+
* <li>
1716+
* <p>
1717+
* Hand cover
1718+
* </p>
1719+
* </li>
1720+
* <li>
1721+
* <p>
1722+
* Head cover
1723+
* </p>
1724+
* </li>
1725+
* </ul>
1726+
* <p>
1727+
* You pass the input image as base64-encoded image bytes or as a reference
1728+
* to an image in an Amazon S3 bucket. The image must be either a PNG or JPG
1729+
* formatted file.
1730+
* </p>
1731+
* <p>
1732+
* <code>DetectProtectiveEquipment</code> detects PPE worn by up to 15
1733+
* persons detected in an image.
1734+
* </p>
1735+
* <p>
1736+
* For each person detected in the image the API returns an array of body
1737+
* parts (face, head, left-hand, right-hand). For each body part, an array
1738+
* of detected items of PPE is returned, including an indicator of whether
1739+
* or not the PPE covers the body part. The API returns the confidence it
1740+
* has in each detection (person, PPE, body part and body part coverage). It
1741+
* also returns a bounding box (<a>BoundingBox</a>) for each detected person
1742+
* and each detected item of PPE.
1743+
* </p>
1744+
* <p>
1745+
* You can optionally request a summary of detected PPE items with the
1746+
* <code>SummarizationAttributes</code> input parameter. The summary
1747+
* provides the following information.
1748+
* </p>
1749+
* <ul>
1750+
* <li>
1751+
* <p>
1752+
* The persons detected as wearing all of the types of PPE that you specify.
1753+
* </p>
1754+
* </li>
1755+
* <li>
1756+
* <p>
1757+
* The persons detected as not wearing all of the types PPE that you
1758+
* specify.
1759+
* </p>
1760+
* </li>
1761+
* <li>
1762+
* <p>
1763+
* The persons detected where PPE adornment could not be determined.
1764+
* </p>
1765+
* </li>
1766+
* </ul>
1767+
* <p>
1768+
* This is a stateless API operation. That is, the operation does not
1769+
* persist any data.
1770+
* </p>
1771+
* <p>
1772+
* This operation requires permissions to perform the
1773+
* <code>rekognition:DetectProtectiveEquipment</code> action.
1774+
* </p>
1775+
*
1776+
* @param detectProtectiveEquipmentRequest
1777+
* @return detectProtectiveEquipmentResult The response from the
1778+
* DetectProtectiveEquipment service method, as returned by Amazon
1779+
* Rekognition.
1780+
* @throws InvalidS3ObjectException
1781+
* @throws InvalidParameterException
1782+
* @throws ImageTooLargeException
1783+
* @throws AccessDeniedException
1784+
* @throws InternalServerErrorException
1785+
* @throws ThrottlingException
1786+
* @throws ProvisionedThroughputExceededException
1787+
* @throws InvalidImageFormatException
1788+
* @throws AmazonClientException If any internal errors are encountered
1789+
* inside the client while attempting to make the request or
1790+
* handle the response. For example if a network connection is
1791+
* not available.
1792+
* @throws AmazonServiceException If an error response is returned by Amazon
1793+
* Rekognition indicating either a problem with the data in the
1794+
* request, or a server side issue.
1795+
*/
1796+
public DetectProtectiveEquipmentResult detectProtectiveEquipment(
1797+
DetectProtectiveEquipmentRequest detectProtectiveEquipmentRequest)
1798+
throws AmazonServiceException, AmazonClientException {
1799+
ExecutionContext executionContext = createExecutionContext(detectProtectiveEquipmentRequest);
1800+
AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();
1801+
awsRequestMetrics.startEvent(Field.ClientExecuteTime);
1802+
Request<DetectProtectiveEquipmentRequest> request = null;
1803+
Response<DetectProtectiveEquipmentResult> response = null;
1804+
try {
1805+
awsRequestMetrics.startEvent(Field.RequestMarshallTime);
1806+
try {
1807+
request = new DetectProtectiveEquipmentRequestMarshaller()
1808+
.marshall(detectProtectiveEquipmentRequest);
1809+
// Binds the request metrics to the current request.
1810+
request.setAWSRequestMetrics(awsRequestMetrics);
1811+
} finally {
1812+
awsRequestMetrics.endEvent(Field.RequestMarshallTime);
1813+
}
1814+
Unmarshaller<DetectProtectiveEquipmentResult, JsonUnmarshallerContext> unmarshaller = new DetectProtectiveEquipmentResultJsonUnmarshaller();
1815+
JsonResponseHandler<DetectProtectiveEquipmentResult> responseHandler = new JsonResponseHandler<DetectProtectiveEquipmentResult>(
1816+
unmarshaller);
1817+
1818+
response = invoke(request, responseHandler, executionContext);
1819+
1820+
return response.getAwsResponse();
1821+
} finally {
1822+
awsRequestMetrics.endEvent(Field.ClientExecuteTime);
1823+
endClientExecution(awsRequestMetrics, request, response, LOGGING_AWS_REQUEST_METRIC);
1824+
}
1825+
}
1826+
17031827
/**
17041828
* <p>
17051829
* Detects text in the input image and converts it into machine-readable
@@ -2798,6 +2922,7 @@ public GetTextDetectionResult getTextDetection(GetTextDetectionRequest getTextDe
27982922
* @throws ProvisionedThroughputExceededException
27992923
* @throws ResourceNotFoundException
28002924
* @throws InvalidImageFormatException
2925+
* @throws ServiceQuotaExceededException
28012926
* @throws AmazonClientException If any internal errors are encountered
28022927
* inside the client while attempting to make the request or
28032928
* handle the response. For example if a network connection is
Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
/*
2+
* Copyright 2010-2020 Amazon.com, Inc. or its affiliates. All Rights Reserved.
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License").
5+
* You may not use this file except in compliance with the License.
6+
* A copy of the License is located at
7+
*
8+
* http://aws.amazon.com/apache2.0
9+
*
10+
* or in the "license" file accompanying this file. This file is distributed
11+
* on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
12+
* express or implied. See the License for the specific language governing
13+
* permissions and limitations under the License.
14+
*/
15+
16+
package com.amazonaws.services.rekognition.model;
17+
18+
import java.util.HashMap;
19+
import java.util.Map;
20+
21+
/**
22+
* Body Part
23+
*/
24+
public enum BodyPart {
25+
26+
FACE("FACE"),
27+
HEAD("HEAD"),
28+
LEFT_HAND("LEFT_HAND"),
29+
RIGHT_HAND("RIGHT_HAND");
30+
31+
private String value;
32+
33+
private BodyPart(String value) {
34+
this.value = value;
35+
}
36+
37+
@Override
38+
public String toString() {
39+
return value;
40+
}
41+
42+
private static final Map<String, BodyPart> enumMap;
43+
static {
44+
enumMap = new HashMap<String, BodyPart>();
45+
enumMap.put("FACE", FACE);
46+
enumMap.put("HEAD", HEAD);
47+
enumMap.put("LEFT_HAND", LEFT_HAND);
48+
enumMap.put("RIGHT_HAND", RIGHT_HAND);
49+
}
50+
51+
/**
52+
* Use this in place of valueOf.
53+
*
54+
* @param value real value
55+
* @return BodyPart corresponding to the value
56+
*/
57+
public static BodyPart fromValue(String value) {
58+
if (value == null || value.isEmpty()) {
59+
throw new IllegalArgumentException("Value cannot be null or empty!");
60+
} else if (enumMap.containsKey(value)) {
61+
return enumMap.get(value);
62+
} else {
63+
throw new IllegalArgumentException("Cannot create enum from " + value + " value!");
64+
}
65+
}
66+
}

aws-android-sdk-rekognition/src/main/java/com/amazonaws/services/rekognition/model/BoundingBox.java

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,11 @@
1919

2020
/**
2121
* <p>
22-
* Identifies the bounding box around the label, face, or text. The
23-
* <code>left</code> (x-coordinate) and <code>top</code> (y-coordinate) are
24-
* coordinates representing the top and left sides of the bounding box. Note
25-
* that the upper-left corner of the image is the origin (0,0).
22+
* Identifies the bounding box around the label, face, text or personal
23+
* protective equipment. The <code>left</code> (x-coordinate) and
24+
* <code>top</code> (y-coordinate) are coordinates representing the top and left
25+
* sides of the bounding box. Note that the upper-left corner of the image is
26+
* the origin (0,0).
2627
* </p>
2728
* <p>
2829
* The <code>top</code> and <code>left</code> values returned are ratios of the

0 commit comments

Comments
 (0)