Code Monkey home page Code Monkey logo

optical-fiber-based-intrusion-detection's Introduction

Optical Fiber based Physical Intrusion Detection System

Table of content



Basic Overview

Using Optical fiber data received from OTDR machine then using that data in Machine learning model to detect intrusion and its location so basically, optical fiber is laid on the ground around 5 cm deep or on wall or fence when someone tries to enter then due to movement of intruder vibration is created which disturb the optical fiber signal and get reflected on OTDR data. From analyzing the data, model find intrusion location and gives alert of intrusion.


  • Workflow Diagram :
    • Data is collected from OTDR
    • Data preprocessed and fed to model
    • Making Model and training and Prediction
    • Result of model


Installation requirement and Dependencies and libraries


Python   Keras   scipy   pandas   numpy   matplotlib  


Data Preprocessing

  • Data is generated with a mathematical model of OTDR and Intrusion is introduced at the random location using sinusoidal noise.
  • For test 4000 meter cable length is taken which divide into 97 zones each of 41 meters approx. for better data extraction and detection.
  • Difference of Amplitude is used as the main parameter for feeding in model and detection.


  • All data are generated in Matlab then it is converted to CSV for working in python.
## Code for converting .mat to csv
data = scipy.io.loadmat('D:\design lab\case1_10.mat')

## data is dictionary with keys : __header__ , __version__, __globals__, array

Amp_data=data["array"][0][0]["Amp"][0].reshape(-1)
DifferenceAmp_data=data["array"][0][0]["DifferenceAmp"][0]
Phase_data=data["array"][0][0]["Phase"][0]
DiffPhase_data=data["array"][0][0]["DiffPhase"][0]
  • Data Visualization of single trace .


Model and its Architecture

  • Data traces are then passed through a Deep Learning Model which is an Autoencoder and the model is trained.
  • After training the Model, the constructional loss is studied and used as a parameter.
  • then from trained autoencoder model we generate mean signal bypassing traces after that the means signal is used as dynamic average and using constructional loss standard deviation to create an envelope around average signal which shows the normal range in which a data should lies if its crosses then there is some intrusion
  • Autoencoder remove anomaly present in the signal while encoding and after decoding the traces,the output trace acts as the mean signal


## Auto encoder model using CNN
model = Sequential()
model.add(Conv1D(90, kernel_size=1,input_shape=(1,97)))
model.add(LeakyReLU())
model.add(MaxPooling1D(pool_size=1))
model.add(Conv1D(45, kernel_size=1))
model.add(LeakyReLU())
model.add(MaxPooling1D(pool_size=1))
model.add(Conv1D(25, kernel_size=1))
model.add(LeakyReLU())
model.add(MaxPooling1D(pool_size=1))
model.add(Conv1D(45, kernel_size=1))
model.add(LeakyReLU())
model.add(MaxPooling1D(pool_size=1))

model.add(Conv1D(90, kernel_size=1))
model.add(LeakyReLU())
model.add(Flatten())
model.add(Dense(97,activation="sigmoid"))

model.summary()

## Model summary

Model: "sequential"
_________________________________________________________________
Layer (type)                 Output Shape              Param #   
=================================================================
conv1d (Conv1D)              (None, 1, 90)             8820      
_________________________________________________________________
leaky_re_lu (LeakyReLU)      (None, 1, 90)             0         
_________________________________________________________________
max_pooling1d (MaxPooling1D) (None, 1, 90)             0         
_________________________________________________________________
conv1d_1 (Conv1D)            (None, 1, 45)             4095      
_________________________________________________________________
leaky_re_lu_1 (LeakyReLU)    (None, 1, 45)             0         
_________________________________________________________________
max_pooling1d_1 (MaxPooling1 (None, 1, 45)             0         
_________________________________________________________________
conv1d_2 (Conv1D)            (None, 1, 25)             1150      
_________________________________________________________________
leaky_re_lu_2 (LeakyReLU)    (None, 1, 25)             0         
_________________________________________________________________
max_pooling1d_2 (MaxPooling1 (None, 1, 25)             0         
_________________________________________________________________
conv1d_3 (Conv1D)            (None, 1, 45)             1170      
_________________________________________________________________
leaky_re_lu_3 (LeakyReLU)    (None, 1, 45)             0         
_________________________________________________________________
max_pooling1d_3 (MaxPooling1 (None, 1, 45)             0         
_________________________________________________________________
conv1d_4 (Conv1D)            (None, 1, 90)             4140      
_________________________________________________________________
leaky_re_lu_4 (LeakyReLU)    (None, 1, 90)             0         
_________________________________________________________________
flatten (Flatten)            (None, 90)                0         
_________________________________________________________________
dense (Dense)                (None, 97)                8827      
=================================================================
Total params: 28,202
Trainable params: 28,202
Non-trainable params: 0

Prediction and Result's

  • From the data an enevelop is created around dynamic mean signal and from that we detected at which point there is intrusion.
#  creating threshold envelop around the Mean signal/output signal
# standard deviation of conructional loss   
upper_thresh=pred_mean_signal+2.3*standard_deviation

lower_thresh=pred_mean_signal-2.3*standard_deviation
  • Below is the grpahical demostarion of detection procces by model


Model Accuracy : 96.35%

Model Resolution : 41 meters

Resolution means the minimum length in which intrusion can be detected


References

Future Works

  • Improving the Resolution of system and model
  • Filtering out the different type of Intrusion in class as follow :
    • Threatening Intrusion
    • Non-threatening Intrusion


Contributions welcome

optical-fiber-based-intrusion-detection's People

Contributors

shubham-0704 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.