Giter Site home page Giter Site logo

violenceclassificationcv's Introduction

Computer Vision Violence Classification

Description

Computer Vision classification for violence using a VGG16 Architecture with pictures and videos.

Features

  • VGG16 Architecture: Three Convolution2D layers with a FC dense layer as the output
  • Libraries: TensorFlow Keras and Sklearn for the model. CV2 and OS for data preprocessing.
  • Image Prediction: Predicts violence for multiple images. Graphs their predictions with the original images using MatPlotLib.
  • Video Prediction: Predicts violence for each frame of a video.
  • Video Blurring: Capable of blurring violence detected frames of videos then writing the altered version to a new .mp4v

Model's Accuracy & Loss

model validation

Image Prediction Example

image predictions

Video Violence Blurring Example (click image)

Violence Blurring

Installation and Running the Script

To install and run the model on your Windows machine, follow these steps:

  1. Clone the Repository: Download the codebase to your local machine.
    https://github.com/EthanStanks/ViolenceClassificationCV.git
  2. Install Dependencies: Ensure you have Python installed, then use pip to install the required libraries.
    pip install -r requirements.txt
  3. Download Dataset: Download the dataset from Kaggle then place the images inside:.
    data/train_images/
  4. Train Model: Set TRAIN_MODEL boolean to True. Navigate to the src directory and execute the main.py script.
    python main.py
  5. Predict Images Add images you'd like to predict inside data/validate_images/. Set PREDICT_IMAGES boolean to True. Add image paths to list on line 95. Execute the main.py script.
    PREDICT_IMAGES = True
  6. Predict Videos Add the video you'd like to predict inside data/video_input/. Set PREDICT_VIDEO boolean to True. Add the file name to the function call on line 88. Execute the main.py script.
    PREDICT_VIDEO = True
  7. Blur Videos Follow step 6. Ensure True is passed as second parameter on line 88. Execute the main.py script.
    PREDICT_VIDEO = True

Credits

Data for this project is sourced from Kaggle's "Violence vs. Non-Violence: 11K Images Dataset" dataset, available here.


Note: This project is currently tailored for Windows operating systems.

violenceclassificationcv's People

Contributors

ethanstanks avatar

Watchers

Kostas Georgiou avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.