Skip to content
This repository was archived by the owner on Sep 23, 2024. It is now read-only.

Commit 8c0359e

Browse files
committed
Reduced the time limit for retrieveTrackedBboxes and continueTracking from 25 seconds to 15 seconds.
This will fix the issue with these requests taking longer than 30 seconds and being aborted. Changed non-error tracker logging from critical to warning. Fixed bug where typing a label name quickly causes unlabeled frame count to be incorrect. If the tracker doesn't find all the objects, automatically pause tracking.
1 parent 4cbb4e1 commit 8c0359e

File tree

3 files changed

+24
-9
lines changed

3 files changed

+24
-9
lines changed

server/app_engine.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -977,7 +977,7 @@ def prepare_to_start_tracking():
977977
@handle_exceptions
978978
@login_required
979979
def retrieve_tracked_bboxes():
980-
time_limit = datetime.now(timezone.utc) + timedelta(seconds=25)
980+
time_limit = datetime.now(timezone.utc) + timedelta(seconds=15)
981981
data = validate_keys(flask.request.form.to_dict(flat=True),
982982
['video_uuid', 'tracker_uuid', 'retrieve_frame_number'])
983983
video_uuid = storage.validate_uuid(data.get('video_uuid'))
@@ -998,7 +998,7 @@ def retrieve_tracked_bboxes():
998998
@handle_exceptions
999999
@login_required
10001000
def continue_tracking():
1001-
time_limit = datetime.now(timezone.utc) + timedelta(seconds=25)
1001+
time_limit = datetime.now(timezone.utc) + timedelta(seconds=15)
10021002
team_uuid = team_info.retrieve_team_uuid(flask.session, flask.request)
10031003
data = validate_keys(flask.request.form.to_dict(flat=True),
10041004
['video_uuid', 'tracker_uuid', 'frame_number', 'bboxes_text'], optional_keys=['retrieve_frame_number'])

server/src/js/labelVideo.js

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,8 @@ fmltc.LabelVideo = function(util, videoEntity, videoFrameEntity0) {
113113

114114
this.retryingGoToFrame = false;
115115

116+
this.savingBboxes = false;
117+
116118
this.playing = false;
117119
this.playingDirection = 1;
118120
this.playingIntervalMs = 0;
@@ -130,6 +132,7 @@ fmltc.LabelVideo = function(util, videoEntity, videoFrameEntity0) {
130132

131133
this.trackingAlreadyInProgress = false;
132134
this.trackingInProgress = false;
135+
this.trackingNumberOfBboxes = 0;
133136
this.trackingPaused = false;
134137
this.trackingWaitingForBboxes = false;
135138
this.trackingInitFrameNumber = 0;
@@ -734,6 +737,12 @@ fmltc.LabelVideo.prototype.saveBboxes = function() {
734737
return bboxesText;
735738
}
736739

740+
if (this.savingBboxes) {
741+
setTimeout(this.saveBboxes.bind(this), 1000);
742+
return;
743+
}
744+
this.savingBboxes = true;
745+
737746
this.labelingAreaSavingMessageDiv.style.color = '#0d6efd';
738747
this.labelingAreaSavingMessageDiv.textContent = ''; // 'Saving...';
739748

@@ -771,6 +780,7 @@ fmltc.LabelVideo.prototype.xhr_storeVideoFrameBboxesText_onreadystatechange = fu
771780
console.log('Failure! /storeVideoFrameBboxesText?' + params +
772781
' xhr.status is ' + xhr.status + '. xhr.statusText is ' + xhr.statusText);
773782
}
783+
this.savingBboxes = false;
774784
}
775785
};
776786

@@ -1259,6 +1269,7 @@ fmltc.LabelVideo.prototype.trackingStartButton_onclick = function() {
12591269
this.updateUI(false);
12601270

12611271
const bboxesText = this.saveBboxes();
1272+
this.trackingNumberOfBboxes = this.convertTextToBboxes(bboxesText).length;
12621273
const trackingScale = Math.max(this.trackingScaleInput.min, Math.min(this.trackingScaleInput.value, this.trackingScaleInput.max));
12631274

12641275
const xhr = new XMLHttpRequest();
@@ -1393,7 +1404,10 @@ fmltc.LabelVideo.prototype.xhr_retrieveTrackedBboxes_onreadystatechange = functi
13931404
}
13941405
this.goToFrame(frameNumber);
13951406

