Skip to content

rdarneal/mediapipe_python_examples

Repository files navigation


Mediapipe Object Detection Python Exapmles

Python jupyter notebook examples using several Mediapipe solutions with opencv for live webcam detection.

Table of Contents
  1. About The Project
  2. Getting Started
  3. Usage
  4. Contact

About The Project

The Mediapipe documentation has several examples for still image detection with python, but the live stream python examples were not fully implemented. This repo contains a few implementations that demonstrate live stream functionality of the following solutions / APIs:

Since much of the example documentation in the Medipipe docs didn't include full implemntation examples, these represent the results of my exploration.

(back to top)

Getting Started

To get a local copy up and running follow these simple example steps.

Prerequisites

An install of Python 3.9, either from python.org, conda, or your preferred method.

Installation

Below is an example of how you can instruct your audience on installing and setting up your app. This template doesn't rely on any external dependencies or services.

  1. Clone the repo
cd /folder/where/you/want/the/copy
git clone https://github.com/rdarneal/mediapipe_python_examples.git
  1. Install packages, either via python or conda:
  • python
    python -m pip install requirements.txt
  • conda
    conda env create -n myenv -f environment.yml
  1. Add the pre-trained models to your project folder :
  • Gesture Recognition model
wget https://storage.googleapis.com/mediapipe-tasks/gesture_recognizer/gesture_recognizer.task
  • Object detector model (other options are available here)
wget -O efficientdet.tflite https://storage.googleapis.com/mediapipe-tasks/object_detector/efficientdet_lite0_uint8.tflite
  1. Open the file in VSCode, Jupyter, or your favorite IDE:
# VSCode example
code .
  1. Run the jupyter notesbook. Refer to information and instructions in the cells.

Usage

After following the installation instructions, you can open the ipynb files and run all cells to start up a live-stream webcam detection.

  • face_mesh_live: Mediapipe face mesh API example notebook
  • gesture_recognition: Mediapipe gesture recognition live stream example notebook
  • holistic_model: Mediapipe holistic model live stream example notebook
  • object_detection: Mediapipe livestream object detection example notebook

For more examples, or for working with still images or pre-recorded video, check out Mediapipe's Documentation

(back to top)

Contact

Robert Darneal- @rdarneal

Project Link: https://github.com/rdarneal/mediapipe_python_examples

(back to top)

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published