performance x 60000%
This commit is contained in:
parent
02f15a64e9
commit
f2553b7067
|
|
@ -2,3 +2,5 @@
|
||||||
*.csproj
|
*.csproj
|
||||||
|
|
||||||
FrontEnd/packages\.config
|
FrontEnd/packages\.config
|
||||||
|
|
||||||
|
server/__pycache__/
|
||||||
|
|
|
||||||
Binary file not shown.
|
|
@ -48,6 +48,7 @@ def gen(camera):
|
||||||
######### ###########
|
######### ###########
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
|
detector = dt.Detector()
|
||||||
while True:
|
while True:
|
||||||
for cam in cams:
|
for cam in cams:
|
||||||
t = 1 # seconds a person can leave the room for
|
t = 1 # seconds a person can leave the room for
|
||||||
|
|
@ -55,7 +56,7 @@ def main():
|
||||||
time.clock()
|
time.clock()
|
||||||
elapsed = 0
|
elapsed = 0
|
||||||
stream = cam["ip"]
|
stream = cam["ip"]
|
||||||
detector = dt.Detector(stream)
|
|
||||||
clientStatus = clients[cam["client_id"]]["status"]
|
clientStatus = clients[cam["client_id"]]["status"]
|
||||||
clientIp = clients[cam["client_id"]]["ip"]
|
clientIp = clients[cam["client_id"]]["ip"]
|
||||||
|
|
||||||
|
|
@ -70,7 +71,7 @@ def main():
|
||||||
print("request error")
|
print("request error")
|
||||||
|
|
||||||
tmp = time.time()
|
tmp = time.time()
|
||||||
img, result = detector.detect()
|
img, result = detector.detect(stream)
|
||||||
print(cam["client_id"], result, time.time()-tmp)
|
print(cam["client_id"], result, time.time()-tmp)
|
||||||
lastImages[cam["id"]] = img
|
lastImages[cam["id"]] = img
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -59,15 +59,13 @@ class DetectorAPI:
|
||||||
|
|
||||||
|
|
||||||
class Detector:
|
class Detector:
|
||||||
def __init__(self, stream):
|
def __init__(self):
|
||||||
self.model_path = "./server/model.pb"
|
self.model_path = "./server/model.pb"
|
||||||
self.odapi = DetectorAPI(path_to_ckpt=self.model_path)
|
self.odapi = DetectorAPI(path_to_ckpt=self.model_path)
|
||||||
self.threshold = 0.3
|
self.threshold = 0.3
|
||||||
self.stream = stream
|
|
||||||
|
|
||||||
|
|
||||||
def detect(self):
|
def detect(self, stream):
|
||||||
cap = cv2.VideoCapture(self.stream)
|
cap = cv2.VideoCapture(stream)
|
||||||
r, img = cap.read()
|
r, img = cap.read()
|
||||||
if img is None:
|
if img is None:
|
||||||
return img
|
return img
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue