repo_description: 🚀 The TensorFlow Object Counting API is an open source framework built on top of TensorFlow and Keras that makes it easy to develop object counting systems!
repo_topics: computer-vision data-science deep-learning deep-neural-networks image-processing machine-learning object-counting object-counting-api object-detection object-detection-api object-detection-label object-detection-pipelines opencv pedestrian-counting shelf-management shelf-navigation tensorflow tensorflow-api tensorflow-object-detection-api vehicle-counting
code: #----------------------------------------------
  #--- Author         : Ahmet Ozlu
  #--- Mail           : [REDACTED_EMAIL]
  #--- Date           : 27th January 2018
  #----------------------------------------------
  
  # Imports
  import tensorflow as tf
  
  # Object detection imports
  from utils import backbone
  from api import object_counting_api
  
  input_video = "./input_images_and_videos/pedestrian_survaillance.mp4"
  
  # By default I use an "SSD with Mobilenet" model here. See the detection model zoo (https://github.com/tensorflow/models/blob/master/research/object_detection/g3doc/detection_model_zoo.md) for a list of other models that can be run out-of-the-box with varying speeds and accuracies.
  detection_graph, category_index = backbone.set_model('ssd_mobilenet_v1_coco_2018_01_28', 'mscoco_label_map.pbtxt')
  
  is_color_recognition_enabled = False # set it to true for enabling the color prediction for the detected objects
  roi = 385 # roi line position
  deviation = 1 # the constant that represents the object counting area
  custom_object_name = 'Pedestrian'
  object_counting_api.cumulative_object_counting_x_axis(input_video, detection_graph, category_index, is_color_recognition_enabled, roi, deviation, custom_object_name) # counting all the objects
  