
신호 스푸핑 및 적대적 교란에 대응하기 위해 CNN과 멀티 헤드 어텐션을 결합한 안전한 5G 실내 위치 파악을 위한 적대자 내성 딥러닝 아키텍처입니다.
본 연구는 적대적 공격에 강인한 딥러닝 아키텍처를 제안하여 5G 실내 측위의 보안 및 프라이버시 문제를 해결합니다. Sec5GLoc은 채널 임펄스 응답(CIR) 핑거프린팅과 도착 시간 차(TDoA) 피처 및 알려진 앵커 위치를 결합하며, 하이브리드 CNN과 멀티-헤드 어텐션 네트워크가 이를 처리합니다. 이 설계는 위치 스푸핑 및 적대적 신호 변조와 같은 위협에 대한 견고성을 향상시킵니다.
그림 1. 적대적 신호 교란 및 물리 계층 위협 하에서 안전하고 강인한 5G 측위의 문제 정식화.
|
그림 2. Sec5GLoc 모델: 공유 CNN을 사용하여 CIR 피처를 추출하고, 앵커 위치와 TDoA 피처를 임베딩한 뒤 어텐션을 통해 융합한 다음, 회귀 헤드를 통해 위치를 예측합니다.
|
이 프로젝트는 채널 임펄스 응답(CIR)을 포함하는 공개 5G 실내 측위 데이터셋을 사용합니다. 이 데이터셋은 약 1,200m² 규모의 대형 산업용 창고 환경에서 8개의 고정 5G 앵커와 사용자 장치의 업링크 전송을 사용하여 수집되었습니다. 주요 특징은 다음과 같습니다:
다른 저자들이 수집한 원본 데이터셋은 여기에서 확인할 수 있습니다: [5G 채널 임펄스 응답 데이터셋]
split_dataset.py 스크립트는 원본 training.csv(주로 NLOS 데이터 포함)에서 특정 학습 및 테스트 분할을 생성하는 데 사용됩니다:
training_NLOS.csv: 원본 training.csv의 90%로, Sec5GLoc 모델 및 어블레이션 학습에 사용됩니다.test_NLOS.csv: 원본 training.csv의 10%로, 기존에 본 (NLOS) 분포에 대한 테스트에 사용됩니다.test_LOS-NLOS.csv: 원본 데이터셋 제공자로부터 받은 별도의 파일로, LOS와 NLOS 조건이 혼합된 궤적을 포함하며, 오직 training_NLOS.csv만으로 학습된 모델에게는 보지 못한 환경/분포를 나타냅니다.Sec5GLoc/
├── dataset/ # Dataset files (anchors.txt, original CSVs)
│ ├── anchors.txt
│ ├── training.csv # Original full NLOS training data from dataset provider
│ └── test_LOS-NLOS.csv # Original mixed LOS/NLOS test data from dataset provider
├── dataset_splits/ # Generated by split_dataset.py
│ ├── training_NLOS.csv
│ └── test_NLOS.csv
├── knn_model_files/ # Output from baseline_knn.py (train mode)
│ ├── knn_model.joblib
│ ├── knn_model.best_params.json
│ ├── knn_model.outer_cv_metrics.json
│ └── logs/
├── knn_test_results/ # Output from baseline_knn.py (test mode)
│ ├── knn_test_predictions.csv
│ ├── knn_test_metrics.json
│ └── logs/
├── tdoa_baseline_results/ # Output from baseline_tdoa_multilateration.py
│ ├── predictions_loss_linear_weights_False.csv
│ ├── predictions_loss_linear_weights_False_metrics.json
│ └── logs/
├── sec5gloc_checkpoints/ # Output from train.py (Sec5GLoc models)
│ ├── checkpoints/
│ │ ├── model_best.pth.tar
│ │ ├── checkpoint.pth.tar
│ │ ├── training_history.json
│ │ └── logs/
│ └── ... (other runs for ablations, etc.)
├── sec5gloc_predictions/ # Output from test.py (Sec5GLoc benign evaluation)
│ ├── test_results/
│ │ ├── predictions_score1_normal.csv (for test_NLOS.csv)
│ │ ├── metrics_score1_normal.json
│ │ ├── predictions_score2_normal.csv (for test_LOS-NLOS.csv)
│ │ ├── metrics_score2_normal.json
│ │ └── logs/
├── sec5gloc_attack_results/ # Output from test_attack_noise_drop_anchor.py
│ ├── test_results/
│ │ ├── predictions_score2_spoofing_attention_main.csv
│ │ ├── metrics_score2_spoofing_attention_main.json
│ │ ├── predictions_score2_noise_attention_main_sigma0.5.csv
│ │ ├── ... (other attack results) ...
│ │ └── logs/
├── figures/ # Output from plot.py
│ ├── figure1_cdf.pdf
│ └── ...
├── dataset.py # Dataset loading and preprocessing utilities
├── model.py # Sec5GLoc model architecture
├── train.py # Script for training Sec5GLoc
├── test.py # Script for testing Sec5GLoc (benign conditions, ablations)
├── test_attack_noise_drop_anchor.py # Script for testing Sec5GLoc under attacks
├── split_dataset.py # Script to split original data into train/test CSVs
├── baseline_knn.py # k-NN fingerprinting baseline script
├── baseline_tdoa_multilateration.py # Geometric TDoA multilateration baseline script
├── plot.py # Script for generating plots from prediction files
├── Sec5GLoc_env.yml # Python package dependencies
└── README.md # This file
1. 저장소 클론:
git clone https://github.com/sec5gloc/Sec5GLoc.git
cd Sec5GLoc
2. Python 환경 생성:
가상 환경(예: Conda 또는 venv) 사용을 권장합니다. 환경을 설정하려면 Sec5GLoc_env.yml 파일을 사용할 수 있습니다:
# Using Conda
conda env create -f Sec5GLoc_env.yml
conda activate <your-environment-name>
4. 데이터셋 다운로드:
training.csv, test_LOS-NLOS.csv, anchors.txt)을 다운로드합니다.dataset/ 디렉토리에 넣습니다.1. 데이터셋 분할 준비(최초 1회 설정):
원본 training.csv(NLOS 전용)는 NLOS 평가를 위해 학습 파일과 분리된(held-out) 테스트 파일로 분할해야 합니다.
python split_dataset.py --input-csv-file dataset/training.csv --output-dir dataset_splits --train-output-name training_NLOS.csv --test-output-name test_NLOS.csv --test-split-ratio 0.1 --seed 42
이렇게 하면 dataset_splits/training_NLOS.csv(원본 training.csv의 90%)와 dataset_splits/test_NLOS.csv(원본 training.csv의 10%)가 생성됩니다.
2. Sec5GLoc 모델 학습:
train.py를 사용하여 주요 Sec5GLoc 모델 또는 그 어블레이션을 학습합니다. 이 스크립트는 dataset_splits/training_NLOS.csv를 사용하고 이를 다시 학습 및 검증 세트로 분할합니다.
python train.py \
--data-dir ./ \
--full-dataset-csv dataset_splits/training_NLOS.csv \
--val-split-ratio 0.1 \
--checkpoint-dir ./sec5gloc_checkpoints/Sec5GLoc_full_model_run1 \
--epochs 100 \
--batch-size 128 \
--lr 1e-4 \
--patience-early-stop 20 \
--seed 42 \
# --no-attention # For non-attention ablation
# --no-tdoa # For non-TDoA ablation
# --no-anchor-pos # For non-anchor-pos ablation (implies --no-tdoa for some features)
# --gpu 0 # Specify GPU ID, or -1 for CPU
체크포인트와 로그는 지정된 --checkpoint-dir에 저장됩니다.
3. Sec5GLoc 평가(정상 조건):
test.py를 사용하여 학습된 Sec5GLoc 모델을 다양한 테스트 세트에서 평가합니다.
score1: dataset_splits/test_NLOS.csv(기존에 본 분포)에서 평가합니다.score2: dataset/test_LOS-NLOS.csv(보지 못한 분포, LOS/NLOS 혼합)에서 평가합니다.python test.py \
--checkpoint ./sec5gloc_checkpoints/Sec5GLoc_full_model_run1/model_best.pth.tar \
--test-set score2 \
--data-dir ./ \
--output-dir ./sec5gloc_predictions/results_Sec5GLoc_full_model_run1_on_LOSNLOS \
--batch-size 256
# --gpu 0
예측 CSV와 메트릭 JSON 파일은 --output-dir에 저장됩니다.
4. Sec5GLoc 평가(공격 상황):
test_attack_noise_drop_anchor.py를 사용하여 견고성을 평가합니다.
# Example: Spoofing attack
python test_attack_noise_drop_anchor.py \
--checkpoint ./sec5gloc_checkpoints/Sec5GLoc_full_model_run1/model_best.pth.tar \
--test-set score2 \
--data-dir ./ \
--output-dir ./sec5gloc_attack_results/results_Sec5GLoc_full_model_run1_spoofing \
--spoofing-attack
# --guiding-attention-checkpoint <path_if_main_model_is_no_attention>
# Example: Noise attack
python test_attack_noise_drop_anchor.py \
--checkpoint ./sec5gloc_checkpoints/Sec5GLoc_full_model_run1/model_best.pth.tar \
--test-set score2 \
--data-dir ./ \
--output-dir ./sec5gloc_attack_results/results_Sec5GLoc_full_model_run1_noise_s0.3 \
--noise-attack \
--noise-sigma 0.2