Giter Site home page Giter Site logo

lostminty / compx527_bag Goto Github PK

View Code? Open in Web Editor NEW
2.0 2.0 0.0 4.07 MB

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

License: MIT License

Python 63.74% Shell 3.89% PHP 29.77% CSS 1.40% Dockerfile 1.20%
machine-learning cctv-monitoring pytorch lightning

compx527_bag's Introduction

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

compx527_bag's People

Contributors

lostminty avatar ravss avatar huangmason avatar axelgao avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar

compx527_bag's Issues

Unknown labels

Some, mostly in one category, mp4s in the designated dataset are not referenced in the labels CSVs.

Is this because they don't have any noted activity?
should we include these as our baseline?

No validation step

The lightning module has no validation step. There is a dataloader passed to the trainer but it will not get used in the process.

  • find out what the validation step does and decide if its useful
  • find example implementations (might have seen some implementations that are part of pytorch/lightning)

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.