{ "cells": [ { "cell_type": "markdown", "metadata": { "colab_type": "text", "id": "3jlqJxFZ-vTq" }, "source": [ "### Author: [Pratik Sharma](https://github.com/sharmapratik88/)\n", "## Project 8 - Computer Vision - Face Detection\n", "In this hands-on project, the goal is to build a face detection model which includes building a face detector to locate the position of a face in an image.\n", "\n", "**Wider Face Dataset**\n", "\n", "Wider Face dataset is a face detection benchmark dataset, of which images are selected from the publicly available WIDER dataset. This data have 32,203 images and 393,703 faces are labeled with a high degree of variability in scale, pose and occlusion as depicted in the sample images.\n", "\n", "In this project, we are using 409 images and around 1000 faces for ease of computation.\n", "\n", "We will be using transfer learning on an already trained model to build our detector. We will perform transfer learning on Mobile Net model which is already trained to perform object detection. We will need to train the last 6-7 layers and freeze the remaining layers to train the model for face detection. To be able to train the Mobile Net model for face detection, we will be using WIDER FACE dataset which already has the bounding box data for various images with a single face and multiple faces. The output of the model is the bounding box data which gives the location of the face in an image. We learn to build a face detection model using Keras supported by Tensorflow.\n", "\n", "**Acknowledgement for the datasets**\n", "\n", "Acknowledgment for the datasets. http://mmlab.ie.cuhk.edu.hk/projects/WIDERFace/\n", "\n", "Mobile Net paper: https://arxiv.org/pdf/1704.04861.pdf\n", "\n", "**Objective of the project**\n", "\n", "In this problem, we use \"Transfer Learning\" of an Object Detector model to detect any object according to the problem in hand. Here, we are particularly interested in detecting faces in a given image." ] }, { "cell_type": "markdown", "metadata": { "colab_type": "text", "id": "NgR0j5310qqC" }, "source": [ "## Face detection\n", "Task is to predict the boundaries(mask) around the face in a given image." ] }, { "cell_type": "markdown", "metadata": { "colab_type": "text", "id": "Aa0jyJzw091I" }, "source": [ "## Dataset\n", "Faces in images marked with bounding boxes. Have around 500 images with around 1100 faces manually tagged via bounding box." ] }, { "cell_type": "code", "execution_count": 1, "metadata": { "colab": { "base_uri": "https://localhost:8080/", "height": 35 }, "colab_type": "code", "id": "sBWMoTJ9cf3Z", "outputId": "8e4ddb1d-524e-414f-aad4-c734d865ce9b" }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Drive already mounted at /content/drive; to attempt to forcibly remount, call drive.mount(\"/content/drive\", force_remount=True).\n" ] } ], "source": [ "# Mounting Google Drive\n", "from google.colab import drive\n", "drive.mount('/content/drive')" ] }, { "cell_type": "code", "execution_count": 0, "metadata": { "colab": {}, "colab_type": "code", "id": "TddMnf4D1-59" }, "outputs": [], "source": [ "# Setting the current working directory\n", "import os; os.chdir('drive/My Drive/Great Learning/Computer Vision Project 1')" ] }, { "cell_type": "markdown", "metadata": { "colab_type": "text", "id": "p46iOubhJpk0" }, "source": [ "### Import Packages" ] }, { "cell_type": "code", "execution_count": 3, "metadata": { "colab": { "base_uri": "https://localhost:8080/", "height": 64 }, "colab_type": "code", "id": "lFAzg4vvJ50F", "outputId": "f6339ed1-291d-4575-9001-e2dd23e7550c" }, "outputs": [ { "data": { "text/html": [ "
\n",
"The default version of TensorFlow in Colab will soon switch to TensorFlow 2.x.
\n",
"We recommend you upgrade now \n",
"or ensure your notebook will continue to use TensorFlow 1.x via the %tensorflow_version 1.x
magic:\n",
"more info.