test.py 23.3 KB
Newer Older
Pedro TOME's avatar
Pedro TOME committed
1
2
#!/usr/bin/env python
# vim: set fileencoding=utf-8 :
3
# Pedro Tome <Pedro.Tome@idiap.ch>
Pedro TOME's avatar
Pedro TOME committed
4
5
# Laurent El Shafey <laurent.el-shafey@idiap.ch>
#
6
# Copyright (C) 2014 Idiap Research Institute, Martigny, Switzerland
Pedro TOME's avatar
Pedro TOME committed
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, version 3 of the License.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.

"""A few checks at the UTFVP database.
"""

import os, sys
import unittest
Pedro TOME's avatar
Pedro TOME committed
25
26
import bob.db.base
import bob.db.utfvp
Pedro TOME's avatar
Pedro TOME committed
27
28
29
30
31
32

class UTFVPDatabaseTest(unittest.TestCase):
  """Performs various tests on the UTFVP database."""

  def test01_clients(self):
    # test whether the correct number of clients is returned
Pedro TOME's avatar
Pedro TOME committed
33
    db = bob.db.utfvp.Database()
34
35
36
37
    
    self.assertEqual(len(db.groups()), 3)
    self.assertEqual(len(db.protocols()), 8)
    self.assertEqual(len(db.protocol_names()), 8)
Pedro TOME's avatar
Pedro TOME committed
38
39
40
    self.assertEqual(len(db.purposes()), 3)

    self.assertEqual(len(db.clients()), 360)
41
42
43
44
45
46
47
48
49
    self.assertEqual(len(db.clients(protocol='1vsall')), 360)
    self.assertEqual(len(db.clients(protocol='nom')), 360)
    self.assertEqual(len(db.clients(protocol='nomLeftRing')), 60)
    self.assertEqual(len(db.clients(protocol='nomLeftMiddle')), 60)
    self.assertEqual(len(db.clients(protocol='nomLeftIndex')), 60)
    self.assertEqual(len(db.clients(protocol='nomRightIndex')), 60)
    self.assertEqual(len(db.clients(protocol='nomRightMiddle')), 60)
    self.assertEqual(len(db.clients(protocol='nomRightRing')), 60)
    
Pedro TOME's avatar
Pedro TOME committed
50
    self.assertEqual(len(db.client_ids()), 360)
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
    self.assertEqual(len(db.client_ids(protocol='1vsall')), 360)
    self.assertEqual(len(db.client_ids(protocol='nom')), 360)
    self.assertEqual(len(db.client_ids(protocol='nomLeftRing')), 60)
    self.assertEqual(len(db.client_ids(protocol='nomLeftMiddle')), 60)
    self.assertEqual(len(db.client_ids(protocol='nomLeftIndex')), 60)
    self.assertEqual(len(db.client_ids(protocol='nomRightIndex')), 60)
    self.assertEqual(len(db.client_ids(protocol='nomRightMiddle')), 60)
    self.assertEqual(len(db.client_ids(protocol='nomRightRing')), 60)

    self.assertEqual(len(db.models()), 1900) #1300 + 300 + 50 * 6
    self.assertEqual(len(db.models(protocol='1vsall')), 1300)
    self.assertEqual(len(db.models(protocol='nom')), 300)
    self.assertEqual(len(db.models(protocol='nomLeftRing')), 50)
    self.assertEqual(len(db.models(protocol='nomLeftMiddle')), 50)
    self.assertEqual(len(db.models(protocol='nomLeftIndex')), 50)
    self.assertEqual(len(db.models(protocol='nomRightIndex')), 50)
    self.assertEqual(len(db.models(protocol='nomRightMiddle')), 50)
    self.assertEqual(len(db.models(protocol='nomRightRing')), 50)

    self.assertEqual(len(db.model_ids()), 1900) #1300 + 300 + 50 * 6
    self.assertEqual(len(db.model_ids(protocol='1vsall')), 1300)
    self.assertEqual(len(db.model_ids(protocol='nom')), 300)
    self.assertEqual(len(db.model_ids(protocol='nom', groups='dev')), 108) #18 subjects *6 fingers
    self.assertEqual(len(db.model_ids(protocol='nom', groups='eval')), 192) #32 subjects *6 fingers

    self.assertEqual(len(db.model_ids(protocol='nomLeftRing')), 50)
    self.assertEqual(len(db.model_ids(protocol='nomLeftRing', groups='dev')), 18) 
    self.assertEqual(len(db.model_ids(protocol='nomLeftRing', groups='eval')), 32)

    self.assertEqual(len(db.model_ids(protocol='nomLeftMiddle')), 50)
    self.assertEqual(len(db.model_ids(protocol='nomLeftMiddle', groups='dev')), 18)
    self.assertEqual(len(db.model_ids(protocol='nomLeftMiddle', groups='eval')), 32)

    self.assertEqual(len(db.model_ids(protocol='nomLeftIndex')), 50)
    self.assertEqual(len(db.model_ids(protocol='nomLeftIndex', groups='dev')), 18)
    self.assertEqual(len(db.model_ids(protocol='nomLeftIndex', groups='eval')), 32)
