File size: 4,400 Bytes
edfaf91 3e11430 edfaf91 3e11430 edfaf91 3e11430 edfaf91 3e11430 edfaf91 3e11430 edfaf91 3e11430 edfaf91 3e11430 edfaf91 3e11430 edfaf91 3e11430 edfaf91 3e11430 edfaf91 3e11430 edfaf91 3e11430 edfaf91 3e11430 edfaf91 3e11430 edfaf91 3e11430 edfaf91 3e11430 edfaf91 3e11430 edfaf91 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 |
---
license: gpl-3.0
title: VIDEO MANIPULATION DETECTION
sdk: streamlit
---
For deploying your project on **Streamlit** in a Space, here's the adjusted **README.md** with relevant details:
```markdown
# Video Manipulation Detection - Streamlit App
## Overview
This project is an AI-powered tool designed to detect video manipulations like deepfakes using object detection and optical flow analysis. It provides a web interface where users can upload videos, and the tool analyzes the video for potential manipulations, giving a score to indicate the likelihood of manipulation.
## Configuration
```yaml
title: Video Manipulation Detection
emoji: 🎥
colorFrom: blue
colorTo: green
sdk: streamlit
python_version: 3.10
sdk_version: 1.10.0
suggested_hardware: "t4-medium"
suggested_storage: "medium"
app_file: app.py
app_port: 8501
base_path: /
fullWidth: true
header: default
short_description: Detect deepfakes and video manipulations using AI-based analysis.
models:
- facebook/detr-resnet-50
tags:
- deepfake-detection
- video-analysis
- AI
thumbnail: https://example.com/thumbnail.png
pinned: true
hf_oauth: false
hf_oauth_scopes: []
hf_oauth_expiration_minutes: 480
hf_oauth_authorized_org: []
disable_embedding: false
startup_duration_timeout: 30m
custom_headers: {}
preload_from_hub:
- facebook/detr-resnet-50
```
## Description
This Streamlit app allows users to upload a video, which is then analyzed for potential manipulation. It uses the following key features:
1. **Frame Extraction**: Captures frames from the video at defined intervals.
2. **Object Detection**: Uses the **DETR model** (a transformer-based object detection model) to detect objects in each frame.
3. **Optical Flow Calculation**: Computes motion patterns between consecutive frames to detect any abnormal motion (indicative of manipulation).
4. **Manipulation Score**: Based on the results of object detection and motion analysis, the app generates a manipulation score to indicate the likelihood of tampering.
## Steps to Deploy
1. **Clone the Repository**:
```bash
git clone https://github.com/yourusername/video-manipulation-detection.git
cd video-manipulation-detection
```
2. **Create a Virtual Environment**:
Create a virtual environment (optional but recommended):
```bash
python3 -m venv venv
```
Activate the virtual environment:
- On Windows: `venv\Scripts\activate`
- On Mac/Linux: `source venv/bin/activate`
3. **Install Dependencies**:
Install the required dependencies:
```bash
pip install -r requirements.txt
```
4. **Run the Streamlit App**:
To run the app locally:
```bash
streamlit run app.py
```
This will start the app on `http://localhost:8501`.
5. **Deployment on Streamlit Space**:
- Push the repository to **Hugging Face Spaces** under your account.
- Ensure the **`app.py`** file is located at the root of the repository.
- The app will automatically run in the cloud on Streamlit.
## Requirements
- Python 3.10
- Streamlit
- OpenCV
- PyTorch
- Hugging Face Transformers
- PIL (Python Imaging Library)
- tqdm
## Usage
1. Upload a video file (e.g., `.mp4`, `.mov`).
2. The app will process the video and display:
- The **manipulation score** based on the likelihood of manipulation.
- **Frame-based analysis** and **optical flow** insights.
3. View the final result on the app interface, indicating whether the video is likely manipulated.
## License
This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.
## Acknowledgments
- **DETR** (facebook/detr-resnet-50) model from Hugging Face for object detection.
- OpenCV for frame extraction and optical flow calculations.
- Streamlit for creating the interactive web interface.
```
### Key Changes for Streamlit Space Deployment:
1. **`sdk: streamlit`**: Specifies that this is a Streamlit-based application.
2. **`app_file: app.py`**: Indicates the main file for the app (`app.py`).
3. **Deployment Steps**: Instructions on how to deploy the app on Streamlit, including how to clone the repository and install dependencies.
4. **Hugging Face Specific Configuration**: The configuration YAML ensures the app is correctly set up when deploying to **Hugging Face Spaces**.
Once this is set up, you'll be able to push your project to **Hugging Face Spaces**, where it will run as a **Streamlit** app. |