Real-world Anomaly Detection in Surveillance Videos- pytorch Re-implementation

Overview

Real world Anomaly Detection in Surveillance Videos : Pytorch RE-Implementation

This repository is a re-implementation of "Real-world Anomaly Detection in Surveillance Videos" with pytorch. As a result of our re-implementation, we achieved a much higher AUC than the original implementation.

Datasets

Download following data link and unzip under your $DATA_ROOT_DIR. /workspace/DATA/UCF-Crime/all_rgbs

  • Directory tree
   DATA/
       UCF-Crime/ 
           ../all_rgbs
               ../~.npy
           ../all_flows
               ../~.npy
       train_anomaly.txt
       train_normal.txt
       test_anomaly.txt
       test_normal.txt
       

train-test script

python main.py

Reslut

METHOD DATASET AUC
Original paper(C3D two stream) UCF-Crimes 75.41
RTFM (I3D RGB) UCF-Crimes 84.03
Ours Re-implementation (I3D two stream) UCF-Crimes 84.45

Acknowledgment

This code is heavily borrowed from Learning to Adapt to Unseen Abnormal Activities under Weak Supervision and AnomalyDetectionCVPR2018.

Comments
  • Need help regarding testing the model with my own Videos!

    Need help regarding testing the model with my own Videos!

    Could you please guide me in understanding how to TEST my own videos using this model. I'm new. I am unable to interpret how the data is labelled in the Test_Anomalyv2.txt file. I want to add my own videos in it to test but I have no idea how to. Any kind of help would be highly appreciated!

    test_anomalyv2.txt

    opened by Zain-Gill123 7
  • Different evaluation strategy

    Different evaluation strategy

    Is your evaluation strategy the same as the official?

    I notice you average the AUCs of 140 testing abnormal videos. If I didn't remember wrong, the official calculated the whole videos at the same time.

    opened by LiUzHiAn 6
  • error regarding vis.py

    error regarding vis.py

    Hai @seominseok0429

    I tried to run code its works fine but i have an error on vis.py

    Traceback (most recent call last):
      File "vis.py", line 10, in <module>
        from models.model import generate_model
    ModuleNotFoundError: No module named 'models'
    

    Thanks

    opened by sumis2140 4
  • Evaluation Strategy Is Incorrect

    Evaluation Strategy Is Incorrect

    You cannot calculate the AUC score in this way, as it leads to a higher overall AUC in the end.

    Since you increment the AUC for every new addition of a video pair, the early increments are closer to 1 than 0, which inflates the final AUC. If anyone wishes to test this, use a small subset of the dataset and you will see very high AUC scores.

    opened by pmcb99 3
  • How to extract the features of my video in I3D?

    How to extract the features of my video in I3D?

    Thank you very much for your work. In order to get the same effect as you.I want to know how to process and train the original video data to get the segment features you share. Can you share the code?

    opened by zzxzzt333 3
  • Duplicate items exist in train_normal.txt

    Duplicate items exist in train_normal.txt

    The last 10 lines in train_normal.txt is duplicate, as below:

    Normal_Videos_event/Normal_Videos016_x264.mp4 Normal_Videos_event/Normal_Videos017_x264.mp4 Normal_Videos_event/Normal_Videos020_x264.mp4 Normal_Videos_event/Normal_Videos825_x264.mp4 Normal_Videos_event/Normal_Videos826_x264.mp4 Normal_Videos_event/Normal_Videos827_x264.mp4 Normal_Videos_event/Normal_Videos856_x264.mp4 Normal_Videos_event/Normal_Videos857_x264.mp4 Normal_Videos_event/Normal_Videos858_x264.mp4 Normal_Videos_event/Normal_Videos859_x264.mp4

    opened by 137xiaoyu 1
  • Query Related to Number of Epoch and Loss

    Query Related to Number of Epoch and Loss

    Hello! I am new to python and NN. I wanted to know for how many EPOCH should I train this model? Also, is there any limit to how low the LOSS can be? And should one stop training if the LOSS is not reducing? Any other information a newbie should have regarding the LOSS VALUE and the EPOCH?

    Any type of comments would be highly appreciated! Cheers!

    -Zain

    opened by Zain-Gill123 1
  • Run code via cpu or withour nvidia driver

    Run code via cpu or withour nvidia driver

    Hello

    def MIL(y_pred, batch_size, is_transformer=0):
        loss = torch.tensor(0.).cpu()
        loss_intra = torch.tensor(0.).cpu()
        sparsity = torch.tensor(0.).cpu()
        smooth = torch.tensor(0.).cpu()
        if is_transformer==0:
            y_pred = y_pred.view(batch_size, -1)
        else:
            y_pred = torch.sigmoid(y_pred)
    
        for i in range(batch_size):
            anomaly_index = torch.randperm(30).cpu()
            normal_index = torch.randperm(30).cpu()
    

    Just change cuda to cpu it's working without Nvidia driver

    Thank you

    opened by Chuttyboy 0
  • ckpt.pth

    ckpt.pth

    I'm sorry can you explain me how you generated ckpt.pth in the VIS directory? It's different from the one you can generate using the main with default settings

    opened by marcocapp 0
  • Lossing models

    Lossing models

    Thanks for your great work! You have submit the full code by the https://drive.google.com/file/d/1xYsBiCSmXjE0BwoiH_Bcm4AWaA1pESHF/view.However,when I run the vis.py, it's wrongModuleNotFoundError: No module named 'models.model'I think the model directory doesn't appear the model and can not impot generater.So,would you please help me? thx so much

    opened by zimengxueying 7
  • HOW TO  SOLVE THIS ERROR

    HOW TO SOLVE THIS ERROR

    Hai @seominseok0429

    I am currently working on your code and it's amazing. The training part is working properly and visualize part I am facing an error while running vis.py

    i got this error

    if I am correct this error occurred due to image size. how to resolve this issue

    PIL.UnidentifiedImageError: cannot identify image file '/NGC-DL-CONTAINER-LICENSE'

    thanks

    opened by suki1504 0
  • Evaluation Problems

    Evaluation Problems

    Hi, thanks for your amazing work!

    I have been trying to plot the ROC curve for the performance evaluation, but I am confused about how the auc is calculated in the test.py. Could you kindly explain your method? For example, what does the number 140 mean in the equation auc/140 in the python file test.py?

    `score_list3 = np.concatenate((score_list, score_list2), axis=0) gt_list3 = np.concatenate((gt_list, gt_list2), axis=0)

    fpr, tpr, thresholds = metrics.roc_curve(gt_list3, score_list3, pos_label=1) auc += metrics.auc(fpr, tpr)

    print('auc = ', auc/140)`

    Additionally, would it be possible to explain some of your idea for how to show the ROC curve?

    opened by Peggy118 1
