Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -264,7 +264,7 @@ class IntrusionDetection:
|
|
264 |
self.conf_threshold = conf_threshold
|
265 |
@spaces.GPU
|
266 |
|
267 |
-
def
|
268 |
try:
|
269 |
device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
|
270 |
if not os.path.exists(self.model_path):
|
@@ -322,6 +322,7 @@ class IntrusionDetection:
|
|
322 |
|
323 |
|
324 |
class LoiteringDetection:
|
|
|
325 |
def __init__(self, model_path="yolov8n.pt", loitering_threshold=10, conf_threshold=0.5):
|
326 |
self.model_path = model_path
|
327 |
self.loitering_threshold = loitering_threshold
|
@@ -329,6 +330,7 @@ class LoiteringDetection:
|
|
329 |
self.entry_time = {}
|
330 |
self.area = [(153, 850), (139, 535), (239, 497), (291, 857)]
|
331 |
@spaces.GPU
|
|
|
332 |
def load_model(self):
|
333 |
device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
|
334 |
model = YOLO(self.model_path).to(device)
|
|
|
264 |
self.conf_threshold = conf_threshold
|
265 |
@spaces.GPU
|
266 |
|
267 |
+
def intrusion_detect(self, video_path):
|
268 |
try:
|
269 |
device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
|
270 |
if not os.path.exists(self.model_path):
|
|
|
322 |
|
323 |
|
324 |
class LoiteringDetection:
|
325 |
+
|
326 |
def __init__(self, model_path="yolov8n.pt", loitering_threshold=10, conf_threshold=0.5):
|
327 |
self.model_path = model_path
|
328 |
self.loitering_threshold = loitering_threshold
|
|
|
330 |
self.entry_time = {}
|
331 |
self.area = [(153, 850), (139, 535), (239, 497), (291, 857)]
|
332 |
@spaces.GPU
|
333 |
+
|
334 |
def load_model(self):
|
335 |
device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
|
336 |
model = YOLO(self.model_path).to(device)
|