Skip to content

Commit 1b4e38b

Browse files
fix
1 parent 2bfcada commit 1b4e38b

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

Core/Utils.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -272,6 +272,7 @@ def extractSessions(dataset, TDelta):
272272
res = []
273273
T = 0
274274
prevSession = 0
275+
N = len(dataset['time'])
275276
for i, t in enumerate(dataset['time']):
276277
if TDelta < (t - T):
277278
if 1 < (i - prevSession):
@@ -281,10 +282,13 @@ def extractSessions(dataset, TDelta):
281282
T = t
282283
continue
283284
# if last session is not empty, then append it
284-
if prevSession < len(dataset['time']):
285-
res.append((prevSession, len(dataset['time'])))
285+
if prevSession < N:
286+
res.append((prevSession, N))
286287
pass
287288

289+
# remove sessions with less than 2 samples
290+
res = [x for x in res if 1 < (x[1] - x[0])]
291+
288292
# check that end of one session is equal or less than start of the next
289293
for i in range(1, len(res)):
290294
assert res[i-1][1] <= res[i][0]

scripts/preprocess-remote.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -194,7 +194,7 @@ def processFolder(folder, timeDelta, testRatio, framesPerChunk, testPadding, ski
194194

195195
if (0 == len(training)) or (0 == len(testing)):
196196
print('No training or testing sets found!')
197-
return 0, 0, True
197+
return 0, 0, True, None
198198

199199
def saveSubset(filename, idx):
200200
print('%s: %d frames' % (filename, len(idx)))

0 commit comments

Comments
 (0)