Pedro TOME's avatar
Pedro TOME committed
87

88
89
90
91
92
93
94
95
96
97
98
    self.assertEqual(len(db.model_ids(protocol='nomRightIndex')), 50)
    self.assertEqual(len(db.model_ids(protocol='nomRightIndex', groups='dev')), 18)
    self.assertEqual(len(db.model_ids(protocol='nomRightIndex', groups='eval')), 32)

    self.assertEqual(len(db.model_ids(protocol='nomRightMiddle')), 50)
    self.assertEqual(len(db.model_ids(protocol='nomRightMiddle', groups='dev')), 18)
    self.assertEqual(len(db.model_ids(protocol='nomRightMiddle', groups='eval')), 32)

    self.assertEqual(len(db.model_ids(protocol='nomRightRing')), 50)
    self.assertEqual(len(db.model_ids(protocol='nomRightRing', groups='dev')), 18)
    self.assertEqual(len(db.model_ids(protocol='nomRightRing', groups='eval')), 32)
Pedro TOME's avatar
Pedro TOME committed
99
100


Pedro TOME's avatar
Pedro TOME committed
101
  def test021_objects(self):
Pedro TOME's avatar
Pedro TOME committed
102
    # tests if the right number of File objects is returned
Pedro TOME's avatar
Pedro TOME committed
103
    db = bob.db.utfvp.Database()
104
105
106
107
108
109
110
111
112
113
114
    
    # Protocol '1vsall'
    self.assertEqual(len(db.objects(protocol='1vsall')), 1440) #1440 - 60 users * 6 fingers * 4 acq

    # World group
    self.assertEqual(len(db.objects(protocol='1vsall', groups='world')), 140) #35 fingers * 4 acq
    self.assertEqual(len(db.objects(protocol='1vsall', groups='world', purposes='train')), 140) #35 fingers * 4 acq

    # Dev group
    self.assertEqual(len(db.objects(protocol='1vsall', groups='dev')), 1300) #(1440-140)
    self.assertEqual(len(db.objects(protocol='1vsall', groups='dev', model_ids=('1_2_3',))), 1300)
Pedro TOME's avatar
Pedro TOME committed
115
116
    self.assertEqual(len(db.objects(protocol='1vsall', groups='dev', purposes='enroll')), 1300)
    self.assertEqual(len(db.objects(protocol='1vsall', groups='dev', model_ids=('1_2_3',), purposes='enroll')), 1)
117
118
119
    self.assertEqual(len(db.objects(protocol='1vsall', groups='dev', model_ids=('1_2_3',), purposes='probe')), 1299)
    self.assertEqual(len(db.objects(protocol='1vsall', groups='dev', purposes='probe', classes='impostor')), 1300)
    self.assertEqual(len(db.objects(protocol='1vsall', groups='dev', model_ids=('1_2_3',), purposes='probe', classes='client')), 3) # 4 acq - 1