Owner
seominseok
seominseok
Official PyTorch code for WACV 2022 paper "CFLOW-AD: Real-Time Unsupervised Anomaly Detection with Localization via Conditional Normalizing Flows"

CFLOW-AD: Real-Time Unsupervised Anomaly Detection with Localization via Conditional Normalizing Flows WACV 2022 preprint:https://arxiv.org/abs/2107.1

Denis 156 Dec 28, 2022
Source codes of CenterTrack++ in 2021 ICME Workshop on Big Surveillance Data Processing and Analysis

MOT Tracked object bounding box association (CenterTrack++) New association method based on CenterTrack. Two new branches (Tracked Size and IOU) are a

null 36 Oct 4, 2022
Make a surveillance camera from your raspberry pi!

rpi-surveillance Make a surveillance camera from your Raspberry Pi 4! The surveillance is built as following: the camera records 10 seconds video and

Vladyslav 62 Feb 3, 2022
Demo project for real time anomaly detection using kafka and python

kafkaml-anomaly-detection Project for real time anomaly detection using kafka and python It's assumed that zookeeper and kafka are running in the loca

Rodrigo Arenas 36 Dec 12, 2022
Real-ESRGAN: Training Real-World Blind Super-Resolution with Pure Synthetic Data

Real-ESRGAN Real-ESRGAN: Training Real-World Blind Super-Resolution with Pure Synthetic Data Ported from https://github.com/xinntao/Real-ESRGAN Depend

