performance x 60000%
This commit is contained in:
parent
02f15a64e9
commit
f2553b7067
|
|
@ -2,3 +2,5 @@
|
|||
*.csproj
|
||||
|
||||
FrontEnd/packages\.config
|
||||
|
||||
server/__pycache__/
|
||||
|
|
|
|||
Binary file not shown.
|
|
@ -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
|
||||
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Reference in New Issue