Pedro TOME's avatar
Pedro TOME committed
120
121
122
123
124
125
126
    self.assertEqual(len(db.objects(protocol='1vsall', groups='dev', model_ids=('1_2_3',), purposes='probe', classes='impostor')), 1296) #1300 - 4 acq     

  def test022_objects(self):
    # tests if the right number of File objects is returned
    db = bob.db.utfvp.Database()
    
    
127
128
129
130
131
132
133
134
135
136
137
    #####################################################
    # Protocol 'nom'
    self.assertEqual(len(db.objects(protocol='nom')), 1440) #1440 - 60 subjects * 6 fingers * 4 acq

    # World group
    self.assertEqual(len(db.objects(protocol='nom', groups='world')), 240) #10 users * 6 fingers * 4 acq
    self.assertEqual(len(db.objects(protocol='nom', groups='world', purposes='train')), 240) #10 users * 6 fingers * 4 acq
    
    # Dev group
    self.assertEqual(len(db.objects(protocol='nom', groups='dev')), 432) #18 users * 6 fingers * 4 acq
    self.assertEqual(len(db.objects(protocol='nom', groups='dev', model_ids=('11_2',))), 218) #18 users * 6 fingers * 2 acq + 2
Pedro TOME's avatar
Pedro TOME committed
138
139
    self.assertEqual(len(db.objects(protocol='nom', groups='dev', purposes='enroll')), 216) #18 users * 6 fingers * 2 acq 
    self.assertEqual(len(db.objects(protocol='nom', groups='dev', model_ids=('11_2',), purposes='enroll')), 2)
140
141
142
143
144
145
146
    self.assertEqual(len(db.objects(protocol='nom', groups='dev', model_ids=('11_2',), purposes='probe')), 216) #18 users * 6 fingers * 2 acq 
    self.assertEqual(len(db.objects(protocol='nom', groups='dev', model_ids=('11_2',), purposes='probe', classes='client')), 2)
    self.assertEqual(len(db.objects(protocol='nom', groups='dev', model_ids=('11_2',), purposes='probe', classes='impostor')), 214) #384 - 2 
        
    # Eval group
    self.assertEqual(len(db.objects(protocol='nom', groups='eval')), 768) #32 users * 6 fingers * 4 acq  
    self.assertEqual(len(db.objects(protocol='nom', groups='eval', model_ids=('30_2',))), 386) #32 users * 6 fingers * 2 acq + 2  
Pedro TOME's avatar
Pedro TOME committed
147
148
    self.assertEqual(len(db.objects(protocol='nom', groups='eval', purposes='enroll')), 384) #18 users * 6 fingers * 2 acq 
    self.assertEqual(len(db.objects(protocol='nom', groups='eval', model_ids=('30_2',), purposes='enroll')), 2) 
149
150
151
152
    self.assertEqual(len(db.objects(protocol='nom', groups='eval', model_ids=('30_2',), purposes='probe')), 384) #18 users * 6 fingers * 2 acq 
    self.assertEqual(len(db.objects(protocol='nom', groups='eval', model_ids=('30_2',), purposes='probe', classes='client')), 2)
    self.assertEqual(len(db.objects(protocol='nom', groups='eval', model_ids=('30_2',), purposes='probe', classes='impostor')), 382) #384 - 2 
    
Pedro TOME's avatar
Pedro TOME committed
153

Pedro TOME's avatar
Pedro TOME committed
154
155
156
157
  def test023_objects(self):
    # tests if the right number of File objects is returned
    db = bob.db.utfvp.Database()
        
158
159
160
    #####################################################
    # Protocol 'nomLeftRing'
    self.assertEqual(len(db.objects(protocol='nomLeftRing')), 240) #1440 - 60 subjects * 1 fingers * 4 acq
Pedro TOME's avatar
Pedro TOME committed
161

