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, 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, 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)