Updated the Thief Detection.
This commit is contained in:
parent
4029c87fdc
commit
062a66cd95
3 changed files with 4 additions and 6 deletions
|
@ -3,7 +3,6 @@ import dlib
|
||||||
import cv2
|
import cv2
|
||||||
import numpy as np
|
import numpy as np
|
||||||
import DBHelper
|
import DBHelper
|
||||||
import time
|
|
||||||
import Upload_Thief
|
import Upload_Thief
|
||||||
|
|
||||||
|
|
||||||
|
@ -34,11 +33,10 @@ def inference():
|
||||||
|
|
||||||
cond = False
|
cond = False
|
||||||
thief = False
|
thief = False
|
||||||
thief_time = 0
|
|
||||||
label = 'unknown'
|
label = 'unknown'
|
||||||
|
start = time.time()
|
||||||
|
|
||||||
while DBHelper.get_power() == "on":
|
while DBHelper.get_power() == "on":
|
||||||
t = time.time()
|
|
||||||
success, im = cam.read()
|
success, im = cam.read()
|
||||||
|
|
||||||
if not success:
|
if not success:
|
||||||
|
@ -100,12 +98,12 @@ def inference():
|
||||||
if cond:
|
if cond:
|
||||||
DBHelper.set_motor("on")
|
DBHelper.set_motor("on")
|
||||||
DBHelper.set_alarm("off")
|
DBHelper.set_alarm("off")
|
||||||
thief_time = 0
|
start = time.time()
|
||||||
elif not cond:
|
elif not cond:
|
||||||
DBHelper.set_motor("off")
|
DBHelper.set_motor("off")
|
||||||
DBHelper.set_alarm("on")
|
DBHelper.set_alarm("on")
|
||||||
thief_time += 1
|
end = time.time()
|
||||||
if thief_time == 10:
|
if end - start >= 30:
|
||||||
thief = True
|
thief = True
|
||||||
DBHelper.set_power("off")
|
DBHelper.set_power("off")
|
||||||
|
|
||||||
|
|
Binary file not shown.
Before Width: | Height: | Size: 0 B After Width: | Height: | Size: 72 KiB |
Binary file not shown.
Loading…
Reference in a new issue