pliers.extractors.MicrosoftAPIFaceExtractor

class pliers.extractors.MicrosoftAPIFaceExtractor(face_id=False, rectangle=True, landmarks=False, attributes=None, subscription_key=None, location=None, api_version='v1.0', rate_limit=None)[source]

Bases: MicrosoftAPITransformer, ImageExtractor

Extracts face features (location, emotion, accessories, etc.). From an image using the Microsoft Azure Cognitive Services API.

Parameters
  • face_id (bool) – Return faceIds of the detected faces or not. The default value is False.

  • landmarks (str) – Return face landmarks of the detected faces or not. The default value is False.

  • attributes (list) – One or more specified face attributes as strings. Supported face attributes include accessories, age, blur, emotion, exposure, facialHair, gender, glasses, hair, headPose, makeup, noise, occlusion, and smile. Note that each attribute has additional computational and time cost.

  • subscription_key (str) – A valid subscription key for Microsoft Cognitive Services. Only needs to be passed the first time the extractor is initialized.

  • location (str) – Region the subscription key has been registered in. It will be the first part of the endpoint URL suggested by Microsoft when you first created the key. Examples include: westus, westcentralus, eastus

  • api_version (str) – API version to use.

  • rate_limit (int) – The minimum number of seconds required between transform calls on this Transformer.

__init__(face_id=False, rectangle=True, landmarks=False, attributes=None, subscription_key=None, location=None, api_version='v1.0', rate_limit=None)[source]
transform(stim, *args, **kwargs)

Executes the transformation on the passed stim(s).

Parameters
  • stims (str, Stim, list) –

    One or more stimuli to process. Must be one of:

    • A string giving the path to a file that can be read in as a Stim (e.g., a .txt file, .jpg image, etc.)

    • A Stim instance of any type.

    • An iterable of stims, where each element is either a string or a Stim.

  • validation (str) –

    String specifying how validation errors should be handled. Must be one of:

    • ’strict’: Raise an exception on any validation error

    • ’warn’: Issue a warning for all validation errors

    • ’loose’: Silently ignore all validation errors

  • args – Optional positional arguments to pass onto the internal _transform call.

  • kwargs – Optional positional arguments to pass onto the internal _transform call.