Home

Awesome

DeepSim: GPS Spoofing Detection Artifact

This repo is the source code for DeepSIM: GPS Spoofing Detection on UAVs using Satellite Imagery Matching.

Abstract

In this artifact, we will provide the source codes of our implementations as well as the corresponding dataset (approx.~12.08 Gigabyte with 967 aerial photos and paired satellite images), which are used in Section 8 of our accepted paper. The dataset consists of training set and test set which can be used to train a new model from scratch and evaluate a trained model, respectively. We also provide trained models that were used in our evaluation procedure. The training and testing of our models require a CUDA-enabled GPU in Linux OS, and the software is implemented using Python. To run our on-board model, i.e. SqueezeNet v1.1, on the IoT platform, a Raspberry Pi is needed, where 3B+ with CPU $\ge$ 1.4GHz and memory $\ge$ 1GB is recommended. Our software also depends on Pytorch, Numpy, and some other Python libraries for it to run.

Objective

Run our deep learning models, and they will compare the aerial photos with the satellite images, to see whether a drone is attacked by GPS spoofing. An example of a paired aerial photo and its corresponding image is shown as follows.

How to Run

Follow the instructions below, you can reproduce our program easily.

Environment

Anaconda + Python 3.7 or higher, and other software in requirements.txt.

Please create a conda env and install pytorch 1.4 and other software. Refer to run.sh for an example. Download the dataset we provided and put them under the source code folder.

Hardware Recommendation

Software and Package

Pytorch, Numpy, cuDNN, CUDA, OpenCV, pandas, h5py, tqdm,matplotlib, seaborn, sklearn, packaging.

Data Directory Organization

The data derectories are available at Google Drive.

DirectoryFunctionality
mid_producth5 files, i.e., features extracted by the backbone neural network, ResNet. With those files you do not need to extract features from the original images, thus can speed up the detection process.
modelsA series of trained models for GPS spoofing detection.
datasetCollected aerial photos and satellite images.
GPS-Spoofing-DetectionSource code for training and test.

Dataset

Here we only provide preprocessed data for easy running and evalution. In general, these photos in our dataset can be devided into categories: aerial photography and satellite imagery. Each has its corresponding counterpart.

NameDescription
England_960x720For generalization ability test-only.
error_toleranceFor error tolerance test.
full_960x720For training and validation.
full_aug_960x720For training and validation with data augmentation technology.

If you want the raw dataset, please send an email to goldgaruda@gmail.com. Please first visit Satellite imagery VS Aerial Photos to download the dataset and necessary files. Then put the data into config.GDRIVE_DIR. For the raw aerial photos from Merlischachen, Renens,Lausanne and Le Bourget Airport, please visit senseFly dataset for more information.

Data Augmentation

We have provided data after augmentation. However, if you want to do it by yourself, For data augmentation source, please visit Here.

The implemented augmentation methods are: grayscaling, blurring, cropping, weather augmentation (e.g. snow, fog, clouds), rotating and adjusting the brightness (e.g. lighter or darker).

An example of cloud and fog effect is shown below:

python augmentation.py

Trained Models

We also provide our trained models for GPS spoofing inferences. With these models, you do not need to train a new one from scratch for detection. You can directly use it to carry out the evaluation.

Besides, you can use the preprocessed data to train a completely new model as you like.

Commands to run

  1. With proper environment setup and dataset downloaded to the source code folder, you can now start to run the training and evaluation procedure.

  2. For training Siamese ResNet, please run: python train.py --model SiameseResNet --data aug --margin 4 --lr 3e-4 --step 10 --nepoch 50 --batch_size 4 For evaluation, please run: python evaluate.py --model SiameseResNet --margin 4 --weight [modelname].pth

  3. Please see more examples and explanations in run.sh.

Code File Organization

FileFunctionality
config.pyConfigurations.
DataLoader.pyBasic data loader functions, mostly used for model 1 in the paper.
Dataset.pyPytorch Dataset Classes.
train.pyTraining code.
evaluate.pyEvaluation code (spoofing detection).
net.pyNeural Network definitions.
preprocess.pyResize rename and generate h5py data file.
utils.pyUtility code.
euclidean_distance.pyModel 1 code.
run.shExamples of commands to run our software.
rpi.mdInstruction for Raspberry Pi.
requirements.txtPython software requirements.
Draw_ROC_loss.ipynbJupyter notebook to draw ROC curves.
GPS_Spoofing_Detection.ipynbModel 1 Jupyter notebook.
Visualize_Model.ipynbJupyter notebook to visualize the models.

Run on Raspberry Pi

If you want to run models on Raspberry Pi, please refer to rpi.md.

Successful running screen shot

An successful training result (1 epoch) is shown below.

Updating information

Please visit here for the newest updating.

Cite our work

Please use the following bibtex code to cite our work:

@InProceedings{nian2020deepsim,
  title={{DeepSIM: GPS Spoofing Detection on UAVs using Satellite Imagery Matching}},
  author={Nian Xue, Liang Niu, Xianbin Hong, Zhen Li, Larissa Hoffaeller, Christina Pöpper},
  booktitle={Proceedings of the Annual Computer Security Applications Conference 
  (ACSAC)},
  year={2020},
  doi={10.1145/3427228.3427254}
}