Skip to content

Commit bbfbeee

Browse files
authored
fix: Use task id in get_local_path sam2 (#634)
1 parent 0f47d25 commit bbfbeee

File tree

1 file changed

+3
-3
lines changed
  • label_studio_ml/examples/segment_anything_2_image

1 file changed

+3
-3
lines changed

label_studio_ml/examples/segment_anything_2_image/model.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -73,14 +73,14 @@ def get_results(self, masks, probs, width, height, from_name, to_name, label):
7373
'score': total_prob / max(len(results), 1)
7474
}]
7575

76-
def set_image(self, image_url):
77-
image_path = get_local_path(image_url)
76+
def set_image(self, image_url, task_id):
77+
image_path = get_local_path(image_url, task_id=task_id)
7878
image = Image.open(image_path)
7979
image = np.array(image.convert("RGB"))
8080
predictor.set_image(image)
8181

8282
def _sam_predict(self, img_url, point_coords=None, point_labels=None, input_box=None, task=None):
83-
self.set_image(img_url)
83+
self.set_image(img_url, task.get('id'))
8484
point_coords = np.array(point_coords, dtype=np.float32) if point_coords else None
8585
point_labels = np.array(point_labels, dtype=np.float32) if point_labels else None
8686
input_box = np.array(input_box, dtype=np.float32) if input_box else None

0 commit comments

Comments
 (0)