162
163
164
165
166
167
168
    # World group
    self.assertEqual(len(db.objects(protocol='nomLeftRing', groups='world')), 40) #10 users * 1 fingers * 4 acq
    self.assertEqual(len(db.objects(protocol='nomLeftRing', groups='world', purposes='train')), 40) #10 users * 1 fingers * 4 acq
    
    # Dev group
    self.assertEqual(len(db.objects(protocol='nomLeftRing', groups='dev')), 72) #18 users * 1 fingers * 4 acq
    self.assertEqual(len(db.objects(protocol='nomLeftRing', groups='dev', model_ids=('11_1',))), 38) #18 users * 1 fingers * 2 acq + 2
Pedro TOME's avatar
Pedro TOME committed
169
170
    self.assertEqual(len(db.objects(protocol='nomLeftRing', groups='dev', purposes='enroll')), 36) #18 users * 1 fingers * 2 acq 
    self.assertEqual(len(db.objects(protocol='nomLeftRing', groups='dev', model_ids=('11_1',), purposes='enroll')), 2)
171
172
173
174
175
176
177
    self.assertEqual(len(db.objects(protocol='nomLeftRing', groups='dev', model_ids=('11_1',), purposes='probe')), 36) #18 users * 1 fingers * 2 acq 
    self.assertEqual(len(db.objects(protocol='nomLeftRing', groups='dev', model_ids=('11_1',), purposes='probe', classes='client')), 2)
    self.assertEqual(len(db.objects(protocol='nomLeftRing', groups='dev', model_ids=('11_1',), purposes='probe', classes='impostor')), 34) #36 - 2 
        
    # Eval group
    self.assertEqual(len(db.objects(protocol='nomLeftRing', groups='eval')), 128) #32 users * 1 fingers * 4 acq  
    self.assertEqual(len(db.objects(protocol='nomLeftRing', groups='eval', model_ids=('30_1',))), 66) #32 users * 1 fingers * 2 acq + 2  
Pedro TOME's avatar
Pedro TOME committed
178
179
    self.assertEqual(len(db.objects(protocol='nomLeftRing', groups='eval', purposes='enroll')), 64) #32 users * 1 fingers * 2 acq 
    self.assertEqual(len(db.objects(protocol='nomLeftRing', groups='eval', model_ids=('30_1',), purposes='enroll')), 2)
180
181
182
183
    self.assertEqual(len(db.objects(protocol='nomLeftRing', groups='eval', model_ids=('30_1',), purposes='probe')), 64) #32 users * 1 fingers * 2 acq 
    self.assertEqual(len(db.objects(protocol='nomLeftRing', groups='eval', model_ids=('30_1',), purposes='probe', classes='client')), 2)
    self.assertEqual(len(db.objects(protocol='nomLeftRing', groups='eval', model_ids=('30_1',), purposes='probe', classes='impostor')), 62) #64 - 2 
    
Pedro TOME's avatar
Pedro TOME committed
184

185
186
187
    #####################################################
    # Protocol 'nomLeftMiddle'
    self.assertEqual(len(db.objects(protocol='nomLeftMiddle')), 240) #1440 - 60 subjects * 1 fingers * 4 acq
Pedro TOME's avatar
Pedro TOME committed
188

189
190
191
192
193
194
195
    # World group
    self.assertEqual(len(db.objects(protocol='nomLeftMiddle', groups='world')), 40) #10 users * 1 fingers * 4 acq
    self.assertEqual(len(db.objects(protocol='nomLeftMiddle', groups='world', purposes='train')), 40) #10 users * 1 fingers * 4 acq
    
    # Dev group
    self.assertEqual(len(db.objects(protocol='nomLeftMiddle', groups='dev')), 72) #18 users * 1 fingers * 4 acq
    self.assertEqual(len(db.objects(protocol='nomLeftMiddle', groups='dev', model_ids=('11_2',))), 38) #18 users * 1 fingers * 2 acq + 2
