Skip to content

Aparnamol-KS/VidSafe

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

34 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

VidSafe: AI-Based Video Content Moderation

Python PyTorch Streamlit FAISS Model Model Model Model

VidSafe is an AI-based video moderation system that analyzes both visual and audio content to detect harmful elements such as violence and offensive speech. It processes video frames to identify violent regions and analyzes audio to detect toxic language. Based on these detections, the system selectively moderates only the unsafe parts of the video by blurring harmful visuals and censoring inappropriate audio, while keeping the rest of the content unchanged. In addition, the system generates a structured moderation report using predefined policies, providing details such as detected violations, timestamps, and recommended actions for better transparency and decision-making.


🎯 Key Features

  • Performs multimodal analysis by processing both video and audio content.
  • Detects violent content at the region level within video frames.
  • Identifies and censors toxic or offensive speech from audio.
  • Applies selective moderation by modifying only unsafe parts instead of removing the entire video.
  • Generates policy-based moderation reports with detected violations and timestamps.

πŸ”„ System Workflow

The VidSafe system follows a structured pipeline to analyze and moderate video content:

  1. Input Processing
    The input video is received and prepared for analysis by separating it into visual frames and audio.

  2. Frame Extraction & Audio Separation
    Video frames are extracted at regular intervals, and the audio stream is isolated for independent processing.

  3. Semantic Filtering
    Relevant frames are selected using CLIP based on similarity to predefined prompts, reducing unnecessary computation.

  4. Violence Detection (Visual Analysis)
    Selected frames are processed using RT-DETR to detect regions containing violent content.

  5. Temporal Consistency Filtering
    Detections are refined by ensuring they persist across consecutive frames, improving stability.

  6. Audio Transcription & Analysis
    The audio is converted to text using speech recognition, and the text is analyzed to detect toxic or offensive language.

  7. Multimodal Alignment
    Visual and audio detections are aligned using timestamps to ensure accurate mapping of events.

  8. Selective Moderation
    Detected harmful regions are blurred, and toxic audio segments are censored while preserving the rest of the video.

  9. Policy-Based Reasoning & Report Generation
    Detected violations are evaluated using predefined policies, and a structured moderation report is generated with timestamps and recommended actions.


πŸ—οΈ System Overview

proposed The system processes input video through visual and audio analysis modules. The extracted information is fused and evaluated using policy-based reasoning to generate a moderated video and a structured report.

βš™οΈ Tech Stack

AI / Machine Learning

  • RT-DETR – region-level violence detection
  • CLIP – semantic frame filtering
  • Faster-Whisper – speech-to-text transcription
  • Detoxify – sentence-level toxicity detection
  • RoBERTa – word-level toxicity analysis
  • LLaMA 3 (via Groq API) – moderation report generation

Frameworks & Libraries

  • PyTorch
  • OpenCV
  • Hugging Face Transformers

UI

  • Streamlit – interactive user interface

Tools & Utilities

  • FFmpeg – audio extraction and processing
  • FAISS – vector database for policy retrieval

Environment

  • Python 3.8+
  • Google Colab / VS Code

πŸ“‚ Dataset & Training

A custom dataset was created for this project due to the lack of publicly available datasets for region-level violence detection in animated content.

  • Total frames: 8,401
  • Violent: 3,819
  • Non-violent: 4,582
  • Annotated using CVAT

πŸ”— Dataset: Anime Violence Detection Dataset

The RT-DETR model was trained on this dataset to perform region-level violence detection. The model learns to identify and localize harmful visual content within video frames, enabling precise moderation.

The trained model is then integrated into the VidSafe pipeline for detecting and moderating unsafe video segments.


πŸ“Š Results

The performance of the trained RT-DETR model was evaluated on the custom annotated dataset.

πŸ”Ή Region-Level Detection

Metric Value
Precision 0.690
Recall 0.559
mAP@50 0.622

πŸ”Ή Frame-Level Performance

Metric Value
Accuracy 80.5%
Precision 0.732
Recall 0.918
F1 Score 0.815

🎬 Sample Output

πŸ”΄ Before Moderation

Before

Original video frame containing violent visual content.


🟒 After Moderation

After

Detected violent regions are blurred, and harmful content is selectively moderated while preserving the rest of the video.


πŸ“Œ Moderation Report (Optional)

Report

A structured report generated using policy-based reasoning, showing detected violations, timestamps, and recommended actions.


βš™οΈ Setup

1. Clone the Repository

git clone https://github.com/Aparnamol-KS/VidSafe.git
cd vidsafe

2. Install Dependencies

pip install -r requirements.txt

3. Run the Application

streamlit run app.py

πŸš€ Future Scope

  • Extend the system for real-time video moderation
  • Introduce age-based or user-specific content filtering
  • Expand detection to additional categories (e.g., explicit or sensitive content)
  • Improve multimodal fusion for handling complex scenarios
  • Optimize the system for deployment on large-scale platforms

πŸ‘₯ Team

  • Alicia Therese Dominic – GitHub
  • Aparnamol K S – GitHub
  • Hazel Nilson – GitHub

Developed as part of a B.Tech AI & DS project.

About

AI-based video moderation system that detects violence and toxic speech using multimodal analysis and applies selective content filtering with policy-based reporting.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages