@@ -153,26 +153,26 @@ def processFolder(
153
153
if 0 < testPadding :
154
154
testing = dropPadding (testing , testPadding )
155
155
156
- def saveSubset (filename , idx ):
157
- print ('%s: %d frames' % (filename , len (idx )))
158
- subset = {k : v [idx ] for k , v in dataset .items ()}
159
- time = subset ['time' ]
160
- diff = np .diff (time )
161
- assert np .all (diff >= 0 ), 'Time is not monotonically increasing!'
162
- np .savez (os .path .join (folder , filename ), ** subset )
163
- return
164
-
165
156
# remove the npz files
166
157
files = os .listdir (folder )
167
158
for fn in files :
168
159
os .remove (os .path .join (folder , fn ))
169
160
print ('Removed' , len (files ), 'files' )
170
161
171
162
totalFrames = len (testing ) + len (training )
172
- if minFrames < totalFrames :
163
+ if totalFrames < minFrames :
173
164
print ('Not enough frames: %d < %d' % (totalFrames , minFrames ))
174
165
return 0 , 0
175
166
# save training and testing sets
167
+ def saveSubset (filename , idx ):
168
+ print ('%s: %d frames' % (filename , len (idx )))
169
+ subset = {k : v [idx ] for k , v in dataset .items ()}
170
+ time = subset ['time' ]
171
+ diff = np .diff (time )
172
+ assert np .all (diff >= 0 ), 'Time is not monotonically increasing!'
173
+ np .savez (os .path .join (folder , filename ), ** subset )
174
+ return
175
+
176
176
saveSubset ('train.npz' , training )
177
177
saveSubset ('test.npz' , testing )
178
178
0 commit comments