Pedro TOME's avatar
Pedro TOME committed
196
197
    self.assertEqual(len(db.objects(protocol='nomLeftMiddle', groups='dev', purposes='enroll')), 36) #18 users * 1 fingers * 2 acq 
    self.assertEqual(len(db.objects(protocol='nomLeftMiddle', groups='dev', model_ids=('11_2',), purposes='enroll')), 2)
198
199
200
201
202
203
204
    self.assertEqual(len(db.objects(protocol='nomLeftMiddle', groups='dev', model_ids=('11_2',), purposes='probe')), 36) #18 users * 1 fingers * 2 acq 
    self.assertEqual(len(db.objects(protocol='nomLeftMiddle', groups='dev', model_ids=('11_2',), purposes='probe', classes='client')), 2)
    self.assertEqual(len(db.objects(protocol='nomLeftMiddle', groups='dev', model_ids=('11_2',), purposes='probe', classes='impostor')), 34) #36 - 2 
        
    # Eval group
    self.assertEqual(len(db.objects(protocol='nomLeftMiddle', groups='eval')), 128) #32 users * 1 fingers * 4 acq  
    self.assertEqual(len(db.objects(protocol='nomLeftMiddle', groups='eval', model_ids=('30_2',))), 66) #32 users * 1 fingers * 2 acq + 2  
Pedro TOME's avatar
Pedro TOME committed
205
206
    self.assertEqual(len(db.objects(protocol='nomLeftMiddle', groups='eval', purposes='enroll')), 64) #32 users * 1 fingers * 2 acq 
    self.assertEqual(len(db.objects(protocol='nomLeftMiddle', groups='eval', model_ids=('30_2',), purposes='enroll')), 2)
207
208
209
    self.assertEqual(len(db.objects(protocol='nomLeftMiddle', groups='eval', model_ids=('30_2',), purposes='probe')), 64) #32 users * 1 fingers * 2 acq 
    self.assertEqual(len(db.objects(protocol='nomLeftMiddle', groups='eval', model_ids=('30_2',), purposes='probe', classes='client')), 2)
    self.assertEqual(len(db.objects(protocol='nomLeftMiddle', groups='eval', model_ids=('30_2',), purposes='probe', classes='impostor')), 62) #64 - 2 
Pedro TOME's avatar
Pedro TOME committed
210

Pedro TOME's avatar
Pedro TOME committed
211

212
213
214
215
216
217
218
219
220
221
222
    #####################################################
    # Protocol 'nomLeftIndex'
    self.assertEqual(len(db.objects(protocol='nomLeftIndex')), 240) #1440 - 60 subjects * 1 fingers * 4 acq

    # World group
    self.assertEqual(len(db.objects(protocol='nomLeftIndex', groups='world')), 40) #10 users * 1 fingers * 4 acq
    self.assertEqual(len(db.objects(protocol='nomLeftIndex', groups='world', purposes='train')), 40) #10 users * 1 fingers * 4 acq
    
    # Dev group
    self.assertEqual(len(db.objects(protocol='nomLeftIndex', groups='dev')), 72) #18 users * 1 fingers * 4 acq
    self.assertEqual(len(db.objects(protocol='nomLeftIndex', groups='dev', model_ids=('11_3',))), 38) #18 users * 1 fingers * 2 acq + 2
Pedro TOME's avatar
Pedro TOME committed
223
224
    self.assertEqual(len(db.objects(protocol='nomLeftIndex', groups='dev', purposes='enroll')), 36) #18 users * 1 fingers * 2 acq 
    self.assertEqual(len(db.objects(protocol='nomLeftIndex', groups='dev', model_ids=('11_3',), purposes='enroll')), 2)
