Spaces:
Runtime error
Runtime error
Update README.md
Browse files
README.md
CHANGED
@@ -1,117 +1,9 @@
|
|
1 |
-
|
2 |
-
|
3 |
-
|
4 |
-
|
5 |
-
|
6 |
-
|
7 |
-
|
8 |
-
|
9 |
-
|
10 |
-
- Identify suspicious behavior in surveillance footage.
|
11 |
-
- Detect stress or duress in interrogation videos.
|
12 |
-
|
13 |
-
### Human Intelligence (HUMINT)
|
14 |
-
- Analyze micro-expressions.
|
15 |
-
- Monitor and assess emotional states in communications.
|
16 |
-
|
17 |
-
## Key Features
|
18 |
-
|
19 |
-
- **Face Extraction**: Extracts faces from video frames using MTCNN model.
|
20 |
-
- **Face Alignment**: Aligns and normalizes faces using MediaPipe for consistent analysis.
|
21 |
-
- **Feature Embeddings**: Extracts facial feature embeddings using the InceptionResnetV1/VGG-Face model.
|
22 |
-
- **Emotion Detection**: Identifies facial expressions and categorizes emotions using the FER model.
|
23 |
-
- **Anomaly Detection**: Uses an LSTM autoencoder to detect anomalies in facial expressions over time.
|
24 |
-
|
25 |
-
<img src="appendix/diagram.svg" width="1050" alt="alt text">
|
26 |
-
|
27 |
-
## Micro-Expressions
|
28 |
-
Paul Ekman’s work on facial expressions of emotion identified universal micro-expressions that reveal true emotions. These fleeting expressions, which last only milliseconds, are incredibly difficult for humans to detect but can be captured and analyzed using computer vision algorithms.
|
29 |
-
|
30 |
-
## InceptionResnetV1
|
31 |
-
The InceptionResnetV1 model is a deep convolutional neural network widely used for facial recognition and facial attributes extraction.
|
32 |
-
|
33 |
-
- **Accuracy and Reliability**: Pre-trained on the VGGFace2 dataset, it achieves high accuracy in recognizing and differentiating between faces.
|
34 |
-
- **Feature Richness**: The embeddings capture rich facial details, essential for recognizing subtle expressions and variations.
|
35 |
-
- **Global Recognition**: Widely adopted in various facial recognition applications, demonstrating reliability and robustness across different scenarios.
|
36 |
-
|
37 |
-
## FER (Facial Expression Recognition)
|
38 |
-
The FER model used in our pipeline is a pre-trained neural network designed to identify emotional states from facial expressions.
|
39 |
-
|
40 |
-
- **Accuracy and Reliability**: Pre-trained on a large dataset of facial images labeled with emotional states, achieving high accuracy in identifying seven basic emotions: Anger, Disgust, Fear, Happiness, Sadness, Surprise, and Neutral.
|
41 |
-
- **Robustness**: Capable of recognizing emotions in varying lighting conditions, facial orientations, and occlusions, making it highly reliable for practical applications.
|
42 |
-
|
43 |
-
## LSTM Autoencoder
|
44 |
-
An LSTM (Long Short-Term Memory) Autoencoder is a neural network designed for sequential data, consisting of an encoder that compresses input sequences into a fixed-length representation and a decoder that reconstructs the sequence from this representation.
|
45 |
-
|
46 |
-
### In Our Facial-Expression Anomaly Detection:
|
47 |
-
- **Input Preparation**: Facial embeddings are extracted from video frames.
|
48 |
-
- **Sequence Creation**: These embeddings form a chronological sequence.
|
49 |
-
- **Training**: The LSTM autoencoder learns typical patterns in these sequences.
|
50 |
-
- **Anomaly Detection**: High reconstruction errors highlight frames with unusual facial expressions, indicating potential anomalies.
|
51 |
-
|
52 |
-
This approach effectively captures temporal dependencies and subtle changes in facial expressions, providing robust anomaly detection.
|
53 |
-
|
54 |
-
### Methods of Anomaly Detection:
|
55 |
-
1. **Using All Features**: Considers feature components and emotion scores as input features.
|
56 |
-
2. **Using Reduced Components**: Uses UMAP to reduce the dimensionality of facial embeddings before inputting them into the LSTM autoencoder.
|
57 |
-
3. **Using Full-Dimensional Embeddings**: Directly uses the raw facial embeddings without dimensionality reduction.
|
58 |
-
|
59 |
-
Each method provides a different perspective on the data, enhancing our capability to detect subtle and varied anomalies in facial expressions.
|
60 |
-
|
61 |
-
|
62 |
-
## Setup Parameters
|
63 |
-
- **DESIRED_FPS**: Frames per second to analyze (lower for faster processing).
|
64 |
-
- **batch_size**: Batch size for processing.
|
65 |
-
|
66 |
-
## Output
|
67 |
-
- **Organized Faces**: Faces organized by detected persons in the `organized_faces` folder.
|
68 |
-
- **Anomalies Detection Results**: Results as a CSV file in the project directory.
|
69 |
-
|
70 |
-
## Face Extraction and Alignment
|
71 |
-
The algorithm extracts faces from the video, aligns, and normalizes them using MediaPipe and MTCNN.
|
72 |
-
|
73 |
-
## Feature Embedding Extraction
|
74 |
-
Utilizes the InceptionResnetV1 model to extract facial features and FER to detect emotions.
|
75 |
-
|
76 |
-
## Clustering and Outlier Detection
|
77 |
-
Clusters faces to organize them by person.
|
78 |
-
|
79 |
-
## LSTM Autoencoder for Anomaly Detection
|
80 |
-
Trains an LSTM autoencoder to identify anomalies in facial expressions over time, helping capture temporal dependencies and irregularities in the sequence of facial expressions and feature embeddings.
|
81 |
-
|
82 |
-
## An Example from a Death Sentence Verdict
|
83 |
-
|
84 |
-
<img src="appendix/wade_wilson_2.jpg" width="250" alt="alt text">
|
85 |
-
|
86 |
-
Wade Wilson, a 30-year-old from Fort Myers, Florida, was convicted in June 2024 for the October 2019 murders of Kristine Melton and Diane Ruiz in Cape Coral. During the trial, Wilson was notably cold and calm. He showed a lack of emotion throughout the proceedings, which many found unsettling. The jury recommended the death penalty, with the final sentencing set for July 23, 2024.
|
87 |
-
|
88 |
-
<p align="left">
|
89 |
-
<img src="appendix/1.jpg" width="50" alt="alt text">
|
90 |
-
<img src="appendix/2.jpg" width="50" alt="alt text">
|
91 |
-
<img src="appendix/3.jpg" width="50" alt="alt text">
|
92 |
-
<img src="appendix/4.jpg" width="50" alt="alt text">
|
93 |
-
<img src="appendix/5.jpg" width="50" alt="alt text">
|
94 |
-
<img src="appendix/6.jpg" width="50" alt="alt text">
|
95 |
-
<p/>
|
96 |
-
|
97 |
-
Sources:
|
98 |
-
1. [Fox News](https://www.foxnews.com/us/florida-double-murderer-viral-smug-soulless-courtroom-demeanor)
|
99 |
-
2. [WINK News](https://winknews.com/2024/06/13/wade-wilsons-lack-emotion-double-murder-trial/)
|
100 |
-
3. [YouTube](https://www.youtube.com/watch?v=8j8psgKXmRg)
|
101 |
-
|
102 |
-
### Detected Anomalies (Facial Features)
|
103 |
-
<p align="left">
|
104 |
-
<img src="appendix/anomaly_scores_all_features_plot.png" width="250" alt="alt text">
|
105 |
-
<img src="appendix/anomaly_scores_components_plot.png" width="250" alt="alt text">
|
106 |
-
<img src="appendix/anomaly_scores_embeddings_plot.png" width="250" alt="alt text">
|
107 |
-
<p/>
|
108 |
-
|
109 |
-
### Detected Anomalies (Emotions)
|
110 |
-
<p align="left">
|
111 |
-
<img src="appendix/angry_scores_plot.png" width="250" alt="alt text">
|
112 |
-
<img src="appendix/fear_scores_plot.png" width="250" alt="alt text">
|
113 |
-
<img src="appendix/sad_scores_plot.png" width="250" alt="alt text">
|
114 |
-
<p/>
|
115 |
-
|
116 |
-
## Conclusion
|
117 |
-
This tool offers robust solutions for detecting emotional anomalies in video-based facial expressions, beneficial for both forensic analysis and HUMINT operations. By leveraging advanced computer vision techniques and the power of LSTM autoencoders, it provides timely and crucial insights into human behavior.
|
|
|
1 |
+
title: Facial Expression and Body Language Anomaly Detection
|
2 |
+
emoji: 🙃
|
3 |
+
colorFrom: yellow
|
4 |
+
colorTo: pink
|
5 |
+
sdk: gradio
|
6 |
+
sdk_version: 4.39.0
|
7 |
+
app_file: app.py
|
8 |
+
pinned: false
|
9 |
+
license: apache-2.0
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|