caoyunkang / Segment-Any-Anomaly

Official implementation of "Segment Any Anomaly without Training via Hybrid Prompt Regularization (SAA+)".
704 stars 76 forks source link

The error of run demo.py #27

Closed ziyouzheilu closed 10 months ago

ziyouzheilu commented 10 months ago

Thank you so much for your wonderful paper! I have really enjoyed it! But when I run:python demo.py and print(score),print(similarty map),it appears the following error and doesn't show the picture:

/share/home/project/Segment-Any-Anomaly/GroundingDINO/groundingdino/models/GroundingDINO/ms_deform_attn.py:31: UserWarning: Failed to load custom C++ ops. Running on CPU mode Only! warnings.warn("Failed to load custom C++ ops. Running on CPU mode Only!") /share/home/anaconda3/lib/python3.10/site-packages/torch/functional.py:504: UserWarning: torch.meshgrid: in an upcoming release, it will be required to pass the indexing argument. (Triggered internally at ../aten/src/ATen/native/TensorShape.cpp:3483.) return _VF.meshgrid(tensors, **kwargs) # type: ignore[attr-defined] final text_encoder_type: bert-base-uncased Some weights of the model checkpoint at bert-base-uncased were not used when initializing BertModel: ['cls.predictions.transform.LayerNorm.bias', 'cls.predictions.bias', 'cls.predictions.transform.dense.bias', 'cls.seq_relationship.weight', 'cls.predictions.transform.dense.weight', 'cls.seq_relationship.bias', 'cls.predictions.transform.LayerNorm.weight']

similarty map is :[[0. 0. 0. ... 0. 0. 0.] [0. 0. 0. ... 0. 0. 0.] [0. 0. 0. ... 0. 0. 0.] ... [0. 0. 0. ... 0. 0. 0.] [0. 0. 0. ... 0. 0. 0.] [0. 0. 0. ... 0. 0. 0.]]

It seems that score, appendix = model(image) has some problems . Thank you very much for your time and expertise. I greatly appreciate any insights or suggestions

caoyunkang commented 10 months ago

Hi! It seems to be an environmental problem. You may try to follow the install.sh and build a new environment instead. Or you may also try the huggingface demo (https://huggingface.co/spaces/Caoyunkang/Segment-Any-Anomaly) or colab demo (https://colab.research.google.com/drive/12Sh0j92YYmTa0oIuSEWWpPBCpIwCSVhz?usp=sharing). Thanks.