From c0ccecc270ec99446e20d7e43a2e83390d417dcc Mon Sep 17 00:00:00 2001 From: Sergey Revyakin Date: Tue, 5 May 2026 12:49:39 +0700 Subject: [PATCH] =?UTF-8?q?=D0=BF=D0=BE=D0=BC=D0=B5=D0=BD=D1=8F=D0=BB=20?= =?UTF-8?q?=D1=83=D1=81=D0=BB=D0=BE=D0=B2=D0=B8=D0=B5=20=D0=BD=D0=B0=20?= =?UTF-8?q?=D0=B1=D0=BE=D0=BB=D0=B5=D0=B5=20=D1=87=D0=B8=D1=82=D0=B0=D0=B1?= =?UTF-8?q?=D0=B5=D0=BB=D1=8C=D0=BD=D0=BE=D0=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- NN_server/server.py | 32 +++++++++++++++++++++----------- 1 file changed, 21 insertions(+), 11 deletions(-) diff --git a/NN_server/server.py b/NN_server/server.py index 043f3ff..331e1d0 100644 --- a/NN_server/server.py +++ b/NN_server/server.py @@ -137,19 +137,29 @@ def receive_data(): print() try: + result = 0 - if (int(freq) == 2400 and (prediction_list[0] in ['drone', 'drone_noise'] or (prediction_list[0] == 'wifi' and float(probability) >= 0.95))) or (int(freq) == 1200 and (prediction_list[0] in ['drone'] and float(probability) >= 0.95)): - result += 0 - if int(freq) in [915]: - result = 0 - if int(freq) in []: + freq_int = int(freq) + prediction = prediction_list[0] + prob = float(probability) + + if freq_int == 2400: + if prediction in ["drone", "drone_noise"]: + result += 0 + elif prediction == "wifi" and prob >= 0.95: + result += 0 + + elif freq_int == 1200: + if prediction == "drone" and prob >= 0.95: + result += 8 + + elif freq_int == 915: result = 0 - data_to_send={ - 'freq': str(freq), - 'amplitude': result - #'triggered': False if result < 7 else True, - #'light_len': result - } + + data_to_send = { + "freq": str(freq), + "amplitude": result, + } response = requests.post("http://{0}:{1}/process_data".format(gen_server_ip, gen_server_port), json=data_to_send) if response.status_code == 200: print("Данные успешно отправлены!")