Rekognizing patterns

Einführung in AWS Boto mit Python

Maksim Pecherskiy

Instructor

Rekognition

Rekognition

Einführung in AWS Boto mit Python

So what is Rekognition anyway?

Detecting Objects in an image

Detect objects in image

Extracting Text from Images

Extract text from image

Einführung in AWS Boto mit Python

Why not build our own?

Use Rekognition if:

  • Quick but good
  • Keep code simple
  • Recognize many things

Build a model if:

  • Custom requirements
  • Security implications
  • Large volumes

Rekognition screenshot

Einführung in AWS Boto mit Python

I am not a computer vision expert

Not a Computer Vision Expert

Einführung in AWS Boto mit Python

Aws Docs

Einführung in AWS Boto mit Python

BOTO DOCUMENTATION

Einführung in AWS Boto mit Python

BOTO DOCUMENTATION

Einführung in AWS Boto mit Python

BOTO DOCUMENTATION

Einführung in AWS Boto mit Python

Upload an image to S3

Initialize S3 Client

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

Upload a file

s3.upload_file(
  Filename='report.jpg', Key='report.jpg', 
  Bucket='datacamp-img')
Einführung in AWS Boto mit Python

Object detection

Initiate the client
rekog = boto3.client(
  'rekognition',
  region_name='us-east-1', 
  aws_access_key_id=AWS_KEY_ID, 
  aws_secret_access_key=AWS_SECRET)

Initiate the Rekognition client

Einführung in AWS Boto mit Python

Object detection

Detect!
response = rekog.detect_labels(
  Image={'S3Object': {
          'Bucket': 'datacamp-img', 
          'Name': 'report.jpg'
        },

MaxLabels=10, MinConfidence=95 )

Object detection

Einführung in AWS Boto mit Python

Detect labels response

Einführung in AWS Boto mit Python

Detect labels response

Einführung in AWS Boto mit Python

Detect Labels Response

Einführung in AWS Boto mit Python

Detect Labels Response

Einführung in AWS Boto mit Python

Detect Labels Response

Einführung in AWS Boto mit Python

Text detection

Perform detection
response = rekog.detect_text(
  Image={'S3Object': 
          {
            'Bucket': 'datacamp-img', 
            'Name': 'report.jpg'
          }
        }
)

Text detection response

Einführung in AWS Boto mit Python

Text detection response

Einführung in AWS Boto mit Python

Text detection response

Einführung in AWS Boto mit Python

Text detection response

Einführung in AWS Boto mit Python

Summary

  • Detect objects in an image
  • Count instances
  • Learn a new AWS Service

Rekognition

.detect_labels()

  • Recognize text in an image
  • Word vs line detections
  • When to build our own

Text detection

.detect_text()

Einführung in AWS Boto mit Python

Let's do some computer vision!

Einführung in AWS Boto mit Python

Preparing Video For Download...