Cambios yolo en gpu
This commit is contained in:
parent
6bc9a5cb44
commit
aa2132f3cf
Binary file not shown.
Binary file not shown.
|
Before Width: | Height: | Size: 4.7 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 3.0 KiB |
@ -10,6 +10,9 @@ from queue import Queue
|
|||||||
from deepface import DeepFace
|
from deepface import DeepFace
|
||||||
from ultralytics import YOLO
|
from ultralytics import YOLO
|
||||||
import warnings
|
import warnings
|
||||||
|
import torch
|
||||||
|
device = "cuda" if torch.cuda.is_available() else "cpu"
|
||||||
|
print(f"Usando dispositivo: {device}")
|
||||||
|
|
||||||
warnings.filterwarnings("ignore")
|
warnings.filterwarnings("ignore")
|
||||||
|
|
||||||
@ -295,7 +298,7 @@ def dibujar_track_fusion(frame_show, trk, global_mem):
|
|||||||
|
|
||||||
def main():
|
def main():
|
||||||
print("\nIniciando Sistema")
|
print("\nIniciando Sistema")
|
||||||
model = YOLO("yolov8n.pt")
|
model = YOLO("yolov8n.pt").to("cuda")
|
||||||
global_mem = GlobalMemory()
|
global_mem = GlobalMemory()
|
||||||
managers = {str(c): CamManager(c, global_mem) for c in SECUENCIA}
|
managers = {str(c): CamManager(c, global_mem) for c in SECUENCIA}
|
||||||
cams = [CamStream(u) for u in URLS]
|
cams = [CamStream(u) for u in URLS]
|
||||||
@ -303,7 +306,7 @@ def main():
|
|||||||
for _ in range(2):
|
for _ in range(2):
|
||||||
threading.Thread(target=worker_rostros, args=(global_mem,), daemon=True).start()
|
threading.Thread(target=worker_rostros, args=(global_mem,), daemon=True).start()
|
||||||
|
|
||||||
cv2.namedWindow("SmartSoft", cv2.WINDOW_AUTOSIZE)
|
cv2.namedWindow("SmartSoft", cv2.WINDOW_NORMAL)
|
||||||
idx = 0
|
idx = 0
|
||||||
|
|
||||||
while True:
|
while True:
|
||||||
|
|||||||
@ -14,6 +14,14 @@ import subprocess
|
|||||||
from datetime import datetime
|
from datetime import datetime
|
||||||
import warnings
|
import warnings
|
||||||
import urllib.request
|
import urllib.request
|
||||||
|
import torch
|
||||||
|
|
||||||
|
if torch.cuda.is_available():
|
||||||
|
device = "cuda"
|
||||||
|
print("GPU detectada → usando GPU 🚀")
|
||||||
|
else:
|
||||||
|
device = "cpu"
|
||||||
|
print("GPU no disponible → usando CPU ⚠️")
|
||||||
|
|
||||||
warnings.filterwarnings("ignore")
|
warnings.filterwarnings("ignore")
|
||||||
|
|
||||||
@ -229,8 +237,8 @@ def gestionar_vectores(actualizar=False):
|
|||||||
res = DeepFace.represent(
|
res = DeepFace.represent(
|
||||||
img_path=img_mejorada,
|
img_path=img_mejorada,
|
||||||
model_name="ArcFace",
|
model_name="ArcFace",
|
||||||
detector_backend="mtcnn",
|
detector_backend="opencv",
|
||||||
align=True,
|
align=False,
|
||||||
enforce_detection=True
|
enforce_detection=True
|
||||||
)
|
)
|
||||||
emb = np.array(res[0]["embedding"], dtype=np.float32)
|
emb = np.array(res[0]["embedding"], dtype=np.float32)
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user