Need help with tfObjWebrtc?
Click the “chat” button below for chat support from the developer who created it, or find similar developers for support.

About the developer

154 Stars 48 Forks MIT License 6 Commits 5 Opened issues


Tensorflow Object Detection API Web Service wrapper that works on any <video> tag and WebRTC streams

Services available


Need anything else?

Contributors list

Tensorflow Object Detection API Web Service

This is an example of how to turn the TensorFlow Object API into a web service. A Python Flask web server is used to interact with a JavaScript a client library. The example shows how you can extract frames from WebRTC's getUserMedia, upload them to the API, and then use the canvas to display them. This allows use of the TensorFlow Object API on any HTML


Please see the Computer Vision on the Web with WebRTC and TensorFlow post on webrtcHacks for a walkthrough and more details.

Example image: Detecting Cats

TensorFlow Object Detection API on a WebRTC getUserMedia stream demo video:

TensorFlow Object Detection API on a video element

TensorFlow Object Detection API on a video element demo video:

TensorFlow Object Detection API on a video element

Quick start with Docker

docker run -it -p 5000:5000 chadhart/tensorflow-object-detection:runserver


Docker Install

git clone
cd tfObjWebrtc
docker run -it -p 5000:5000 --name tf-webrtchacks -v $(pwd):/code chadhart/tensorflow-object-detection:webrtchacks
python install

Manual install

Follow the TensorFlow Object API install instructions. Then run the the instructions above.

Example web apps

Point your browser to: -

- shows a mirrored video from a webcam -
- shows object detection running on a HTML

Browser support

WebRTC browsers have secure origin restrictions: - Chrome will only work on

unless you add TLS certificates to your server - Firefox will work on any domain as long as you allow it - Safari will work, but you will need to "Allow Media Capture on Insecure Domains"

These should all work fine with any other video source.

Edge is currently not supported (polyfill for


See the webrtcHacks link for details.

API Details

Point to a

 tag to 
with an id of
. Include
and other optional
tags to set parameters.



Data tags:

  • data-source
    - the ID of the source
    to use. Must be specified.
  • data-uploadWidth
    - the width of the upload file. Height will automatically be calculated based on the source video's aspect ratio. Default is
  • data-mirror
    - mirror the boundary boxes. Used is the image is mirrored (as is usual with a local getUserMedia view). Default is
  • data-scoreThreshold
    - only show objects above this confidence threshold. Default is
    • data-apiServer
      - the full URL of the TensorFlow Object Detection Web API server location. Default is
      off of the current domain - i.e.

We use cookies. If you continue to browse the site, you agree to the use of cookies. For more information on our use of cookies please see our Privacy Policy.