Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AttributeError running fast_sam.fast_show_masks #325

Open
pherateriw opened this issue Sep 25, 2024 · 0 comments
Open

AttributeError running fast_sam.fast_show_masks #325

pherateriw opened this issue Sep 25, 2024 · 0 comments
Labels
bug Something isn't working

Comments

@pherateriw
Copy link

Environment Information

  • samgeo version: 0.10.7 and 0.11.2
  • Python version: 3.12.5
  • Operating System: Windows 11 Pro

Description

I was trying to use the everything_prompt and return the masks. Running the fast_show_mask function gave me an error message "AttributeError: 'SamGeo' object has no attribute 'image'."
The same code and image works as expected and does not throw an error if I use sam.show_anns("mask.png") instead of fast_show_mask.

What I Did

My Code:

from samgeo.fast_sam import SamGeo

image = 'local_image.tif'
sam = SamGeo(model="FastSam-x.pt")
sam.set_image(image)

segments = "segment.tif"
sam.everything_prompt(segments)
mask_result = sam.fast_show_mask()

Stack Trace:

Traceback (most recent call last):
  File "<local_file_path>\src\segment_geospatial\fast_sam.py", line 17, in <module>
    mask_result = sam.fast_show_mask()
                  ^^^^^^^^^^^^^^^^^^^^
  File "<local_file_path>\env\Lib\site-packages\samgeo\fast_sam.py", line 231, in fast_show_mask
    target_height = self.image.shape[0]
                    ^^^^^^^^^^
  File "<local_file_path>\env\Lib\site-packages\fastsam\model.py", line 106, in __getattr__
    raise AttributeError(f"'{name}' object has no attribute '{attr}'. See valid attributes below.\n{self.__doc__}")
AttributeError: 'SamGeo' object has no attribute 'image'. See valid attributes below.
Segmenting remote sensing images with the Fast Segment Anything Model (FastSAM).
@pherateriw pherateriw added the bug Something isn't working label Sep 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant