Skip to content

📹🧐 Add face, gender and age detection annotations to a video

License

Notifications You must be signed in to change notification settings

tuomastik/video_face_detection

Repository files navigation

video_face_detection

A small Python program which adds a face, gender and age detection annotations to a video.

Example output

Installation and usage instructions

  1. Clone this repository:
git clone --recursive [email protected]:tuomastik/video_face_detection.git
  1. Prepare Python environment with Conda:
conda create -n video_face_detection python=3.5 scipy numpy pillow tensorflow keras
source activate video_face_detection
pip install google-cloud-vision==0.30.1
  1. Install FFmpeg for video processing. On Linux, install by sudo apt-get install ffmpeg.

  2. Put your Google Cloud Platform service account key in the root directory of this repository with a name gcp_service_account_key.json.

  3. Execute main() function in main.py. The script will start by downloading the weights for gender and age predictor:

main(input_video_path="input.mp4",
     output_video_path="input_annotated.mp4",
     detection_start_time=2, detection_end_time=4,
     highlight_color="#00ff00", font="Montserrat-Bold.ttf", font_size=32,
     line_width_rectangle=4, line_width_face_parts=4, language=Language.english,
     draw_eyes=True, draw_eyebrows=True, draw_mouth=True, draw_nose=True)