-
Notifications
You must be signed in to change notification settings - Fork 0
/
targeted_bus.py
29 lines (19 loc) · 1.51 KB
/
targeted_bus.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
#----------------------------------------------
#--- Author : Ahmet Ozlu
#--- Mail : [email protected]
#--- Date : 27th January 2018
#----------------------------------------------
# Imports
import tensorflow as tf
# Object detection imports
from utils import backbone
from api import object_counting_api
input_video = "VDO-Traffic_Drone View-16may1045hour.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('inference_graph', 'labelmap.pbtxt')
#object_counting_api.object_counting(input_video, detection_graph, category_index, 0) # for counting all the objects, disabled color prediction
#object_counting_api.object_counting(input_video, detection_graph, category_index, 1) # for counting all the objects, enabled color prediction
targeted_objects = " bus " # (for counting targeted objects) change it with your targeted objects
is_color_recognition_enabled = 0
object_counting_api.targeted_object_counting(input_video, detection_graph, category_index, is_color_recognition_enabled, targeted_objects) # targeted objects counting
#object_counting_api.object_counting(input_video, detection_graph, category_index, is_color_recognition_enabled, fps, width, height) # counting all the objects