Skip to content

Commit

Permalink
Update grounded_sam_simple_demo.py (#308)
Browse files Browse the repository at this point in the history
Added DEVICE acceleration
  • Loading branch information
danigarciaoca authored Jun 17, 2023
1 parent 0c29c82 commit bb8ce18
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion grounded_sam_simple_demo.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@

# Building SAM Model and SAM Predictor
sam = sam_model_registry[SAM_ENCODER_VERSION](checkpoint=SAM_CHECKPOINT_PATH)
sam.to(device=DEVICE)
sam_predictor = SamPredictor(sam)


Expand Down Expand Up @@ -103,4 +104,4 @@ def segment(sam_predictor: SamPredictor, image: np.ndarray, xyxy: np.ndarray) ->
annotated_image = box_annotator.annotate(scene=annotated_image, detections=detections, labels=labels)

# save the annotated grounded-sam image
cv2.imwrite("grounded_sam_annotated_image.jpg", annotated_image)
cv2.imwrite("grounded_sam_annotated_image.jpg", annotated_image)

0 comments on commit bb8ce18

Please sign in to comment.