Skip to content

Commit

Permalink
Fix missing images
Browse files Browse the repository at this point in the history
  • Loading branch information
sglvladi committed Jun 24, 2020
1 parent c66757b commit 9418356
Show file tree
Hide file tree
Showing 111 changed files with 3,148 additions and 2,794 deletions.
2 changes: 1 addition & 1 deletion docs/build/html/.buildinfo → docs/build/.buildinfo
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Sphinx build info version 1
# This file hashes the configuration used when building these files. When it is not found, a full rebuild will be done.
config: 12ae803fbc9b69a8e785b52f812c9afd
config: 71ee4cae48b6d2f290dbbba66f289314
tags: 645f666f9bcd5a90fca523b33c5a78b7
Binary file not shown.
Binary file added docs/build/.doctrees/environment.pickle
Binary file not shown.
Binary file added docs/build/.doctrees/index.doctree
Binary file not shown.
Binary file added docs/build/.doctrees/install.doctree
Binary file not shown.
Binary file added docs/build/.doctrees/issues.doctree
Binary file not shown.
Binary file added docs/build/.doctrees/training.doctree
Binary file not shown.
File renamed without changes
File renamed without changes
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ Detect Objects Using Your Webcam

Hereby you can find an example which allows you to use your camera to generate a video stream, based on which you can perform object_detection.

To run the example, simply create a new file under ``<PATH_TO_TF>/TensorFlow/models/research/object_detection`` and paste the code below.

.. code-block:: python
import numpy as np
Expand All @@ -18,8 +20,8 @@ Hereby you can find an example which allows you to use your camera to generate a
from io import StringIO
from matplotlib import pyplot as plt
from PIL import Image
from utils import label_map_util
from utils import visualization_utils as vis_util
from object_detection.utils import label_map_util
from object_detection.utils import visualization_utils as vis_util
# Define the video stream
cap = cv2.VideoCapture(0) # Change only if you have more than one webcams
Expand All @@ -40,20 +42,22 @@ Hereby you can find an example which allows you to use your camera to generate a
NUM_CLASSES = 90
# Download Model
opener = urllib.request.URLopener()
opener.retrieve(DOWNLOAD_BASE + MODEL_FILE, MODEL_FILE)
tar_file = tarfile.open(MODEL_FILE)
for file in tar_file.getmembers():
file_name = os.path.basename(file.name)
if 'frozen_inference_graph.pb' in file_name:
tar_file.extract(file, os.getcwd())
if not os.path.exists(os.path.join(os.getcwd(), MODEL_FILE)):
print("Downloading model")
opener = urllib.request.URLopener()
opener.retrieve(DOWNLOAD_BASE + MODEL_FILE, MODEL_FILE)
tar_file = tarfile.open(MODEL_FILE)
for file in tar_file.getmembers():
file_name = os.path.basename(file.name)
if 'frozen_inference_graph.pb' in file_name:
tar_file.extract(file, os.getcwd())
# Load a (frozen) Tensorflow model into memory.
detection_graph = tf.Graph()
with detection_graph.as_default():
od_graph_def = tf.GraphDef()
with tf.gfile.GFile(PATH_TO_CKPT, 'rb') as fid:
od_graph_def = tf.compat.v1.GraphDef()
with tf.io.gfile.GFile(PATH_TO_CKPT, 'rb') as fid:
serialized_graph = fid.read()
od_graph_def.ParseFromString(serialized_graph)
tf.import_graph_def(od_graph_def, name='')
Expand All @@ -76,9 +80,8 @@ Hereby you can find an example which allows you to use your camera to generate a
# Detection
with detection_graph.as_default():
with tf.Session(graph=detection_graph) as sess:
with tf.compat.v1.Session(graph=detection_graph) as sess:
while True:
# Read frame from camera
ret, image_np = cap.read()
# Expand dimensions since the model expects images to have shape: [1, None, None, 3]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,28 +6,34 @@
TensorFlow Object Detection API tutorial
============================================

.. important:: This tutorial is intended for TensorFlow 1.14, which (at the time of writing this tutorial) is the latest stable version before TensorFlow 2.x.

Tensorflow 1.15 has also been released, but seems to be exhibiting `instability issues <https://github.com/tensorflow/models/issues/7640>`_.

A version for TensorFlow 1.9 can be found `here <https://tensorflow-object-detection-api-tutorial.readthedocs.io/en/v1.9.1/>`_.

At the time of righting this tutorial, Object Detection model training and evaluation was not migrated to TensorFlow 2.x (see `here <https://github.com/tensorflow/models/issues/6423#issuecomment-600925072>`_). From personal tests, it seems that detection using pre-trained models works, however it is not yet possible to train and evaluate models. Once the migration has been completed, a version for TensorFlow 2.x will be produced.

This is a step-by-step tutorial/guide to setting up and using TensorFlow's Object Detection API to perform, namely, object detection in images/video.

The software tools which we shall use throughout this tutorial are listed in the table below:

+---------------------------------------------+
| Target Software versions |
+==============+==============================+
| OS | Windows, Linux [*]_ |
| OS | Windows, Linux |
+--------------+------------------------------+
| Python | 3.6 |
| Python | 3.7 |
+--------------+------------------------------+
| TensorFlow | 1.9 |
| TensorFlow | 1.14 |
+--------------+------------------------------+
| CUDA Toolkit | v9.0 |
| CUDA Toolkit | 10.0 |
+--------------+------------------------------+
| CuDNN | v7.0.5 |
| CuDNN | 7.6.5 |
+--------------+------------------------------+
| Anaconda | Python 3.7 (Optional) |
+--------------+------------------------------+

.. [*] Even though this tutorial is mostly based (and properly tested) on Windows 10, information is also provided for Linux systems.
.. toctree::
:maxdepth: 4
:caption: Contents:
Expand Down
Loading

0 comments on commit 9418356

Please sign in to comment.