- Hands-On Artificial Intelligence on Amazon Web Services
- Subhashini Tripuraneni Charles Song
- 330字
- 2021-06-24 12:48:44
Invoking the Rekognition service using the AWS CLI
Now, let's invoke the object detection capability of Amazon Rekognition via the AWS CLI. This time, let's perform the object detection on an image that's stored in one of our S3 buckets. We will be using a sample image from Pexels, a website with thousands of royalty-free images. Download the image at https://www.pexels.com/photo/animal-beagle-canine-close-up-460823/ and upload it to the contents S3 bucket.
Here, we can see an adorable beagle puppy laying on what appears to be a bed of gravel:

You should see the following output when you list the objects in your contents bucket:
$ aws s3 ls s3://<YOUR BUCKET>
2018-12-02 13:31:32 362844 animal-beagle-canine-460823.jpg
Now that we have an image, we can invoke the object detection capability of Rekognition via the following CLI command. Note that we must escape the { and } characters with a \, and we must not include any spaces when specifying the S3 object on the command line:
$ aws rekognition detect-labels --image S3Object=\{Bucket=<YOUR BUCKET>,Name=animal-beagle-canine-460823.jpg\}
The results come back almost instantly:
{
"Labels": [
{
"Name": "Mammal",
"Confidence": 98.9777603149414
},
{
"Name": "Pet",
"Confidence": 98.9777603149414
},
{
"Name": "Hound",
"Confidence": 98.9777603149414
},
{
"Name": "Dog",
"Confidence": 98.9777603149414
},
{
"Name": "Canine",
"Confidence": 98.9777603149414
},
{
"Name": "Animal",
"Confidence": 98.9777603149414
},
{
"Name": "Beagle",
"Confidence": 98.0347900390625
},
{
"Name": "Road",
"Confidence": 82.47952270507812
},
{
"Name": "Gravel",
"Confidence": 74.52912902832031
},
{
"Name": "Dirt Road",
"Confidence": 74.52912902832031
}
]
}
The output is in JSON format, just like we configured the CLI to the output. From the output, the Rekognition service detected several objects or labels. Rekognition is very sure that it detected a dog; it even identified the breed of the dog as a beagle! Rekognition also detected the gravel in the image, which could be a part of a dirt road. The AWS CLI can be very useful when trying out an AWS service, and to see how the output is structured when we are developing our applications.
- 輕松學PHP
- 計算機原理
- 工業(yè)機器人工程應用虛擬仿真教程:MotoSim EG-VRC
- 工業(yè)機器人入門實用教程(KUKA機器人)
- Maya極速引擎:材質篇
- 統(tǒng)計策略搜索強化學習方法及應用
- 網(wǎng)絡綜合布線設計與施工技術
- 統(tǒng)計學習理論與方法:R語言版
- Implementing Splunk 7(Third Edition)
- 網(wǎng)絡化分布式系統(tǒng)預測控制
- 電腦上網(wǎng)輕松入門
- Hands-On Dashboard Development with QlikView
- 項目實踐精解:C#核心技術應用開發(fā)
- 從祖先到算法:加速進化的人類文化
- 案例解說虛擬儀器典型控制應用