def connect(sensor, location, uri, algorithm, algorithmName, resolution, zonemap): global runva try: rec2db = Rec2DB(sensor) rec2db.start() runva = RunVA("crowd_counting") runva.loop( sensor, location, uri, algorithm, algorithmName, { "crowd_count": { "width": resolution["width"], "height": resolution["height"], "zonemap": zonemap, }, }) print("rec2db stop", flush=True) rec2db.stop() print("rec2db stopped", flush=True) raise Exception("VA exited. This should not happen.") except: print(traceback.format_exc(), flush=True) print("connect stopped", flush=True)
def connect(sensor, location, uri, algorithm, algorithmName): try: rec2db = Rec2DB(sensor) rec2db.start() runva = RunVA("object_detection", version, stop=stop) runva.loop(sensor, location, uri, algorithm, algorithmName) rec2db.stop() raise Exception("VA exited. This should not happen.") except: print(traceback.format_exc(), flush=True)
def connect(sensor, location, uri, algorithm, algorithmName): global runva try: rec2db=Rec2DB(sensor) rec2db.start() runva=RunVA("entrance_counting", stop=stop) runva.loop(sensor, location, uri, algorithm, algorithmName) rec2db.stop() raise Exception("VA exited. This should not happen.") except: print(traceback.format_exc(), flush=True)
def connect(sensor, location, algorithm, uri): global mqtt2db, rec2db, runva try: mqtt2db = MQTT2DB(algorithm) # this waits for mqtt rec2db = Rec2DB(sensor) runva = RunVA() topic = str( uuid.uuid4()) # topic must be different as camera may reconnect with ThreadPoolExecutor(2) as e: e.submit(mqtt2db.loop, topic) e.submit(rec2db.loop) # any VA exit indicates a camera disconnect with ThreadPoolExecutor(1) as e1: e1.submit(runva.loop, sensor, location, uri, algorithm, topic) if not stop: mqtt2db.stop() rec2db.stop() raise Exception("VA exited. This should not happen.") except Exception as e: print("Exception: " + str(e), flush=True)
def connect(sensor, algorithm, uri): global mqtt2db, rec2db, runva try: mqtt2db = MQTT2DB(algorithm) # this waits for mqtt rec2db = Rec2DB(sensor) runva = RunVA() topic = "smtc_va_inferences_" + algorithm with ThreadPoolExecutor(3) as e: e.submit(mqtt2db.loop, topic) e.submit(rec2db.loop) e.submit(runva.loop, sensor, uri, algorithm, topic) except Exception as e: print("Exception: " + str(e), flush=True)
def connect(sensor, location, uri, algorithm, algorithmName): global rec2db, runva try: rec2db = Rec2DB(sensor) runva = RunVA("entrance_counting") with ThreadPoolExecutor(2) as e: e.submit(rec2db.loop) # any VA exit indicates a camera disconnect with ThreadPoolExecutor(1) as e1: e1.submit(runva.loop, sensor, location, uri, algorithm, algorithmName) if not stop: rec2db.stop() raise Exception("VA exited. This should not happen.") except Exception as e: print("Exception in connect: " + str(e), flush=True)
def connect(sensor, location, uri, algorithm, algorithmName, resolution, zonemap): global mqtt2db, rec2db, runva print("==============count-crowd:connect:zonemap=", zonemap, "========================", flush=True) flatZonemap = [] for sublist in zonemap[0]["polygon"]: for item in sublist: flatZonemap.append(item) try: mqtt2db = MQTT2DB(algorithm) # this waits for mqtt rec2db = Rec2DB(sensor) runva = RunVA("crowd_counting") topic = str( uuid.uuid4()) # topic must be different as camera may reconnect with ThreadPoolExecutor(2) as e: e.submit(mqtt2db.loop, topic) e.submit(rec2db.loop) # any VA exit indicates a camera disconnect with ThreadPoolExecutor(1) as e1: e1.submit(runva.loop, sensor, location, uri, topic, algorithm, algorithmName, resolution, zonemap[0]["zone"], flatZonemap) if not stop: mqtt2db.stop() rec2db.stop() raise Exception("VA exited. This should not happen.") except Exception as e: print("Exception in connect: " + str(e), flush=True)
from zkstate import ZKState import merged_segment as merge import datetime import json import socket import time import os import re import traceback video_analytics_topic = "seg_analytics_sched" machine_prefix = os.environ.get("VA_PRE") if machine_prefix == None: machine_prefix = "VA-" va = RunVA() global_total_fps = 0 global_seg_count = 0 def process_stream(streamstring): streamjson = ast.literal_eval(streamstring) pipeline1 = streamjson["pipeline"] + "/1" stream = streamjson['source']['uri'] user = streamjson["user_info"]["name"] elapsed_time = time.time() - streamjson["start_time"] print("VA feeder: stream: " + stream + " " + user + " elapsed-time on kafka queue:" + str(elapsed_time), flush=True) zk_path = None