SHI-Labs / Matting-Anything

Matting Anything Model (MAM), an efficient and versatile framework for estimating the alpha matte of any instance in an image with flexible and interactive visual or linguistic user prompt guidance.
https://arxiv.org/abs/2306.05399
MIT License
602 stars 45 forks source link

An error occurred while running python gradio_app.py. #17

Closed EagleAiDi closed 1 year ago

EagleAiDi commented 1 year ago

Hello! Author, thank you for sharing your project. I encountered the following error while running your project: Traceback (most recent call last): File "C:\Users\Dell\Matting-Anything\gradio_app.py", line 43, in mam_model = networks.get_generator_m2m(seg='sam', m2m='sam_decoder_deep') File "C:\Users\Dell\Matting-Anything\networks\generator_m2m.py", line 44, in get_generator_m2m generator = sam_m2m(seg=seg, m2m=m2m) File "C:\Users\Dell\Matting-Anything\networks\generator_m2m.py", line 26, in init self.seg_model.eval() File "D:\Anaconda\envs\mam\lib\site-packages\torch\nn\modules\module.py", line 1614, in getattr raise AttributeError("'{}' object has no attribute '{}'".format( AttributeError: 'sam_m2m' object has no attribute 'seg_model'

Process finished with exit code 1 I believe there might be an issue with the weights. I downloaded three weights from this link: https://drive.google.com/drive/folders/1Bor2jRE0U-U6PIYaCm6SZY7qu_c1GYfq - mam_vitb.pth, mam_vith.pth, mam_vitl.pth. However, I couldn't find sam_mam_vitb.pth. How can I resolve this error? Thank you!

zhengzhou commented 1 year ago

same problem.

I found some possible reason as the code blew: https://github.com/SHI-Labs/Matting-Anything/blob/6d4cd9074a1fc09285f9ecf5270519676b5ee113/gradio_app.py#L43

the seg argument should be "sam_vit_b" or some other options.

and 'sam_mam_vitb.pth' is missing

EagleAiDi commented 1 year ago

same problem.

I found some possible reason as the code blew:

https://github.com/SHI-Labs/Matting-Anything/blob/6d4cd9074a1fc09285f9ecf5270519676b5ee113/gradio_app.py#L43

the seg argument should be "sam_vit_b" or some other options.

and 'sam_mam_vitb.pth' is missing

I have found the download link for the weight file mam_sam_vitb.pth: https://huggingface.co/camenduru/Matting-Anything/resolve/main/mam_sam_vitb.pth.

However, I am still encountering the same problem:

mam_model = networks.get_generator_m2m(seg='sam', m2m='sam_decoder_deep')

ZC0102-shu commented 1 year ago

Hi, Have you solve this yet?

EagleAiDi commented 1 year ago

Hi, Have you solve this yet?

mam_model = networks.get_generator_m2m(seg='sam', m2m='sam_decoder_deep') the seg argument should be "sam_vit_b" Is right.

ZC0102-shu commented 1 year ago

Hi, Have you solve this yet?

mam_model = networks.get_generator_m2m(seg='sam', m2m='sam_decoder_deep') the seg argument should be "sam_vit_b" Is right.

Thanks to your rely! My problem is because of the code changes. I clone the latest code and use sam_vit_b, it needs the original SAM chackpoint as well according to the new code.

sunyuhan19981208 commented 6 months ago

same problem