Skip to content

Commit

Permalink
refactor: rename object_detection_model to inference_model
Browse files Browse the repository at this point in the history
  • Loading branch information
PaulHax committed Dec 4, 2024
1 parent 4296bf4 commit 6f16fd0
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 10 deletions.
2 changes: 1 addition & 1 deletion src/nrtk_explorer/app/images/stateful_annotations.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ def __init__(
add_to_cache_callback, delete_from_cache_callback
)

@change("current_dataset", "object_detection_model")
@change("current_dataset", "inference_model")
def _cache_clear(self, **kwargs):
self.annotations_factory.cache_clear()

Expand Down
12 changes: 5 additions & 7 deletions src/nrtk_explorer/app/transforms.py
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ def __init__(

known_args, _ = self.server.cli.parse_known_args()
self.state.inference_models = known_args.models
self.state.object_detection_model = self.state.inference_models[0]
self.state.inference_model = self.state.inference_models[0]
self.state.setdefault("image_list_ids", [])
self.state.setdefault("dataset_ids", [])
self.state.setdefault("user_selected_ids", [])
Expand Down Expand Up @@ -204,17 +204,15 @@ def delete_meta_state(old_ids, new_ids):
self.visible_dataset_ids = [] # set by ImageList via self.on_scroll callback

def on_server_ready(self, *args, **kwargs):
self.state.change("object_detection_model")(self.on_object_detection_model_change)
self.on_object_detection_model_change()
self.state.change("inference_model")(self.on_inference_model_change)
self.on_inference_model_change()
self.state.change("current_dataset")(self._cancel_update_images)
self.state.change("current_dataset")(self.reset_detector)

def on_object_detection_model_change(self, **kwargs):
def on_inference_model_change(self, **kwargs):
self.original_detection_annotations.cache_clear()
self.transformed_detection_annotations.cache_clear()
self.detector = object_detector.ObjectDetector(
model_name=self.state.object_detection_model
)
self.detector = object_detector.ObjectDetector(model_name=self.state.inference_model)
self._start_update_images()

def reset_detector(self, **kwargs):
Expand Down
4 changes: 2 additions & 2 deletions src/nrtk_explorer/app/ui/layout.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,8 @@ def __init__(
html.Span("Model Inference", classes="text-h6")
with card.slot_content:
quasar.QSelect(
label="Object Detection Model",
v_model=("object_detection_model", "facebook/detr-resnet-50"),
label="Inference Model",
v_model=("inference_model", "facebook/detr-resnet-50"),
options=("inference_models", []),
filled=True,
emit_value=True,
Expand Down

0 comments on commit 6f16fd0

Please sign in to comment.