Detects Personal Protective Equipment (PPE) worn by people detected in an image. Amazon Rekognition can detect the following types of PPE.
-
Face cover
-
Hand cover
-
Head cover
You pass the input image as base64-encoded image bytes or as a reference to an image in an Amazon S3 bucket. The image must be either a PNG or JPG formatted file.
DetectProtectiveEquipment detects PPE worn by up to 15 persons detected in an image.
For each person detected in the image the API returns an array of body parts (face, head, left-hand, right-hand). For each body part, an array of detected items of PPE is returned, including an indicator of whether or not the PPE covers the body part. The API returns the confidence it has in each detection (person, PPE, body part and body part coverage). It also returns a bounding box (BoundingBox) for each detected person and each detected item of PPE.
You can optionally request a summary of detected PPE items with the SummarizationAttributes input parameter. The summary provides the following information.
-
The persons detected as wearing all of the types of PPE that you specify.
-
The persons detected as not wearing all of the types PPE that you specify.
-
The persons detected where PPE adornment could not be determined.
This is a stateless API operation. That is, the operation does not persist any data.
This operation requires permissions to perform the rekognition:DetectProtectiveEquipment action.
Parameters:
-
image
(Image)
–
The image in which you want to detect PPE on detected persons. The image can be passed as image bytes or you can reference an image stored in an Amazon S3 bucket.
-
summarization_attributes
(Optional[ProtectiveEquipmentSummarizationAttributes], default:
None
)
–
An array of PPE types that you want to summarize.
Raises:
-
AccessDeniedException
–
You are not authorized to perform the action.
-
ImageTooLargeException
–
The input image size exceeds the allowed limit. If you are calling DetectProtectiveEquipment, the image size or resolution exceeds the allowed limit. For more information, see Guidelines and quotas in Amazon Rekognition in the Amazon Rekognition Developer Guide.
-
InternalServerError
–
Amazon Rekognition experienced a service issue. Try your call again.
-
InvalidImageFormatException
–
The provided image format is not supported.
-
InvalidParameterException
–
Input parameter violated a constraint. Validate your parameter before calling the API operation again.
-
InvalidS3ObjectException
–
Amazon Rekognition is unable to access the S3 object specified in the request.
-
ProvisionedThroughputExceededException
–
The number of requests exceeded your throughput limit. If you want to increase this limit, contact Amazon Rekognition.
-
ThrottlingException
–
Amazon Rekognition is temporarily unable to process the request. Try your call again.
-
UnknownServiceError
–
The service returned an error code this client does not model.
Source code in docs_src/capo_rekognition/_services/rekognition.py
| def detect_protective_equipment(
self,
image: "capo_rekognition.types.image.Image",
*,
config_overrides: Optional[RekognitionClientConfig] = None,
summarization_attributes: Optional[
"capo_rekognition.types.protective_equipment_summarization_attributes.ProtectiveEquipmentSummarizationAttributes"
] = None,
) -> "capo_rekognition.types.detect_protective_equipment_response.DetectProtectiveEquipmentResponse":
"""<p>Detects Personal Protective Equipment (PPE) worn by people detected in an image. Amazon Rekognition can detect the following types of PPE.</p> <ul> <li> <p>Face cover</p> </li> <li> <p>Hand cover</p> </li> <li> <p>Head cover</p> </li> </ul> <p>You pass the input image as base64-encoded image bytes or as a reference to an image in an Amazon S3 bucket. The image must be either a PNG or JPG formatted file. </p> <p> <code>DetectProtectiveEquipment</code> detects PPE worn by up to 15 persons detected in an image.</p> <p>For each person detected in the image the API returns an array of body parts (face, head, left-hand, right-hand). For each body part, an array of detected items of PPE is returned, including an indicator of whether or not the PPE covers the body part. The API returns the confidence it has in each detection (person, PPE, body part and body part coverage). It also returns a bounding box (<a>BoundingBox</a>) for each detected person and each detected item of PPE. </p> <p>You can optionally request a summary of detected PPE items with the <code>SummarizationAttributes</code> input parameter. The summary provides the following information. </p> <ul> <li> <p>The persons detected as wearing all of the types of PPE that you specify.</p> </li> <li> <p>The persons detected as not wearing all of the types PPE that you specify.</p> </li> <li> <p>The persons detected where PPE adornment could not be determined. </p> </li> </ul> <p>This is a stateless API operation. That is, the operation does not persist any data.</p> <p>This operation requires permissions to perform the <code>rekognition:DetectProtectiveEquipment</code> action. </p>
Args:
image: <p>The image in which you want to detect PPE on detected persons. The image can be passed as image bytes or you can reference an image stored in an Amazon S3 bucket. </p>
summarization_attributes: <p>An array of PPE types that you want to summarize.</p>
Raises:
capo_rekognition.errors.access_denied_exception.AccessDeniedException: <p>You are not authorized to perform the action.</p>
capo_rekognition.errors.image_too_large_exception.ImageTooLargeException: <p>The input image size exceeds the allowed limit. If you are calling DetectProtectiveEquipment, the image size or resolution exceeds the allowed limit. For more information, see Guidelines and quotas in Amazon Rekognition in the Amazon Rekognition Developer Guide. </p>
capo_rekognition.errors.internal_server_error.InternalServerError: <p>Amazon Rekognition experienced a service issue. Try your call again.</p>
capo_rekognition.errors.invalid_image_format_exception.InvalidImageFormatException: <p>The provided image format is not supported. </p>
capo_rekognition.errors.invalid_parameter_exception.InvalidParameterException: <p>Input parameter violated a constraint. Validate your parameter before calling the API operation again.</p>
capo_rekognition.errors.invalid_s3_object_exception.InvalidS3ObjectException: <p>Amazon Rekognition is unable to access the S3 object specified in the request.</p>
capo_rekognition.errors.provisioned_throughput_exceeded_exception.ProvisionedThroughputExceededException: <p>The number of requests exceeded your throughput limit. If you want to increase this limit, contact Amazon Rekognition.</p>
capo_rekognition.errors.throttling_exception.ThrottlingException: <p>Amazon Rekognition is temporarily unable to process the request. Try your call again.</p>
capo_rekognition.errors.UnknownServiceError: The service returned an error code this client does not model.
"""
def _handler(
req: "OperationRequest[capo_rekognition.types.detect_protective_equipment_request.DetectProtectiveEquipmentRequest]",
) -> OperationResponse[
"capo_rekognition.types.detect_protective_equipment_response.DetectProtectiveEquipmentResponse"
]:
import capo_rekognition._operations.rekognition_service.detect_protective_equipment
output, http_response = (
capo_rekognition._operations.rekognition_service.detect_protective_equipment.detect_protective_equipment(
req.options, req.input
)
)
return OperationResponse(output=output, response=http_response)
interceptors_, options_ = self.operation_options(
config_overrides, OperationLogging("DetectProtectiveEquipment")
)
input_: capo_rekognition.types.detect_protective_equipment_request.DetectProtectiveEquipmentRequest = {
"image": image
}
if summarization_attributes is not None:
input_["summarization_attributes"] = summarization_attributes
response = execute_pipeline(
OperationRequest(input=input_, options=options_),
handler=_handler,
interceptors=list(interceptors_),
)
response.response.close()
return response.output
|