automatica 3 final

Automatica-3
Sergey Revyakin 3 days ago
parent e0b258c911
commit 8801da18c4

@ -1,17 +1,50 @@
.git # Default-deny: include only files required by Docker images.
.vscode *
.venv-sdr
!.dockerignore
!deploy/
!deploy/docker/
!deploy/docker/**
!deploy/requirements/
!deploy/requirements/**
!src/
!src/**
!common/
!common/**
!NN_server/
!NN_server/**
!telemetry/
!telemetry/**
!torchsig/
!torchsig/**
# Drop heavy or host-only artifacts even if their parent directory is included.
.git/
.vscode/
.venv*/
__pycache__/ __pycache__/
*.pyc *.pyc
*.pyo *.pyo
*.tar
# Heavy host-only SDR sources *.tar.gz
*.tgz
*.zip
*.iq
logs/
runtime/
train_scripts/
scripts_nn/
orange_scripts/
signal/
gnuradio/ gnuradio/
gr-osmosdr/ gr-osmosdr/
gr-osmosdr-0.2.6/ gr-osmosdr-0.2.6/
# Local runtime artifacts
NN_server/result/
# Legacy install artifacts not needed in docker image
install_scripts/ install_scripts/
NN_server/NN/
NN_server/result/
NN_server/__pycache__/
src/__pycache__/
common/__pycache__/
telemetry/__pycache__/
torchsig/__pycache__/
torchsig/docs/

