astaileyyoung commited on
Commit
85371ed
·
verified ·
1 Parent(s): 3ac4e3a

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +151 -3
README.md CHANGED
@@ -1,3 +1,151 @@
1
- ---
2
- license: mit
3
- ---
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ language:
3
+ - en
4
+ license: cc-by-4.0
5
+ size_categories:
6
+ - 1M<n<10M
7
+ task_categories:
8
+ - object-detection
9
+ - feature-extraction
10
+ tags:
11
+ - movies
12
+ - tv-series
13
+ - facial-recognition
14
+ - computer-vision
15
+ - embeddings
16
+ - face-detection
17
+ - imdb
18
+ pretty_name: CineFace Database
19
+ dataset_info:
20
+ features:
21
+ - name: "Unnamed: 0"
22
+ dtype: int32
23
+ description: "Row index from export"
24
+ - name: frame_num
25
+ dtype: int32
26
+ description: "The frame number in the video file"
27
+ - name: face_num
28
+ dtype: int32
29
+ description: "The index of the face within that specific frame"
30
+ - name: x1
31
+ dtype: float32
32
+ description: "Top-left X coordinate of the bounding box"
33
+ - name: y1
34
+ dtype: float32
35
+ description: "Top-left Y coordinate of the bounding box"
36
+ - name: x2
37
+ dtype: float32
38
+ description: "Bottom-right X coordinate of the bounding box"
39
+ - name: y2
40
+ dtype: float32
41
+ description: "Bottom-right Y coordinate of the bounding box"
42
+ - name: confidence
43
+ dtype: float32
44
+ description: "Face detection confidence score"
45
+ - name: predicted_name
46
+ dtype: string
47
+ description: "The real-world name of the actor/person"
48
+ - name: predicted_character
49
+ dtype: string
50
+ description: "The name of the character played in the film/series"
51
+ - name: predicted_tmdb_id
52
+ dtype: string
53
+ description: "The TMDb identifier for the actor"
54
+ - name: predicted_confidence
55
+ dtype: float32
56
+ description: "Recognition/Matching confidence score"
57
+ ---
58
+
59
+ # CineFace
60
+
61
+ **CineFace** is a comprehensive ecosystem for facial analysis in entertainment media. It consists of:
62
+ 1. **The CineFace Dataset:** A massive collection of detections and embeddings from over 6,000 movies and TV series.
63
+ 2. **The CineFace Toolkit:** Pipeline for large-scale facial detection, encoding, and identification in TV and Film.
64
+
65
+ [**📊 View Dashboard**](https://app.powerbi.com/view?r=eyJrIjoiMWE4YzViOWMtY2RiYy00ZTk1LWExNTgtMTg5YjZjNTE2NjIzIiwidCI6ImI3Yzk1YTkyLTBlYWQtNDRlOS04YjgzLTdjMGY5NmNiMDUyMSIsImMiOjF9) | [**🤗 Hugging Face Dataset**](https://huggingface.co/datasets/astaileyyoung/CineFaceDB)
66
+
67
+
68
+ ## Dataset
69
+ The CineFace database contains metadata and facial detections for over 6,000 titles. You can download the components directly from Hugging Face:
70
+
71
+ * **Film List:** [`film_list.csv`](https://huggingface.co/datasets/astaileyyoung/CineFaceDB/blob/main/film_list.csv) — Comprehensive list of all movies and series in the DB.
72
+ * **Detections:** [`faces.tar.gz`](https://huggingface.co/datasets/astaileyyoung/CineFaceDB/blob/main/faces.tar.gz) — Bounding boxes and identifications.
73
+ * **Encodings:** [`embeddings.tar.gz`](https://huggingface.co/datasets/astaileyyoung/CineFaceDB/blob/main/embeddings.tar.gz) — Pre-computed face embeddings.
74
+ * **Relational DB:** [`CineFaceDW.db`](https://huggingface.co/datasets/astaileyyoung/CineFaceDB/blob/main/CineFaceDW.db) — SQLite version of the dataset.
75
+
76
+ ### Using the Encodings
77
+ The encodings are saved as `.npz` files. Since the encoded faces are stored in sequence, you can join them to the detection metadata by loading the corresponding CSV and adding the array as a column:
78
+
79
+ ```python
80
+ import numpy as np
81
+ import pandas as pd
82
+
83
+ # Load metadata and embeddings
84
+ df = pd.read_csv("movie_12345.csv")
85
+ embeddings = np.load("movie_12345.npz")['embeddings']
86
+
87
+ # Join (sequence based)
88
+ df['encoding'] = list(embeddings)
89
+ ```
90
+
91
+ ## Toolkit (Installation and Usage)
92
+ ### Requirements
93
+ CineFace relies on [Docker](https://docs.docker.com/get-started/get-docker/) and [Qdrant](https://qdrant.tech/). To install Qdrant, just run with Docker. It will download the image automatically
94
+ ```
95
+ docker run -p 6333:6333 qdrant/qdrant
96
+ ```
97
+
98
+ ### Install
99
+ Simply download the source code
100
+ ```
101
+ git clone https://github.com/astaileyyoung/CineFace.git
102
+ ```
103
+
104
+ Then install the required dependencies
105
+ ```
106
+ pip install -r requirements.txt
107
+ ```
108
+
109
+ Finally, install CineFace
110
+ ```
111
+ pip install -e .
112
+ ```
113
+
114
+ CineFace uses Visage as a backend for accurate, high-performance facial detection and encoding. [Visage](https://github.com/astaileyyoung/Visage) can also be used independently.
115
+
116
+ **Be advised that the associated docker image is quite large (~17GB) since it relies on heavy ML libraries built from source, so it will take a while to download (~10-15 minutes).
117
+
118
+
119
+ ### Usage
120
+ Running CineFace is straightforward.
121
+
122
+ #### **Basic Command**
123
+ ```
124
+ cineface <src> <dst> [options]
125
+ ```
126
+ - `<src>`: Path to the input video file
127
+ - `<dst>`: Path to the output file
128
+ #### **Command-Line Arguments**
129
+
130
+ | Argument | Type | Default | Description |
131
+ |-------------------------|----------|----------------------------|-----------------------------------------------------|
132
+ | `src` | str | (required) | Path to input video file or directory. |
133
+ | `dst` | str | (required) | Path to output directory or results file. |
134
+ | `imdb_id` | int | (required) | IMDb ID (just the numbers). |
135
+ | `--faces_dir` | str | `None` | Directory to save face images to |
136
+ | `--encoding_col` | str | `'embedding'` | Column name for face embeddings. |
137
+ | `--image` | str | `'astaileyyoung/visage'` | Container/image name (for debugging/development). |
138
+ | `--frameskip` | int | `24` | Number of frames to skip between detections. |
139
+ | `--threshold`, `-t` | float | `0.5` | Recognition confidence threshold. |
140
+ | `--timeout` | int | `60` | Timeout (in seconds) for matching. |
141
+ | `--batch_size` | int | `256` | Batch size for matching. |
142
+ | `--season` | int | `None` | Season number (required for matching tv show). |
143
+ | `--episode` | int | `None` | Episode number (requird for matching tv show). |
144
+ | `--qdrant_client` | str | `'localhost'` | Qdrant client address (vector DB). |
145
+ | `--qdrant_port` | int | `6333` | Qdrant port. |
146
+
147
+ **Automatic tv/movie identification by filename is no longer working due to change in the IMDb API that has broken Cinemagoer search, which automatic identification depends on. If analyzing a movie, you must enter the imdb_id. If analyzing a TV show, you must enter the imdb_id, season, and episode.
148
+
149
+
150
+ ## Research and Analysis
151
+ Notebooks analyzing the dataset can be found in CineFace/notebooks/research. Feel free to submit a ticket if you encounter bugs or have feature requests for the dashboard.