Skip to content

Commit

Permalink
Minor formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
bnorthan committed Apr 22, 2024
1 parent 2a51f6f commit 8c3daab
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions src/napari_segment_everything/segment_everything.py
Original file line number Diff line number Diff line change
Expand Up @@ -367,13 +367,11 @@ def save_project(self):
def process(self):
if self.image is None:
return

model_selection = self.model_dropdown.currentText()

points_per_side = self.points_per_side_spinner.spinner.value()
pred_iou_thresh = self.pred_iou_thresh_spinner.spinner.value()
stability_score_thresh = (
self.stability_score_thresh_spinner.spinner.value()
)
stability_score_thresh = self.stability_score_thresh_spinner.spinner.value()
box_nms_thresh = self.box_nms_thresh_spinner.spinner.value()
crop_n_layers = self.crop_n_layers_spinner.spinner.value()

Expand All @@ -393,21 +391,26 @@ def process(self):
self.textBrowser_log.append("Running SAM automatic mask generator recipe")
self.textBrowser_log.append(f"SAM prompt is grid of {points_per_side} by {points_per_side} points")
self.progressBar.setValue(30)

self.textBrowser_log.append("Generating 3D labels with vitb model")

self.results = self._predictor.generate(self.image)

if model_selection == "mobileSAMv2":
self.textBrowser_log.append("Running mobileSAMv2 recipe")
self.progressBar.setValue(20)
self.textBrowser_log.append("Detecting bounding boxes with YOLO Object Aware Model")

bounding_boxes = get_bounding_boxes(self.image, imgsz=1024, device='cuda')

self.textBrowser_log.append(f"SAM prompt is {len(bounding_boxes)} bounding boxes")
self.progressBar.setValue(40)
self.textBrowser_log.append("Generating 3D labels with efficientvit_l2 model")

self.results = get_mobileSAMv2(self.image, bounding_boxes)

for result, bbox in zip(self.results, bounding_boxes):
result["prompt_bbox"] = bbox

self.results = sorted(
self.results, key=lambda x: x["area"], reverse=False
)
Expand Down

0 comments on commit 8c3daab

Please sign in to comment.