xmed-lab / clip_surgery Goto Github PK
View Code? Open in Web Editor NEWCLIP Surgery for Better Explainability with Enhancement in Open-Vocabulary Tasks
CLIP Surgery for Better Explainability with Enhancement in Open-Vocabulary Tasks
As is in the title
Thank you for sharing excellent work!
I am trying to get segmentation masks (open-vocabulary) from the code.
I tried argmax from "similarity_map" from demo.py, and it showed lower performance.
Is there any way to get a segmentation mask?
Hi! Thanks for your great work.
Could you please provide a detailed explanation of how the category weight 'w' in formula (7) is designed? Why is it crucial to emphasize obvious classes?
Thanks for your excellent work.
I failed to reproduce the multi-label recognition results in Table 7. For example, when I use CLIP ViT-B/16 with softmax function, I only got 35% mAP on NUS-Wide (42.85% in paper). I use the cls token of the original CLIP without feature surgery. Could you share the details and evaluation code of multi-label recognition?
I have an error in jupyter :
AttributeError: module 'clip' has no attribute 'encode_text_with_prompt_ensemble'
"encode_text_with_prompt_ensemble" is a function? How can i solve it ?
Thanks!
Hi, Thank you for great work !
I wonder if your method also can be applied for EVA-CLIP ! Have you ever tried?
Thanks to MIM training, EVA-CLIP-L showed 15 mIoU zero-shot performance on Cityscapes Validation, while original CLIP showed 0 mIoU without any scheme(i.e. MaskCLIP, CLIPSurgery).
Therefore, I wonder your Surgery method can also boost zero-shot EVA-CLIP too !
The segmentation effect is good when there are existed object in the image, but when a random prompts text is given, a high-confidence point will also be generated, which will cause segmentation errors in the downstream SAM model. How can this situation be solved?
here is some case:
I need to find the bag in the image , but the bag actually is not in the image,but the generated point is also high score.
Hi, thanks for your great work.
I am interested in the details about open-vocab segmentation and I have few questions regarding this task.
In the architecture surgery
, I'm wondering whether the prediction for segmentation comes from the original path or the new path? Additionally, which features are used in the feature surgery
? The paper said "Note that Eq. 9 is specifically designed for the explainability task", but I think the segmentation should use this too?
And it confused me in the [code](https://github.com/xmed-lab/CLIP_Surgery/blob/e346359d67e8fc4fe301467914151316d3982661/clip/clip_surgery_model.py#L349C36-L349C36)
x[0, :, :] = x_ori[0, :, :] # clip_surgery
Why do you preserve the [cls] token in the original_path? If my understanding was right, the [cls] token in the original_path is not influenced by the new_path. So for the multi-label recognition task, the architecture surgery
would be useless?
Could you give more details? And it would be of great help if you could release the code for the open-vocabulary segmentation.
Thanks again for your work!
Hi there
Thanks for this good work!
I am trying to explore input a sentence to get some satisfied SAM results with CLIp surgery, could you please provide some suggestions on it?
Best.
I want to reimplement the eclip, can you give more details about it?
First of all great work and thank you for sharing!
I have a question that I am in the process of figuring out but I thought I would post it here incase it was useful. I was able to get everything working quite successfully but I ran into a case I had a problem with. As you can see below I have a photo with two birds, through clip.get_similarity_map I was able to select the two birds
After when I want to implement clip.similarity_map_to_points to infer for SAM, it only seems to provide me with one bird
As you can guess in the title, I think this is a limitation of similarity_map_to_points method, but I am not sure. Would you be able to provide some clarity on similarity_map_to_points method any/or maybe suggest why this is happening.
Again, great work and thank you for posting!
your work is very good.I'd like to know more details.Can you provide the paper?
Thanks for your excellent work, but I can't understand that the redundant features Fr can be obtained with equation 8. Can you help me with this question?
your work seems similar to Extract Free Dense Labels from CLIP
Hi, thanks for this great work, I've noticed that clip_surgery also achieves good performance in open-vocabulary segmentation. However, clip_surgery requires specific words as input to obtain the corresponding segmentation results. I'd like to ask how clip_surgery is implemented in the open-vocabulary segmentation setting?
Hi! thank you for this good work and neat implementation
Have you tried training/fine-tuning CLIP_surgery on out of domain datasets (medical scans, drawings ..etc)? Do you think that would improve the mIoU on these dataset or the model would collapse?
Thanks for your work and for sharing the code!
It is, however unclear to me how the mIoU was computed for the open-vocabulary segmentation tasks.
In the paper (sec.5.1.3 page 10), you mention that:
"Specifically, the mIoU is also used to measure the visualization quality. While each positive label is evaluated independently with a grid search threshold to identify the foreground."
I have several questions:
Thanks,
Could you help me find my errors?
Thanks a lot.
Hi, thanks for your great work! I just wonder have you tried CLIP Surgery on traditional classification datasets like ImageNet and Cifar?
Hello
Thanks for the great work.
Do you have a script to convert your CLIP_Surgery to onnx format ?
Great work, is that possible for this work extend to the medical imaging field?
Hi, Thank u for your great works! I just want to ask about the exact definition of
你好,
论文中5.6不是很明白。clip在训练的时候是句子和图片pair。如何得到每个单词与图片的相似度的呢?等式(9)里的Nt,是text token数量,那么在5.6的实验中,把句子中的每个单词作为text token吗?
Hi, thanks for the awesome repo.
I had a question about how clip processes the images that are different then 224x224, specifically for the high resolution images in the demo.
When I load the vit-b-16 model, and print the shape for the model.visual.positional_embedding, it is 197x768. Then when I encode the high res image (512x512) using model.visual, I notice that the shape of the positional embeddings automatically change to greater then 197 to be compatible with the image tokens. Can you tell me where in the code the positional embeddings is changing dynamically with the input image?
Hi,
First of all, great work! I have implemented CLIP_Surgery in my project and can confirm that it's better than clipseg at certain tasks.
However, I'm having a hard time getting it to make decent selections of small objects when using SAM. Let me give you an example:
CLIP_Surgery selection of "hand" without SAM:
CLIP_Surgery selection of "hand" with SAM (it selected the background?):
Now, SAM outputs 3 different masks but the one above was selected as having the highest score per masks[np.argmax(scores)]
. But if I look at the outputs, I can see that it really should have preferred mask0 in this case:
Is this an issue with CLIP_Surgery's implementation of SAM or SAM itself?
Also, even the best SAM mask seems to include a lot of background noise not present in clipseg's output. Is there an easy way to filter that out?
Thanks!
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.