Skip to content

Commit f551709

Browse files
committed
Fix "Agree to All"
Look up equivalent label category by prediction name, not by prediction category index. Label and prediction category lists are not guaranteed to be in sync.
1 parent fd6fe2b commit f551709

1 file changed

Lines changed: 13 additions & 4 deletions

File tree

wsi_superpixel_guided_labeling/web_client/views/vue/components/ActiveLearning/ActiveLearningFilmStrip.vue

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -64,10 +64,19 @@ export default {
6464
},
6565
updateAll(usePrediction) {
6666
_.forEach(store.superpixelsToDisplay, (superpixel) => {
67-
// Account for missing "default" category in predictions
68-
const value = usePrediction ? superpixel.prediction + 1 : 0;
69-
superpixel.selectedCategory = value;
70-
updateMetadata(superpixel, value, false);
67+
let categoryIndex = 0;
68+
if (usePrediction) {
69+
// Try to match prediction category to label category
70+
const prediction = superpixel.predictionCategories[superpixel.prediction];
71+
const predictionCategory = prediction.label;
72+
categoryIndex = superpixel.labelCategories.findIndex((cat) => {
73+
return cat.label === predictionCategory;
74+
});
75+
}
76+
// Default to "no label" if no match found
77+
categoryIndex = categoryIndex === -1 ? 0 : categoryIndex;
78+
superpixel.selectedCategory = categoryIndex;
79+
updateMetadata(superpixel, categoryIndex, false);
7180
store.labelingChangeLog.push(superpixel);
7281
});
7382
},

0 commit comments

Comments
 (0)