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

ImportError: cannot import name 'sam_model_registry_feature' from 'segment_anything' #3

Open
Luca-Wiehe opened this issue Jun 17, 2024 · 1 comment

Comments

@Luca-Wiehe
Copy link

Luca-Wiehe commented Jun 17, 2024

I've been trying to run your demo.py script. Unfortunately, I am encountering the following error message:

(deop) ~/<path>/deop$ python3 demo.py --input dataset/test/000000000285.jpg --output ./output --class-names bear other
Traceback (most recent call last):
  File "demo.py", line 20, in <module>
    from mask_former import  add_mask_former_config
  File "~/<path>/deop/mask_former/__init__.py", line 9, in <module>
    from .zero_shot_clipfeat_upsample_nodecoder_sammask_noAssembly import ZeroShotClipfeatUpsampleNodecoderSAMMaskNoAssembly
  File "~/<path>/deop/mask_former/zero_shot_clipfeat_upsample_nodecoder_sammask_noAssembly.py", line 34, in <module>
    from segment_anything import SamAutomaticMaskGenerator,sam_model_registry,  sam_model_registry_feature, SamAutomaticMaskGeneratorMaskFeature
ImportError: cannot import name 'sam_model_registry_feature' from 'segment_anything' (~/<path>/deop/segment-anything/segment_anything/__init__.py)

Note that I have manually installed the Segment Anything repository from source (according to setup instructions from their github).

@CongHan0808
Copy link
Owner

I've been trying to run your demo.py script. Unfortunately, I am encountering the following error message:

(deop) ~/<path>/deop$ python3 demo.py --input dataset/test/000000000285.jpg --output ./output --class-names bear other
Traceback (most recent call last):
  File "demo.py", line 20, in <module>
    from mask_former import  add_mask_former_config
  File "~/<path>/deop/mask_former/__init__.py", line 9, in <module>
    from .zero_shot_clipfeat_upsample_nodecoder_sammask_noAssembly import ZeroShotClipfeatUpsampleNodecoderSAMMaskNoAssembly
  File "~/<path>/deop/mask_former/zero_shot_clipfeat_upsample_nodecoder_sammask_noAssembly.py", line 34, in <module>
    from segment_anything import SamAutomaticMaskGenerator,sam_model_registry,  sam_model_registry_feature, SamAutomaticMaskGeneratorMaskFeature
ImportError: cannot import name 'sam_model_registry_feature' from 'segment_anything' (~/<path>/deop/segment-anything/segment_anything/__init__.py)

Note that I have manually installed the Segment Anything repository from source (according to setup instructions from their github).

I modify some code of the segment-anything to get the mask. You can install the 'segment-anything' by this reposity sam-mask

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants