识别模式

Python 中的 AWS Boto 入门

Maksim Pecherskiy

Instructor

Rekognition

Rekognition

Python 中的 AWS Boto 入门

那么,Rekognition 到底是什么?

在图像中检测对象

在图像中检测对象

从图像中提取文本

从图像中提取文本

Python 中的 AWS Boto 入门

为何不自己做?

在以下情况下使用 Rekognition:

  • 需要快速且效果好
  • 保持代码简单
  • 识别多种对象

在以下情况下自行构建模型:

  • 自定义需求
  • 涉及安全
  • 规模大、数据量高

Rekognition 截图

Python 中的 AWS Boto 入门

我不是计算机视觉专家

不是计算机视觉专家

Python 中的 AWS Boto 入门

AWS 文档

Python 中的 AWS Boto 入门

BOTO 文档

Python 中的 AWS Boto 入门

BOTO 文档

Python 中的 AWS Boto 入门

BOTO 文档

Python 中的 AWS Boto 入门

将图像上传到 S3

初始化 S3 客户端

s3 = boto3.client(
  's3', region_name='us-east-1', 
  aws_access_key_id=AWS_KEY_ID, aws_secret_access_key=AWS_SECRET
)

上传文件

s3.upload_file(
  Filename='report.jpg', Key='report.jpg', 
  Bucket='datacamp-img')
Python 中的 AWS Boto 入门

目标检测

初始化客户端
rekog = boto3.client(
  'rekognition',
  region_name='us-east-1', 
  aws_access_key_id=AWS_KEY_ID, 
  aws_secret_access_key=AWS_SECRET)

初始化 Rekognition 客户端

Python 中的 AWS Boto 入门

目标检测

开始检测
response = rekog.detect_labels(
  Image={'S3Object': {
          'Bucket': 'datacamp-img', 
          'Name': 'report.jpg'
        },

MaxLabels=10, MinConfidence=95 )

目标检测

Python 中的 AWS Boto 入门

检测标签的响应

Python 中的 AWS Boto 入门

检测标签的响应

Python 中的 AWS Boto 入门

检测标签的响应

Python 中的 AWS Boto 入门

检测标签的响应

Python 中的 AWS Boto 入门

检测标签的响应

Python 中的 AWS Boto 入门

文本检测

执行检测
response = rekog.detect_text(
  Image={'S3Object': 
          {
            'Bucket': 'datacamp-img', 
            'Name': 'report.jpg'
          }
        }
)

文本检测响应

Python 中的 AWS Boto 入门

文本检测响应

Python 中的 AWS Boto 入门

文本检测响应

Python 中的 AWS Boto 入门

Rekognition 看到的内容

Python 中的 AWS Boto 入门

小结

  • 在图像中检测对象
  • 统计实例数量
  • 学习一项新的 AWS 服务

Rekognition

.detect_labels()

  • 识别图像中的文本
  • 单词 vs 行 检测
  • 何时自行构建

文本检测

.detect_text()

Python 中的 AWS Boto 入门

开始做点计算机视觉吧!

Python 中的 AWS Boto 入门

Preparing Video For Download...