orz2333 commited on
Commit
f7ca549
·
verified ·
1 Parent(s): de65277

Copy files from datasets/ParityLab/Hand-Datasets

Browse files
FreiHAND/raw/data/FreiHAND_pub_v2.zip ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:0e1ce30e75d12d0874b0d39a93dee0dad8cd0121ebabf72d3c9745b0f68dca96
3
+ size 3881833583
FreiHAND/raw/data/FreiHAND_pub_v2_eval.zip ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:7f1968695971479149e28c0fe9495fabee930c48d171cfba739cfd7eeca35712
3
+ size 758382230
FreiHAND/raw/doc/README.md ADDED
@@ -0,0 +1,125 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # FreiHAND - Toolbox
2
+
3
+ ![Teaser](teaser.png)
4
+
5
+ FreiHAND is a dataset for evaluation and training of deep neural networks for estimation of hand **pose** and **shape** from single color images,
6
+ which was proposed in our [paper](https://lmb.informatik.uni-freiburg.de/projects/freihand/).
7
+ Its current version contains 32560 unique training samples and 3960 unique evaluation samples.
8
+ The training samples were recorded with a green screen background allowing for background removal.
9
+ We provide 3 additional _sample_versions_ for each training sample using different post processing strategies yielding a total training set size of 130240 samples.
10
+
11
+ This repository contains a collection of scripts that show how the dataset can be used.
12
+ See the [project page](https://lmb.informatik.uni-freiburg.de/projects/freihand/) for additional information.
13
+
14
+
15
+ # New:exclamation:
16
+ An extendend version of this dataset, with calibration data and multiple-views, is released in [HanCo](https://lmb.informatik.uni-freiburg.de/projects/contra-hand/).
17
+ Due to ungoing problems with the Codalab evaluation server we have decided to release the evaluation split annotations publicly on our [dataset page](https://lmb.informatik.uni-freiburg.de/resources/datasets/FreihandDataset.en.html).
18
+
19
+
20
+ # Basic setup
21
+
22
+ 1. Download the dataset. See project page for instructions.
23
+
24
+ 2. Install basic requirements:
25
+ ```
26
+ virtualenv -p python2.7 ./venv
27
+ source venv/bin/activate
28
+ pip install numpy matplotlib scikit-image transforms3d tqdm opencv-python cython
29
+ ```
30
+
31
+ 3. Assuming ${DB_PATH} is the path to where you unpacked the dataset (path to where _./training/_ and _./evaluation/_ folder branch off).
32
+ This should enable you to run the following to show some dataset samples.
33
+ In my case ${DB_PATH} holds the value `~/FreiHAND_pub_v2/`
34
+ ```
35
+ python view_samples.py ${DB_PATH}
36
+ python view_samples.py ${DB_PATH} --show_eval
37
+ ```
38
+
39
+ The script provides a couple of other parameters you might want to try. Note that for visualization of the hand shape you need to follow the **Advanced setup**.
40
+
41
+
42
+ # Advanced setup (allows for visualization of MANO shape annotation)
43
+
44
+ 1. Download Models&code from the MANO website
45
+ ```
46
+ http://mano.is.tue.mpg.de
47
+ ```
48
+
49
+ 2. Assuming ${MANO_PATH} contains the path to where you unpacked the downloaded archive use the provided script to enable visualization of the hand shape fit. See the section __Mano version__ for a known caveat.
50
+ ```
51
+ python setup_mano.py ${MANO_PATH}
52
+ ```
53
+
54
+ 3. Install OpenDR
55
+
56
+ Getting OpenDR installed can be tricky. Maybe you are lucky and the pip install works for your system.
57
+ ```
58
+ pip install opendr
59
+ ```
60
+ But there is a known [issue](https://github.com/mattloper/opendr/issues/30) with a library. On my system the pip install didn't work and I installed the package using:
61
+ ```
62
+ bash install_opendr.sh
63
+ ```
64
+
65
+ 4. Visualize samples with rendered MANO shapes
66
+ ```
67
+ python view_samples.py ${DB_PATH} --mano
68
+ ```
69
+
70
+ # Evaluate on the dataset
71
+
72
+ **Update**: Due to ungoing problems with the Codalab evaluation server we have decided to release the evaluation split annotations publicly on our [dataset page](https://lmb.informatik.uni-freiburg.de/resources/datasets/FreihandDataset.en.html).
73
+
74
+ In order to ensure a fair and consistent protocol, evaluation of your algorithm on FreiHAND is handled through Codalab.
75
+
76
+ 1. Make predictions for the evaluation dataset. The code provided here predicts zeros for all joints and vertices.
77
+ ```
78
+ python pred.py ${DB_PATH}
79
+ ```
80
+
81
+ 2. Zip the `pred.json` file
82
+ ```
83
+ zip -j pred.zip pred.json
84
+ ```
85
+
86
+ 3. Upload `pred.zip` to our [Codalab competition](https://competitions.codalab.org/competitions/21238) website (Participate -> Submit)
87
+
88
+ 4. Wait for the evaluation server to report back your results and publish your results to the leaderboard. The zero predictor will give you the following results
89
+ ```
90
+ Keypoint error 70.79cm
91
+ Keypoint error aligned 4.73cm
92
+ Mesh error 70.84cm
93
+ Mesh error aligned 5.07cm
94
+ F@5mm=0.0, F@15mm=0.0
95
+ F_aliged@5mm= 0.001, F_aligned@15mm=0.031
96
+ ```
97
+
98
+ 5. Modify `pred.py` to use your method for making shape prediction and see how well it performs compared to the baselines in our [leaderboard](https://competitions.codalab.org/competitions/21238#results).
99
+
100
+ # Mano version and FreiHAND v2
101
+ The following paragraph is only relevant if you downloaded the dataset **before 22. Oct**.
102
+
103
+ This dataset was developed with the original version of the MANO shape model, which differs from the one that is currently (Sept. 2019) offered for download.
104
+ If the change in version is not dealt with properly this results into mismatches between the provided keypoint and vertex coordinates and the ones the hand model implementation will yield,
105
+ when the respective hand model parameters are applied to it. Therefore an updated dataset version is offered for download now, where all annotations were converted to be compatible with the new MANO version.
106
+ The conversion is approximate, but the residual mean vertex deviation between versions is 0.6mm on average and does not exceed 6mm for any sample.
107
+ Manual inspection of the respective max deviation samples showed, that the new fits even look a bit better than the old ones.
108
+ Additionally the new version correctly accounts for perspective correction due to cropping of non centered image patches by warping the images.
109
+
110
+ If you downloaded the dataset or cloned the repository **before 22. Oct** then you should update to the new version, i.e. download the new data and update the code repository.
111
+
112
+ # Terms of use
113
+
114
+ This dataset is provided for research purposes only and without any warranty. Any commercial use is prohibited.
115
+ If you use the dataset or parts of it in your research, you must cite the respective paper.
116
+
117
+ ```
118
+ @InProceedings{Freihand2019,
119
+ author = {Christian Zimmermann, Duygu Ceylan, Jimei Yang, Bryan Russel, Max Argus and Thomas Brox},
120
+ title = {FreiHAND: A Dataset for Markerless Capture of Hand Pose and Shape from Single RGB Images},
121
+ booktitle = {IEEE International Conference on Computer Vision (ICCV)},
122
+ year = {2019},
123
+ url = {"https://lmb.informatik.uni-freiburg.de/projects/freihand/"}
124
+ }
125
+ ```
FreiHAND/raw/doc/SOURCES.md ADDED
@@ -0,0 +1,6 @@
 
 
 
 
 
 
 
1
+ # FreiHAND 原始来源
2
+
3
+ 官方来源:https://lmb.informatik.uni-freiburg.de/resources/datasets/FreihandDataset.en.html
4
+
5
+ - `FreiHAND_pub_v2.zip`:3881833583 字节;SHA256 `0e1ce30e75d12d0874b0d39a93dee0dad8cd0121ebabf72d3c9745b0f68dca96`。
6
+ - `FreiHAND_pub_v2_eval.zip`:758382230 字节;SHA256 `7f1968695971479149e28c0fe9495fabee930c48d171cfba739cfd7eeca35712`。
FreiHAND/raw/doc/official_page.html ADDED
@@ -0,0 +1,640 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
2
+ <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="de" lang="de">
3
+
4
+ <head>
5
+ <!-- Internet Explorer fix, forces IE8 into newest possible rendering
6
+ engine even if it's on an intranet. This has to be defined before any
7
+ script/style tags. -->
8
+ <meta http-equiv="X-UA-Compatible" content="IE=edge" />
9
+
10
+ <!-- Prevent Chrome mobile browser from randomly rescaling elements -->
11
+ <meta name="viewport" content="width=device-width, initial-scale=1">
12
+
13
+ <!-- -->
14
+ <!-- Hier den Titel fuer die Seiten angeben -->
15
+ <!-- Title + favicon -->
16
+ <!-- -->
17
+ <link rel="shortcut icon" href="/logo_small.png" type="image/png"/>
18
+ <title>Computer Vision Group, Freiburg</title>
19
+
20
+ <meta http-equiv="content-type" content="text/html; charset=iso-8859-1" />
21
+ <meta http-equiv="expires" content="-1" />
22
+ <meta http-equiv="pragma" content="no-cache" />
23
+
24
+ <meta name='robots' content='all'/>
25
+
26
+ <!-- Custom meta tags -->
27
+
28
+ <!-- -->
29
+ <!-- Standardlayout laden -->
30
+ <!-- -->
31
+ <style type="text/css" media="all">
32
+ @import url(/css/default.css);
33
+ </style>
34
+
35
+
36
+ <!-- Internet Explorer Fixes -->
37
+ <!--[if IE]>
38
+ <style type="text/css" media="all">@import url(/muster/css/IEFixes.css);</style>
39
+ <style type="text/css" media="all">@import url(/muster/css/IE.css);</style>
40
+ <![endif]-->
41
+
42
+ <!--[if IE 6]><link rel="stylesheet" type="text/css" href="css/IE6.css" media="all" /><![endif]-->
43
+ <!--[if IE 7]><link rel="stylesheet" type="text/css" href="css/IE7.css" media="all" /><![endif]-->
44
+ </head>
45
+
46
+ <body>
47
+
48
+
49
+ <!-- -->
50
+ <!-- gesamtes Layout ist Tabelle -->
51
+ <!-- -->
52
+ <div id="wrapper">
53
+ <table id="wrapperTable">
54
+ <tbody>
55
+ <tr>
56
+
57
+
58
+ <!-- -->
59
+ <!-- linke Tabelle = Navigation -->
60
+ <!-- -->
61
+ <td id="leftwrapperTable">
62
+ <div id="leftcolumnWrapper">
63
+ <div id="leftTopSpace">&nbsp;</div>
64
+ <div id="leftGreyBar">&nbsp;</div>
65
+ <div id="leftUpperSpace">&nbsp;</div>
66
+ <dl class="portletNavigationTree">
67
+ <dd>
68
+ <ul class="navTreeLevel0">
69
+
70
+ <!-- -->
71
+ <!-- Hier Links und Titel eingeben -->
72
+ <!-- beliebig erweiterbar durch neuen Eintrag -->
73
+ <!-- -->
74
+
75
+
76
+ <li class="navTreeItem visualNoMarker "><div><a href="/index.php" class="state-published "><span>Home</span></a></div></li>
77
+ <li class="navTreeItem visualNoMarker "><div><a href="/people/team.php" class="state-published "><span>Team</span></a></div></li>
78
+ <li class="navTreeItem visualNoMarker "><div><a href="/people/social.php" class="state-published "><span>Social Events</span></a></div></li>
79
+ <li class="navTreeItem visualNoMarker "><div><a href="/research/research.php" class="state-published "><span>Research</span></a></div></li>
80
+ <li class="navTreeItem visualNoMarker "><div><a href="/Publications" class="state-published "><span>Publications</span></a></div></li>
81
+ <li class="navTreeItem visualNoMarker "><div><a href="/lectures/teaching.php" class="state-published "><span>Teaching</span></a></div></li>
82
+ <li class="navTreeItem visualNoMarker "><div><a href="/resources/software.php" class="state-published "><span>Software/Datasets</span></a></div></li>
83
+ <li class="navTreeItem visualNoMarker "><div><a href="/jobs.php" class="state-published "><span>Job Offers</span></a></div></li>
84
+ <li class="navTreeItem visualNoMarker "><div><a href="/contact.php" class="state-published "><span>Contact</span></a></div></li>
85
+ <li class="navTreeItem visualNoMarker "><div><a href="/interna/" class="state-published "><span>Internal</span></a></div></li>
86
+
87
+
88
+ </ul>
89
+ </dd>
90
+ </dl>
91
+ </div>
92
+
93
+ <div style="height:100%; position:absolute; top:204px; left:145px;">
94
+ <img src="/css/home.png" border="0" alt="Home"/>
95
+ </div>
96
+ </td>
97
+
98
+ <!-- -->
99
+ <!-- Uni-Logo einbinden -->
100
+ <!-- -->
101
+ <td id="logowrapperTable">
102
+ <div id="logocolumnWrapper">
103
+ <div id="logoWrapper">
104
+ <a href="http://www.uni-freiburg.de/" title="Albert-Ludwigs-Universit�t Freiburg"><img src="/css/unilogo.gif" alt="Uni-Logo"/></a>
105
+ </div>
106
+ </div>
107
+ </td>
108
+
109
+ <!-- -->
110
+ <!-- LS-Titel eingeben -->
111
+ <!-- Informatik und Fak als Link -->
112
+ <!-- -->
113
+ <td id="rightwrapperTable">
114
+ <div id="rightcolumnWrapper">
115
+ <div id="portal-header">
116
+ <div id="logo-resource"><a href="/index.php"><img src="/css/group_logo.png" border="0" alt="LMB group logo"/></a></div>
117
+
118
+ <!-- -->
119
+ <!-- Lehrstuhl, wait no now it's "Professur"-->
120
+ <!-- -->
121
+ <div id="title-resource">
122
+ <table border="0" cellpadding="0" cellspacing="0">
123
+ <tbody>
124
+ <tr><td valign="bottom"><a href="/index.php"><span class="resource"> Pattern Recognition and Image Processing </span></a></td></tr>
125
+ </tbody>
126
+ </table>
127
+ </div>
128
+ <!-- <div style="height:100%; position:absolute; top:2px; left:775px;" >
129
+ <img src="/css/group_logo.png" border="0">
130
+ </div> -->
131
+ <!-- -->
132
+ <!-- Links Info / TF unter LS -->
133
+ <!-- -->
134
+ <div id="title-uni">
135
+
136
+ <a href="http://www.informatik.uni-freiburg.de/" title="Dept. of Computer Science">Dept. of Computer Science</a>
137
+ &nbsp;&nbsp;&nbsp;
138
+ <a href="http://www.tf.uni-freiburg.de/" title="Technische Fakult�t">Faculty of Engineering</a>
139
+
140
+ </div>
141
+
142
+ </div>
143
+ <!-- -->
144
+ <!-- Navigation horizontal -->
145
+ <!-- hier ausgeschaltet -->
146
+ <!-- nur Eintrag auf Startseite -->
147
+ <!-- -->
148
+ <div id="red-bar"></div>
149
+ <div id="sections-breadcrumbs">
150
+ <div id="portal-breadcrumbs">
151
+ <span id="breadcrumbs-you-are-here"></span>
152
+ <!-- <a href="http://lmb.informatik.uni-freiburg.de/">Home</a> -->
153
+ <?php=$breadcrum?>
154
+
155
+ </div>
156
+ </div>
157
+
158
+ <div id="rightSpaceGrey">&nbsp;</div>
159
+
160
+ <div id="content" class="def" style="vertical-align: top;">
161
+
162
+ <h1>
163
+ Datasets
164
+ </h1>
165
+
166
+ <table>
167
+ <tr style="background-color: #dadada;">
168
+ <td><a href="/resources/binaries">Binaries/Code</a></td>
169
+ <td style="background-color: #bababa;"><a href="/resources/datasets">Datasets</a></td>
170
+ <td><a href="/resources/opensource/imagej_plugins.en.html">Open Source Software</a></td>
171
+ </tr>
172
+ </table>
173
+
174
+ <br/>
175
+ <table>
176
+ <tr>
177
+ <td style="width: 2%"></td>
178
+ <!-- entry 1,1 -->
179
+ <td style="width: 10%"><a href="moseg.en.html"><img src="mosegIcon.png" width="120" alt=""/></a></td>
180
+ <td style="width: 30%; background-color: #f8f8f8;">
181
+ <table><tr>
182
+ <td style="width: 3%"></td>
183
+ <td style="width: 95%"><a href="moseg.en.html">Freiburg-Berkeley Motion Segmentation Dataset</a></td>
184
+ <td style="width: 3%"></td>
185
+ </tr></table></td>
186
+ <td style="width: 2%"></td>
187
+ <!-- entry 1,2 -->
188
+ <td style="width: 10%"><a href="vsb.en.html"><img src="vsb100.png" width="120px" alt=""/></a></td>
189
+ <td style="width: 30%; background-color: #f8f8f8;">
190
+ <table>
191
+ <tr>
192
+ <td style="width: 3%"></td>
193
+ <td style="width: 95%"><a href="vsb.en.html">Video Segmentation Benchmark</a></td>
194
+ <td style="width: 3%"></td>
195
+ </tr>
196
+ </table>
197
+ </td>
198
+ </tr>
199
+ <tr><td></td></tr>
200
+ <tr>
201
+ <td style="width: 2%"></td>
202
+ <!-- entry 2,1 -->
203
+ <td style="width: 10%"><a href="sequences.en.html"><img src="sequencesIcon.jpg" width="120" alt=""/></a></td>
204
+ <td style="width: 30%; background-color: #f8f8f8;">
205
+ <table>
206
+ <tr>
207
+ <td style="width: 3%"></td>
208
+ <td style="width: 95%"><a href="sequences.en.html">Image Sequences</a></td>
209
+ <td style="width: 3%"></td>
210
+ </tr>
211
+ </table>
212
+ </td>
213
+ <td style="width: 2%"></td>
214
+ <!-- entry 2,2 -->
215
+ <td style="width: 10%"><a href="tem.en.html"><img src="TEMsegIcon.jpg" width="120" alt=""/></a></td>
216
+ <td style="width: 30%; background-color: #f8f8f8;">
217
+ <table>
218
+ <tr>
219
+ <td style="width: 3%"></td>
220
+ <td style="width: 95%"><a href="tem.en.html">TEM Dataset</a></td>
221
+ <td style="width: 3%"></td>
222
+ </tr>
223
+ </table>
224
+ </td>
225
+ </tr>
226
+ <tr><td></td></tr>
227
+ <tr>
228
+ <td style="width: 2%"></td>
229
+ <!-- entry 3,1 -->
230
+ <td style="width: 10%"><a href="tilda.en.html"><img src="TILDAIcon.jpg" width="120" alt=""/></a></td>
231
+ <td style="width: 20%; background-color: #f8f8f8;">
232
+ <table>
233
+ <tr>
234
+ <td style="width: 3%"></td>
235
+ <td style="width: 95%"><a href="tilda.en.html">TILDA Textile Texture Database</a></td>
236
+ <td style="width: 3%"></td>
237
+ </tr>
238
+ </table>
239
+ </td>
240
+ <td style="width: 2%"></td>
241
+ <!-- entry 3,2 -->
242
+ <td style="width: 10%"><a href="exemplarCNN.en.html"><img src="exemplarCNN.png" width="120" alt=""/></a></td>
243
+ <td style="width: 20%; background-color: #f8f8f8;">
244
+ <table>
245
+ <tr>
246
+ <td style="width: 3%"></td>
247
+ <td style="width: 95%"><a href="exemplarCNN.en.html">Training data for Exemplar CNN</a></td>
248
+ <td style="width: 3%"></td>
249
+ </tr>
250
+ </table>
251
+ </td>
252
+ <td style="width: 2%"></td>
253
+ </tr>
254
+ <tr><td></td></tr>
255
+ <tr>
256
+ <td style="width: 2%"></td>
257
+ <!-- entry 4,1 -->
258
+ <td style="width: 10%"><a href="genmatch.en.html"><img src="generated-matching.png" width="120" alt=""/></a></td>
259
+ <td style="width: 20%; background-color: #f8f8f8;">
260
+ <table>
261
+ <tr>
262
+ <td style="width: 3%"></td>
263
+ <td style="width: 95%"><a href="genmatch.en.html">Generated Matching Dataset</a></td>
264
+ <td style="width: 3%"></td>
265
+ </tr>
266
+ </table>
267
+ </td>
268
+ <td style="width: 2%"></td>
269
+ <!-- entry 4,2 -->
270
+ <td style="width: 10%"><a href="GenerateChairs.en.html"><img src="GenerateChairs.png" width="120" alt=""/></a></td>
271
+ <td style="width: 20%; background-color: #f8f8f8;">
272
+ <table>
273
+ <tr>
274
+ <td style="width: 3%"></td>
275
+ <td style="width: 95%"><a href="GenerateChairs.en.html">Training data for chair generation</a></td>
276
+ <td style="width: 3%"></td>
277
+ </tr>
278
+ </table>
279
+ </td>
280
+ <td style="width: 2%"></td>
281
+ </tr>
282
+ <tr><td></td></tr>
283
+ <tr>
284
+ <td style="width: 2%"></td>
285
+ <!-- entry 5,1 -->
286
+ <td style="width: 10%"><a href="StereoEgomotion.en.html"><img src="StereoEgomotion/dataset_thumbnail.png" width="120" alt=""/></a></td>
287
+ <td style="width: 20%; background-color: #f8f8f8;">
288
+ <table>
289
+ <tr>
290
+ <td style="width: 3%"></td>
291
+ <td style="width: 95%"><a href="StereoEgomotion.en.html">Stereo Ego-motion Dataset</a></td>
292
+ <td style="width: 3%"></td>
293
+ </tr>
294
+ </table>
295
+ </td>
296
+ <td style="width: 2%"></td>
297
+ <!-- entry 5,2 -->
298
+ <td style="width: 10%"><a href="FlyingChairs.en.html"><img src="FlyingChairs.png" width="120" alt=""/></a></td>
299
+ <td style="width: 20%; background-color: #f8f8f8;">
300
+ <table>
301
+ <tr>
302
+ <td style="width: 3%"></td>
303
+ <td style="width: 95%"><a href="FlyingChairs.en.html">Optical Flow Datasets: "Flying Chairs", "ChairsSDHom"</a></td>
304
+ <td style="width: 3%"></td>
305
+ </tr>
306
+ </table>
307
+ </td>
308
+ <td style="width: 2%"></td>
309
+ </tr>
310
+ <tr><td></td></tr>
311
+ <tr>
312
+ <td style="width: 2%"></td>
313
+ <!-- entry 6,1 -->
314
+ <td style="width: 10%"><a href="SceneFlowDatasets.en.html"><img src="SceneFlow/assets/img/teaser_tiny.png" width="120" alt=""/></a></td>
315
+ <td style="width: 20%; background-color: #f8f8f8;">
316
+ <table>
317
+ <tr>
318
+ <td style="width: 3%"></td>
319
+ <td style="width: 95%"><a href="SceneFlowDatasets.en.html">Scene Flow Datasets</a></td>
320
+ <td style="width: 3%"></td>
321
+ </tr>
322
+ </table>
323
+ </td>
324
+ <td style="width: 2%"></td>
325
+ <!-- entry 6,2 -->
326
+ <td style="width: 10%"><a href="PartSeg.html"><img src="PartSeg/imgs/datasets.png" width="120" alt=""/></a></td>
327
+ <td style="width: 20%; background-color: #f8f8f8;">
328
+ <table>
329
+ <tr>
330
+ <td style="width: 3%"></td>
331
+ <td style="width: 95%"><a href="PartSeg.html">Human Part Segmentation Datasets &nbsp;</a></td>
332
+ <td style="width: 3%"></td>
333
+ </tr>
334
+ </table>
335
+ </td>
336
+
337
+ <td style="width: 2%"></td>
338
+ </tr>
339
+ <tr><td></td></tr>
340
+ <tr>
341
+ <td style="width: 2%"></td>
342
+ <!-- entry 7,1 -->
343
+ <td style="width: 10%"><a href="RenderedHandposeDataset.en.html"><img src="RenderedHandpose/examples/teaser_small.png" width="120" height="70" alt=""/></a></td>
344
+ <td style="width: 20%; background-color: #f8f8f8;">
345
+ <table>
346
+ <tr>
347
+ <td style="width: 3%"></td>
348
+ <td style="width: 95%"><a href="RenderedHandposeDataset.en.html">Rendered Handpose Dataset</a></td>
349
+ <td style="width: 3%"></td>
350
+ </tr>
351
+ </table>
352
+ </td>
353
+ <td style="width: 2%"></td>
354
+ <!-- entry 7,2 -->
355
+ <td style="width: 10%; background-color: transparent;"><a href="pedestrian_zone.html"><img src="pedestrian_zone/pedestrian_zone_thumbnail.png" width="120" alt=""/></a></td>
356
+ <td style="width: 20%; background-color: #f8f8f8;">
357
+ <table>
358
+ <tr>
359
+ <td style="width: 3%"></td>
360
+ <td style="width: 95%"><a href="pedestrian_zone.html">Pedestrian Zone Scene</a></td>
361
+ <td style="width: 3%"></td>
362
+ </tr>
363
+ </table>
364
+ </td>
365
+
366
+ <td style="width: 2%">
367
+ </td>
368
+ </tr>
369
+
370
+ <tr><td></td></tr>
371
+ <tr>
372
+ <td style="width: 2%"></td>
373
+ <!-- entry 8,1 -->
374
+ <td style="width: 10%"><a href="FreihandDataset.en.html"><img src="FreiHAND/teaser.png" width="120" alt=""/></a></td>
375
+ <td style="width: 20%; background-color: #f8f8f8;">
376
+ <table>
377
+ <tr>
378
+ <td style="width: 3%"></td>
379
+ <td style="width: 95%"><a href="FreihandDataset.en.html">FreiHAND Dataset</a></td>
380
+ <td style="width: 3%"></td>
381
+ </tr>
382
+ </table>
383
+ </td>
384
+ <td style="width: 2%"></td>
385
+ <!-- entry 8,2 -->
386
+ <td style="width: 10%"><a href="HanCo.en.html"><img src="hanco_teaser_small.png" width="120" height="60" alt=""/></a></td>
387
+ <td style="width: 20%; background-color: #f8f8f8;">
388
+ <table>
389
+ <tr>
390
+ <td style="width: 3%"></td>
391
+ <td style="width: 95%"><a href="HanCo.en.html">HanCo Dataset</a></td>
392
+ <td style="width: 3%"></td>
393
+ </tr>
394
+ </table>
395
+ </td>
396
+ </tr>
397
+
398
+ </tr>
399
+ <tr><td></td></tr>
400
+ <tr>
401
+ <td style="width: 2%"></td>
402
+ <!-- entry 9,1 -->
403
+ <td style="width: 10%; background-color: transparent;"><a href="KinectDatasets.en.html"><img src="kinect_teaser.jpg" width="120" alt=""/></a></td>
404
+ <td style="width: 20%; background-color: #f8f8f8;">
405
+ <table>
406
+ <tr>
407
+ <td style="width: 3%"></td>
408
+ <td style="width: 95%"><a href="KinectDatasets.en.html">Human Pose RGBD Datasets</a></td>
409
+ <td style="width: 3%"></td>
410
+ </tr>
411
+ </table>
412
+ </td>
413
+ <td style="width: 2%"></td>
414
+ <!-- entry 9,2 -->
415
+ <td style="width: 10%; background-color: transparent;"><a href="https://lmb.informatik.uni-freiburg.de/Publications/2023/BMGB23/"><img src="ovad/ovad_teaser.png" width="120" alt=""/></a></td>
416
+ <td style="width: 20%; background-color: #f8f8f8;">
417
+ <table>
418
+ <tr>
419
+ <td style="width: 3%"></td>
420
+ <td style="width: 95%"><a href="https://lmb.informatik.uni-freiburg.de/Publications/2023/BMGB23/">OVAD: Open-Vocabulary Attribute Detection Dataset</a></td>
421
+ <td style="width: 3%"></td>
422
+ </tr>
423
+ </table>
424
+ </td>
425
+
426
+ <tr><td></td></tr>
427
+ <td style="width: 2%"></td>
428
+ <!-- entry 10,1 -->
429
+ <td style="width: 10%; background-color: transparent;"><a href="ADE-OoD.html"><img src="adeood.png" width="120" alt=""/></a></td>
430
+ <td style="width: 20%; background-color: #f8f8f8;">
431
+ <table>
432
+ <tr>
433
+ <td style="width: 3%"></td>
434
+ <td style="width: 95%"><a href="ADE-OoD.html">ADE-OoD: a benchmark for dense Out-of-Distribution detection on natural images.</a></td>
435
+ <td style="width: 3%"></td>
436
+ </tr>
437
+ </table>
438
+ </td>
439
+ <td style="width: 2%">
440
+ </td>
441
+ </tr>
442
+
443
+ <!--
444
+ <tr><td></td></tr>
445
+ <tr>
446
+ <td style="width: 2%"></td>
447
+ <!-- entry 10,1 - ->
448
+ <td style="width: 10%"><a href=""><img src="" width="120" alt=""/></a></td>
449
+ <td style="width: 20%; background-color: #f8f8f8;">
450
+ <table>
451
+ <tr>
452
+ <td style="width: 3%"></td>
453
+ <td style="width: 95%"><a href="">Dataset</a></td>
454
+ <td style="width: 3%"></td>
455
+ </tr>
456
+ </table>
457
+ </td>
458
+ <td style="width: 2%"></td>
459
+ <!-- entry 10,2 - ->
460
+ <td style="width: 10%; background-color: transparent;"><a href=""><img src="" width="120" alt=""/></a></td>
461
+ <td style="width: 20%; background-color: #f8f8f8;">
462
+ <table>
463
+ <tr>
464
+ <td style="width: 3%"></td>
465
+ <td style="width: 95%"><a href="">Dataset</a></td>
466
+ <td style="width: 3%"></td>
467
+ </tr>
468
+ </table>
469
+ </td>
470
+ <td style="width: 2%">
471
+ </td>
472
+ </tr>
473
+ -->
474
+ </table>
475
+
476
+ <hr/>
477
+
478
+ <br>
479
+
480
+ <h1>FreiHAND Dataset</h1><p></p>
481
+
482
+ <b>News:</b> An extended version of this dataset with calibration and multiple-views is released in <a href="https://lmb.informatik.uni-freiburg.de/projects/contra-hand/">HanCo</a>.
483
+ <br>
484
+ <b>News:</b> Due to ungoing problems with the Codalab evaluation server we have decided to release the evaluation split annotations publicly on this page.
485
+ <br><br>
486
+
487
+ In our recent publication we presented the challenging <i>FreiHAND</i> dataset, a dataset for hand pose and shape estimation from single color image, which can serve both as training and benchmarking dataset for deep learning algorithms. It contains 4*32560 = 130240 training and 3960 evaluation samples. Each training sample provides:<br>
488
+ <table>
489
+ <tr><td width="20"></td> <td valign="top">- </td><td>RGB image (224x224 pixels)</td></tr>
490
+ <tr><td width="20"></td> <td valign="top">- </td><td>Hand segmentation mask (224x224 pixels)</td></tr>
491
+ <tr><td width="20"></td> <td valign="top">- </td><td>Intrinsic camera matrix K</td></tr>
492
+ <tr><td width="20"></td> <td valign="top">- </td><td>Hand scale (metric length of a reference bone)</td></tr>
493
+ <tr><td width="20"></td> <td valign="top">- </td><td>3D keypoint annotation for 21 Hand Keypoints</td></tr>
494
+ <tr><td width="20"></td> <td valign="top">- </td><td>3D shape annotation</td></tr>
495
+ </table>
496
+ The training set contains 32560 unique samples post processed in 4 different ways to remove the green screen background.
497
+ Each evaluation sample provides an RGB image, Hand scale and intrinsic camera matrix. The keypoint and shape annotation is withhold and scoring of algorithms is handled through our Codalab evaluation server.
498
+ For additional information please visit our <a href='https://lmb.informatik.uni-freiburg.de/projects/freihand/'>project page</a>.
499
+ <br><br>
500
+
501
+ <h1>Examples</h1><p></p>
502
+ <table>
503
+ <thead>
504
+ <tr>
505
+ <th style="text-align: left"> RGB </th>
506
+ <th style="text-align: left"> RGB + Keypoints </th>
507
+ <th style="text-align: left"> RGB + Shape </th>
508
+ <th> </th>
509
+ <th style="text-align: left"> RGB </th>
510
+ <th style="text-align: left"> RGB + Keypoints </th>
511
+ <th style="text-align: left"> RGB + Shape </th>
512
+ </tr>
513
+ </thead>
514
+ <tbody>
515
+ <tr>
516
+ <td> <img src='FreiHAND/001_rgb.png' width="100" title='rgb' alt='Image RGB'/> </td>
517
+ <td> <img src='FreiHAND/001_kp.png' width="100" title='rgb_kp' alt='Image RGB w keypoints'/> </td>
518
+ <td> <img src='FreiHAND/001_shape.png' width="100" title='rgb_shape' alt='Image RGB w shape'/> </td>
519
+ <td width="50"></td>
520
+ <td> <img src='FreiHAND/006_rgb.png' width="100" title='rgb' alt='Image RGB'/> </td>
521
+ <td> <img src='FreiHAND/006_kp.png' width="100" title='rgb_kp' alt='Image RGB w keypoints'/> </td>
522
+ <td> <img src='FreiHAND/006_shape.png' width="100" title='rgb_shape' alt='Image RGB w shape'/> </td>
523
+ </tr>
524
+
525
+ <tr>
526
+ <td> <img src='FreiHAND/010_rgb.png' width="100" title='rgb' alt='Image RGB'/> </td>
527
+ <td> <img src='FreiHAND/010_kp.png' width="100" title='rgb_kp' alt='Image RGB w keypoints'/> </td>
528
+ <td> <img src='FreiHAND/010_shape.png' width="100" title='rgb_shape' alt='Image RGB w shape'/> </td>
529
+ <td width="50"></td>
530
+ <td> <img src='FreiHAND/012_rgb.png' width="100" title='rgb' alt='Image RGB'/> </td>
531
+ <td> <img src='FreiHAND/012_kp.png' width="100" title='rgb_kp' alt='Image RGB w keypoints'/> </td>
532
+ <td> <img src='FreiHAND/012_shape.png' width="100" title='rgb_shape' alt='Image RGB w shape'/> </td>
533
+ </tr>
534
+
535
+ <tr>
536
+ <td> <img src='FreiHAND/018_rgb.png' width="100" title='rgb' alt='Image RGB'/> </td>
537
+ <td> <img src='FreiHAND/018_kp.png' width="100" title='rgb_kp' alt='Image RGB w keypoints'/> </td>
538
+ <td> <img src='FreiHAND/018_shape.png' width="100" title='rgb_shape' alt='Image RGB w shape'/> </td>
539
+ <td width="50"></td>
540
+ <td> <img src='FreiHAND/020_rgb.png' width="100" title='rgb' alt='Image RGB'/> </td>
541
+ <td> <img src='FreiHAND/020_kp.png' width="100" title='rgb_kp' alt='Image RGB w keypoints'/> </td>
542
+ <td> <img src='FreiHAND/020_shape.png' width="100" title='rgb_shape' alt='Image RGB w shape'/> </td>
543
+ </tr>
544
+
545
+ <tr>
546
+ <td> <img src='FreiHAND/025_rgb.png' width="100" title='rgb' alt='Image RGB'/> </td>
547
+ <td> <img src='FreiHAND/025_kp.png' width="100" title='rgb_kp' alt='Image RGB w keypoints'/> </td>
548
+ <td> <img src='FreiHAND/025_shape.png' width="100" title='rgb_shape' alt='Image RGB w shape'/> </td>
549
+ <td width="50"></td>
550
+ <td> <img src='FreiHAND/028_rgb.png' width="100" title='rgb' alt='Image RGB'/> </td>
551
+ <td> <img src='FreiHAND/028_kp.png' width="100" title='rgb_kp' alt='Image RGB w keypoints'/> </td>
552
+ <td> <img src='FreiHAND/028_shape.png' width="100" title='rgb_shape' alt='Image RGB w shape'/> </td>
553
+ </tr>
554
+ </tbody>
555
+ </table>
556
+
557
+ <br><br>
558
+
559
+ <hr>
560
+
561
+ <h3>Terms of use</h3><p></p>
562
+
563
+ This dataset is provided for research purposes only and without any warranty. Any commercial use is prohibited. If you use the dataset or parts of it in your research, you must cite the respective paper.<br><br>
564
+ <table>
565
+ <tr>
566
+ <td style='border-left: 2px solid #003592; padding: 0px 0px 0px 5px;'>
567
+ <pre style='font-size: 8pt; font-family: courier,sans-serif; margin: 3px auto;'>
568
+ @InProceedings{Freihand2019,
569
+ author = {Christian Zimmermann, Duygu Ceylan, Jimei Yang, Bryan Russell, Max Argus and Thomas Brox},
570
+ title = {FreiHAND: A Dataset for Markerless Capture of Hand Pose and Shape from Single RGB Images},
571
+ booktitle = {IEEE International Conference on Computer Vision (ICCV)},
572
+ year = {2019},
573
+ url = "https://lmb.informatik.uni-freiburg.de/projects/freihand/"
574
+ }</pre>
575
+ </td>
576
+ </tr>
577
+ </table>
578
+
579
+
580
+ <br><br>
581
+
582
+ <hr>
583
+
584
+ <h3>Dataset</h3><p></p>
585
+
586
+ For examples how to work with the dataset visit the accompanying <a href="https://github.com/lmb-freiburg/freihand">Github repository</a>. <br> <br>
587
+ <a href="../../data/freihand/FreiHAND_pub_v2.zip">Download FreiHAND Dataset v2 (3.7GB)</a><br>
588
+ <a href="../../data/freihand/FreiHAND_pub_v2_eval.zip">Download FreiHAND Dataset v2 - Evaluation set with annotations (724MB)</a>
589
+
590
+ <br><br><br>
591
+
592
+ <hr>
593
+
594
+ <h3>Contact</h3><p></p>
595
+
596
+ For questions about the dataset please contact
597
+ <a href="/people/zimmermc/">Christian Zimmermann</a>.
598
+
599
+ <br><br><br>
600
+
601
+
602
+ </div>
603
+ </div>
604
+
605
+ </td>
606
+ </tr>
607
+
608
+ <tr>
609
+ <td></td>
610
+ <td></td>
611
+
612
+ <!-- -->
613
+ <!-- rechter Teil und Fusszeile -->
614
+ <!-- -->
615
+ <td class="rightwrapperTable">
616
+ <div class="rightcolumnWrapper">
617
+ <div id="portal-footer">
618
+ <div id="im-footer">
619
+ <table>
620
+ <tr>
621
+ <td align="left">
622
+ <a href="/impressum.php" title="Impressum">Webmaster&nbsp;&nbsp;Disclaimer</a>
623
+ <a>|</a>
624
+ <a href="/privacy.php" title="Privacy Policy">Datenschutz</a>
625
+ </td>
626
+ <td align="right"> <a href="/impressum.php" title="Impressum"><font color="white">&copy; Copyright 2011 &ndash; 2026, LMB, University of Freiburg</font></a></td>
627
+ </tr>
628
+ </table>
629
+ </div> <!-- #im-footer -->
630
+ <div id="rightSpace">&nbsp;</div>
631
+ </div> <!-- #portal-footer -->
632
+ </div> <!-- #rightcolumnWrapper -->
633
+ </td> <!-- #rightwrapperTable -->
634
+ </tr>
635
+ </tbody>
636
+ </table> <!-- #wrapperTable -->
637
+ </div> <!-- #wrapper -->
638
+
639
+ </body>
640
+ </html>
FreiHAND/raw/script/setup_mano.py ADDED
@@ -0,0 +1,109 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from __future__ import print_function, unicode_literals
2
+ import argparse
3
+ import os
4
+ from tempfile import mkstemp
5
+ from shutil import move
6
+ from os import fdopen, remove
7
+ import hashlib
8
+ import shutil
9
+
10
+ def replace(file_path, line_ids, new_lines):
11
+ """ Replace a line in a given file with a new given line. """
12
+ line_ids = [i - 1 for i in line_ids]
13
+ # Create temp file
14
+ fh, abs_path = mkstemp()
15
+ with fdopen(fh,'w') as new_file:
16
+ with open(file_path) as old_file:
17
+ for i, line in enumerate(old_file):
18
+ if i in line_ids:
19
+ new_file.write(new_lines[line_ids.index(i)] + '\n')
20
+ else:
21
+ new_file.write(line)
22
+
23
+ #Remove original file
24
+ remove(file_path)
25
+
26
+ #Move new file
27
+ move(abs_path, file_path)
28
+
29
+ def md5(fname):
30
+ hash_md5 = hashlib.md5()
31
+ with open(fname, "rb") as f:
32
+ for chunk in iter(lambda: f.read(4096), b""):
33
+ hash_md5.update(chunk)
34
+ return hash_md5.hexdigest()
35
+
36
+ def _patch_mano_loader():
37
+ file = 'utils/mano_core/mano_loader.py'
38
+
39
+ replace(file, *zip(*
40
+ [
41
+ (26, ' from posemapper import posemap'),
42
+ (62, 'def load_model(fname_or_dict, ncomps=6, flat_hand_mean=False, v_template=None, use_pca=True):'),
43
+ (66, ' from verts import verts_core'),
44
+ (80, ' if use_pca:\n hands_components = smpl_data[''hands_components''] # PCA components\n else:\n hands_components = np.eye(45) # directly modify 15x3 articulation angles'),
45
+ (131,' result.dd = dd'),
46
+ ]
47
+ ))
48
+
49
+
50
+ def patch_files():
51
+ _patch_mano_loader()
52
+
53
+
54
+ if __name__ == '__main__':
55
+ parser = argparse.ArgumentParser(description='Import needed files from MANO repository.')
56
+ parser.add_argument('mano_path', type=str, help='Path to where the original MANO repository is located.')
57
+ parser.add_argument('--clear', action='store_true', help='Util call for me to remove mano files before committing.')
58
+ args = parser.parse_args()
59
+
60
+ # files we attempt to copy from the original mano repository
61
+ files_needed = [
62
+ 'models/MANO_RIGHT.pkl',
63
+ 'webuser/verts.py',
64
+ 'webuser/posemapper.py',
65
+ 'webuser/lbs.py',
66
+ 'webuser/smpl_handpca_wrapper_HAND_only.py',
67
+ ]
68
+
69
+ # how to rename them to be used in our repository
70
+ files_copy_to = [
71
+ 'data/MANO_RIGHT.pkl',
72
+ 'utils/mano_core/verts.py',
73
+ 'utils/mano_core/posemapper.py',
74
+ 'utils/mano_core/lbs.py',
75
+ 'utils/mano_core/mano_loader.py',
76
+ ]
77
+
78
+ if args.clear:
79
+ for f in files_copy_to:
80
+ if os.path.exists(f):
81
+ os.remove(f)
82
+ if '.py' in f:
83
+ f2 = f.replace('.py', '.pyc')
84
+ if os.path.exists(f2):
85
+ os.remove(f2)
86
+ print('Repository cleaned.')
87
+ exit()
88
+
89
+ # check input files
90
+ files_needed = [os.path.join(args.mano_path, f) for f in files_needed]
91
+ assert all([os.path.exists(f) for f in files_needed]), 'Could not find one of the needed MANO files in the directory you provided.'
92
+
93
+ # coursely check content
94
+ hash_ground_truth = [
95
+ 'fd5a9d35f914987cf1cc04ffe338caa1',
96
+ '998c30fd83c473da6178aa2cb23b6a5d',
97
+ 'c5e9eacc535ec7d03060e0c8d6f80f45',
98
+ 'd11c767d5db8d4a55b4ece1c46a4e4ac',
99
+ '5afc7a3eb1a6ce0c2dac1483338a5f58'
100
+ ]
101
+ assert all([md5(f) == gt for f, gt in zip(files_needed, hash_ground_truth)]), 'Hash sum of provided files differs from what was expected.'
102
+
103
+ # copy files
104
+ for a, b in zip(files_needed, files_copy_to):
105
+ shutil.copy2(a, b)
106
+
107
+ # some files need to be modified
108
+ patch_files()
109
+
FreiHAND/raw/script/utils/fh_utils.py ADDED
@@ -0,0 +1,187 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from __future__ import print_function, unicode_literals
2
+ import numpy as np
3
+ import json
4
+ import os
5
+ import time
6
+ import skimage.io as io
7
+
8
+
9
+ """ General util functions. """
10
+ def _assert_exist(p):
11
+ msg = 'File does not exists: %s' % p
12
+ assert os.path.exists(p), msg
13
+
14
+
15
+ def json_load(p):
16
+ _assert_exist(p)
17
+ with open(p, 'r') as fi:
18
+ d = json.load(fi)
19
+ return d
20
+
21
+ def projectPoints(xyz, K):
22
+ """ Project 3D coordinates into image space. """
23
+ xyz = np.array(xyz)
24
+ K = np.array(K)
25
+ uv = np.matmul(K, xyz.T).T
26
+ return uv[:, :2] / uv[:, -1:]
27
+
28
+
29
+
30
+ """ Draw functions. """
31
+ def plot_hand(axis, coords_hw, vis=None, color_fixed=None, linewidth='1', order='hw', draw_kp=True):
32
+ """ Plots a hand stick figure into a matplotlib figure. """
33
+ if order == 'uv':
34
+ coords_hw = coords_hw[:, ::-1]
35
+
36
+ colors = np.array([[0.4, 0.4, 0.4],
37
+ [0.4, 0.0, 0.0],
38
+ [0.6, 0.0, 0.0],
39
+ [0.8, 0.0, 0.0],
40
+ [1.0, 0.0, 0.0],
41
+ [0.4, 0.4, 0.0],
42
+ [0.6, 0.6, 0.0],
43
+ [0.8, 0.8, 0.0],
44
+ [1.0, 1.0, 0.0],
45
+ [0.0, 0.4, 0.2],
46
+ [0.0, 0.6, 0.3],
47
+ [0.0, 0.8, 0.4],
48
+ [0.0, 1.0, 0.5],
49
+ [0.0, 0.2, 0.4],
50
+ [0.0, 0.3, 0.6],
51
+ [0.0, 0.4, 0.8],
52
+ [0.0, 0.5, 1.0],
53
+ [0.4, 0.0, 0.4],
54
+ [0.6, 0.0, 0.6],
55
+ [0.7, 0.0, 0.8],
56
+ [1.0, 0.0, 1.0]])
57
+
58
+ colors = colors[:, ::-1]
59
+
60
+ # define connections and colors of the bones
61
+ bones = [((0, 1), colors[1, :]),
62
+ ((1, 2), colors[2, :]),
63
+ ((2, 3), colors[3, :]),
64
+ ((3, 4), colors[4, :]),
65
+
66
+ ((0, 5), colors[5, :]),
67
+ ((5, 6), colors[6, :]),
68
+ ((6, 7), colors[7, :]),
69
+ ((7, 8), colors[8, :]),
70
+
71
+ ((0, 9), colors[9, :]),
72
+ ((9, 10), colors[10, :]),
73
+ ((10, 11), colors[11, :]),
74
+ ((11, 12), colors[12, :]),
75
+
76
+ ((0, 13), colors[13, :]),
77
+ ((13, 14), colors[14, :]),
78
+ ((14, 15), colors[15, :]),
79
+ ((15, 16), colors[16, :]),
80
+
81
+ ((0, 17), colors[17, :]),
82
+ ((17, 18), colors[18, :]),
83
+ ((18, 19), colors[19, :]),
84
+ ((19, 20), colors[20, :])]
85
+
86
+ if vis is None:
87
+ vis = np.ones_like(coords_hw[:, 0]) == 1.0
88
+
89
+ for connection, color in bones:
90
+ if (vis[connection[0]] == False) or (vis[connection[1]] == False):
91
+ continue
92
+
93
+ coord1 = coords_hw[connection[0], :]
94
+ coord2 = coords_hw[connection[1], :]
95
+ coords = np.stack([coord1, coord2])
96
+ if color_fixed is None:
97
+ axis.plot(coords[:, 1], coords[:, 0], color=color, linewidth=linewidth)
98
+ else:
99
+ axis.plot(coords[:, 1], coords[:, 0], color_fixed, linewidth=linewidth)
100
+
101
+ if not draw_kp:
102
+ return
103
+
104
+ for i in range(21):
105
+ if vis[i] > 0.5:
106
+ axis.plot(coords_hw[i, 1], coords_hw[i, 0], 'o', color=colors[i, :])
107
+
108
+
109
+ """ Dataset related functions. """
110
+ def db_size(set_name):
111
+ """ Hardcoded size of the datasets. """
112
+ if set_name == 'training':
113
+ return 32560 # number of unique samples (they exists in multiple 'versions')
114
+ elif set_name == 'evaluation':
115
+ return 3960
116
+ else:
117
+ assert 0, 'Invalid choice.'
118
+
119
+
120
+ def load_db_annotation(base_path, set_name=None):
121
+ if set_name is None:
122
+ # only training set annotations are released so this is a valid default choice
123
+ set_name = 'training'
124
+
125
+ print('Loading FreiHAND dataset index ...')
126
+ t = time.time()
127
+
128
+ # assumed paths to data containers
129
+ k_path = os.path.join(base_path, '%s_K.json' % set_name)
130
+ mano_path = os.path.join(base_path, '%s_mano.json' % set_name)
131
+ xyz_path = os.path.join(base_path, '%s_xyz.json' % set_name)
132
+
133
+ # load if exist
134
+ K_list = json_load(k_path)
135
+ mano_list = json_load(mano_path)
136
+ xyz_list = json_load(xyz_path)
137
+
138
+ # should have all the same length
139
+ assert len(K_list) == len(mano_list), 'Size mismatch.'
140
+ assert len(K_list) == len(xyz_list), 'Size mismatch.'
141
+
142
+ print('Loading of %d samples done in %.2f seconds' % (len(K_list), time.time()-t))
143
+ return zip(K_list, mano_list, xyz_list)
144
+
145
+
146
+ class sample_version:
147
+ gs = 'gs' # green screen
148
+ hom = 'hom' # homogenized
149
+ sample = 'sample' # auto colorization with sample points
150
+ auto = 'auto' # auto colorization without sample points: automatic color hallucination
151
+
152
+ db_size = db_size('training')
153
+
154
+ @classmethod
155
+ def valid_options(cls):
156
+ return [cls.gs, cls.hom, cls.sample, cls.auto]
157
+
158
+
159
+ @classmethod
160
+ def check_valid(cls, version):
161
+ msg = 'Invalid choice: "%s" (must be in %s)' % (version, cls.valid_options())
162
+ assert version in cls.valid_options(), msg
163
+
164
+ @classmethod
165
+ def map_id(cls, id, version):
166
+ cls.check_valid(version)
167
+ return id + cls.db_size*cls.valid_options().index(version)
168
+
169
+
170
+ def read_img(idx, base_path, set_name, version=None):
171
+ if version is None:
172
+ version = sample_version.gs
173
+
174
+ if set_name == 'evaluation':
175
+ assert version == sample_version.gs, 'This the only valid choice for samples from the evaluation split.'
176
+
177
+ img_rgb_path = os.path.join(base_path, set_name, 'rgb',
178
+ '%08d.jpg' % sample_version.map_id(idx, version))
179
+ _assert_exist(img_rgb_path)
180
+ return io.imread(img_rgb_path)
181
+
182
+
183
+ def read_msk(idx, base_path):
184
+ mask_path = os.path.join(base_path, 'training', 'mask',
185
+ '%08d.jpg' % idx)
186
+ _assert_exist(mask_path)
187
+ return io.imread(mask_path)
FreiHAND/raw/script/utils/mano_utils.py ADDED
@@ -0,0 +1,35 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import chumpy as ch
2
+ import numpy as np
3
+
4
+ kpId2vertices = {
5
+ 4: [744], #ThumbT
6
+ 8: [320], #IndexT
7
+ 12: [443], #MiddleT
8
+ 16: [555], #RingT
9
+ 20: [672] #PinkT
10
+ }
11
+
12
+
13
+ def get_keypoints_from_mesh_ch(mesh_vertices, keypoints_regressed):
14
+ """ Assembles the full 21 keypoint set from the 16 Mano Keypoints and 5 mesh vertices for the fingers. """
15
+ keypoints = [0.0 for _ in range(21)] # init empty list
16
+
17
+ # fill keypoints which are regressed
18
+ mapping = {0: 0, #Wrist
19
+ 1: 5, 2: 6, 3: 7, #Index
20
+ 4: 9, 5: 10, 6: 11, #Middle
21
+ 7: 17, 8: 18, 9: 19, # Pinky
22
+ 10: 13, 11: 14, 12: 15, # Ring
23
+ 13: 1, 14: 2, 15: 3} # Thumb
24
+
25
+ for manoId, myId in mapping.items():
26
+ keypoints[myId] = keypoints_regressed[manoId, :]
27
+
28
+ # get other keypoints from mesh
29
+ for myId, meshId in kpId2vertices.items():
30
+ keypoints[myId] = ch.mean(mesh_vertices[meshId, :], 0)
31
+
32
+ keypoints = ch.vstack(keypoints)
33
+
34
+ return keypoints
35
+
FreiHAND/raw/script/utils/model.py ADDED
@@ -0,0 +1,182 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from __future__ import unicode_literals, print_function
2
+ import transforms3d as t3d
3
+ import pickle
4
+ import chumpy as ch
5
+ import numpy as np
6
+ from opendr.lighting import LambertianPointLight
7
+ try:
8
+ from utils.mano_core.mano_loader import load_model
9
+ from utils.mano_core.lbs import global_rigid_transformation
10
+ from utils.mano_utils import get_keypoints_from_mesh_ch
11
+ except ImportError as e:
12
+ raise ImportError('%s \nDid you set up the repository for advanced use?' % e)
13
+
14
+
15
+ renderer = None
16
+ def pose_hand(mano, K, use_mean_pose=True):
17
+ global renderer
18
+ if renderer is None:
19
+ renderer = HandModel(use_mean_pca=False, use_mean_pose=use_mean_pose)
20
+
21
+ # split mano parameters
22
+ poses, shapes, uv_root, scale = split_theta(mano)
23
+ focal, pp = get_focal_pp(K)
24
+ xyz_root = recover_root(uv_root, scale, focal, pp)
25
+
26
+ # set up the hand model and feed hand parameters
27
+ renderer.pose_by_root(xyz_root[0], poses[0], shapes[0])
28
+ V, F = renderer._get_verts_faces()
29
+ xyz = renderer._calc_coords()
30
+ return np.array(xyz), np.array(V)
31
+
32
+
33
+ def split_theta(theta):
34
+ poses = theta[:, :48]
35
+ shapes = theta[:, 48:58]
36
+ uv_root = theta[:, 58:60]
37
+ scale = theta[:, 60:]
38
+ return poses, shapes, uv_root, scale
39
+
40
+ def get_focal_pp(K):
41
+ """ Extract the camera parameters that are relevant for an orthographic assumption. """
42
+ focal = 0.5 * (K[0, 0] + K[1, 1])
43
+ pp = K[:2, 2]
44
+ return focal, pp
45
+
46
+
47
+ def backproject_ortho(uv, scale, # kind of the predictions
48
+ focal, pp): # kind of the camera calibration
49
+ """ Calculate 3D coordinates from 2D coordinates and the camera parameters. """
50
+ uv = uv.copy()
51
+ uv -= pp
52
+ xyz = np.concatenate([np.reshape(uv, [-1, 2]),
53
+ np.ones_like(uv[:, :1])*focal], 1)
54
+ xyz /= scale
55
+ return xyz
56
+
57
+
58
+ def recover_root(uv_root, scale,
59
+ focal, pp):
60
+ uv_root = np.reshape(uv_root, [1, 2])
61
+ xyz_root = backproject_ortho(uv_root, scale, focal, pp)
62
+ return xyz_root
63
+
64
+
65
+ class HandModel(object):
66
+ def __init__(self, use_mean_pca=False, use_mean_pose=False):
67
+ if use_mean_pca:
68
+ self.model = load_model('./data/MANO_RIGHT.pkl', ncomps=6, flat_hand_mean=not use_mean_pose,
69
+ use_pca=True)
70
+ else:
71
+ self.model = load_model('./data/MANO_RIGHT.pkl', ncomps=45, flat_hand_mean=not use_mean_pose,
72
+ use_pca=False)
73
+
74
+ self.global_trans = ch.array([0.0, 0.0, 0.3])
75
+
76
+ def _get_verts_faces(self):
77
+ V = self.model + self.global_trans
78
+ F = self.model.f
79
+ return V, F
80
+
81
+ def _calc_coords(self):
82
+ # calculate joint location and rotation
83
+ V, _ = self._get_verts_faces()
84
+ J_regressor = self.model.dd['J_regressor']
85
+ Jtr_x = ch.MatVecMult(J_regressor, V[:, 0])
86
+ Jtr_y = ch.MatVecMult(J_regressor, V[:, 1])
87
+ Jtr_z = ch.MatVecMult(J_regressor, V[:, 2])
88
+ Jtr = ch.vstack([Jtr_x, Jtr_y, Jtr_z]).T
89
+ coords_kp_xyz = get_keypoints_from_mesh_ch(V, Jtr)
90
+ return coords_kp_xyz
91
+
92
+ def pose_by_root(self, xyz_root, poses, shapes, root_id=9):
93
+ """ Poses the MANO model according to the root keypoint given. """
94
+ self.model.pose[:] = poses # set estimated articulation
95
+ self.model.betas[:] = shapes # set estimated shape
96
+ self.global_trans[:] = 0.0
97
+
98
+ # how to chose translation
99
+ xyz = np.array(self._calc_coords())
100
+ global_t = xyz_root - xyz[root_id] # new - old root keypoint
101
+
102
+ # apply changes
103
+ self.global_trans[:] = global_t
104
+
105
+ def render(self, cam_intrinsics, dist=None, M=None, img_shape=None, render_mask=False):
106
+ from opendr.camera import ProjectPoints
107
+ from utils.renderer import ColoredRenderer
108
+
109
+ if dist is None:
110
+ dist = np.zeros(5)
111
+ dist = dist.flatten()
112
+ if M is None:
113
+ M = np.eye(4)
114
+
115
+ # get R, t from M (has to be world2cam)
116
+ R = M[:3, :3]
117
+ ax, angle = t3d.axangles.mat2axangle(R)
118
+ rt = ax*angle
119
+ rt = rt.flatten()
120
+ t = M[:3, 3]
121
+
122
+ w, h = (320, 320)
123
+ if img_shape is not None:
124
+ w, h = img_shape[1], img_shape[0]
125
+
126
+ pp = np.array([cam_intrinsics[0, 2], cam_intrinsics[1, 2]])
127
+ f = np.array([cam_intrinsics[0, 0], cam_intrinsics[1, 1]])
128
+
129
+ # Create OpenDR renderer
130
+ rn = ColoredRenderer()
131
+
132
+ # Assign attributes to renderer
133
+ rn.camera = ProjectPoints(rt=rt,
134
+ t=t, # camera translation
135
+ f=f, # focal lengths
136
+ c=pp, # camera center (principal point)
137
+ k=dist) # OpenCv distortion params
138
+ rn.frustum = {'near': 0.1, 'far': 5., 'width': w, 'height': h}
139
+
140
+ V, F = self._get_verts_faces()
141
+ rn.set(v=V,
142
+ f=F,
143
+ bgcolor=np.zeros(3))
144
+
145
+ if render_mask:
146
+ rn.vc = np.ones_like(V) #for segmentation mask like rendering
147
+ else:
148
+ colors = np.ones_like(V)
149
+
150
+ # Construct point light sources
151
+ rn.vc = LambertianPointLight(f=F,
152
+ v=V,
153
+ num_verts=V.shape[0],
154
+ light_pos=np.array([-1000, -1000, -2000]),
155
+ vc=0.8 * colors,
156
+ light_color=np.array([1., 1., 1.]))
157
+
158
+ rn.vc += LambertianPointLight(f=F,
159
+ v=V,
160
+ num_verts=V.shape[0],
161
+ light_pos=np.array([1000, 1000, -2000]),
162
+ vc=0.25 * colors,
163
+ light_color=np.array([1., 1., 1.]))
164
+
165
+ rn.vc += LambertianPointLight(f=F,
166
+ v=V,
167
+ num_verts=V.shape[0],
168
+ light_pos=np.array([2000, 2000, 2000]),
169
+ vc=0.1 * colors,
170
+ light_color=np.array([1., 1., 1.]))
171
+
172
+ rn.vc += LambertianPointLight(f=F,
173
+ v=V,
174
+ num_verts=V.shape[0],
175
+ light_pos=np.array([-2000, -2000, 2000]),
176
+ vc=0.1 * colors,
177
+ light_color=np.array([1., 1., 1.]))
178
+
179
+ # render
180
+ img = (np.array(rn.r) * 255).astype(np.uint8)
181
+ return img
182
+
FreiHAND/raw/script/view_samples.py ADDED
@@ -0,0 +1,109 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from __future__ import print_function, unicode_literals
2
+ import matplotlib.pyplot as plt
3
+ import argparse
4
+
5
+ from utils.fh_utils import *
6
+
7
+
8
+ def show_training_samples(base_path, version, num2show=None, render_mano=False):
9
+ if render_mano:
10
+ from utils.model import HandModel, recover_root, get_focal_pp, split_theta
11
+
12
+ if num2show == -1:
13
+ num2show = db_size('training') # show all
14
+
15
+ # load annotations
16
+ db_data_anno = load_db_annotation(base_path, 'training')
17
+
18
+ # iterate over all samples
19
+ for idx in range(db_size('training')):
20
+ if idx >= num2show:
21
+ break
22
+
23
+ # load image and mask
24
+ img = read_img(idx, base_path, 'training', version)
25
+ msk = read_msk(idx, base_path)
26
+
27
+ # annotation for this frame
28
+ K, mano, xyz = db_data_anno[idx]
29
+ K, mano, xyz = [np.array(x) for x in [K, mano, xyz]]
30
+ uv = projectPoints(xyz, K)
31
+
32
+ # render an image of the shape
33
+ msk_rendered = None
34
+ if render_mano:
35
+ # split mano parameters
36
+ poses, shapes, uv_root, scale = split_theta(mano)
37
+ focal, pp = get_focal_pp(K)
38
+ xyz_root = recover_root(uv_root, scale, focal, pp)
39
+
40
+ # set up the hand model and feed hand parameters
41
+ renderer = HandModel(use_mean_pca=False, use_mean_pose=True)
42
+ renderer.pose_by_root(xyz_root[0], poses[0], shapes[0])
43
+ msk_rendered = renderer.render(K, img_shape=img.shape[:2])
44
+
45
+ # show
46
+ fig = plt.figure()
47
+ ax1 = fig.add_subplot(121)
48
+ ax2 = fig.add_subplot(122)
49
+ ax1.imshow(img)
50
+ ax2.imshow(msk if msk_rendered is None else msk_rendered)
51
+ plot_hand(ax1, uv, order='uv')
52
+ plot_hand(ax2, uv, order='uv')
53
+ ax1.axis('off')
54
+ ax2.axis('off')
55
+ plt.show()
56
+
57
+
58
+ def show_eval_samples(base_path, num2show=None):
59
+ if num2show == -1:
60
+ num2show = db_size('evaluation') # show all
61
+
62
+ for idx in range(db_size('evaluation')):
63
+ if idx >= num2show:
64
+ break
65
+
66
+ # load image only, because for the evaluation set there is no mask
67
+ img = read_img(idx, base_path, 'evaluation')
68
+
69
+ # show
70
+ fig = plt.figure()
71
+ ax1 = fig.add_subplot(111)
72
+ ax1.imshow(img)
73
+ ax1.axis('off')
74
+ plt.show()
75
+
76
+
77
+ if __name__ == '__main__':
78
+ parser = argparse.ArgumentParser(description='Show some samples from the dataset.')
79
+ parser.add_argument('base_path', type=str,
80
+ help='Path to where the FreiHAND dataset is located.')
81
+ parser.add_argument('--show_eval', action='store_true',
82
+ help='Shows samples from the evaluation split if flag is set, shows training split otherwise.')
83
+ parser.add_argument('--mano', action='store_true',
84
+ help='Enables rendering of the hand if mano is available. See README for details.')
85
+ parser.add_argument('--num2show', type=int, default=-1,
86
+ help='Number of samples to show. ''-1'' defaults to show all.')
87
+ parser.add_argument('--sample_version', type=str, default=sample_version.gs,
88
+ help='Which sample version to use when showing the training set.'
89
+ ' Valid choices are %s' % sample_version.valid_options())
90
+ args = parser.parse_args()
91
+
92
+ # check inputs
93
+ msg = 'Invalid choice: ''%s''. Must be in %s' % (args.sample_version, sample_version.valid_options())
94
+ assert args.sample_version in sample_version.valid_options(), msg
95
+
96
+ if args.show_eval:
97
+ """ Show some evaluation samples. """
98
+ show_eval_samples(args.base_path,
99
+ num2show=args.num2show)
100
+
101
+ else:
102
+ """ Show some training samples. """
103
+ show_training_samples(
104
+ args.base_path,
105
+ args.sample_version,
106
+ num2show=args.num2show,
107
+ render_mano=args.mano
108
+ )
109
+