225
226
227
228
229
230
231
    self.assertEqual(len(db.objects(protocol='nomLeftIndex', groups='dev', model_ids=('11_3',), purposes='probe')), 36) #18 users * 1 fingers * 2 acq 
    self.assertEqual(len(db.objects(protocol='nomLeftIndex', groups='dev', model_ids=('11_3',), purposes='probe', classes='client')), 2)
    self.assertEqual(len(db.objects(protocol='nomLeftIndex', groups='dev', model_ids=('11_3',), purposes='probe', classes='impostor')), 34) #36 - 2 
        
    # Eval group
    self.assertEqual(len(db.objects(protocol='nomLeftIndex', groups='eval')), 128) #32 users * 1 fingers * 4 acq  
    self.assertEqual(len(db.objects(protocol='nomLeftIndex', groups='eval', model_ids=('30_3',))), 66) #32 users * 1 fingers * 2 acq + 2  
Pedro TOME's avatar
Pedro TOME committed
232
233
    self.assertEqual(len(db.objects(protocol='nomLeftIndex', groups='eval', purposes='enroll')), 64) #32 users * 1 fingers * 2 acq 
    self.assertEqual(len(db.objects(protocol='nomLeftIndex', groups='eval', model_ids=('30_3',), purposes='enroll')), 2)
234
235
236
237
238
    self.assertEqual(len(db.objects(protocol='nomLeftIndex', groups='eval', model_ids=('30_3',), purposes='probe')), 64) #32 users * 1 fingers * 2 acq 
    self.assertEqual(len(db.objects(protocol='nomLeftIndex', groups='eval', model_ids=('30_3',), purposes='probe', classes='client')), 2)
    self.assertEqual(len(db.objects(protocol='nomLeftIndex', groups='eval', model_ids=('30_3',), purposes='probe', classes='impostor')), 62) #64 - 2 


Pedro TOME's avatar
Pedro TOME committed
239
240
241
242
  def test024_objects(self):
    # tests if the right number of File objects is returned
    db = bob.db.utfvp.Database()
    
243
244
245
246
247
248
249
250
251
252
253
    #####################################################
    # Protocol 'nomRightIndex'
    self.assertEqual(len(db.objects(protocol='nomRightIndex')), 240) #1440 - 60 subjects * 1 fingers * 4 acq

    # World group
    self.assertEqual(len(db.objects(protocol='nomRightIndex', groups='world')), 40) #10 users * 1 fingers * 4 acq
    self.assertEqual(len(db.objects(protocol='nomRightIndex', groups='world', purposes='train')), 40) #10 users * 1 fingers * 4 acq
    
    # Dev group
    self.assertEqual(len(db.objects(protocol='nomRightIndex', groups='dev')), 72) #18 users * 1 fingers * 4 acq
    self.assertEqual(len(db.objects(protocol='nomRightIndex', groups='dev', model_ids=('11_4',))), 38) #18 users * 1 fingers * 2 acq + 2
Pedro TOME's avatar
Pedro TOME committed
254
255
    self.assertEqual(len(db.objects(protocol='nomRightIndex', groups='dev', purposes='enroll')), 36) #18 users * 1 fingers * 2 acq 
    self.assertEqual(len(db.objects(protocol='nomRightIndex', groups='dev', model_ids=('11_4',), purposes='enroll')), 2)
256
257
258
259
260
261
262
    self.assertEqual(len(db.objects(protocol='nomRightIndex', groups='dev', model_ids=('11_4',), purposes='probe')), 36) #18 users * 1 fingers * 2 acq 
    self.assertEqual(len(db.objects(protocol='nomRightIndex', groups='dev', model_ids=('11_4',), purposes='probe', classes='client')), 2)
    self.assertEqual(len(db.objects(protocol='nomRightIndex', groups='dev', model_ids=('11_4',), purposes='probe', classes='impostor')), 34) #36 - 2 
        
    # Eval group
    self.assertEqual(len(db.objects(protocol='nomRightIndex', groups='eval')), 128) #32 users * 1 fingers * 4 acq  
    self.assertEqual(len(db.objects(protocol='nomRightIndex', groups='eval', model_ids=('30_4',))), 66) #32 users * 1 fingers * 2 acq + 2  
