Increase accuracy of face detection with Object Detection

Get the code Watch the video


Facial recognition is considered to be one of the most promising applications in the field of image analysis. However, a robust facial recognition application must recognize an identity despite the many variations in appearance that the face might have in a scene. To increase the accuracy, you can use instances where a face detection algorithm fails and append a machine learning Object Detection model by using Tensorflow to detect the failed cases and treat them as an object. In this code pattern, we’ll demonstrate a way to extend the face detection function of Watson Visual Recognition by treating images as an object, which is detected by a model, and appended to a face detection algorithm.


A robust face recognition program must recognize an identity despite the many variations in appearance that the face can have in a scene. So, how can you achieve increased accuracy in face detection? The border cases, where face detection algorithms tend to fail can be treated as an Object. Then, a model can identify these objects and append it to a face detection algorithm.

Using the example of an image in which a person’s face remains covered – for example, a cloth or cap over a person’s head – these faces are treated as a separate object, labeled as Covered. Next, the objects that are detected are appended to a face detection algorithm. This process increases the number of detections that are done by a face detection algorithm, and the accuracy of the prediction.

This code pattern uses Watson Visual Recognition, Watson Studio, and a Python notebook to demonstrate a way to detect covered faces.



  1. Create an image data set that contains the faces to be detected, and upload these images on Cloud Object Storage.
  2. The image files are fed into the Watson Studio Python notebook.
  3. The algorithm first detects the faces by using a model of the Tensorflow Object Detection API.
  4. The detected faces are augmented to Watson Visual Recognition face detection for output.


Get the detailed steps in the readme file. These steps will explain how to:

  1. Get the Object Detection folder.
  2. Sign up for IBM Watson Studio.
  3. Create a Watson Visual Recognition Service instance.
  4. Run using a Jupyter Notebook in IBM Watson Studio.
  5. Prepare the data.
  6. Prepare the model.
  7. Create an Object Storage service instance.
  8. Create a notebook on Watson Studio.
  9. Add Tensorflow Object Detection API files.
  10. Update the notebook with service credentials.
  11. Run the notebook.
  12. Analyze the results.