Skip to content

Commit

Permalink
remove unnecessary lines of code
Browse files Browse the repository at this point in the history
  • Loading branch information
jesicasusanto committed Jun 5, 2023
1 parent 8ea9773 commit ad39a80
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
4 changes: 2 additions & 2 deletions openadapt/strategies/demo.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,10 +44,10 @@ def get_next_action_event(
screenshot: Screenshot,
window_event: WindowEvent,
):
#ascii_text = self.get_ascii_text(screenshot)
ascii_text = self.get_ascii_text(screenshot)
#logger.info(f"ascii_text=\n{ascii_text}")

#ocr_text = self.get_ocr_text(screenshot)
ocr_text = self.get_ocr_text(screenshot)
#logger.info(f"ocr_text=\n{ocr_text}")

screenshot_bbox = self.get_screenshot_bbox(screenshot)
Expand Down
10 changes: 5 additions & 5 deletions openadapt/strategies/mixins/sam.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,8 +73,6 @@ def get_screenshot_bbox(self, screenshot: Screenshot, show_plots=SHOW_PLOTS) ->
array_resized = np.array(image_resized)
masks = self.sam_mask_generator.generate(array_resized)
bbox_list = []
plt.figure(figsize=(10, 10))
plt.imshow(array_resized)
for mask in masks:
bbox_list.append(mask["bbox"])
if SHOW_PLOTS :
Expand Down Expand Up @@ -122,8 +120,10 @@ def get_click_event_bbox(self, screenshot: Screenshot, show_plots=SHOW_PLOTS) ->
# Calculate bounding box coordinates
x0 = np.min(cols)
y0 = np.min(rows)
w = np.max(cols)
h = np.max(rows)
x1 = np.max(cols)
y1 = np.max(rows)
w = x1-x0
h = y1-y0
input_box = [x0, y0, w, h]
if SHOW_PLOTS :
plt.figure(figsize=(10, 10))
Expand All @@ -133,7 +133,7 @@ def get_click_event_bbox(self, screenshot: Screenshot, show_plots=SHOW_PLOTS) ->
show_points(input_point, input_label, plt.gca())
plt.axis("on")
plt.show()
return [x0, y0, w - x0, h - y0]
return input_box
return []


Expand Down

0 comments on commit ad39a80

Please sign in to comment.