An FTP server that logs anomalous motion from a camera stream.
When working with basic FTP webcam streams, it's easy to end up with disk-fulls of image data. A basic solution is to delete old footage automatically, but this can end up deleting important events. Another idea is to analyze the change between every image and only save them if enough pixels changed indicating motion. While this works sometimes, in situations where the camera is positioned in front of trees or towards clouds the system will often end up with a plethora of false positives. This project aims to fix this by using machine learning to determine what is anomalous motion. It does this by creating a delta image (dI = |old-new|) and classifying it as either noise or an anomaly. This way only key frames stay while pictures that only show leaves moving are discarded.
git clone https://github.com/sshh12/Webcam-Anomaly-Detection.git
pip install -r requirements.txt
(For Keras, Tensorflow or Theano is required)
- Find a camera that supports FTP logging
- Create a username and password then add it to the
config.py
- Set
TRAIN = True
inconfig.py
- Point the camera to the IP (and port 21) of your computer
- Run
main.py
, this will populate the training folder with a constant stream of images and delta images (dimages) - Once a bunch (>1000) of images have been collected, drag the dimages (*.d.jpg) into either the anomaly or noise folder
- Run
generate_anomaly_model.py
to generate a model to predict future dimages (this will take a while) - Set
TRAIN = False
inconfig.py
and optionally delete the contents of the training folder
- Run
main.py
- Check the images folder to see if images are being saved
- Close the window or press Ctrl-C to stop the server