From 3ca49eab314cab8706dbc8b0677ddc836e043a09 Mon Sep 17 00:00:00 2001 From: r0mchik Date: Tue, 3 Jun 2025 14:32:42 +0700 Subject: [PATCH] v0.0.4 --- dev.env | 4 ++++ web/streaming/consumer.py | 8 ++++---- 2 files changed, 8 insertions(+), 4 deletions(-) create mode 100644 dev.env diff --git a/dev.env b/dev.env new file mode 100644 index 0000000..3fa92bd --- /dev/null +++ b/dev.env @@ -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' \ No newline at end of file diff --git a/web/streaming/consumer.py b/web/streaming/consumer.py index ec34395..8585152 100644 --- a/web/streaming/consumer.py +++ b/web/streaming/consumer.py @@ -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,