|
@@ 279-294 (lines=16) @@
|
| 276 |
|
if cur_truth != prev_truth: |
| 277 |
|
truth_time = time_list[i] |
| 278 |
|
# Check the start boundary |
| 279 |
|
if truth[i] == prediction[i]: |
| 280 |
|
# If current prediction is correct, then it can only be overfill of current truth label. |
| 281 |
|
j = i - 1 |
| 282 |
|
while j >= 0 and prediction_scoring[j] == 'O': |
| 283 |
|
j -= 1 |
| 284 |
|
# If there is no overfill for cur_truth, and the current truth and prediction are the same, |
| 285 |
|
# then there is no start_boundary mismatch. |
| 286 |
|
start_mismatch[cur_truth].append((time_list[j + 1] - truth_time).total_seconds()) |
| 287 |
|
else: |
| 288 |
|
# If current prediction is incorrect, then it can only be underfill of current truth label at start |
| 289 |
|
# boundary. |
| 290 |
|
j = i |
| 291 |
|
while j < truth.shape[0] and truth_scoring[j] == 'U': |
| 292 |
|
j += 1 |
| 293 |
|
if j != i and j < truth.shape[0]: |
| 294 |
|
start_mismatch[cur_truth].append((time_list[j-1] - truth_time).total_seconds()) |
| 295 |
|
# Check the stop boundary |
| 296 |
|
if i > 0: |
| 297 |
|
if prediction[i-1] == truth[i-1]: |
|
@@ 296-310 (lines=15) @@
|
| 293 |
|
if j != i and j < truth.shape[0]: |
| 294 |
|
start_mismatch[cur_truth].append((time_list[j-1] - truth_time).total_seconds()) |
| 295 |
|
# Check the stop boundary |
| 296 |
|
if i > 0: |
| 297 |
|
if prediction[i-1] == truth[i-1]: |
| 298 |
|
# Previous prediction is correct, then it can only be overfill of previous truth. |
| 299 |
|
# If there is no overfill, the stop boundary is accurate |
| 300 |
|
j = i |
| 301 |
|
while prediction_scoring[j] == 'o': |
| 302 |
|
j += 1 |
| 303 |
|
stop_mismatch[prev_truth].append((time_list[j-1] - truth_time).total_seconds()) |
| 304 |
|
else: |
| 305 |
|
# Check Underfill for prev_truth (at the stop boundary) |
| 306 |
|
j = i - 1 |
| 307 |
|
while j >= 0 and truth_scoring[j] == 'u': |
| 308 |
|
j -= 1 |
| 309 |
|
if j != i - 1: |
| 310 |
|
stop_mismatch[prev_truth].append((time_list[j + 1] - truth_time).total_seconds()) |
| 311 |
|
if prev_truth != -1: |
| 312 |
|
if len(stop_mismatch[prev_truth]) > 0 and abs(stop_mismatch[prev_truth][-1]) > 1800: |
| 313 |
|
logger.warning('Stop mismatch is over half an hour: %s at %d (%s) - %f' % |