This commit is contained in:
r0mchik 2025-06-03 14:32:42 +07:00
parent 7264bdc956
commit 3ca49eab31
2 changed files with 8 additions and 4 deletions

4
dev.env Normal file
View File

@ -0,0 +1,4 @@
SECRET_KEY='django-insecure-dwz6w*m*yl$!))@7v36)u=034$1=41gp9ph5u7!g3x!b0un#)e'
WEBSOCKET_URL='ws://localhost:8000/ws/stream/'
RTSP_URL='rtsp://192.168.1.247:554/rtsp/streaming?channel=01&subtype=A'
MODEL_PATH='models/colors/detection/v4/med/epochs_60/best.pt'

View File

@ -26,7 +26,7 @@ clients = set()
model = YOLO(MODEL_PATH)
crop_x, crop_y, crop_w, crop_h = 950, 600, 640, 640
crop_x, crop_y, crop_w, crop_h = 1030, 650, 450, 500
RECORD_DURATION = 60 # 1 минута
read_task_lock = asyncio.Lock()
@ -149,8 +149,8 @@ class VideoConsumer(AsyncWebsocketConsumer):
results = model.predict(source=cropped, save=False, verbose=False)
detected = False
annotated_img = img.copy()
# annotated_img = cropped # для отображения рабочей области нейронки
# annotated_img = img.copy()
annotated_img = cropped # для отображения рабочей области нейронки
for box in results[0].boxes:
cls_id = int(box.cls[0])
@ -189,7 +189,7 @@ class VideoConsumer(AsyncWebsocketConsumer):
cv2.putText(
annotated_img,
# f"{class_name} {conf:.2f}",
f"quality {conf:.2f}",
f"spray {conf:.2f}",
(x1, y1 - 10),
cv2.FONT_HERSHEY_SIMPLEX,
0.9,