Pedro TOME's avatar
Pedro TOME committed
263
264
    self.assertEqual(len(db.objects(protocol='nomRightIndex', groups='eval', purposes='enroll')), 64) #32 users * 1 fingers * 2 acq 
    self.assertEqual(len(db.objects(protocol='nomRightIndex', groups='eval', model_ids=('30_4',), purposes='enroll')), 2)
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
    self.assertEqual(len(db.objects(protocol='nomRightIndex', groups='eval', model_ids=('30_4',), purposes='probe')), 64) #32 users * 1 fingers * 2 acq 
    self.assertEqual(len(db.objects(protocol='nomRightIndex', groups='eval', model_ids=('30_4',), purposes='probe', classes='client')), 2)
    self.assertEqual(len(db.objects(protocol='nomRightIndex', groups='eval', model_ids=('30_4',), purposes='probe', classes='impostor')), 62) #64 - 2 


    #####################################################
    # Protocol 'nomRightMiddle'
    self.assertEqual(len(db.objects(protocol='nomRightMiddle')), 240) #1440 - 60 subjects * 1 fingers * 4 acq

    # World group
    self.assertEqual(len(db.objects(protocol='nomRightMiddle', groups='world')), 40) #10 users * 1 fingers * 4 acq
    self.assertEqual(len(db.objects(protocol='nomRightMiddle', groups='world', purposes='train')), 40) #10 users * 1 fingers * 4 acq
    
    # Dev group
    self.assertEqual(len(db.objects(protocol='nomRightMiddle', groups='dev')), 72) #18 users * 1 fingers * 4 acq
    self.assertEqual(len(db.objects(protocol='nomRightMiddle', groups='dev', model_ids=('11_5',))), 38) #18 users * 1 fingers * 2 acq + 2
Pedro TOME's avatar
Pedro TOME committed
281
282
    self.assertEqual(len(db.objects(protocol='nomRightMiddle', groups='dev', purposes='enroll')), 36) #18 users * 1 fingers * 2 acq 
    self.assertEqual(len(db.objects(protocol='nomRightMiddle', groups='dev', model_ids=('11_5',), purposes='enroll')), 2)
283
284
285
286
287
288
289
    self.assertEqual(len(db.objects(protocol='nomRightMiddle', groups='dev', model_ids=('11_5',), purposes='probe')), 36) #18 users * 1 fingers * 2 acq 
    self.assertEqual(len(db.objects(protocol='nomRightMiddle', groups='dev', model_ids=('11_5',), purposes='probe', classes='client')), 2)
    self.assertEqual(len(db.objects(protocol='nomRightMiddle', groups='dev', model_ids=('11_5',), purposes='probe', classes='impostor')), 34) #36 - 2 
        
    # Eval group
    self.assertEqual(len(db.objects(protocol='nomRightMiddle', groups='eval')), 128) #32 users * 1 fingers * 4 acq  
    self.assertEqual(len(db.objects(protocol='nomRightMiddle', groups='eval', model_ids=('30_5',))), 66) #32 users * 1 fingers * 2 acq + 2  
Pedro TOME's avatar
Pedro TOME committed
290
291
    self.assertEqual(len(db.objects(protocol='nomRightMiddle', groups='eval', purposes='enroll')), 64) #32 users * 1 fingers * 2 acq 
    self.assertEqual(len(db.objects(protocol='nomRightMiddle', groups='eval', model_ids=('30_5',), purposes='enroll')), 2)
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
    self.assertEqual(len(db.objects(protocol='nomRightMiddle', groups='eval', model_ids=('30_5',), purposes='probe')), 64) #32 users * 1 fingers * 2 acq 
    self.assertEqual(len(db.objects(protocol='nomRightMiddle', groups='eval', model_ids=('30_5',), purposes='probe', classes='client')), 2)
    self.assertEqual(len(db.objects(protocol='nomRightMiddle', groups='eval', model_ids=('30_5',), purposes='probe', classes='impostor')), 62) #64 - 2 


    #####################################################
    # Protocol 'nomRightRing'
    self.assertEqual(len(db.objects(protocol='nomRightRing')), 240) #1440 - 60 subjects * 1 fingers * 4 acq

    # World group
    self.assertEqual(len(db.objects(protocol='nomRightRing', groups='world')), 40) #10 users * 1 fingers * 4 acq
    self.assertEqual(len(db.objects(protocol='nomRightRing', groups='world', purposes='train')), 40) #10 users * 1 fingers * 4 acq
    
    # Dev group
    self.assertEqual(len(db.objects(protocol='nomRightRing', groups='dev')), 72) #18 users * 1 fingers * 4 acq
    self.assertEqual(len(db.objects(protocol='nomRightRing', groups='dev', model_ids=('11_6',))), 38) #18 users * 1 fingers * 2 acq + 2