1396-
if (this.trackingPaused) {
1407+
if (this.bboxes[frameNumber].length != this.trackingNumberOfBboxes) {
1408+
this.trackingPaused = true;
1409+
this.trackingMessageDiv.textContent = 'Could not track all objects. Paused.';
1410+
} else if (this.trackingPaused) {
13971411
this.trackingMessageDiv.textContent = 'Paused.';
13981412
} else {
13991413
this.trackingMessageDiv.textContent =
@@ -1439,6 +1453,7 @@ fmltc.LabelVideo.prototype.sendContinueTracking = function(failureCount) {
14391453
this.trackingWaitingForBboxes = true;
14401454
this.updateUI(false);
14411455

1456+
this.trackingNumberOfBboxes = this.bboxes[this.currentFrameNumber].length;
14421457
this.videoFrameEntity[this.currentFrameNumber].bboxes_text =
14431458
this.convertBboxesToText(this.bboxes[this.currentFrameNumber]);
14441459

server/storage.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -360,23 +360,23 @@ def retrieve_video_entity_for_labeling(team_uuid, video_uuid):
360360
tracker_entity = maybe_retrieve_tracker_entity(video_uuid, tracker_uuid)
361361
if tracker_entity is None:
362362
tracking_in_progress = False
363-
logging.critical('Tracker is not in progress. Tracker entity is missing.')
363+
logging.warning('Tracker is not in progress. Tracker entity is missing.')
364364
else:
365365
# If it's been more than two minutes, assume the tracker has died.
366366
timedelta_since_last_update = datetime.now(timezone.utc) - tracker_entity['update_time']
367367
if timedelta_since_last_update > timedelta(minutes=2):
368-
logging.critical('Tracker is not in progress. Elapsed time since last tracker update: %f seconds' %
368+
logging.warning('Tracker is not in progress. Elapsed time since last tracker update: %f seconds' %
369369
timedelta_since_last_update.total_seconds())
370370
tracking_in_progress = False
371371
tracker_client_entity = maybe_retrieve_tracker_client_entity(video_uuid, tracker_uuid)
372372
if tracker_client_entity is None:
373373
tracking_in_progress = False
374-
logging.critical('Tracker is not in progress. Tracker client entity is missing.')
374+
logging.warning('Tracker is not in progress. Tracker client entity is missing.')
375375
else:
376376
# If it's been more than two minutes, assume the tracker client is not connected.
377377
timedelta_since_last_update = datetime.now(timezone.utc) - tracker_client_entity['update_time']
378378
if timedelta_since_last_update > timedelta(minutes=2):
379-
logging.critical('Tracker is not in progress. Elapsed time since last tracker client update: %f seconds' %
379+
logging.warning('Tracker is not in progress. Elapsed time since last tracker client update: %f seconds' %
380380
timedelta_since_last_update.total_seconds())
381381
tracking_in_progress = False
382382
if not tracking_in_progress:
@@ -732,7 +732,7 @@ def retrieve_tracked_bboxes(video_uuid, tracker_uuid, retrieve_frame_number, tim
732732
tracker_entity = maybe_retrieve_tracker_entity(video_uuid, tracker_uuid)
733733
while True:
734734
if tracker_entity is None:
735-
logging.critical('Tracker appears to have failed. Tracker entity is missing.')
735+
logging.warning('Tracker appears to have failed. Tracker entity is missing.')
736736
return True, 0, ''
737737
if tracker_entity['frame_number'] == retrieve_frame_number:
738738
break
@@ -741,7 +741,7 @@ def retrieve_tracked_bboxes(video_uuid, tracker_uuid, retrieve_frame_number, tim
741741
# If it's been more than two minutes, assume the tracker has died.
742742
timedelta_since_last_update = datetime.now(timezone.utc) - tracker_entity['update_time']
743743
if timedelta_since_last_update > timedelta(minutes=2):
744-
logging.critical('Tracker appears to have failed. Elapsed time since last tracker update: %f seconds' %
744+
logging.warning('Tracker appears to have failed. Elapsed time since last tracker update: %f seconds' %
745745
timedelta_since_last_update.total_seconds())
746746
tracker_stopping(tracker_entity['team_uuid'], tracker_entity['video_uuid'], tracker_uuid)
747747
tracker_failed = True

0 commit comments

Comments
 (0)