pykognition

pykognition.imageAnalysis module

Created on Fri Apr 10 13:10:49 2020

@author: rhs

class pykognition.imageAnalysis.ImageFaceAnalysis(personal_acces_key, secret_access_key)[source]

The ImageFaceAnalysis class implements AWS Rekognition API endpoint for detecting and analyzing faces in images. For more information about the API, visit: https://docs.aws.amazon.com/rekognition/latest/dg/faces.html

draw(outputPath, images=None, conf_threshold=0, font_size=16)[source]

Returns boxes with face ID, emotions and confidence level

Parameters:
  • outputPath (str) – Folder location for images with boxes
  • images (str, optional, Default = None) – choose subset of images by providing image-names. If none, takes all images as input
  • conf_threshold (int, optional, default = 0) – Only draw boxes with confidence level above the threshold
  • font_size (int, optional, default = 16) – Size of the font
Returns:

Return type:

Images with boxes

Example

get(attributes='all')[source]

Get the face attributes in a flat data format (not-nested).

Parameters:attributes (list ('emotions', 'age', 'features'), default = 'all') –
Returns:
Return type:Pandas DataFrame

Example

getResponse()[source]

Returns entire response from the AWS Rekognition API in nested format

Returns:
Return type:List of dicts

Example

initialize(imageFileList, region='us-east-1')[source]

Initializes the actual analysis.

Parameters:
  • imageFileList (list,) – The list of images to run through the API Provide full path if images are not in same folder.
  • Region (string, Default: 'us-east-1') – Your AWS region
Returns:

Return type:

Class object

Example

class pykognition.imageAnalysis.ImageObjectAnalysis(personal_acces_key, secret_access_key)[source]

The ImageObjectAnalysis class implements AWS Rekognition API endpoint for detecting and analyzing objects and scenes in images. For more information about the API, visit: https://docs.aws.amazon.com/rekognition/latest/dg/labels.html

get()[source]

Get the objects and scenes in a flat data format (not-nested).

Returns:
Return type:Pandas DataFrame

Example

initialize(imageFileList, region='us-east-1')[source]

Initializes the actual analysis.

Parameters:
  • imageFileList (list,) – The list of images to run through the API Provide full path if images are not in same folder.
  • Region (string, Default: 'us-east-1') – Your AWS region
Returns:

Return type:

Class object

Example