Pedro TOME's avatar
Pedro TOME committed
308
309
    self.assertEqual(len(db.objects(protocol='nomRightRing', groups='dev', purposes='enroll')), 36) #18 users * 1 fingers * 2 acq 
    self.assertEqual(len(db.objects(protocol='nomRightRing', groups='dev', model_ids=('11_6',), purposes='enroll')), 2)
310
311
312
313
314
315
316
    self.assertEqual(len(db.objects(protocol='nomRightRing', groups='dev', model_ids=('11_6',), purposes='probe')), 36) #18 users * 1 fingers * 2 acq 
    self.assertEqual(len(db.objects(protocol='nomRightRing', groups='dev', model_ids=('11_6',), purposes='probe', classes='client')), 2)
    self.assertEqual(len(db.objects(protocol='nomRightRing', groups='dev', model_ids=('11_6',), purposes='probe', classes='impostor')), 34) #36 - 2 
        
    # Eval group
    self.assertEqual(len(db.objects(protocol='nomRightRing', groups='eval')), 128) #32 users * 1 fingers * 4 acq  
    self.assertEqual(len(db.objects(protocol='nomRightRing', groups='eval', model_ids=('30_6',))), 66) #32 users * 1 fingers * 2 acq + 2  
Pedro TOME's avatar
Pedro TOME committed
317
318
    self.assertEqual(len(db.objects(protocol='nomRightRing', groups='eval', purposes='enroll')), 64) #32 users * 1 fingers * 2 acq 
    self.assertEqual(len(db.objects(protocol='nomRightRing', groups='eval', model_ids=('30_6',), purposes='enroll')), 2)
319
320
321
322
    self.assertEqual(len(db.objects(protocol='nomRightRing', groups='eval', model_ids=('30_6',), purposes='probe')), 64) #32 users * 1 fingers * 2 acq 
    self.assertEqual(len(db.objects(protocol='nomRightRing', groups='eval', model_ids=('30_6',), purposes='probe', classes='client')), 2)
    self.assertEqual(len(db.objects(protocol='nomRightRing', groups='eval', model_ids=('30_6',), purposes='probe', classes='impostor')), 62) #64 - 2 

Pedro TOME's avatar
Pedro TOME committed
323
324
325

  def test03_driver_api(self):

Pedro TOME's avatar
Pedro TOME committed
326
    from bob.db.base.script.dbmanage import main
Pedro TOME's avatar
Pedro TOME committed
327
    self.assertEqual(main('utfvp dumplist --self-test'.split()), 0)
Pedro TOME's avatar
Pedro TOME committed
328
    self.assertEqual(main('utfvp dumplist --protocol=1vsall --class=client --group=dev --purpose=enroll --model=1_2_3 --self-test'.split()), 0)
Pedro TOME's avatar
Pedro TOME committed
329
330
331
    self.assertEqual(main('utfvp checkfiles --self-test'.split()), 0)
    self.assertEqual(main('utfvp reverse 0001/0001_1_1_120509-135315 --self-test'.split()), 0)
    self.assertEqual(main('utfvp path 37 --self-test'.split()), 0)
332