Liang Niu
    • Create new note
    • Create a note from template
      • Sharing URL Link copied
      • /edit
      • View mode
        • Edit mode
        • View mode
        • Book mode
        • Slide mode
        Edit mode View mode Book mode Slide mode
      • Customize slides
      • Note Permission
      • Read
        • Only me
        • Signed-in users
        • Everyone
        Only me Signed-in users Everyone
      • Write
        • Only me
        • Signed-in users
        • Everyone
        Only me Signed-in users Everyone
      • Engagement control Commenting, Suggest edit, Emoji Reply
      • Invitee
    • Publish Note

      Share your work with the world Congratulations! 🎉 Your note is out in the world Publish Note

      Your note will be visible on your profile and discoverable by anyone.
      Your note is now live.
      This note is visible on your profile and discoverable online.
      Everyone on the web can find and read all notes of this public team.
      See published notes
      Unpublish note
      Please check the box to agree to the Community Guidelines.
      View profile
    • Commenting
      Permission
      Disabled Forbidden Owners Signed-in users Everyone
    • Enable
    • Permission
      • Forbidden
      • Owners
      • Signed-in users
      • Everyone
    • Suggest edit
      Permission
      Disabled Forbidden Owners Signed-in users Everyone
    • Enable
    • Permission
      • Forbidden
      • Owners
      • Signed-in users
    • Emoji Reply
    • Enable
    • Versions and GitHub Sync
    • Note settings
    • Engagement control
    • Transfer ownership
    • Delete this note
    • Save as template
    • Insert from template
    • Import from
      • Dropbox
      • Google Drive
      • Gist
      • Clipboard
    • Export to
      • Dropbox
      • Google Drive
      • Gist
    • Download
      • Markdown
      • HTML
      • Raw HTML
Menu Note settings Sharing URL Create Help
Create Create new note Create a note from template
Menu
Options
Versions and GitHub Sync Engagement control Transfer ownership Delete this note
Import from
Dropbox Google Drive Gist Clipboard
Export to
Dropbox Google Drive Gist
Download
Markdown HTML Raw HTML
Back
Sharing URL Link copied
/edit
View mode
  • Edit mode
  • View mode
  • Book mode
  • Slide mode
Edit mode View mode Book mode Slide mode
Customize slides
Note Permission
Read
Only me
  • Only me
  • Signed-in users
  • Everyone
Only me Signed-in users Everyone
Write
Only me
  • Only me
  • Signed-in users
  • Everyone
Only me Signed-in users Everyone
Engagement control Commenting, Suggest edit, Emoji Reply
Invitee
Publish Note

Share your work with the world Congratulations! 🎉 Your note is out in the world Publish Note

Your note will be visible on your profile and discoverable by anyone.
Your note is now live.
This note is visible on your profile and discoverable online.
Everyone on the web can find and read all notes of this public team.
See published notes
Unpublish note
Please check the box to agree to the Community Guidelines.
View profile
Engagement control
Commenting
Permission
Disabled Forbidden Owners Signed-in users Everyone
Enable
Permission
  • Forbidden
  • Owners
  • Signed-in users
  • Everyone
Suggest edit
Permission
Disabled Forbidden Owners Signed-in users Everyone
Enable
Permission
  • Forbidden
  • Owners
  • Signed-in users
Emoji Reply
Enable
Import from Dropbox Google Drive Gist Clipboard
   owned this note    owned this note      
Published Linked with GitHub
Subscribed
  • Any changes
    Be notified of any changes
  • Mention me
    Be notified of mention me
  • Unsubscribe
Subscribe
# 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. - [DeepSim: GPS Spoofing Detection](#deepsim:-gps-spoofing-detection) - [How to Run](#How-to-Run) - [Environment](#Environment) - [Hardware Recommendation](#Hardware-Recommendation) - [Software and Package](#Software-and-Package) - [Data Directory Organization](#Data-Directory-Organization) - [Dataset](#Dataset) - [Data Augmentation](#Data-Augmentation) - [Trained Models](#Trained-Models) - [Commands to run](#Commands-to-run) - [Code File Organization](#Code-File-Organization) - [Run on Raspberry Pi](#run-on-raspberry-pi) - [Updating information](#Updating-information) ## 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. ![](https://i.imgur.com/9c5PGDD.jpg) ## 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 * On-ground If you want to train a model from scratch, a GPU with at least 16G video memory is recommended. We trained our models on an NVIDIA Tesla V100. Batch size is set to 2 if video memory is 16G and 4 if 32G. Training new models on Cloud platform like [Google Colab](https://colab.research.google.com) is an option for your reference. * On-board Raspberry Pi is needed, where 3B+ with CPU ≥ 1.4GHz and memory ≥ 1GB is recommended. ### Software and Package Pytorch, Numpy, cuDNN, CUDA, OpenCV, pandas, h5py, tqdm,matplotlib, seaborn, sklearn, packaging. ## Data Directory Organization The data directories are available at [Google Drive](https://drive.google.com/drive/u/1/folders/1F0mMpq_C5RTKCVQiktFoZgUZLvRRpf2o). | Directory | Functionality | | ----------- | ------------------------------------------------------------ | | mid_product | h5 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. | | models | A series of trained models for GPS spoofing detection. | | dataset | Collected aerial photos and satellite images. | |GPS-Spoofing-Detection |Source 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. | Name | Description | | ---------------- | ------------------------------------------------------------ | | England_960x720 | For generalization ability test-only. | | error_tolerance | For error tolerance test. | | full_960x720 | For training and validation. | full_aug_960x720 |For 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](https://drive.google.com/drive/u/1/folders/1LKBjDpgqeuE7mjVdFYO9vbHBwPHjlzgG) 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](https://www.sensefly.com/education/datasets/) 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](https://github.com/Lariiii/DeepSimDataAugmentation.git). 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: ![](https://i.imgur.com/BjsfPtz.jpg) * generate the newly preprocessed images by running the augmentation.py file with the desired amount of generated image pairs and adapted filepaths * if you want to generate preprocessed images for all available images, then run the augmentation.py file for every available method and the amount of all available pairs ``` 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 | File | Functionality | | ---------------- | ------------------------------------------------------------ | | config.py | Configurations. | | DataLoader.py | Basic data loader functions, mostly used for model 1 in the paper. | | Dataset.py | Pytorch Dataset Classes. | | train.py | Training code. | | evaluate.py | Evaluation code (spoofing detection). | | net.py | Neural Network definitions. | | preprocess.py | Resize rename and generate h5py data file. | | utils.py | Utility code. | | euclidean_distance.py | Model 1 code. | | run.sh | Examples of commands to run our software. | | rpi.md | Instruction for Raspberry Pi. | | requirements.txt | Python software requirements. | | Draw_ROC_loss.ipynb | Jupyter notebook to draw ROC curves. | | GPS_Spoofing_Detection.ipynb | Model 1 Jupyter notebook. | | Visualize_Model.ipynb | Jupyter 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 A successful training result (1 epoch) is shown below. ![](https://i.imgur.com/VljSa0S.png) ## Updating information Please visit [here](https://hackmd.io/2GvHLw2wQSSMqwEzMDFx4A) for the newest updating.

