main
luanhailiang 2023-08-17 13:08:17 +08:00
parent f66dc12d5e
commit 2763f9bafc
1 changed files with 2 additions and 1 deletions

3
app.py
View File

@ -73,6 +73,7 @@ def worker(id,source,region=None,stream=False):
name = model.model.names[class_id] name = model.model.names[class_id]
if name in names: if name in names:
print("Name duplicate",name) print("Name duplicate",name)
continue
ball = balls.get(name,{}) ball = balls.get(name,{})
ball["tkid"] = int(tracker_id) ball["tkid"] = int(tracker_id)
ball["conf"] = round(float(confidence), 2) ball["conf"] = round(float(confidence), 2)
@ -82,12 +83,12 @@ def worker(id,source,region=None,stream=False):
ball["final"] = ball.get("final",0) + 1 ball["final"] = ball.get("final",0) + 1
balls[name] = ball balls[name] = ball
names[name] = True names[name] = True
names = {}
if count < region: if count < region:
continue continue
json_data = json.dumps({"table":id,"balls":balls,"time":int(time.time()*1000)}) json_data = json.dumps({"table":id,"balls":balls,"time":int(time.time()*1000)})
balls = {} balls = {}
count = 0 count = 0
names = {}
if not stream: if not stream:
yield json_data yield json_data
else: else: