Project Oxford for Python
Switch branches/tags
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.

Project Oxford for Python

Build Status PyPI version

This package contains a set of intelligent APIs understanding images: It can detect and analyze people's faces, their age, gender, and similarity. It can identify people based on a set of images. It can understand what is displayed in a picture and crop it according to where the important features are. It can tell you whether an image contains adult content, what the main colors are, and which of your images belong in a group. If your image features text, it will tell you the language and return the text as a string. It's basically magic. For more details on the Project Oxford API, please visit

This python module implements all APIs available in the Face and Vision APIs of Project Oxford.


To install the latest release you can use pip.

$ pip install projectoxford


Note: before you can send data to you will need an API key. There are separate API keys for face and vision.

Initialize a client

from projectoxford import Client
client = Client('<api_key>')

Face detection

result = client.face.detect({'url': ''})

Face identification

personGroup = 'example-person-group'
bill = ''
billAndMelinda = ''

# get a face ID and create and train a person group with a person
faceId = client.face.detect({'url': bill})[0]['faceId']
client.face.personGroup.createOrUpdate(personGroup, 'my person group')
client.face.person.createOrUpdate(personGroup, [faceId], 'bill gates')

# detect faces in a second photo
detectResults = client.face.detect({'url': billAndMelinda})
faceIds = []
for result in detectResults:

# identify any known faces from the second photo
identifyResults = client.face.identify(personGroup, faceIds)
for result in identifyResults:
    for candidate in result['candidates']:
        confidence = candidate['confidence']
        personData = client.face.person.get(personGroup, candidate['personId'])
        name = personData['name']
        print('identified {0} with {1}% confidence'.format(name, str(float(confidence) * 100)))

# remove the example person group from your subscription


Development environment

  • Install python, pip

  • Get a Project Oxford API key

  • Install dev dependencies

    pip install -r requirements.txt
  • Set environment variable API key

    set OXFORD_FACE_API_KEY=<insert_your_key_here>
    set OXFORD_VISION_API_KEY=<insert_your_key_here>
  • Run tests

    python test
  • Publishing

    • update version number in
     git tag <version number> -m "update tag version"
     git push --tags origin master
     python register -r pypi # first time only
     python sdist upload


Licensed as MIT - please see LICENSE for details.