Skip to content

Commit 4941ec6

Browse files
committed
[Evaluation] Proposal evaluation code does not fail when some video ids are missing from the submission file
1 parent efce35a commit 4941ec6

File tree

1 file changed

+14
-9
lines changed

1 file changed

+14
-9
lines changed

Evaluation/eval_proposal.py

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -198,24 +198,29 @@ def average_recall_vs_avg_nr_proposals(ground_truth, proposals,
198198
score_lst = []
199199
total_nr_proposals = 0
200200
for videoid in video_lst:
201-
202-
# Get proposals for this video.
203-
proposals_videoid = proposals_gbvn.get_group(videoid)
204-
this_video_proposals = proposals_videoid.loc[:, ['t-start', 't-end']].values
205-
206-
# Sort proposals by score.
207-
sort_idx = proposals_videoid['score'].argsort()[::-1]
208-
this_video_proposals = this_video_proposals[sort_idx, :]
209-
210201
# Get ground-truth instances associated to this video.
211202
ground_truth_videoid = ground_truth_gbvn.get_group(videoid)
212203
this_video_ground_truth = ground_truth_videoid.loc[:,['t-start', 't-end']].values
213204

205+
# Get proposals for this video.
206+
try:
207+
proposals_videoid = proposals_gbvn.get_group(videoid)
208+
except:
209+
n = this_video_ground_truth.shape[0]
210+
score_lst.append(np.zeros((n, 1)))
211+
continue
212+
213+
this_video_proposals = proposals_videoid.loc[:, ['t-start', 't-end']].values
214+
214215
if this_video_proposals.shape[0] == 0:
215216
n = this_video_ground_truth.shape[0]
216217
score_lst.append(np.zeros((n, 1)))
217218
continue
218219

220+
# Sort proposals by score.
221+
sort_idx = proposals_videoid['score'].argsort()[::-1]
222+
this_video_proposals = this_video_proposals[sort_idx, :]
223+
219224
if this_video_proposals.ndim != 2:
220225
this_video_proposals = np.expand_dims(this_video_proposals, axis=0)
221226
if this_video_ground_truth.ndim != 2:

0 commit comments

Comments
 (0)