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

Why divide 0.07 #15

Open
vvthai10 opened this issue May 23, 2024 · 7 comments
Open

Why divide 0.07 #15

vvthai10 opened this issue May 23, 2024 · 7 comments

Comments

@vvthai10
Copy link

I don't understand why you divide right here
text_probs = image_features.unsqueeze(1) @ text_features.permute(0, 2, 1) text_probs = text_probs[:, 0, ...]/0.07 text_probs = text_probs.squeeze()
and another here
logit_scale = self.logit_scale.exp() # nn.Parameter(torch.ones([]) * np.log(1 / 0.07)) logits_per_image = logit_scale * image_features @ text_features.t() logits_per_text = logits_per_image.t()

And in another paper , they use multi with 100, example
for layer in range(len(det_patch_tokens)): det_patch_tokens[layer] = det_patch_tokens[layer] / det_patch_tokens[layer].norm(dim=-1, keepdim=True) anomaly_map = (100.0 * det_patch_tokens[layer] @ text_features) anomaly_map = torch.softmax(anomaly_map, dim=-1)[:, :, 1] anomaly_score = torch.mean(anomaly_map, dim=-1) det_loss += loss_bce(anomaly_score, image_label)

@zqhang
Copy link
Owner

zqhang commented May 24, 2024

It is the temperature ratio of the original CLIP.

@vvthai10
Copy link
Author

But i see in https://github.com/mlfoundations/open_clip#usage, they use 100, you think it make result different?

@zqhang
Copy link
Owner

zqhang commented May 24, 2024 via email

@vvthai10
Copy link
Author

Another question, i want use Linear layer to get local feature of images, You think when train text by your idea and with adapter linear. It can be better

@zqhang
Copy link
Owner

zqhang commented May 24, 2024

you can have a try

@vvthai10
Copy link
Author

I am trying but i don't have make high ACC, I just high in first epoch and after it reduce and I don't know why :(

@vvthai10
Copy link
Author

vvthai10 commented May 25, 2024 via email

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