Update README.md
Browse files
README.md
CHANGED
@@ -1,80 +1,131 @@
|
|
1 |
-
|
|
|
|
|
|
|
|
|
|
|
2 |
|
3 |
```markdown
|
4 |
-
# Video Manipulation Detection
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
5 |
|
6 |
-
|
7 |
|
8 |
-
|
9 |
-
- **Metadata Extraction**: Extracts and displays metadata from uploaded videos.
|
10 |
-
- **Frame Extraction**: Extracts frames from videos at specified intervals for analysis.
|
11 |
-
- **Object Detection**: Analyzes each frame to detect objects using the DETR model.
|
12 |
-
- **Optical Flow Calculation**: Computes motion patterns to detect inconsistencies.
|
13 |
-
- **Report Generation**: Compiles visual and motion analysis results into a comprehensive JSON report.
|
14 |
-
- **Manipulation Detection**: Uses the report to assess the likelihood of video manipulation.
|
15 |
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
- **Transformers**: Pre-trained DETR model for object detection.
|
21 |
-
- **FFmpeg**: Tool for extracting metadata from videos and processing video files.
|
22 |
|
23 |
-
##
|
24 |
|
25 |
-
1. Clone the
|
26 |
```bash
|
27 |
-
git clone https://github.com/
|
28 |
cd video-manipulation-detection
|
29 |
```
|
30 |
|
31 |
-
2.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
32 |
```bash
|
33 |
pip install -r requirements.txt
|
34 |
```
|
35 |
|
36 |
-
|
|
|
37 |
```bash
|
38 |
streamlit run app.py
|
39 |
```
|
|
|
40 |
|
41 |
-
|
|
|
|
|
|
|
42 |
|
43 |
-
|
44 |
-
2. **Start Analysis**: Click the **"Analyze Video"** button to start processing.
|
45 |
-
3. **View Results**: After analysis, the app will display a score and details about the potential manipulation of the video.
|
46 |
|
47 |
-
|
48 |
-
|
49 |
-
-
|
50 |
-
-
|
51 |
-
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
52 |
|
53 |
## License
|
|
|
54 |
This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.
|
55 |
|
56 |
## Acknowledgments
|
57 |
-
|
58 |
-
-
|
59 |
-
-
|
60 |
-
-
|
61 |
-
- [FFmpeg](https://ffmpeg.org/)
|
62 |
-
- This project is built as part of a research and development effort to analyze and detect video manipulations.
|
63 |
-
|
64 |
-
## Contact
|
65 |
-
- **Ayush Agarwal**
|
66 |
-
AIML Enthusiast, VIT Bhopal University
|
67 |
-
π§ [[email protected]](mailto:[email protected])
|
68 |
-
π [LinkedIn](https://www.linkedin.com/in/ayush20039939)
|
69 |
-
π [GitHub](https://github.com/your-github)
|
70 |
```
|
71 |
|
72 |
-
### Key
|
73 |
-
1. **Project Overview**: Describes the purpose and features of the app.
|
74 |
-
2. **Technologies Used**: Lists the libraries and tools used in the project.
|
75 |
-
3. **Installation**: Step-by-step guide on how to clone, install dependencies, and run the app.
|
76 |
-
4. **How to Use**: Instructions on how users can interact with the app.
|
77 |
-
5. **Report Details**: Describes the information generated in the analysis report.
|
78 |
-
6. **License & Acknowledgments**: Includes the MIT License and credits to the libraries and tools used.
|
79 |
|
80 |
-
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
---
|
2 |
+
license: gpl-3.0
|
3 |
+
title: VIDEO MANIPULATION DETECTION
|
4 |
+
sdk: streamlit
|
5 |
+
---
|
6 |
+
For deploying your project on **Streamlit** in a Space, here's the adjusted **README.md** with relevant details:
|
7 |
|
8 |
```markdown
|
9 |
+
# Video Manipulation Detection - Streamlit App
|
10 |
+
|
11 |
+
## Overview
|
12 |
+
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.
|
13 |
+
|
14 |
+
## Configuration
|
15 |
+
|
16 |
+
```yaml
|
17 |
+
title: Video Manipulation Detection
|
18 |
+
emoji: π₯
|
19 |
+
colorFrom: blue
|
20 |
+
colorTo: green
|
21 |
+
sdk: streamlit
|
22 |
+
python_version: 3.10
|
23 |
+
sdk_version: 1.10.0
|
24 |
+
suggested_hardware: "t4-medium"
|
25 |
+
suggested_storage: "medium"
|
26 |
+
app_file: app.py
|
27 |
+
app_port: 8501
|
28 |
+
base_path: /
|
29 |
+
fullWidth: true
|
30 |
+
header: default
|
31 |
+
short_description: Detect deepfakes and video manipulations using AI-based analysis.
|
32 |
+
models:
|
33 |
+
- facebook/detr-resnet-50
|
34 |
+
tags:
|
35 |
+
- deepfake-detection
|
36 |
+
- video-analysis
|
37 |
+
- AI
|
38 |
+
thumbnail: https://example.com/thumbnail.png
|
39 |
+
pinned: true
|
40 |
+
hf_oauth: false
|
41 |
+
hf_oauth_scopes: []
|
42 |
+
hf_oauth_expiration_minutes: 480
|
43 |
+
hf_oauth_authorized_org: []
|
44 |
+
disable_embedding: false
|
45 |
+
startup_duration_timeout: 30m
|
46 |
+
custom_headers: {}
|
47 |
+
preload_from_hub:
|
48 |
+
- facebook/detr-resnet-50
|
49 |
+
```
|
50 |
|
51 |
+
## Description
|
52 |
|
53 |
+
This Streamlit app allows users to upload a video, which is then analyzed for potential manipulation. It uses the following key features:
|
|
|
|
|
|
|
|
|
|
|
|
|
54 |
|
55 |
+
1. **Frame Extraction**: Captures frames from the video at defined intervals.
|
56 |
+
2. **Object Detection**: Uses the **DETR model** (a transformer-based object detection model) to detect objects in each frame.
|
57 |
+
3. **Optical Flow Calculation**: Computes motion patterns between consecutive frames to detect any abnormal motion (indicative of manipulation).
|
58 |
+
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.
|
|
|
|
|
59 |
|
60 |
+
## Steps to Deploy
|
61 |
|
62 |
+
1. **Clone the Repository**:
|
63 |
```bash
|
64 |
+
git clone https://github.com/yourusername/video-manipulation-detection.git
|
65 |
cd video-manipulation-detection
|
66 |
```
|
67 |
|
68 |
+
2. **Create a Virtual Environment**:
|
69 |
+
Create a virtual environment (optional but recommended):
|
70 |
+
```bash
|
71 |
+
python3 -m venv venv
|
72 |
+
```
|
73 |
+
Activate the virtual environment:
|
74 |
+
- On Windows: `venv\Scripts\activate`
|
75 |
+
- On Mac/Linux: `source venv/bin/activate`
|
76 |
+
|
77 |
+
3. **Install Dependencies**:
|
78 |
+
Install the required dependencies:
|
79 |
```bash
|
80 |
pip install -r requirements.txt
|
81 |
```
|
82 |
|
83 |
+
4. **Run the Streamlit App**:
|
84 |
+
To run the app locally:
|
85 |
```bash
|
86 |
streamlit run app.py
|
87 |
```
|
88 |
+
This will start the app on `http://localhost:8501`.
|
89 |
|
90 |
+
5. **Deployment on Streamlit Space**:
|
91 |
+
- Push the repository to **Hugging Face Spaces** under your account.
|
92 |
+
- Ensure the **`app.py`** file is located at the root of the repository.
|
93 |
+
- The app will automatically run in the cloud on Streamlit.
|
94 |
|
95 |
+
## Requirements
|
|
|
|
|
96 |
|
97 |
+
- Python 3.10
|
98 |
+
- Streamlit
|
99 |
+
- OpenCV
|
100 |
+
- PyTorch
|
101 |
+
- Hugging Face Transformers
|
102 |
+
- PIL (Python Imaging Library)
|
103 |
+
- tqdm
|
104 |
+
|
105 |
+
## Usage
|
106 |
+
|
107 |
+
1. Upload a video file (e.g., `.mp4`, `.mov`).
|
108 |
+
2. The app will process the video and display:
|
109 |
+
- The **manipulation score** based on the likelihood of manipulation.
|
110 |
+
- **Frame-based analysis** and **optical flow** insights.
|
111 |
+
3. View the final result on the app interface, indicating whether the video is likely manipulated.
|
112 |
|
113 |
## License
|
114 |
+
|
115 |
This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.
|
116 |
|
117 |
## Acknowledgments
|
118 |
+
|
119 |
+
- **DETR** (facebook/detr-resnet-50) model from Hugging Face for object detection.
|
120 |
+
- OpenCV for frame extraction and optical flow calculations.
|
121 |
+
- Streamlit for creating the interactive web interface.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
122 |
```
|
123 |
|
124 |
+
### Key Changes for Streamlit Space Deployment:
|
|
|
|
|
|
|
|
|
|
|
|
|
125 |
|
126 |
+
1. **`sdk: streamlit`**: Specifies that this is a Streamlit-based application.
|
127 |
+
2. **`app_file: app.py`**: Indicates the main file for the app (`app.py`).
|
128 |
+
3. **Deployment Steps**: Instructions on how to deploy the app on Streamlit, including how to clone the repository and install dependencies.
|
129 |
+
4. **Hugging Face Specific Configuration**: The configuration YAML ensures the app is correctly set up when deploying to **Hugging Face Spaces**.
|
130 |
+
|
131 |
+
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.
|