Skip to content

Commit

Permalink
fix(core): filter image selection by ground truth categories
Browse files Browse the repository at this point in the history
Closes Kitware#74
  • Loading branch information
PaulHax committed Jul 24, 2024
1 parent bacadff commit 1ca7879
Showing 1 changed file with 6 additions and 8 deletions.
14 changes: 6 additions & 8 deletions src/nrtk_explorer/app/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
from nrtk_explorer.app.applet import Applet
from nrtk_explorer.app import ui
import nrtk_explorer.test_data
from nrtk_explorer.app.image_ids import image_id_to_result_id
from nrtk_explorer.app.image_ids import image_id_to_result_id, dataset_id_to_image_id

import os

Expand Down Expand Up @@ -135,15 +135,13 @@ def on_dataset_change(self, **kwargs):

def on_filter_apply(self, filter: FilterProtocol[Iterable[int]], **kwargs):
selected_indices = []

for index, image_id in enumerate(self.state.images_ids):
image_annotations_categories = map(
lambda annotation: annotation["category_id"],
self.state.get(image_id_to_result_id(image_id), []),
)

image_annotations_categories = [
annotation["category_id"]
for annotation in self.context.dataset.anns.values()
if annotation["image_id"] == image_id
]
include = filter.evaluate(image_annotations_categories)

if include:
selected_indices.append(index)

Expand Down

0 comments on commit 1ca7879

Please sign in to comment.