Import from clipboard

Paste your markdown or webpage here...

Advanced permission required

Your current role can only read. Ask the system administrator to acquire write and comment permission.

This team is disabled

Sorry, this team is disabled. You can't edit this note.

This note is locked

Sorry, only owner can edit this note.

Reach the limit

Sorry, you've reached the max length this note can be.
Please reduce the content or divide it to more notes, thank you!

Import from Gist

Import from Snippet

or

Export to Snippet

Are you sure?

Do you really want to delete this note?
All users will lose their connection.

Create a note from template

Create a note from template

Oops...
This template has been removed or transferred.
Upgrade
All
  • All
  • Team
No template.

Create a template

Upgrade

Delete template

Do you really want to delete this template?
Turn this template into a regular note and keep its content, versions, and comments.

This page need refresh

You have an incompatible client version.
Refresh to update.
New version available!
See releases notes here
Refresh to enjoy new features.
Your user state has changed.
Refresh to load new user state.

Sign in

Forgot password

or

By clicking below, you agree to our terms of service.

Sign in via Facebook Sign in via Twitter Sign in via GitHub Sign in via Dropbox Sign in with Wallet
Wallet ( )
Connect another wallet

New to HackMD? Sign up

Help

  • English
  • 中文
  • Français
  • Deutsch
  • 日本語
  • Español
  • Català
  • Ελληνικά
  • Português
  • italiano
  • Türkçe
  • Русский
  • Nederlands
  • hrvatski jezik
  • język polski
  • Українська
  • हिन्दी
  • svenska
  • Esperanto
  • dansk

Documents

Help & Tutorial

How to use Book mode

Slide Example

API Docs

Edit in VSCode

Install browser extension

Contacts

Feedback

Discord

Send us email

Resources

Releases

Pricing

Blog

Policy

Terms

Privacy

Cheatsheet

Syntax Example Reference
# Header Header 基本排版
- Unordered List
  • Unordered List
1. Ordered List
  1. Ordered List
- [ ] Todo List
  • Todo List
> Blockquote
Blockquote
**Bold font** Bold font
*Italics font* Italics font
~~Strikethrough~~ Strikethrough
19^th^ 19th
H~2~O H2O
++Inserted text++ Inserted text
==Marked text== Marked text
[link text](https:// "title") Link
![image alt](https:// "title") Image
`Code` Code 在筆記中貼入程式碼
```javascript
var i = 0;
```
var i = 0;
:smile: :smile: Emoji list
{%youtube youtube_id %} Externals
$L^aT_eX$ LaTeX
:::info
This is a alert area.
:::

This is a alert area.

Versions and GitHub Sync
Get Full History Access

  • Edit version name
  • Delete

revision author avatar     named on  

More Less

Note content is identical to the latest version.
Compare
    Choose a version
    No search result
    Version not found
Sign in to link this note to GitHub
Learn more
This note is not linked with GitHub
 

Feedback

Submission failed, please try again

Thanks for your support.

On a scale of 0-10, how likely is it that you would recommend HackMD to your friends, family or business associates?

Please give us some advice and help us improve HackMD.

 

Thanks for your feedback

Remove version name

Do you want to remove this version name and description?

Transfer ownership

Transfer to
    Warning: is a public team. If you transfer note to this team, everyone on the web can find and read this note.

      Link with GitHub

      Please authorize HackMD on GitHub
      • Please sign in to GitHub and install the HackMD app on your GitHub repo.
      • HackMD links with GitHub through a GitHub App. You can choose which repo to install our App.
      Learn more  Sign in to GitHub

      Push the note to GitHub Push to GitHub Pull a file from GitHub

        Authorize again
       

      Choose which file to push to

      Select repo
      Refresh Authorize more repos
      Select branch
      Select file
      Select branch
      Choose version(s) to push
      • Save a new version and push
      • Choose from existing versions
      Include title and tags
      Available push count

      Pull from GitHub

       
      File from GitHub
      File from HackMD

      GitHub Link Settings

      File linked

      Linked by
      File path
      Last synced branch
      Available push count

      Danger Zone

      Unlink
      You will no longer receive notification when GitHub file changes after unlink.

      Syncing

      Push failed

      Push successfully