1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
pub use crate::operation::detect_labels::_detect_labels_output::DetectLabelsOutputBuilder;
pub use crate::operation::detect_labels::_detect_labels_input::DetectLabelsInputBuilder;
/// Fluent builder constructing a request to `DetectLabels`.
///
/// <p>Detects instances of real-world entities within an image (JPEG or PNG) provided as input. This includes objects like flower, tree, and table; events like wedding, graduation, and birthday party; and concepts like landscape, evening, and nature. </p>
/// <p>For an example, see Analyzing images stored in an Amazon S3 bucket in the Amazon Rekognition Developer Guide.</p>
/// <p>You pass the input image as base64-encoded image bytes or as a reference to an image in an Amazon S3 bucket. If you use the AWS CLI to call Amazon Rekognition operations, passing image bytes is not supported. The image must be either a PNG or JPEG formatted file. </p>
/// <p> <b>Optional Parameters</b> </p>
/// <p>You can specify one or both of the <code>GENERAL_LABELS</code> and <code>IMAGE_PROPERTIES</code> feature types when calling the DetectLabels API. Including <code>GENERAL_LABELS</code> will ensure the response includes the labels detected in the input image, while including <code>IMAGE_PROPERTIES </code>will ensure the response includes information about the image quality and color.</p>
/// <p>When using <code>GENERAL_LABELS</code> and/or <code>IMAGE_PROPERTIES</code> you can provide filtering criteria to the Settings parameter. You can filter with sets of individual labels or with label categories. You can specify inclusive filters, exclusive filters, or a combination of inclusive and exclusive filters. For more information on filtering see <a href="https://docs.aws.amazon.com/rekognition/latest/dg/labels-detect-labels-image.html">Detecting Labels in an Image</a>.</p>
/// <p>You can specify <code>MinConfidence</code> to control the confidence threshold for the labels returned. The default is 55%. You can also add the <code>MaxLabels</code> parameter to limit the number of labels returned. The default and upper limit is 1000 labels.</p>
/// <p> <b>Response Elements</b> </p>
/// <p> For each object, scene, and concept the API returns one or more labels. The API returns the following types of information about labels:</p>
/// <ul>
/// <li> <p> Name - The name of the detected label. </p> </li>
/// <li> <p> Confidence - The level of confidence in the label assigned to a detected object. </p> </li>
/// <li> <p> Parents - The ancestor labels for a detected label. DetectLabels returns a hierarchical taxonomy of detected labels. For example, a detected car might be assigned the label car. The label car has two parent labels: Vehicle (its parent) and Transportation (its grandparent). The response includes the all ancestors for a label, where every ancestor is a unique label. In the previous example, Car, Vehicle, and Transportation are returned as unique labels in the response. </p> </li>
/// <li> <p> Aliases - Possible Aliases for the label. </p> </li>
/// <li> <p> Categories - The label categories that the detected label belongs to. </p> </li>
/// <li> <p> BoundingBox — Bounding boxes are described for all instances of detected common object labels, returned in an array of Instance objects. An Instance object contains a BoundingBox object, describing the location of the label on the input image. It also includes the confidence for the accuracy of the detected bounding box. </p> </li>
/// </ul>
/// <p> The API returns the following information regarding the image, as part of the ImageProperties structure:</p>
/// <ul>
/// <li> <p>Quality - Information about the Sharpness, Brightness, and Contrast of the input image, scored between 0 to 100. Image quality is returned for the entire image, as well as the background and the foreground. </p> </li>
/// <li> <p>Dominant Color - An array of the dominant colors in the image. </p> </li>
/// <li> <p>Foreground - Information about the sharpness, brightness, and dominant colors of the input image’s foreground. </p> </li>
/// <li> <p>Background - Information about the sharpness, brightness, and dominant colors of the input image’s background.</p> </li>
/// </ul>
/// <p>The list of returned labels will include at least one label for every detected object, along with information about that label. In the following example, suppose the input image has a lighthouse, the sea, and a rock. The response includes all three labels, one for each object, as well as the confidence in the label:</p>
/// <p> <code>{Name: lighthouse, Confidence: 98.4629}</code> </p>
/// <p> <code>{Name: rock,Confidence: 79.2097}</code> </p>
/// <p> <code> {Name: sea,Confidence: 75.061}</code> </p>
/// <p>The list of labels can include multiple labels for the same object. For example, if the input image shows a flower (for example, a tulip), the operation might return the following three labels. </p>
/// <p> <code>{Name: flower,Confidence: 99.0562}</code> </p>
/// <p> <code>{Name: plant,Confidence: 99.0562}</code> </p>
/// <p> <code>{Name: tulip,Confidence: 99.0562}</code> </p>
/// <p>In this example, the detection algorithm more precisely identifies the flower as a tulip.</p> <note>
/// <p>If the object detected is a person, the operation doesn't provide the same facial details that the <code>DetectFaces</code> operation provides.</p>
/// </note>
/// <p>This is a stateless API operation that doesn't return any data.</p>
/// <p>This operation requires permissions to perform the <code>rekognition:DetectLabels</code> action. </p>
#[derive(::std::clone::Clone, ::std::fmt::Debug)]
pub struct DetectLabelsFluentBuilder {
handle: ::std::sync::Arc<crate::client::Handle>,
inner: crate::operation::detect_labels::builders::DetectLabelsInputBuilder,
}
impl DetectLabelsFluentBuilder {
/// Creates a new `DetectLabels`.
pub(crate) fn new(handle: ::std::sync::Arc<crate::client::Handle>) -> Self {
Self {
handle,
inner: ::std::default::Default::default(),
}
}
// This function will go away in the near future. Do not rely on it.
#[doc(hidden)]
pub async fn customize_middleware(
self,
) -> ::std::result::Result<
crate::client::customize::CustomizableOperation<
crate::operation::detect_labels::DetectLabels,
::aws_http::retry::AwsResponseRetryClassifier,
>,
::aws_smithy_http::result::SdkError<crate::operation::detect_labels::DetectLabelsError>,
> {
let handle = self.handle.clone();
let operation = self
.inner
.build()
.map_err(::aws_smithy_http::result::SdkError::construction_failure)?
.make_operation(&handle.conf)
.await
.map_err(::aws_smithy_http::result::SdkError::construction_failure)?;
::std::result::Result::Ok(crate::client::customize::CustomizableOperation {
handle,
operation,
})
}
// This function will go away in the near future. Do not rely on it.
#[doc(hidden)]
pub async fn send_middleware(
self,
) -> ::std::result::Result<
crate::operation::detect_labels::DetectLabelsOutput,
::aws_smithy_http::result::SdkError<crate::operation::detect_labels::DetectLabelsError>,
> {
let op = self
.inner
.build()
.map_err(::aws_smithy_http::result::SdkError::construction_failure)?
.make_operation(&self.handle.conf)
.await
.map_err(::aws_smithy_http::result::SdkError::construction_failure)?;
self.handle.client.call(op).await
}
/// Sends the request and returns the response.
///
/// If an error occurs, an `SdkError` will be returned with additional details that
/// can be matched against.
///
/// By default, any retryable failures will be retried twice. Retry behavior
/// is configurable with the [RetryConfig](aws_smithy_types::retry::RetryConfig), which can be
/// set when configuring the client.
pub async fn send(
self,
) -> ::std::result::Result<
crate::operation::detect_labels::DetectLabelsOutput,
::aws_smithy_http::result::SdkError<crate::operation::detect_labels::DetectLabelsError>,
> {
self.send_middleware().await
}
/// Consumes this builder, creating a customizable operation that can be modified before being
/// sent. The operation's inner [http::Request] can be modified as well.
pub async fn customize(
self,
) -> ::std::result::Result<
crate::client::customize::CustomizableOperation<
crate::operation::detect_labels::DetectLabels,
::aws_http::retry::AwsResponseRetryClassifier,
>,
::aws_smithy_http::result::SdkError<crate::operation::detect_labels::DetectLabelsError>,
> {
self.customize_middleware().await
}
/// <p>The input image as base64-encoded bytes or an S3 object. If you use the AWS CLI to call Amazon Rekognition operations, passing image bytes is not supported. Images stored in an S3 Bucket do not need to be base64-encoded.</p>
/// <p>If you are using an AWS SDK to call Amazon Rekognition, you might not need to base64-encode image bytes passed using the <code>Bytes</code> field. For more information, see Images in the Amazon Rekognition developer guide.</p>
pub fn image(mut self, input: crate::types::Image) -> Self {
self.inner = self.inner.image(input);
self
}
/// <p>The input image as base64-encoded bytes or an S3 object. If you use the AWS CLI to call Amazon Rekognition operations, passing image bytes is not supported. Images stored in an S3 Bucket do not need to be base64-encoded.</p>
/// <p>If you are using an AWS SDK to call Amazon Rekognition, you might not need to base64-encode image bytes passed using the <code>Bytes</code> field. For more information, see Images in the Amazon Rekognition developer guide.</p>
pub fn set_image(mut self, input: ::std::option::Option<crate::types::Image>) -> Self {
self.inner = self.inner.set_image(input);
self
}
/// <p>Maximum number of labels you want the service to return in the response. The service returns the specified number of highest confidence labels. </p>
pub fn max_labels(mut self, input: i32) -> Self {
self.inner = self.inner.max_labels(input);
self
}
/// <p>Maximum number of labels you want the service to return in the response. The service returns the specified number of highest confidence labels. </p>
pub fn set_max_labels(mut self, input: ::std::option::Option<i32>) -> Self {
self.inner = self.inner.set_max_labels(input);
self
}
/// <p>Specifies the minimum confidence level for the labels to return. Amazon Rekognition doesn't return any labels with confidence lower than this specified value.</p>
/// <p>If <code>MinConfidence</code> is not specified, the operation returns labels with a confidence values greater than or equal to 55 percent.</p>
pub fn min_confidence(mut self, input: f32) -> Self {
self.inner = self.inner.min_confidence(input);
self
}
/// <p>Specifies the minimum confidence level for the labels to return. Amazon Rekognition doesn't return any labels with confidence lower than this specified value.</p>
/// <p>If <code>MinConfidence</code> is not specified, the operation returns labels with a confidence values greater than or equal to 55 percent.</p>
pub fn set_min_confidence(mut self, input: ::std::option::Option<f32>) -> Self {
self.inner = self.inner.set_min_confidence(input);
self
}
/// Appends an item to `Features`.
///
/// To override the contents of this collection use [`set_features`](Self::set_features).
///
/// <p>A list of the types of analysis to perform. Specifying GENERAL_LABELS uses the label detection feature, while specifying IMAGE_PROPERTIES returns information regarding image color and quality. If no option is specified GENERAL_LABELS is used by default.</p>
pub fn features(mut self, input: crate::types::DetectLabelsFeatureName) -> Self {
self.inner = self.inner.features(input);
self
}
/// <p>A list of the types of analysis to perform. Specifying GENERAL_LABELS uses the label detection feature, while specifying IMAGE_PROPERTIES returns information regarding image color and quality. If no option is specified GENERAL_LABELS is used by default.</p>
pub fn set_features(
mut self,
input: ::std::option::Option<::std::vec::Vec<crate::types::DetectLabelsFeatureName>>,
) -> Self {
self.inner = self.inner.set_features(input);
self
}
/// <p>A list of the filters to be applied to returned detected labels and image properties. Specified filters can be inclusive, exclusive, or a combination of both. Filters can be used for individual labels or label categories. The exact label names or label categories must be supplied. For a full list of labels and label categories, see <a href="https://docs.aws.amazon.com/rekognition/latest/dg/labels.html">Detecting labels</a>.</p>
pub fn settings(mut self, input: crate::types::DetectLabelsSettings) -> Self {
self.inner = self.inner.settings(input);
self
}
/// <p>A list of the filters to be applied to returned detected labels and image properties. Specified filters can be inclusive, exclusive, or a combination of both. Filters can be used for individual labels or label categories. The exact label names or label categories must be supplied. For a full list of labels and label categories, see <a href="https://docs.aws.amazon.com/rekognition/latest/dg/labels.html">Detecting labels</a>.</p>
pub fn set_settings(
mut self,
input: ::std::option::Option<crate::types::DetectLabelsSettings>,
) -> Self {
self.inner = self.inner.set_settings(input);
self
}
}