performance x 60000%

This commit is contained in:
Patrice 2019-06-10 12:50:21 +02:00
parent 02f15a64e9
commit f2553b7067
4 changed files with 9 additions and 8 deletions

2
.gitignore vendored
View File

@ -2,3 +2,5 @@
*.csproj
FrontEnd/packages\.config
server/__pycache__/

View File

@ -48,6 +48,7 @@ def gen(camera):
######### ###########
def main():
detector = dt.Detector()
while True:
for cam in cams:
t = 1 # seconds a person can leave the room for
@ -55,7 +56,7 @@ def main():
time.clock()
elapsed = 0
stream = cam["ip"]
detector = dt.Detector(stream)
clientStatus = clients[cam["client_id"]]["status"]
clientIp = clients[cam["client_id"]]["ip"]
@ -70,7 +71,7 @@ def main():
print("request error")
tmp = time.time()
img, result = detector.detect()
img, result = detector.detect(stream)
print(cam["client_id"], result, time.time()-tmp)
lastImages[cam["id"]] = img

View File

@ -59,15 +59,13 @@ class DetectorAPI:
class Detector:
def __init__(self, stream):
def __init__(self):
self.model_path = "./server/model.pb"
self.odapi = DetectorAPI(path_to_ckpt=self.model_path)
self.threshold = 0.3
self.stream = stream
self.threshold = 0.3
def detect(self):
cap = cv2.VideoCapture(self.stream)
def detect(self, stream):
cap = cv2.VideoCapture(stream)
r, img = cap.read()
if img is None:
return img