xinghaochen / TinySAM

Official PyTorch implementation of "TinySAM: Pushing the Envelope for Efficient Segment Anything Model"
Apache License 2.0
403 stars 23 forks source link

TinySAM multimask_output parameter #9

Closed Riley-livingston closed 10 months ago

Riley-livingston commented 11 months ago

Hello, I'm trying to use TinySAM with the output of RTMDet as bounding box prompts.

I came across the issue of the 'multimask_output' parameter in the 'predict' method of mask_predictor not being recognized. Is the name of this parameter different, or does it not need to be specified? I believe that it's by default set to True in the foundation model.

TypeError                              Traceback (most recent call last)
[<ipython-input-28-1a43b775f4cb>](https://localhost:8080/#) in <cell line: 50>()
     48 logging.basicConfig(level=logging.INFO)
     49 image_path = "/content/drive/MyDrive/YOLOv5_Images/4lqw42gnjq1c1.webp"  # Replace with your image path
---> 50 segment_and_display_objects(image_path, rtmdet_model, mask_predictor, threshold=0.5, mask_threshold=0.3)

[<ipython-input-28-1a43b775f4cb>](https://localhost:8080/#) in segment_and_display_objects(image_path, rtmdet_model, mask_predictor, threshold, mask_threshold)
     24         if score > threshold:
     25             mask_predictor.set_image(original_img_bgr)
---> 26             masks, _, _ = mask_predictor.predict(box=bbox, multimask_output=True)
     27 
     28             if len(masks) >= 3:

TypeError: SamPredictor.predict() got an unexpected keyword argument 'multimask_output'
shuh15 commented 11 months ago

Hi, the 'multimask_output' is True by default, there is no need to be specified. You can just remove 'multimask_output=True' in Line 26.