Rekognizing patterns

Introduction to AWS Boto in Python

Maksim Pecherskiy

Instructor

Rekognition

Rekognition

Introduction to AWS Boto in Python

So what is Rekognition anyway?

Detecting Objects in an image

Detect objects in image

Extracting Text from Images

Extract text from image

Introduction to AWS Boto in 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

Introduction to AWS Boto in Python

I am not a computer vision expert

Not a Computer Vision Expert

Introduction to AWS Boto in Python

Aws Docs

Introduction to AWS Boto in Python

BOTO DOCUMENTATION

Introduction to AWS Boto in Python

BOTO DOCUMENTATION

Introduction to AWS Boto in Python

BOTO DOCUMENTATION

Introduction to AWS Boto in 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')
Introduction to AWS Boto in 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

Introduction to AWS Boto in Python

Object detection

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

MaxLabels=10, MinConfidence=95 )

Object detection

Introduction to AWS Boto in Python

Detect labels response

Introduction to AWS Boto in Python

Detect labels response

Introduction to AWS Boto in Python

Detect Labels Response

Introduction to AWS Boto in Python

Detect Labels Response

Introduction to AWS Boto in Python

Detect Labels Response

Introduction to AWS Boto in Python

Text detection

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

Text detection response

Introduction to AWS Boto in Python

Text detection response

Introduction to AWS Boto in Python

Text detection response

Introduction to AWS Boto in Python

Text detection response

Introduction to AWS Boto in 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()

Introduction to AWS Boto in Python

Let's do some computer vision!

Introduction to AWS Boto in Python

Preparing Video For Download...