# cap = cv2.VideoCapture("/home/developer/PycharmProjects/SecureIt/obj_tracking/sort_deep/MOT16/train/test.mp4")
cap = cv2.VideoCapture(-1)

# cap = cv2.VideoCapture("/home/developer/PycharmProjects/SecureIt/data/videos/People Counting Demonstration.mp4")

from tf_session.tf_session_runner import SessionRunner
session_runner = SessionRunner()
session_runner.start()

while True:
    ret, image = cap.read()
    if ret:
        break

od_api = TFObjectDetectionAPI(
    PRETRAINED_faster_rcnn_inception_resnet_v2_atrous_coco_2018_01_28,
    image.shape, 'tf_api', True)
# od_api = YOLOObjectDetectionAPI('yolo_api', True)
od_ip = od_api.get_in_pipe()
od_op = od_api.get_out_pipe()
od_api.use_session_runner(session_runner)
od_api.run()

ds_api = ImageEncoder(session_runner, PRETRAINED_mars_small128, 'ds_api')
ds_ip = ds_api.get_in_pipe()
ds_op = ds_api.get_out_pipe()
ds_api.run()

viewer = None

Exemple #2
0
    PRETRAINED_faster_rcnn_inception_resnet_v2_atrous_coco_2018_01_28, PRETRAINED_ssd_mobilenet_v1_coco_2017_11_17
from obj_tracking.sort.sort import Sort
from tf_session.tf_session_runner import SessionRunner

tracker = Sort(max_age=120, min_hits=5)  # create instance of the SORT tracker

session_runner = SessionRunner()
session_runner.start()

cap0 = cv2.VideoCapture(-1)
while True:
    ret, image0 = cap0.read()
    if ret:
        break

detection0 = TFObjectDetectionAPI(PRETRAINED_faster_rcnn_inception_v2_coco_2018_01_28, image0.shape,
                                  'tf_api_0', True)
detection0.use_session_runner(session_runner)
ip0 = detection0.get_in_pipe()
op0 = detection0.get_out_pipe()
detection0.run()

# cap1 = cv2.VideoCapture(1)
# while True:
#     ret, image1 = cap1.read()
#     if ret:
#         break
#
# detection1 = TFObjectDetectionAPI(PRETRAINED_faster_rcnn_inception_v2_coco_2018_01_28, image1.shape,
#                                   'tf_api_1', True)
# detection1.use_session_runner(session_runner)
# ip1 = detection1.get_in_pipe()
from tf_session.tf_session_runner import SessionRunner
from tf_session.tf_session_utils import Inference

session_runner = SessionRunner()
session_runner.start()

cap = cv2.VideoCapture("/home/developer/PycharmProjects/SecureIt/data/videos/abandoned_detection/abandoned_luggage.avi")
# cap = cv2.VideoCapture('/home/developer/Downloads/shoe_tracking.mp4')
# cap = cv2.VideoCapture(0)
while True:
    ret, image = cap.read()
    if ret:
        break

# detector =  YOLOObjectDetectionAPI('yolo_api', True)
detector = TFObjectDetectionAPI(PRETRAINED_faster_rcnn_inception_v2_coco_2018_01_28, image.shape, 'tf_api', True)
detector.use_session_runner(session_runner)
detector_ip = detector.get_in_pipe()
detector_op = detector.get_out_pipe()
detector.run()

tracker = OFISTObjectTrackingAPI(flush_pipe_on_read=True)
tracker.use_session_runner(session_runner)
trk_ip = tracker.get_in_pipe()
trk_op = tracker.get_out_pipe()
tracker.run()


def read_video():
    while True:
        ret, image = cap.read()
Exemple #4
0
    Thread(target=fs.get_app().run, args=("0.0.0.0", )).start()

    session_runner = {}
    detector = {}

    cap = {}
    pipe = {}
    video_inputs = {
        0: 0,
        1: 1,
        2: 2,
        3: 3,
        4: 4,
        6: 'rtsp://*****:*****@192.168.0.6'
    }

    for i in video_inputs.keys():
        session_runner[i] = SessionRunner(skip=True)
        session_runner[i].start()
        detector[i] = TFObjectDetectionAPI(
            PRETRAINED_faster_rcnn_inception_v2_coco_2018_01_28, None,
            'tf_api_' + str(i), True)
        detector[i].use_session_runner(session_runner[i])
        detector[i].run()

        cap[i] = cv2.VideoCapture(video_inputs[i])
        pipe[i] = Pipe()
        fs.create('feed_' + str(i), pipe[i])
        Thread(target=detect_objects,
               args=(cap[i], pipe[i], detector[i], False)).start()