Home

Awesome

This is an official implementation of CVPR23 paper 'Unbiased Multiple Instance Learning for Weakly Supervised Video Anomaly Detection' (https://arxiv.org/abs/2303.12369v1).

Environment Setup

To set up the environment, you can easily run the following command:

conda create -n UMIL python=3.7
conda activate UMIL
pip install -r requirements.txt

Install Apex as follows

git clone https://github.com/NVIDIA/apex
cd apex
pip install -v --disable-pip-version-check --no-cache-dir --global-option="--cpp_ext" --global-option="--cuda_ext" ./

Data Preparation

Download the videos and labels for UCF-crime or TAD dataset and extract frames from videos. The dataset directory should be origanized as follows:

UCF/
├─ frames/    
    ├─ Abuse/
       ├─ Abuse001_x264.mp4/
           ├─ img_00000000.jpg
    ├─ Arrest/ 
    ...
    
TAD/
├─ frames/    
    ├─ abnormal/
        ├─ 01_Accident_001.mp4/
        ...
    ├─ normal/ 
        ...

TAD extracted frames

Pre-trained model weights

Please find the model weights in the following:

k400 pre-trained weights

Train

The config files lie in configs. For example, to train X-CLIP-B/32 with 5 frames on UCF on 2 GPUs, you can run

CUDA_VISIBLE_DEVICES=0,1 bash tools/dist_train_recognizer.sh 2

Note:

Test

For example, to test the X-CLIP-B/32 with 5 frames on UCF, you can run

CUDA_VISIBLE_DEVICES=1 bash tools/dist_test_recognizer.sh 1

If you find this work helpful, please cite:

@inproceedings{Lv2023unbiased,
title={Unbiased Multiple Instance Learning for Weakly Supervised Video Anomaly Detection},
author={Hui Lv and Zhongqi Yue and Qianru Sun and Bin Luo and Zhen Cui and Hanwang Zhang},
booktitle={CVPR},
year={2023}
}