This repository contains code to extract **video features using the x3d_m model, given a folder of input videos.
⚠️ This code is intended for research purposes .
It can be used in the context of the following paper:
Weakly-supervised Video Anomaly Detection with Robust Temporal Feature Magnitude Learning
This code processes each video in a folder and saves a corresponding NumPy file containing its extracted features.
- Input: A folder of videos or subfolders of videos
- Output:
.npyfeature file for each video - Feature shape:
(n/16, x, 2048)wherenis the number of frames
This project is based on the following repositories:
✅ The backbone has been replaced with
x3d_min this version.
Install dependencies:
pip install -r requirements.txt--datasetpath: folder of input videos (contains videos or subdirectories of videos) --outputpath: folder of extracted features --frequency: how many frames between adjacent snippet --batch_size: batch size for snippets
python main.py --datasetpath=dataset_path/ --outputpath=outputput the video in a folder and add the path to that folder in the datasetpath