@ -139,11 +139,11 @@ def receive_data():
try: try:
result = 0 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)): 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 += 8 result += 0
if int(freq) in [915]: if int(freq) in [915]:
result = 0 result = 0
if int(freq) in []: if int(freq) in []:
result = 8 result = 0
data_to_send={ data_to_send={
'freq': str(freq), 'freq': str(freq),
'amplitude': result 'amplitude': result

@ -6,7 +6,7 @@ set -Eeuo pipefail
############################ ############################
# ЗАМЕНИ на реальную точку монтирования nvme1n1 # ЗАМЕНИ на реальную точку монтирования nvme1n1
BASE_DIR="/mnt/nvme1/dataset" BASE_DIR="/mnt/data/noise"
# Путь к python из venv # Путь к python из venv
PYTHON_BIN="${PYTHON_BIN:-$PWD/.venv-sdr/bin/python}" PYTHON_BIN="${PYTHON_BIN:-$PWD/.venv-sdr/bin/python}"
@ -14,8 +14,6 @@ PYTHON_BIN="${PYTHON_BIN:-$PWD/.venv-sdr/bin/python}"
# Путь к headless скрипту # Путь к headless скрипту
SCRIPT_PATH="${SCRIPT_PATH:-$PWD/scripts_nn/data_saver_headless.py}" SCRIPT_PATH="${SCRIPT_PATH:-$PWD/scripts_nn/data_saver_headless.py}"
# Проверка, что каталог реально на nvme1n1
EXPECTED_DEVICE_PREFIX="/dev/nvme1n1"
# Лимиты # Лимиты
PER_FREQ_LIMIT_BYTES=$((3 * 1024 * 1024 * 1024)) # 3 GiB на частоту за запуск PER_FREQ_LIMIT_BYTES=$((3 * 1024 * 1024 * 1024)) # 3 GiB на частоту за запуск
@ -34,39 +32,40 @@ BB_GAIN="36"
# ЧАСТОТЫ И SERIAL ИЗ ENV # ЧАСТОТЫ И SERIAL ИЗ ENV
############################ ############################
ORDER=(433 750 915 1200 2400 3300 4500 5200 5800) #ORDER=(433 750 915 1200 2400 3300 4500 5200 5800)
ORDER=(1200)
declare -A SERIAL declare -A SERIAL
declare -A FREQ_HZ declare -A FREQ_HZ
SERIAL[433]="0000000000000000114864dc382a8e1b" #SERIAL[433]="$hack_433"
FREQ_HZ[433]="433000000" FREQ_HZ[433]="433000000"
SERIAL[750]="0000000000000000114864dc383d0d1b" #SERIAL[750]="$hack_750"
FREQ_HZ[750]="750000000" FREQ_HZ[750]="750000000"
SERIAL[868]="000000000000000026a468dc36066b63" #SERIAL[868]="$hack_868"
FREQ_HZ[868]="868000000" FREQ_HZ[868]="868000000"
SERIAL[915]="000000000000000026a468dc36066b63" #SERIAL[915]="$hack_915"
FREQ_HZ[915]="915000000" FREQ_HZ[915]="915000000"
SERIAL[1200]="0000000000000000518864dc32660d83" SERIAL[1200]="0000000000000000114864dc38638a1b"
FREQ_HZ[1200]="1200000000" FREQ_HZ[1200]="1200000000"
SERIAL[2400]="0000000000000000919068dc3437b31f" #SERIAL[2400]="0000000000000000600463dc29789bc7"
FREQ_HZ[2400]="2400000000" FREQ_HZ[2400]="1200000000"
SERIAL[3300]="0000000000000000114864dc325069a3" #SERIAL[3300]="$hack_3300"
FREQ_HZ[3300]="3300000000" FREQ_HZ[3300]="3300000000"
SERIAL[4500]="0000000000000000518864dc33833183" #SERIAL[4500]="$hack_4500"
FREQ_HZ[4500]="4500000000" FREQ_HZ[4500]="4500000000"
SERIAL[5200]="0000000000000000874461dc241c7857" #SERIAL[5200]="$hack_5200"
FREQ_HZ[5200]="5200000000" FREQ_HZ[5200]="5200000000"
SERIAL[5800]="0000000000000000919068dc35781c1f" SERIAL[5800]="0000000000000000518864dc33743883"
FREQ_HZ[5800]="5800000000" FREQ_HZ[5800]="5800000000"
############################ ############################
@ -89,7 +88,6 @@ dir_size_bytes() {
total_size_bytes() { total_size_bytes() {
dir_size_bytes "$BASE_DIR" dir_size_bytes "$BASE_DIR"
} }
ensure_requirements() { ensure_requirements() {
if [[ ! -x "$PYTHON_BIN" ]]; then if [[ ! -x "$PYTHON_BIN" ]]; then
echo "Не найден python: $PYTHON_BIN" >&2 echo "Не найден python: $PYTHON_BIN" >&2
@ -106,11 +104,7 @@ ensure_requirements() {
local dev local dev
dev="$(df -P "$BASE_DIR" | awk 'NR==2 {print $1}')" dev="$(df -P "$BASE_DIR" | awk 'NR==2 {print $1}')"
if [[ "$dev" != ${EXPECTED_DEVICE_PREFIX}* ]]; then
echo "BASE_DIR=$BASE_DIR сейчас находится на $dev, а ожидался ${EXPECTED_DEVICE_PREFIX}*" >&2
echo "Исправь BASE_DIR на точку монтирования nvme1n1" >&2
exit 1
fi
} }
run_one_freq() { run_one_freq() {

@ -8,7 +8,7 @@ SDR_UNITS=(
dronedetector-sdr-433.service dronedetector-sdr-433.service
dronedetector-sdr-750.service dronedetector-sdr-750.service
#dronedetector-sdr-868-915.service #dronedetector-sdr-868-915.service
#dronedetector-sdr-868.service dronedetector-sdr-868.service
dronedetector-sdr-1500.service dronedetector-sdr-1500.service
dronedetector-sdr-3300.service dronedetector-sdr-3300.service
dronedetector-sdr-4500.service dronedetector-sdr-4500.service

@ -298,7 +298,7 @@ async def agregate_data(data_to_agregate: list):
data = [] data = []
if any(item is not None for item in data_to_agregate): if all(item is not None for item in data_to_agregate):
for item in data_to_agregate: for item in data_to_agregate:
if item is not None: if item is not None:
item['freq'] = int(item['freq']) item['freq'] = int(item['freq'])

@ -2,10 +2,18 @@
"cells": [ "cells": [
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 2, "execution_count": 1,
"id": "4fdb98fc-65bb-467e-be0c-168fee9b0fca", "id": "4fdb98fc-65bb-467e-be0c-168fee9b0fca",
"metadata": {}, "metadata": {},
"outputs": [ "outputs": [
{
"name": "stderr",
"output_type": "stream",
"text": [
"/home/sibscience-4/from_ssh/DroneDetector/.venv-train/lib/python3.12/site-packages/matplotlib/projections/__init__.py:63: UserWarning: Unable to import Axes3D. This may be due to multiple versions of Matplotlib being installed (e.g. as a system package and as a pip package). As a result, the 3D projection is not available.\n",
" warnings.warn(\"Unable to import Axes3D. This may be due to multiple versions of \"\n"
]
},
{ {
"name": "stdout", "name": "stdout",
"output_type": "stream", "output_type": "stream",
@ -16,10 +24,10 @@
{ {
"data": { "data": {
"text/plain": [ "text/plain": [
"<contextlib.ExitStack at 0x7d183e4bd220>" "<contextlib.ExitStack at 0x7dbe9e0bc080>"
] ]
}, },
"execution_count": 2, "execution_count": 1,
"metadata": {}, "metadata": {},
"output_type": "execute_result" "output_type": "execute_result"
} }
@ -64,7 +72,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 3, "execution_count": 2,
"id": "4848b066-2e09-4c1c-b8fa-8e3fa84d907a", "id": "4848b066-2e09-4c1c-b8fa-8e3fa84d907a",
"metadata": {}, "metadata": {},
"outputs": [], "outputs": [],
@ -74,7 +82,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 4, "execution_count": 3,
"id": "9267fbe1", "id": "9267fbe1",
"metadata": {}, "metadata": {},
"outputs": [], "outputs": [],
@ -147,20 +155,20 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 12, "execution_count": 16,
"id": "448da74a-e0ae-44d8-9877-8dd1f257a24f", "id": "448da74a-e0ae-44d8-9877-8dd1f257a24f",
"metadata": {}, "metadata": {},
"outputs": [], "outputs": [],
"source": [ "source": [
"selected_freq=750\n", "selected_freq=2400\n",
"\n", "\n",
"path_to_binaries = f'/mnt/nvme1/dataset/{selected_freq}'\n", "path_to_binaries = f'/mnt/data/Dataset/noise/{selected_freq}'\n",
"path_to_pictures = f'/mnt/nvme1/dataset_img/noise/{selected_freq}_jpg'" "path_to_pictures = f'/mnt/data/Dataset_img/noise/{selected_freq}_jpg'"
] ]
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 6, "execution_count": 14,
"id": "ac4945a8-29c4-4da4-945f-08658953e3e5", "id": "ac4945a8-29c4-4da4-945f-08658953e3e5",
"metadata": {}, "metadata": {},
"outputs": [], "outputs": [],
@ -170,7 +178,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 13, "execution_count": 17,
"id": "6f226f86-5d72-4573-8af6-750128b70263", "id": "6f226f86-5d72-4573-8af6-750128b70263",
"metadata": {}, "metadata": {},
"outputs": [ "outputs": [
@ -178,287 +186,42 @@
"name": "stderr", "name": "stderr",
"output_type": "stream", "output_type": "stream",
"text": [ "text": [
"2026-03-25_16-59-25: 0%| | 0/40 [00:00<?, ?it/s]" "2026-04-08_18-06-46: 100%|██████████| 1013/1013 [19:43<00:00, 1.17s/it]\n"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"2026-03-25_16-59-25: 100%|██████████| 40/40 [00:47<00:00, 1.18s/it]\n"
]
},
{
"name": "stdout",
"output_type": "stream",
"text": [
"Dir: 2026-03-25_16-59-25 finished!\n"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"2026-03-26_02-59-25: 100%|██████████| 40/40 [00:47<00:00, 1.18s/it]\n"
]
},
{
"name": "stdout",
"output_type": "stream",
"text": [
"Dir: 2026-03-26_02-59-25 finished!\n"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"2026-03-25_14-59-25: 100%|██████████| 40/40 [00:35<00:00, 1.11it/s]\n"
]
},
{
"name": "stdout",
"output_type": "stream",
"text": [
"Dir: 2026-03-25_14-59-25 finished!\n"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"2026-03-26_04-59-26: 100%|██████████| 40/40 [00:49<00:00, 1.23s/it]\n"
]
},
{
"name": "stdout",
"output_type": "stream",
"text": [
"Dir: 2026-03-26_04-59-26 finished!\n"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"2026-03-25_17-59-26: 100%|██████████| 40/40 [00:44<00:00, 1.12s/it]\n"
]
},
{
"name": "stdout",
"output_type": "stream",
"text": [
"Dir: 2026-03-25_17-59-26 finished!\n"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"2026-03-25_20-59-26: 100%|██████████| 40/40 [00:47<00:00, 1.20s/it]\n"
]
},
{
"name": "stdout",
"output_type": "stream",
"text": [
"Dir: 2026-03-25_20-59-26 finished!\n"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"2026-03-25_22-59-25: 100%|██████████| 40/40 [00:45<00:00, 1.13s/it]\n"
]
},
{
"name": "stdout",
"output_type": "stream",
"text": [
"Dir: 2026-03-25_22-59-25 finished!\n"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"2026-03-25_14-56-12: 100%|██████████| 25/25 [00:22<00:00, 1.12it/s]\n"
]
},
{
"name": "stdout",
"output_type": "stream",
"text": [
"Dir: 2026-03-25_14-56-12 finished!\n"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"2026-03-26_00-59-27: 100%|██████████| 40/40 [00:46<00:00, 1.16s/it]\n"
]
},
{
"name": "stdout",
"output_type": "stream",
"text": [
"Dir: 2026-03-26_00-59-27 finished!\n"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"2026-03-25_19-59-25: 100%|██████████| 40/40 [00:44<00:00, 1.11s/it]\n"
]
},
{
"name": "stdout",
"output_type": "stream",
"text": [
"Dir: 2026-03-25_19-59-25 finished!\n"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"2026-03-26_05-59-25: 100%|██████████| 40/40 [00:48<00:00, 1.20s/it]\n"
]
},
{
"name": "stdout",
"output_type": "stream",
"text": [
"Dir: 2026-03-26_05-59-25 finished!\n"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"2026-03-26_08-59-25: 100%|██████████| 40/40 [00:47<00:00, 1.18s/it]\n"
]
},
{
"name": "stdout",
"output_type": "stream",
"text": [
"Dir: 2026-03-26_08-59-25 finished!\n"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"2026-03-26_07-59-25: 100%|██████████| 40/40 [00:46<00:00, 1.16s/it]\n"
]
},
{
"name": "stdout",
"output_type": "stream",
"text": [
"Dir: 2026-03-26_07-59-25 finished!\n"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"2026-03-26_06-59-26: 100%|██████████| 40/40 [00:48<00:00, 1.20s/it]\n"
]
},
{
"name": "stdout",
"output_type": "stream",
"text": [
"Dir: 2026-03-26_06-59-26 finished!\n"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"2026-03-26_01-59-26: 100%|██████████| 40/40 [00:47<00:00, 1.20s/it]\n"
]
},
{
"name": "stdout",
"output_type": "stream",
"text": [
"Dir: 2026-03-26_01-59-26 finished!\n"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"2026-03-25_15-59-26: 100%|██████████| 40/40 [00:45<00:00, 1.14s/it]\n"
]
},
{
"name": "stdout",
"output_type": "stream",
"text": [
"Dir: 2026-03-25_15-59-26 finished!\n"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"2026-03-25_23-59-26: 100%|██████████| 40/40 [00:48<00:00, 1.20s/it]\n"
]
},
{
"name": "stdout",
"output_type": "stream",
"text": [
"Dir: 2026-03-25_23-59-26 finished!\n"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"2026-03-25_21-59-26: 100%|██████████| 40/40 [00:46<00:00, 1.17s/it]\n"
] ]
}, },
{ {
"name": "stdout", "name": "stdout",
"output_type": "stream", "output_type": "stream",
"text": [ "text": [
"Dir: 2026-03-25_21-59-26 finished!\n" "Dir: 2026-04-08_18-06-46 finished!\n"
] ]
}, },
{ {
"name": "stderr", "name": "stderr",
"output_type": "stream", "output_type": "stream",
"text": [ "text": [
"2026-03-25_18-59-25: 100%|██████████| 40/40 [00:47<00:00, 1.19s/it]\n" "2026-04-08_18-10-32: 100%|██████████| 353/353 [06:53<00:00, 1.17s/it]\n"
] ]
}, },
{ {
"name": "stdout", "name": "stdout",
"output_type": "stream", "output_type": "stream",
"text": [ "text": [
"Dir: 2026-03-25_18-59-25 finished!\n" "Dir: 2026-04-08_18-10-32 finished!\n"
] ]
}, },
{ {
"name": "stderr", "name": "stderr",
"output_type": "stream", "output_type": "stream",
"text": [ "text": [
"2026-03-26_03-59-26: 100%|██████████| 40/40 [00:47<00:00, 1.19s/it]" "2026-04-08_18-08-39: 100%|██████████| 1017/1017 [19:48<00:00, 1.17s/it]"
] ]
}, },
{ {
"name": "stdout", "name": "stdout",
"output_type": "stream", "output_type": "stream",
"text": [ "text": [
"Dir: 2026-03-26_03-59-26 finished!\n" "Dir: 2026-04-08_18-08-39 finished!\n"
] ]
}, },
{ {
@ -482,7 +245,7 @@
" continue\n", " continue\n",
"\n", "\n",
" files = os.listdir(filepath)\n", " files = os.listdir(filepath)\n",
" k = max(1, int(len(files) * 0.04))\n", " k = max(1, int(len(files) * 1))\n",
" files = random.sample(files, k)\n", " files = random.sample(files, k)\n",
" for file in tqdm(files, desc=subdir):\n", " for file in tqdm(files, desc=subdir):\n",
" full_input_path = filepath + file\n", " full_input_path = filepath + file\n",
@ -542,7 +305,7 @@
], ],
"metadata": { "metadata": {
"kernelspec": { "kernelspec": {
"display_name": ".venv-train (3.12.3)", "display_name": ".venv-train",
"language": "python", "language": "python",
"name": "python3" "name": "python3"
}, },

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long
Loading…
Cancel
Save