Skip to main content

(Unofficial) PyTorch library data efficient video transformer for video understanding and action recognatio

Project description

PWC

Data-efficient-video-transformer

this repo is for menovideo associated with the paper 'Data Efficient Video Transformer for Violence Detection' (DeVTR)

one of big challenges facing researchers in computer vision with transformers especially in video tasks is the need for large data and high computational resources , our method called DeVTR (Data Efficient Video Transformer for Violence Detection) to overcame these challenges (he need for large data and high computational resources )

In this work, we propose a data-efficient video transformer (DeVTr) based on the transformer network as a Spatio-temporal learning method with a pre-trained 2d-Convolutional neural network (2d-CNN) as an embedding layer for the input data. The model has been trained and tested on the Real-life violence dataset (RLVS) and achieved an accuracy of 96.25%. A comparison of the result for the suggested method with previous techniques illustrated that the suggested method provides the best result among all the other studies for violence event detection.

Results and benchmarking

the model achieved 96.25% based on RLVS dataset and also worth to mention that it was better than TimeSformer in both memory efficiency and convergence speed and accuracy

Comparing results of DeVTr vs other methods based on RLVS Dataset

saliency map for random video of violence action

menvideo package

the menovideo package help you build video action recognation / video understanding model based on
1- build using our Novel model DeVTR with full costmaztion 2- video dataset reader and preprocessing to easly read videos and make them as pytorch ready dataloaders 3- Timedistributed warper similar to keras timedistributed warper which can help you easly build (classical CNN+LSTM )

this is new novel transformer network combined with Conv net to build a highly accuract video action recognation model with limited data and hw rescources

simple usage

install

pip install menovideo
 

import it

import menovideo.menovideo as menoformer
import menovideo.videopre as vide_reader 

init DeVTr model without pre-trained wights

model = menoformer.DeVTr()


init DeVTr with pre-trained wigths the trained wights can be downloaded from this url

wight = 'drive/MyDrive/Colab Notebooks/transformers/violance-detaction-myresearch/vg19bn40convtransformer-ep-0.pth'
model2 = menoformer.DeVTr(w= wight , base ='default')

using the video reader and pre-processing helpers parameters is :

  1. pandas dataframe contain the path and label of each video
  2. number of frames for the singal video
  3. RGB is the number of color channles
  4. h is the hieght of the frame for each video
  5. w is the width of the frame for each video
valid_dataset = vide_reader.TaskDataset(valid_df,timesep=time_stp,rgb=RGB,h=H,w=W)

for detlied example of using the labrary use package_test.ipynb

please use pytorch 1.9 for the pre-trained model

To cite our paper/code:


@INPROCEEDINGS{9530829,  author={Abdali, Almamon Rasool},  booktitle={2021 IEEE International Conference on Communication, Networks and Satellite (COMNETSAT)},   title={Data Efficient Video Transformer for Violence Detection},   year={2021},  volume={},  number={},  pages={195-199},  doi={10.1109/COMNETSAT53002.2021.9530829}}

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

menovideo-0.5.1.tar.gz (6.8 kB view details)

Uploaded Source

Built Distribution

menovideo-0.5.1-py3-none-any.whl (7.3 kB view details)

Uploaded Python 3

File details

Details for the file menovideo-0.5.1.tar.gz.

File metadata

  • Download URL: menovideo-0.5.1.tar.gz
  • Upload date:
  • Size: 6.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.2 importlib_metadata/1.1.0 pkginfo/1.7.1 requests/2.23.0 requests-toolbelt/0.9.1 tqdm/4.56.0 CPython/3.7.5

File hashes

Hashes for menovideo-0.5.1.tar.gz
Algorithm Hash digest
SHA256 472c9f01b488e946b98fd51658825bc8993227436a2844180528b14c9bbda6e5
MD5 740810ce382f5bcf206dc6848b5b865d
BLAKE2b-256 48e4b3c64e90870dc29f5730c114a164261a129e3df6d003425503abd97f2fd0

See more details on using hashes here.

File details

Details for the file menovideo-0.5.1-py3-none-any.whl.

File metadata

  • Download URL: menovideo-0.5.1-py3-none-any.whl
  • Upload date:
  • Size: 7.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.2 importlib_metadata/1.1.0 pkginfo/1.7.1 requests/2.23.0 requests-toolbelt/0.9.1 tqdm/4.56.0 CPython/3.7.5

File hashes

Hashes for menovideo-0.5.1-py3-none-any.whl
Algorithm Hash digest
SHA256 6ee9713db3b59bb65b3ab59c957303a518d41b850764a669b8317afb6bb1efbc
MD5 3a976ec06466cd08ab50d9c1a42510d5
BLAKE2b-256 f03ffdac16b44e3db8a32c39469388ca0825ef597fd81b5f84466966b6ae997a

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page