Holy Wu 44 Dec 27, 2022
A PyTorch implementation of "ANEMONE: Graph Anomaly Detection with Multi-Scale Contrastive Learning", CIKM-21

ANEMONE A PyTorch implementation of "ANEMONE: Graph Anomaly Detection with Multi-Scale Contrastive Learning", CIKM-21 Dependencies python==3.6.1 dgl==

Graph Analysis & Deep Learning Laboratory, GRAND 30 Dec 14, 2022
(JMLR'19) A Python Toolbox for Scalable Outlier Detection (Anomaly Detection)

Python Outlier Detection (PyOD) Deployment & Documentation & Stats Build Status & Coverage & Maintainability & License PyOD is a comprehensive and sca

Yue Zhao 6.6k Jan 3, 2023
Streaming Anomaly Detection Framework in Python (Outlier Detection for Streaming Data)

Python Streaming Anomaly Detection (PySAD) PySAD is an open-source python framework for anomaly detection on streaming multivariate data. Documentatio

Selim Firat Yilmaz 181 Dec 18, 2022
A Python Library for Graph Outlier Detection (Anomaly Detection)

PyGOD is a Python library for graph outlier detection (anomaly detection). This exciting yet challenging field has many key applications, e.g., detect

PyGOD Team 757 Jan 4, 2023
A Pytorch implement of paper "Anomaly detection in dynamic graphs via transformer" (TADDY).

TADDY: Anomaly detection in dynamic graphs via transformer This repo covers an reference implementation for the paper "Anomaly detection in dynamic gr

Yue Tan 21 Nov 24, 2022
This is an unofficial implementation of the paper “Student-Teacher Feature Pyramid Matching for Unsupervised Anomaly Detection”.

This is an unofficial implementation of the paper “Student-Teacher Feature Pyramid Matching for Unsupervised Anomaly Detection”.

haifeng xia 32 Oct 26, 2022
Unofficial implementation of PatchCore anomaly detection

PatchCore anomaly detection Unofficial implementation of PatchCore(new SOTA) anomaly detection model Original Paper : Towards Total Recall in Industri

Changwoo Ha 268 Dec 22, 2022
Official Implementation for the "An Empirical Investigation of 3D Anomaly Detection and Segmentation" paper.

An Empirical Investigation of 3D Anomaly Detection and Segmentation Project | Paper Official PyTorch Implementation for the "An Empirical Investigatio

Eliahu Horwitz 55 Dec 14, 2022
PyTorch reimplementation of the Smooth ReLU activation function proposed in the paper "Real World Large Scale Recommendation Systems Reproducibility and Smooth Activations" [arXiv 2022].

Smooth ReLU in PyTorch Unofficial PyTorch reimplementation of the Smooth ReLU (SmeLU) activation function proposed in the paper Real World Large Scale

Christoph Reich 10 Jan 2, 2023
Official implementation of the paper 'Efficient and Degradation-Adaptive Network for Real-World Image Super-Resolution'

DASR Paper Efficient and Degradation-Adaptive Network for Real-World Image Super-Resolution Jie Liang, Hui Zeng, and Lei Zhang. In arxiv preprint. Abs

null 81 Dec 28, 2022
Paper list of log-based anomaly detection

Paper list of log-based anomaly detection

Weibin Meng 411 Dec 5, 2022
MemStream: Memory-Based Anomaly Detection in Multi-Aspect Streams with Concept Drift

MemStream Implementation of MemStream: Memory-Based Anomaly Detection in Multi-Aspect Streams with Concept Drift . Siddharth Bhatia, Arjit Jain, Shivi

Stream-AD 61 Dec 2, 2022
USAD - UnSupervised Anomaly Detection on multivariate time series

USAD - UnSupervised Anomaly Detection on multivariate time series Scripts and utility programs for implementing the USAD architecture. Implementation

null 116 Jan 4, 2023
LogDeep is an open source deeplearning-based log analysis toolkit for automated anomaly detection.

LogDeep is an open source deeplearning-based log analysis toolkit for automated anomaly detection.

donglee 279 Dec 13, 2022