https://github.com/alfredbrake1126/violencedetection-from-video

https://github.com/alfredbrake1126/violencedetection-from-video

Science Score: 13.0%

This score indicates how likely this project is to be science-related based on various indicators:

  • CITATION.cff file
  • codemeta.json file
    Found codemeta.json file
  • .zenodo.json file
  • DOI references
  • Academic publication links
  • Academic email domains
  • Institutional organization owner
  • JOSS paper metadata
  • Scientific vocabulary similarity
    Low similarity (10.7%) to scientific vocabulary
Last synced: 10 months ago · JSON representation

Repository

Basic Info
  • Host: GitHub
  • Owner: alfredbrake1126
  • Language: Jupyter Notebook
  • Default Branch: main
  • Size: 38.8 MB
Statistics
  • Stars: 0
  • Watchers: 1
  • Forks: 0
  • Open Issues: 0
  • Releases: 0
Created about 2 years ago · Last pushed about 2 years ago
Metadata Files
Readme

README.md

Table of Contents

Introduction

How to Run

Resutls

Further Work

Introduction

This repo presents code for Deep Learning based algorithm for detecting violence in indoor or outdoor environments. The algorithm can detect following scenarios with high accuracy: fight, fire, car crash and even more.

To detect other scenarios you have to add descriptive text label of a scenario in settings.yaml file under labels key. At this moment model can detect 16+1 scenarios, where one is default Unknown label. You can change, add or remove labels according to your use case. The model is trained on wide variety of data. The task for the model at training was to predict similar vectors for image and text that describes well a scene on the image. Thus model can generalize well on other scenarios too if you provide proper textual information about a scene of interest.

How to Run

First install requirements: pip install -r requirements.txt

To test the model you can either run: python run.py --image-path ./data/7.jpg

Or you can test it through web app: streamlit run app.py

Or you can see the example code in tutorial.ipynb jupyter notebook

Or incorporate this model in your project using this code:

```python from model import Model import cv2

model = Model() image = cv2.imread('./yourimage.jpg') image = cv2.cvtColor(image, cv2.COLORBGR2RGB) label = model.predict(image=image)['label'] print('Image label is: ', label) ```

Results

Below are the resulting videos and images. I used the model to make predictions on each frame of the videos and print model's predictions on the left side of frame of saved videos. In case of images, titles are model's predictions. You can find code that produces that result in tutorial.ipynb jupyter notebook.

Result video

Result video

Result Images

Result image Result image Result image Result image Result image Result image Result image

Owner

  • Login: alfredbrake1126
  • Kind: user

GitHub Events

Total
Last Year

Dependencies

requirements.txt pypi
  • Pillow ==8.3.2
  • clip-by-openai *
  • jupyter *
  • matplotlib ==3.4.2
  • numpy ==1.20.3
  • opencv-python ==4.5.3.56
  • pyaml *
  • pyheif ==0.5.1
  • requests ==2.26.0
  • streamlit ==0.89.0
  • torch ==1.7.1
  • whatimage ==0.0.3