Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added functionality to display detection scores #83

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 18 additions & 1 deletion vis/view_results.html
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
var INPUT_JSON_PATH = 'data/results.json'
var input_struct = null; // will be loaded from json
var current_id = 0; // currently shown image id
var show_scores = 0;

// render flags utils
var render_flags = {
Expand All @@ -29,6 +30,13 @@
render_flags[name] = !render_flags[name];
renderAnnotations();
}
function toggleScores() {
show_scores = !show_scores;
renderAnnotations();
}
function sigmoid(t) {
return 1/(1+Math.pow(Math.E, -t));
}

function getUrlParam(name, fallback) {
name = name.replace(/[\[]/, "\\[").replace(/[\]]/, "\\]");
Expand Down Expand Up @@ -111,11 +119,16 @@
var i = ixscore[k][0];
var det_box = result.boxes[i];
var caption = result.captions[i];
var score = sigmoid(result.scores[i]);
// render box
var color = WAD_COLORS[k % WAD_COLORS.length];
renderBox(elt, det_box, color, BOX_WIDTH, render_flags.captions_inline ? caption : '');
// render caption in a separate div below the image
delt.append('span').classed('ddesc', true).style('color', color).html(escapeHtml(caption) + '. ');
if (show_scores) {
delt.append('span').classed('ddesc', true).style('color', color).html(escapeHtml(caption) + ' (' + score.toFixed(2) + '). ');
} else {
delt.append('span').classed('ddesc', true).style('color', color).html(escapeHtml(caption) + '. ');
}
}
}

Expand All @@ -127,6 +140,7 @@
if (e.keyCode == 83) updateCounter('detections_to_show', -1);
if (e.keyCode == 87) updateCounter('detections_to_show', 1);
if (e.keyCode == 84) toggleFlag('captions_inline');
if (e.keyCode == 67) toggleScores();
if (e.keyCode == 82) jumpRandom();
};

Expand Down Expand Up @@ -159,6 +173,9 @@
<button onclick="toggleFlag('captions_inline')" class="bb" style="width:200px">
Toggle show captions inline (t)
</button>
<button onclick="toggleScores()" class="bb" style="width:200px">
Toggle show scores (c)
</button>
<button onclick="jumpRandom()" class="bb" style="width:200px">
Jump to random image (r)
</button>
Expand Down