Add Biwi Kinect Head Pose dataset. (#3903)
Browse files* Initial draft for Biwi Kinect Head Pose dataset.
* fix typo.
* update dataset features and complete generate_examples.
* add dummy data.
* add dataset_infos.json
* update Dataset Structure section.
* update Readme.
* add data processing section, sample code to read a compressed binary depth image.
* add size category info.
* Update datasets/biwi_kinect_head_pose/biwi_kinect_head_pose.py
Co-authored-by: Quentin Lhoest <42851186+lhoestq@users.noreply.github.com>
* Update datasets/biwi_kinect_head_pose/biwi_kinect_head_pose.py
Use os.path.join for consistency.
Co-authored-by: Quentin Lhoest <42851186+lhoestq@users.noreply.github.com>
* Update datasets/biwi_kinect_head_pose/biwi_kinect_head_pose.py
Use os.path.join
Co-authored-by: Quentin Lhoest <42851186+lhoestq@users.noreply.github.com>
* Update datasets/biwi_kinect_head_pose/biwi_kinect_head_pose.py
Add encoding when we open files.
Co-authored-by: Quentin Lhoest <42851186+lhoestq@users.noreply.github.com>
* Update datasets/biwi_kinect_head_pose/biwi_kinect_head_pose.py
Add encoding when we open files.
Co-authored-by: Quentin Lhoest <42851186+lhoestq@users.noreply.github.com>
* add missing quote.
* collapse C++ code.
* add full name to pretty_name
* new dataset_infos.json file.
* replace tabs with spaces.
* Update datasets/biwi_kinect_head_pose/README.md
Add contributions info.
Co-authored-by: Quentin Lhoest <42851186+lhoestq@users.noreply.github.com>
Co-authored-by: Quentin Lhoest <42851186+lhoestq@users.noreply.github.com>
Commit from https://github.com/huggingface/datasets/commit/55e6b308c6b6ee039b33752a1b464fb9f934f1cd
- README.md +308 -0
- biwi_kinect_head_pose.py +215 -0
- dataset_infos.json +1 -0
- dummy/1.0.0/dummy_data.zip +3 -0
@@ -0,0 +1,308 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
---
|
2 |
+
annotations_creators:
|
3 |
+
- expert-generated
|
4 |
+
language_creators:
|
5 |
+
- expert-generated
|
6 |
+
languages:
|
7 |
+
- en
|
8 |
+
licenses:
|
9 |
+
- other
|
10 |
+
multilinguality:
|
11 |
+
- monolingual
|
12 |
+
pretty_name: Biwi Kinect Head Pose Database
|
13 |
+
size_categories:
|
14 |
+
- 10K<n<100K
|
15 |
+
source_datasets:
|
16 |
+
- original
|
17 |
+
task_categories:
|
18 |
+
- other
|
19 |
+
task_ids:
|
20 |
+
- other-other-head-pose-estimation
|
21 |
+
paperswithcode_id: biwi
|
22 |
+
---
|
23 |
+
|
24 |
+
# Dataset Card for Biwi Kinect Head Pose Database
|
25 |
+
|
26 |
+
## Table of Contents
|
27 |
+
- [Dataset Description](#dataset-description)
|
28 |
+
- [Dataset Summary](#dataset-summary)
|
29 |
+
- [Supported Tasks](#supported-tasks-and-leaderboards)
|
30 |
+
- [Languages](#languages)
|
31 |
+
- [Dataset Structure](#dataset-structure)
|
32 |
+
- [Data Instances](#data-instances)
|
33 |
+
- [Data Fields](#data-instances)
|
34 |
+
- [Data Splits](#data-instances)
|
35 |
+
- [Dataset Creation](#dataset-creation)
|
36 |
+
- [Curation Rationale](#curation-rationale)
|
37 |
+
- [Source Data](#source-data)
|
38 |
+
- [Annotations](#annotations)
|
39 |
+
- [Personal and Sensitive Information](#personal-and-sensitive-information)
|
40 |
+
- [Considerations for Using the Data](#considerations-for-using-the-data)
|
41 |
+
- [Social Impact of Dataset](#social-impact-of-dataset)
|
42 |
+
- [Discussion of Biases](#discussion-of-biases)
|
43 |
+
- [Other Known Limitations](#other-known-limitations)
|
44 |
+
- [Additional Information](#additional-information)
|
45 |
+
- [Dataset Curators](#dataset-curators)
|
46 |
+
- [Licensing Information](#licensing-information)
|
47 |
+
- [Citation Information](#citation-information)
|
48 |
+
|
49 |
+
## Dataset Description
|
50 |
+
|
51 |
+
- **Homepage:** [Biwi Kinect Head Pose homepage](https://icu.ee.ethz.ch/research/datsets.html)
|
52 |
+
- **Repository:** [Needs More Information]
|
53 |
+
- **Paper:** [Biwi Kinect Head Pose paper](https://link.springer.com/article/10.1007/s11263-012-0549-0)
|
54 |
+
- **Leaderboard:** [Needs More Information]
|
55 |
+
- **Point of Contact:** [Gabriele Fanelli](mailto:gabriele.fanelli@gmail.com)
|
56 |
+
|
57 |
+
### Dataset Summary
|
58 |
+
|
59 |
+
The Biwi Kinect Head Pose Database is acquired with the Microsoft Kinect sensor, a structured IR light device.It contains 15K images of 20 people with 6 females and 14 males where 4 people were recorded twice.
|
60 |
+
|
61 |
+
For each frame, there is :
|
62 |
+
- a depth image,
|
63 |
+
- a corresponding rgb image (both 640x480 pixels),
|
64 |
+
- annotation
|
65 |
+
|
66 |
+
The head pose range covers about +-75 degrees yaw and +-60 degrees pitch. The ground truth is the 3D location of the head and its rotation.
|
67 |
+
|
68 |
+
### Data Processing
|
69 |
+
|
70 |
+
Example code for reading a compressed binary depth image file provided by the authors.
|
71 |
+
|
72 |
+
<details>
|
73 |
+
<summary> View C++ Code </summary>
|
74 |
+
|
75 |
+
```cpp
|
76 |
+
/*
|
77 |
+
* Gabriele Fanelli
|
78 |
+
*
|
79 |
+
* fanelli@vision.ee.ethz.ch
|
80 |
+
*
|
81 |
+
* BIWI, ETHZ, 2011
|
82 |
+
*
|
83 |
+
* Part of the Biwi Kinect Head Pose Database
|
84 |
+
*
|
85 |
+
* Example code for reading a compressed binary depth image file.
|
86 |
+
*
|
87 |
+
* THE SOFTWARE IS PROVIDED “AS IS” AND THE PROVIDER GIVES NO EXPRESS OR IMPLIED WARRANTIES OF ANY KIND,
|
88 |
+
* INCLUDING WITHOUT LIMITATION THE WARRANTIES OF FITNESS FOR ANY PARTICULAR PURPOSE AND NON-INFRINGEMENT.
|
89 |
+
* IN NO EVENT SHALL THE PROVIDER BE HELD RESPONSIBLE FOR LOSS OR DAMAGE CAUSED BY THE USE OF THE SOFTWARE.
|
90 |
+
*
|
91 |
+
*
|
92 |
+
*/
|
93 |
+
|
94 |
+
#include <iostream>
|
95 |
+
#include <fstream>
|
96 |
+
#include <cstdlib>
|
97 |
+
|
98 |
+
int16_t* loadDepthImageCompressed( const char* fname ){
|
99 |
+
|
100 |
+
//now read the depth image
|
101 |
+
FILE* pFile = fopen(fname, "rb");
|
102 |
+
if(!pFile){
|
103 |
+
std::cerr << "could not open file " << fname << std::endl;
|
104 |
+
return NULL;
|
105 |
+
}
|
106 |
+
|
107 |
+
int im_width = 0;
|
108 |
+
int im_height = 0;
|
109 |
+
bool success = true;
|
110 |
+
|
111 |
+
success &= ( fread(&im_width,sizeof(int),1,pFile) == 1 ); // read width of depthmap
|
112 |
+
success &= ( fread(&im_height,sizeof(int),1,pFile) == 1 ); // read height of depthmap
|
113 |
+
|
114 |
+
int16_t* depth_img = new int16_t[im_width*im_height];
|
115 |
+
|
116 |
+
int numempty;
|
117 |
+
int numfull;
|
118 |
+
int p = 0;
|
119 |
+
|
120 |
+
while(p < im_width*im_height ){
|
121 |
+
|
122 |
+
success &= ( fread( &numempty,sizeof(int),1,pFile) == 1 );
|
123 |
+
|
124 |
+
for(int i = 0; i < numempty; i++)
|
125 |
+
depth_img[ p + i ] = 0;
|
126 |
+
|
127 |
+
success &= ( fread( &numfull,sizeof(int), 1, pFile) == 1 );
|
128 |
+
success &= ( fread( &depth_img[ p + numempty ], sizeof(int16_t), numfull, pFile) == (unsigned int) numfull );
|
129 |
+
p += numempty+numfull;
|
130 |
+
|
131 |
+
}
|
132 |
+
|
133 |
+
fclose(pFile);
|
134 |
+
|
135 |
+
if(success)
|
136 |
+
return depth_img;
|
137 |
+
else{
|
138 |
+
delete [] depth_img;
|
139 |
+
return NULL;
|
140 |
+
}
|
141 |
+
}
|
142 |
+
|
143 |
+
float* read_gt(const char* fname){
|
144 |
+
|
145 |
+
//try to read in the ground truth from a binary file
|
146 |
+
FILE* pFile = fopen(fname, "rb");
|
147 |
+
if(!pFile){
|
148 |
+
std::cerr << "could not open file " << fname << std::endl;
|
149 |
+
return NULL;
|
150 |
+
}
|
151 |
+
|
152 |
+
float* data = new float[6];
|
153 |
+
|
154 |
+
bool success = true;
|
155 |
+
success &= ( fread( &data[0], sizeof(float), 6, pFile) == 6 );
|
156 |
+
fclose(pFile);
|
157 |
+
|
158 |
+
if(success)
|
159 |
+
return data;
|
160 |
+
else{
|
161 |
+
delete [] data;
|
162 |
+
return NULL;
|
163 |
+
}
|
164 |
+
|
165 |
+
}
|
166 |
+
```
|
167 |
+
|
168 |
+
</details>
|
169 |
+
|
170 |
+
|
171 |
+
### Supported Tasks and Leaderboards
|
172 |
+
|
173 |
+
Biwi Kinect Head Pose Database supports the following tasks :
|
174 |
+
- Head pose estimation
|
175 |
+
- Pose estimation
|
176 |
+
- Face verification
|
177 |
+
|
178 |
+
### Languages
|
179 |
+
|
180 |
+
[Needs More Information]
|
181 |
+
|
182 |
+
## Dataset Structure
|
183 |
+
|
184 |
+
### Data Instances
|
185 |
+
|
186 |
+
A sample from the Biwi Kinect Head Pose dataset is provided below:
|
187 |
+
|
188 |
+
```
|
189 |
+
{
|
190 |
+
'sequence_number': '12',
|
191 |
+
'subject_id': 'M06',
|
192 |
+
'rgb': [<PIL.PngImagePlugin.PngImageFile image mode=RGB size=640x480 at 0x7F53A6446C10>,.....],
|
193 |
+
'rgb_cal':
|
194 |
+
{
|
195 |
+
'intrisic_mat': [[517.679, 0.0, 320.0], [0.0, 517.679, 240.5], [0.0, 0.0, 1.0]],
|
196 |
+
'extrinsic_mat':
|
197 |
+
{
|
198 |
+
'rotation': [[0.999947, 0.00432361, 0.00929419], [-0.00446314, 0.999877, 0.0150443], [-0.009228, -0.015085, 0.999844]],
|
199 |
+
'translation': [-24.0198, 5.8896, -13.2308]
|
200 |
+
}
|
201 |
+
}
|
202 |
+
'depth': ['../hpdb/12/frame_00003_depth.bin', .....],
|
203 |
+
'depth_cal':
|
204 |
+
{
|
205 |
+
'intrisic_mat': [[575.816, 0.0, 320.0], [0.0, 575.816, 240.0], [0.0, 0.0, 1.0]],
|
206 |
+
'extrinsic_mat':
|
207 |
+
{
|
208 |
+
'rotation': [[1.0, 0.0, 0.0], [0.0, 1.0, 0.0], [0.0, 0.0, 1.0]],
|
209 |
+
'translation': [0.0, 0.0, 0.0]
|
210 |
+
}
|
211 |
+
}
|
212 |
+
'head_pose_gt':
|
213 |
+
{
|
214 |
+
'center': [[43.4019, -30.7038, 906.864], [43.0202, -30.8683, 906.94], [43.0255, -30.5611, 906.659], .....],
|
215 |
+
'rotation': [[[0.980639, 0.109899, 0.162077], [-0.11023, 0.993882, -0.00697376], [-0.161851, -0.011027, 0.986754]], ......]
|
216 |
+
}
|
217 |
+
}
|
218 |
+
```
|
219 |
+
|
220 |
+
### Data Fields
|
221 |
+
|
222 |
+
- `sequence_number` : This refers to the sequence number in the dataset. There are a total of 24 sequences.
|
223 |
+
- `subject_id` : This refers to the subjects in the dataset. There are a total of 20 people with 6 females and 14 males where 4 people were recorded twice.
|
224 |
+
- `rgb` : List of png frames containing the poses.
|
225 |
+
- `rgb_cal`: Contains calibration information for the color camera which includes intrinsic matrix,
|
226 |
+
global rotation and translation.
|
227 |
+
- `depth` : List of depth frames for the poses.
|
228 |
+
- `depth_cal`: Contains calibration information for the depth camera which includes intrinsic matrix, global rotation and translation.
|
229 |
+
- `head_pose_gt` : Contains ground truth information, i.e., the location of the center of the head in 3D and the head rotation, encoded as a 3x3 rotation matrix.
|
230 |
+
|
231 |
+
|
232 |
+
### Data Splits
|
233 |
+
|
234 |
+
All the data is contained in the training set.
|
235 |
+
|
236 |
+
## Dataset Creation
|
237 |
+
|
238 |
+
### Curation Rationale
|
239 |
+
|
240 |
+
[More Information Needed]
|
241 |
+
|
242 |
+
### Source Data
|
243 |
+
|
244 |
+
#### Initial Data Collection and Normalization
|
245 |
+
|
246 |
+
The Biwi Kinect Head Pose Database is acquired with the Microsoft Kinect sensor, a structured IR light device.
|
247 |
+
#### Who are the source language producers?
|
248 |
+
|
249 |
+
[More Information Needed]
|
250 |
+
|
251 |
+
### Annotations
|
252 |
+
|
253 |
+
#### Annotation process
|
254 |
+
|
255 |
+
From Dataset's README :
|
256 |
+
> The database contains 24 sequences acquired with a Kinect sensor. 20 people (some were recorded twice - 6 women and 14 men) were recorded while turning their heads, sitting in front of the sensor, at roughly one meter of distance.
|
257 |
+
|
258 |
+
#### Who are the annotators?
|
259 |
+
|
260 |
+
[More Information Needed]
|
261 |
+
|
262 |
+
### Personal and Sensitive Information
|
263 |
+
|
264 |
+
[More Information Needed]
|
265 |
+
|
266 |
+
## Considerations for Using the Data
|
267 |
+
|
268 |
+
### Social Impact of Dataset
|
269 |
+
|
270 |
+
[More Information Needed]
|
271 |
+
|
272 |
+
### Discussion of Biases
|
273 |
+
|
274 |
+
[More Information Needed]
|
275 |
+
|
276 |
+
### Other Known Limitations
|
277 |
+
|
278 |
+
[More Information Needed]
|
279 |
+
|
280 |
+
## Additional Information
|
281 |
+
|
282 |
+
### Dataset Curators
|
283 |
+
|
284 |
+
[Needs More Information]
|
285 |
+
|
286 |
+
### Licensing Information
|
287 |
+
|
288 |
+
From Dataset's README :
|
289 |
+
> This database is made available for non-commercial use such as university research and education.
|
290 |
+
|
291 |
+
### Citation Information
|
292 |
+
|
293 |
+
```bibtex
|
294 |
+
@article{fanelli_IJCV,
|
295 |
+
author = {Fanelli, Gabriele and Dantone, Matthias and Gall, Juergen and Fossati, Andrea and Van Gool, Luc},
|
296 |
+
title = {Random Forests for Real Time 3D Face Analysis},
|
297 |
+
journal = {Int. J. Comput. Vision},
|
298 |
+
year = {2013},
|
299 |
+
month = {February},
|
300 |
+
volume = {101},
|
301 |
+
number = {3},
|
302 |
+
pages = {437--458}
|
303 |
+
}
|
304 |
+
```
|
305 |
+
|
306 |
+
### Contributions
|
307 |
+
|
308 |
+
Thanks to [@dnaveenr](https://github.com/dnaveenr) for adding this dataset.
|
@@ -0,0 +1,215 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# Copyright 2022 The HuggingFace Datasets Authors and the current dataset script contributor.
|
2 |
+
#
|
3 |
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
4 |
+
# you may not use this file except in compliance with the License.
|
5 |
+
# You may obtain a copy of the License at
|
6 |
+
#
|
7 |
+
# http://www.apache.org/licenses/LICENSE-2.0
|
8 |
+
#
|
9 |
+
# Unless required by applicable law or agreed to in writing, software
|
10 |
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
11 |
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
12 |
+
# See the License for the specific language governing permissions and
|
13 |
+
# limitations under the License.
|
14 |
+
|
15 |
+
"""Biwi Kinect Head Pose Database."""
|
16 |
+
|
17 |
+
|
18 |
+
import glob
|
19 |
+
import os
|
20 |
+
|
21 |
+
import datasets
|
22 |
+
|
23 |
+
|
24 |
+
_CITATION = """\
|
25 |
+
@article{fanelli_IJCV,
|
26 |
+
author = {Fanelli, Gabriele and Dantone, Matthias and Gall, Juergen and Fossati, Andrea and Van Gool, Luc},
|
27 |
+
title = {Random Forests for Real Time 3D Face Analysis},
|
28 |
+
journal = {Int. J. Comput. Vision},
|
29 |
+
year = {2013},
|
30 |
+
month = {February},
|
31 |
+
volume = {101},
|
32 |
+
number = {3},
|
33 |
+
pages = {437--458}
|
34 |
+
}
|
35 |
+
"""
|
36 |
+
|
37 |
+
|
38 |
+
_DESCRIPTION = """\
|
39 |
+
The Biwi Kinect Head Pose Database is acquired with the Microsoft Kinect sensor, a structured IR light device.It contains 15K images of 20 people with 6 females and 14 males where 4 people were recorded twice.
|
40 |
+
"""
|
41 |
+
|
42 |
+
|
43 |
+
_HOMEPAGE = "https://icu.ee.ethz.ch/research/datsets.html"
|
44 |
+
|
45 |
+
|
46 |
+
_LICENSE = "This database is made available for non-commercial use such as university research and education."
|
47 |
+
|
48 |
+
|
49 |
+
_URLS = {
|
50 |
+
"kinect_head_pose_db": "https://data.vision.ee.ethz.ch/cvl/gfanelli/kinect_head_pose_db.tgz",
|
51 |
+
}
|
52 |
+
|
53 |
+
_sequence_to_subject_map = {
|
54 |
+
"01": "F01",
|
55 |
+
"02": "F02",
|
56 |
+
"03": "F03",
|
57 |
+
"04": "F04",
|
58 |
+
"05": "F05",
|
59 |
+
"06": "F06",
|
60 |
+
"07": "M01",
|
61 |
+
"08": "M02",
|
62 |
+
"09": "M03",
|
63 |
+
"10": "M04",
|
64 |
+
"11": "M05",
|
65 |
+
"12": "M06",
|
66 |
+
"13": "M07",
|
67 |
+
"14": "M08",
|
68 |
+
"15": "F03",
|
69 |
+
"16": "M09",
|
70 |
+
"17": "M10",
|
71 |
+
"18": "F05",
|
72 |
+
"19": "M11",
|
73 |
+
"20": "M12",
|
74 |
+
"21": "F02",
|
75 |
+
"22": "M01",
|
76 |
+
"23": "M13",
|
77 |
+
"24": "M14",
|
78 |
+
}
|
79 |
+
|
80 |
+
|
81 |
+
class BiwiKinectHeadPose(datasets.GeneratorBasedBuilder):
|
82 |
+
|
83 |
+
VERSION = datasets.Version("1.0.0")
|
84 |
+
|
85 |
+
def _info(self):
|
86 |
+
return datasets.DatasetInfo(
|
87 |
+
description=_DESCRIPTION,
|
88 |
+
features=datasets.Features(
|
89 |
+
{
|
90 |
+
"sequence_number": datasets.Value("string"),
|
91 |
+
"subject_id": datasets.Value("string"),
|
92 |
+
"rgb": datasets.Sequence(datasets.Image()),
|
93 |
+
"rgb_cal": {
|
94 |
+
"intrisic_mat": datasets.Array2D(shape=(3, 3), dtype="float64"),
|
95 |
+
"extrinsic_mat": {
|
96 |
+
"rotation": datasets.Array2D(shape=(3, 3), dtype="float64"),
|
97 |
+
"translation": datasets.Sequence(datasets.Value("float64"), length=3),
|
98 |
+
},
|
99 |
+
},
|
100 |
+
"depth": datasets.Sequence(datasets.Value("string")),
|
101 |
+
"depth_cal": {
|
102 |
+
"intrisic_mat": datasets.Array2D(shape=(3, 3), dtype="float64"),
|
103 |
+
"extrinsic_mat": {
|
104 |
+
"rotation": datasets.Array2D(shape=(3, 3), dtype="float64"),
|
105 |
+
"translation": datasets.Sequence(datasets.Value("float64"), length=3),
|
106 |
+
},
|
107 |
+
},
|
108 |
+
"head_pose_gt": datasets.Sequence(
|
109 |
+
{
|
110 |
+
"center": datasets.Sequence(datasets.Value("float64"), length=3),
|
111 |
+
"rotation": datasets.Array2D(shape=(3, 3), dtype="float64"),
|
112 |
+
}
|
113 |
+
),
|
114 |
+
"head_template": datasets.Value("string"),
|
115 |
+
}
|
116 |
+
),
|
117 |
+
homepage=_HOMEPAGE,
|
118 |
+
license=_LICENSE,
|
119 |
+
citation=_CITATION,
|
120 |
+
)
|
121 |
+
|
122 |
+
def _split_generators(self, dl_manager):
|
123 |
+
|
124 |
+
data_dir = dl_manager.download_and_extract(_URLS)
|
125 |
+
return [
|
126 |
+
datasets.SplitGenerator(
|
127 |
+
name=datasets.Split.TRAIN,
|
128 |
+
gen_kwargs={
|
129 |
+
"dataset_path": os.path.join(data_dir["kinect_head_pose_db"], "hpdb"),
|
130 |
+
},
|
131 |
+
),
|
132 |
+
]
|
133 |
+
|
134 |
+
@staticmethod
|
135 |
+
def _get_calibration_information(cal_file_path):
|
136 |
+
with open(cal_file_path, "r", encoding="utf-8") as f:
|
137 |
+
cal_info = f.read().splitlines()
|
138 |
+
|
139 |
+
intrisic_mat = []
|
140 |
+
extrinsic_mat = []
|
141 |
+
|
142 |
+
for data in cal_info[:3]:
|
143 |
+
row = list(map(float, data.strip().split(" ")))
|
144 |
+
intrisic_mat.append(row)
|
145 |
+
|
146 |
+
for data in cal_info[6:9]:
|
147 |
+
row = list(map(float, data.strip().split(" ")))
|
148 |
+
extrinsic_mat.append(row)
|
149 |
+
|
150 |
+
translation = list(map(float, cal_info[10].strip().split(" ")))
|
151 |
+
|
152 |
+
return {
|
153 |
+
"intrisic_mat": intrisic_mat,
|
154 |
+
"extrinsic_mat": {
|
155 |
+
"rotation": extrinsic_mat,
|
156 |
+
"translation": translation,
|
157 |
+
},
|
158 |
+
}
|
159 |
+
|
160 |
+
@staticmethod
|
161 |
+
def _parse_head_pose_info(head_pose_file):
|
162 |
+
with open(head_pose_file, "r", encoding="utf-8") as f:
|
163 |
+
head_pose_info = f.read().splitlines()
|
164 |
+
|
165 |
+
rotation = []
|
166 |
+
for data in head_pose_info[:3]:
|
167 |
+
row = list(map(float, data.strip().split(" ")))
|
168 |
+
rotation.append(row)
|
169 |
+
|
170 |
+
center = list(map(float, head_pose_info[4].strip().split(" ")))
|
171 |
+
|
172 |
+
return {
|
173 |
+
"center": center,
|
174 |
+
"rotation": rotation,
|
175 |
+
}
|
176 |
+
|
177 |
+
@staticmethod
|
178 |
+
def _get_head_pose_information(path):
|
179 |
+
head_pose_files = sorted(glob.glob(os.path.join(path, "*_pose.txt")))
|
180 |
+
|
181 |
+
head_poses_info = []
|
182 |
+
|
183 |
+
for head_pose_file in head_pose_files:
|
184 |
+
head_pose = BiwiKinectHeadPose._parse_head_pose_info(head_pose_file)
|
185 |
+
head_poses_info.append(head_pose)
|
186 |
+
|
187 |
+
return head_poses_info
|
188 |
+
|
189 |
+
def _generate_examples(self, dataset_path):
|
190 |
+
|
191 |
+
idx = 0
|
192 |
+
folders = os.listdir(dataset_path)
|
193 |
+
for item in folders:
|
194 |
+
sequence_number = item
|
195 |
+
sequence_base_path = os.path.join(dataset_path, sequence_number)
|
196 |
+
if os.path.isdir(sequence_base_path):
|
197 |
+
rgb_files = sorted(glob.glob(os.path.join(sequence_base_path, "*.png")))
|
198 |
+
depth_files = sorted(glob.glob(os.path.join(sequence_base_path, "*.bin")))
|
199 |
+
head_template_path = os.path.join(dataset_path, sequence_number + ".obj")
|
200 |
+
rgb_cal = self._get_calibration_information(os.path.join(sequence_base_path, "rgb.cal"))
|
201 |
+
depth_cal = self._get_calibration_information(os.path.join(sequence_base_path, "depth.cal"))
|
202 |
+
head_pose_gt = self._get_head_pose_information(sequence_base_path)
|
203 |
+
|
204 |
+
yield idx, {
|
205 |
+
"sequence_number": sequence_number,
|
206 |
+
"subject_id": _sequence_to_subject_map[sequence_number],
|
207 |
+
"rgb": rgb_files,
|
208 |
+
"rgb_cal": rgb_cal,
|
209 |
+
"depth": depth_files,
|
210 |
+
"depth_cal": depth_cal,
|
211 |
+
"head_pose_gt": head_pose_gt,
|
212 |
+
"head_template": head_template_path,
|
213 |
+
}
|
214 |
+
|
215 |
+
idx += 1
|
@@ -0,0 +1 @@
|
|
|
|
|
1 |
+
{"default": {"description": "The Biwi Kinect Head Pose Database is acquired with the Microsoft Kinect sensor, a structured IR light device.It contains 15K images of 20 people with 6 females and 14 males where 4 people were recorded twice.\n", "citation": "@article{fanelli_IJCV,\n author = {Fanelli, Gabriele and Dantone, Matthias and Gall, Juergen and Fossati, Andrea and Van Gool, Luc},\n title = {Random Forests for Real Time 3D Face Analysis},\n journal = {Int. J. Comput. Vision},\n year = {2013},\n month = {February},\n volume = {101},\n number = {3},\n pages = {437--458}\n}\n", "homepage": "https://icu.ee.ethz.ch/research/datsets.html", "license": "This database is made available for non-commercial use such as university research and education.", "features": {"sequence_number": {"dtype": "string", "id": null, "_type": "Value"}, "subject_id": {"dtype": "string", "id": null, "_type": "Value"}, "rgb": {"feature": {"decode": true, "id": null, "_type": "Image"}, "length": -1, "id": null, "_type": "Sequence"}, "rgb_cal": {"intrisic_mat": {"shape": [3, 3], "dtype": "float64", "id": null, "_type": "Array2D"}, "extrinsic_mat": {"rotation": {"shape": [3, 3], "dtype": "float64", "id": null, "_type": "Array2D"}, "translation": {"feature": {"dtype": "float64", "id": null, "_type": "Value"}, "length": 3, "id": null, "_type": "Sequence"}}}, "depth": {"feature": {"dtype": "string", "id": null, "_type": "Value"}, "length": -1, "id": null, "_type": "Sequence"}, "depth_cal": {"intrisic_mat": {"shape": [3, 3], "dtype": "float64", "id": null, "_type": "Array2D"}, "extrinsic_mat": {"rotation": {"shape": [3, 3], "dtype": "float64", "id": null, "_type": "Array2D"}, "translation": {"feature": {"dtype": "float64", "id": null, "_type": "Value"}, "length": 3, "id": null, "_type": "Sequence"}}}, "head_pose_gt": {"feature": {"center": {"feature": {"dtype": "float64", "id": null, "_type": "Value"}, "length": 3, "id": null, "_type": "Sequence"}, "rotation": {"shape": [3, 3], "dtype": "float64", "id": null, "_type": "Array2D"}}, "length": -1, "id": null, "_type": "Sequence"}, "head_template": {"dtype": "string", "id": null, "_type": "Value"}}, "post_processed": null, "supervised_keys": null, "task_templates": null, "builder_name": "biwi_kinect_head_pose", "config_name": "default", "version": {"version_str": "1.0.0", "description": null, "major": 1, "minor": 0, "patch": 0}, "splits": {"train": {"name": "train", "num_bytes": 6914063, "num_examples": 24, "dataset_name": "biwi_kinect_head_pose"}}, "download_checksums": {"https://data.vision.ee.ethz.ch/cvl/gfanelli/kinect_head_pose_db.tgz": {"num_bytes": 6014398431, "checksum": "d8fc0fee11b6b865b18b292de7c21dd2181492bd770c4fe13821e8dc630f5549"}}, "download_size": 6014398431, "post_processing_size": null, "dataset_size": 6914063, "size_in_bytes": 6021312494}}
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:58468f9f93a1fd98c8f2e1f702d717bfbbbf968f8d8f78744ec1330abd8a8459
|
3 |
+
size 829287
|