From 4ec4ba5b37d05e91b5734fd6300c602f77a26d05 Mon Sep 17 00:00:00 2001 From: John Woo Date: Wed, 8 Apr 2020 16:45:58 -0700 Subject: [PATCH 1/3] Update identify entity removed bounding box info * Removing bound box info. If this info is worthy, we should have it in an appendix so it applies to all sections. * I was unable to test the portion around "match entities from a pre-created "Amazon Recognition Collection" -- does anyone have an example I can use? The documentation that we link to isn't very helpful in this context. --- .../fragments/ios/identify-entity.md | 29 ++++++++++++++----- 1 file changed, 22 insertions(+), 7 deletions(-) diff --git a/docs/lib/predictions/fragments/ios/identify-entity.md b/docs/lib/predictions/fragments/ios/identify-entity.md index d7281e8affd..23c4111d974 100644 --- a/docs/lib/predictions/fragments/ios/identify-entity.md +++ b/docs/lib/predictions/fragments/ios/identify-entity.md @@ -2,23 +2,38 @@ If you haven't already done so, run `amplify init` inside your project and then `amplify add auth` (we recommend selecting the *default configuration*). -Run `amplify add predictions` and select **Identify**. Then use the following answers: +Run `amplify add predictions`, then use the following answers: ```bash -? What would you like to identify? +? Please select from one of the categories below (Use arrow keys) +❯ Identify + Convert + Interpret + Infer + Learn More + +? What would you like to identify? Identify Text ❯ Identify Entities Identify Labels - Learn More -? Would you like use the default configuration? Default Configuration +? Provide a friendly name for your resource + -? Who should have access? Auth and Guest users +? Would you like use the default configuration? (Use arrow keys) +❯ Default Configuration + Advanced Configuration + +? Who should have access? + Auth users only +❯ Auth and Guest users ``` +Run `amplify push` to create the resources in the cloud + ## Working with the API -In order to match entities from a pre-created [Amazon Rekognition Collection](https://docs.aws.amazon.com/rekognition/latest/dg/collections.html), make sure there is a `collectionId` set in your `amplifyconfiguration.json` file. If there is no `collectionId` set in the `amplifyconfiguration.json` file, then this call will just detect entities in general with facial features, landmarks, etc. Bounding boxes for entities are returned as ratios so make sure if you would like to place the bounding box of your entity on an image that you multiple the x by the width of the image, the y by the width of the image, and both height and width ratios by the image's respective height and width. +In order to match entities from a pre-created [Amazon Rekognition Collection](https://docs.aws.amazon.com/rekognition/latest/dg/collections.html), make sure there is a `collectionId` set in your `amplifyconfiguration.json` file. If there is no `collectionId` set in the `amplifyconfiguration.json` file, then this call will just detect entities in general with facial features, landmarks, etc. You can identify entities in your app using the following code sample: @@ -53,4 +68,4 @@ func detectEntities(_ image: URL) { } }) } -``` \ No newline at end of file +``` From 62b841b952be5df51cea1e2610cf5a535f982b78 Mon Sep 17 00:00:00 2001 From: John Woo Date: Tue, 14 Apr 2020 11:34:43 -0700 Subject: [PATCH 2/3] Temporarily remove example of collection in Rekognition --- .../fragments/ios/identify-entity.md | 21 +------------------ 1 file changed, 1 insertion(+), 20 deletions(-) diff --git a/docs/lib/predictions/fragments/ios/identify-entity.md b/docs/lib/predictions/fragments/ios/identify-entity.md index 23c4111d974..ba2a124ea5b 100644 --- a/docs/lib/predictions/fragments/ios/identify-entity.md +++ b/docs/lib/predictions/fragments/ios/identify-entity.md @@ -33,26 +33,7 @@ Run `amplify push` to create the resources in the cloud ## Working with the API -In order to match entities from a pre-created [Amazon Rekognition Collection](https://docs.aws.amazon.com/rekognition/latest/dg/collections.html), make sure there is a `collectionId` set in your `amplifyconfiguration.json` file. If there is no `collectionId` set in the `amplifyconfiguration.json` file, then this call will just detect entities in general with facial features, landmarks, etc. - -You can identify entities in your app using the following code sample: - -``` swift -func detectEntities(_ image: URL) { - _ = Amplify.Predictions.identify(type: .detectEntities, image: image, options: PredictionsIdentifyRequest.Options(), listener: { (event) in - switch event { - case .completed(let result): - let data = result as! IdentifyEntityMatchesResult - print(data.entities) - case .failed(let error): - print(error) - default: - print("") - } - }) -} -``` -If you would like to only detect entities and you do not have a collection of existing entities to match entities to, the call will be similar but the result is mapped to `IdentifyEntitiesResult` instead of the `IdentifyEntityMatchesResult`. +To detect general entities like facial features, landmarks etc, you can use the following call pattern. Results are mapped to `IdentifyEntityResults`. For example: ``` swift func detectEntities(_ image: URL) { From 6995f20e8a242d665be912550517c9a5901353e5 Mon Sep 17 00:00:00 2001 From: John Woo Date: Tue, 14 Apr 2020 11:35:16 -0700 Subject: [PATCH 3/3] Update identify-entity.md --- docs/lib/predictions/fragments/ios/identify-entity.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/lib/predictions/fragments/ios/identify-entity.md b/docs/lib/predictions/fragments/ios/identify-entity.md index ba2a124ea5b..98619121353 100644 --- a/docs/lib/predictions/fragments/ios/identify-entity.md +++ b/docs/lib/predictions/fragments/ios/identify-entity.md @@ -33,7 +33,7 @@ Run `amplify push` to create the resources in the cloud ## Working with the API -To detect general entities like facial features, landmarks etc, you can use the following call pattern. Results are mapped to `IdentifyEntityResults`. For example: +To detect general entities like facial features, landmarks etc, you can use the following call pattern. Results are mapped to `IdentifyEntityResult`. For example: ``` swift func detectEntities(_ image: URL) {