Skip to content

Instantly share code, notes, and snippets.

@Davidnet
Created April 10, 2018 06:26
Show Gist options
  • Save Davidnet/98dcdce9cdd87a5222c90677c51fc4c6 to your computer and use it in GitHub Desktop.
Save Davidnet/98dcdce9cdd87a5222c90677c51fc4c6 to your computer and use it in GitHub Desktop.
import tensorflow as tf
import cv2
import objectdetection
config = tf.ConfigProto()
config.gpu_options.allow_growth = True
with tf.Session(config=config) as sess:
detector = objectdetection.ObjectDetection('ssd_mobilenet_v2_coco_2018_03_29/frozen_inference_graph.pb', session=sess)
cam = cv2.VideoCapture(0)
while True:
ret_val, img = cam.read()
print(detector.predict([img]))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment