Skip to content

COMPX527-21B A2:AWS CC App Service to detect suspicious behaviour on submitted CCTV footage

License

Notifications You must be signed in to change notification settings

lostminty/COMPX527_BAG

Repository files navigation

COMPX527_BAG (Behaviour Anomaly Group)

COMPX527-21B A2:AWS CC App Service to detect suspicious behaviour on submitted CCTV footage

Sample generation

Samples can be saved to file using predictor_src/create_json_sample.py

this takes 2-3 arguments

  • location of dcsass dataset
  • output file name
  • optional 3rd parameter of the index of the sample to output

This script was used to generate the json string used in the demonstration of calling the API

Training on

Note:

for downloading the Dataset, the zip comes with a duplicate of the dataset.

Based on:

most of what is in the my_prog.py is from the README.md

Some dependencies

Been running it in an anaconda env https://www.anaconda.com/products/individual

after installing, reload command prompt/bash (windows has a shortcut installed in the start menu for anaconda)

in my_prog.py are two vars:

  • SEED = 1
  • NUM_WORKERS = 8 (set to your number of CPU cores)

if you have multiple GPUs, edit the following line param gpus=x

line to edit

trainer = pl.Trainer(gpus=1)

Setup Instructions

  1. Install nvidia cuda toolkit from link above

conda env create --file ./envs/video.yml
python my_prog.py /path/to/dcsass/videos/

Use - Generic

from predictor_src/scr.py

import predict
with open ("output.txt", "r") as myfile:
    data=myfile.readlines()

predict.predictor(data,"./example.ckpt")

Notes

Transforms

  • VideoToTensor(frames_in_tensor=10,fps=2)
  • Grayscale
  • Resize(128,128)

Label Encoder

  • Not well implemented: creates a sklearn labelencoder within the dataset class init then uses a helper method to create numpy arrays
  • Labels in my_prog.py available as a global var list which the predict.py uses to relabel identify it's output predictions

Encoder

  • Linear(in=video.xvideo.yframes_in_tensor,out=64)
  • ReLU
  • Linear(out=64, num_of_classes)

Decoder

  • Linear(in=num_of_classes,out=64)
  • ReLU
  • Linear(in=64,out=video.xvideo.yframes_in_tensor)

Early Stop Callback

  • generic callback, uses log_acc var. currently running tests
  • Note: Doesn't produce a stable model

Forward Step

  • Unpacks tuple. taking the frame representation only, ignoring any category
  • Passes through the encoder and returns residual

TODO

  • Optimizer description
  • validation step & epoch_end desc

About

COMPX527-21B A2:AWS CC App Service to detect suspicious behaviour on submitted CCTV footage

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 4

  •  
  •  
  •  
  •