jlianglab / BenchmarkTransformers

Other
24 stars 12 forks source link

pre-trained weights!! #3

Closed wenxin06133 closed 1 year ago

wenxin06133 commented 1 year ago

Hello~~ I would want to ask your pre-trained weights : ImageNet→X-rays(926 K). Can anyone know what data was used to train this set of weights first?

Mda233 commented 1 year ago

Hi, Thanks for reaching out. You can find the datasets assembled as X-rays(926 K) in the supplementary material of our paper: https://static-content.springer.com/esm/chp%3A10.1007%2F978-3-031-16852-9_2/MediaObjects/538914_1_En_2_MOESM1_ESM.pdf Let us know if you have any questions.

wenxin06133 commented 1 year ago

I want to ask another question. Do you have any install requirements about cuda or PyTorch?

Mda233 @.***>於 2023年2月7日 週二,下午1:07寫道:

Hi, Thanks for reaching out. You can find the datasets assembled as X-rays(926 K) in the supplementary material of our paper:

https://static-content.springer.com/esm/chp%3A10.1007%2F978-3-031-16852-9_2/MediaObjects/538914_1_En_2_MOESM1_ESM.pdf Let us know if you have any questions.

— Reply to this email directly, view it on GitHub https://github.com/jlianglab/BenchmarkTransformers/issues/3#issuecomment-1420208036, or unsubscribe https://github.com/notifications/unsubscribe-auth/A2FS2IT5VINFGTZO4ZCSWITWWHJ73ANCNFSM6AAAAAAUTP2KSU . You are receiving this because you authored the thread.Message ID: @.***>

Mda233 commented 1 year ago

We were using both pytorch >= 1.10 and the latest version. And there no requirement for cuda. You can go to pytorch official website to find the latest version to use.

wenxin06133 commented 1 year ago

Hi! Here is another question I want to ask. I want to use your code and create heat map,but it is not allow to get the attention score.

Mda233 @.***>於 2023年2月7日 週二,下午1:07寫道:

Hi, Thanks for reaching out. You can find the datasets assembled as X-rays(926 K) in the supplementary material of our paper:

https://static-content.springer.com/esm/chp%3A10.1007%2F978-3-031-16852-9_2/MediaObjects/538914_1_En_2_MOESM1_ESM.pdf Let us know if you have any questions.

— Reply to this email directly, view it on GitHub https://github.com/jlianglab/BenchmarkTransformers/issues/3#issuecomment-1420208036, or unsubscribe https://github.com/notifications/unsubscribe-auth/A2FS2IT5VINFGTZO4ZCSWITWWHJ73ANCNFSM6AAAAAAUTP2KSU . You are receiving this because you authored the thread.Message ID: @.***>

Mda233 commented 1 year ago

I don't know how you compute the attention score. You can use GradCAM for swin transformer to create heat map from the released models. https://github.com/jacobgil/pytorch-grad-cam/blob/master/usage_examples/swinT_example.py

wenxin06133 commented 1 year ago

Thanks a lot to reply my question!! So the link you gave me is allow to creat the heat map on your code,right? Because the pth file only saved the result of models ,it seems not easy to have heat map.

Mda233 @.***>於 2023年2月23日 週四,下午12:16寫道:

I don't know how you compute the attention score. You can use GradCAM for swin transformer to create heat map from the released models.

https://github.com/jacobgil/pytorch-grad-cam/blob/master/usage_examples/swinT_example.py

— Reply to this email directly, view it on GitHub https://github.com/jlianglab/BenchmarkTransformers/issues/3#issuecomment-1441196709, or unsubscribe https://github.com/notifications/unsubscribe-auth/A2FS2IQYERVLBWY5RF6MVULWY3QDHANCNFSM6AAAAAAUTP2KSU . You are receiving this because you authored the thread.Message ID: @.***>

Mda233 commented 1 year ago

The backbone of the released models (pretrained weights) is Swin Transformer Base. Actually you can build the model from timm or by the original work: https://github.com/microsoft/Swin-Transformer After you build the model successfully, you can use our code to load the pretrained weights by using https://github.com/jlianglab/BenchmarkTransformers/blob/7cf9d52a922a51fb9fd290d3156572f83ec1cd46/simmim/utils.py#L98

wenxin06133 commented 1 year ago

I want to ask what is the meaning of the p_test.txt.

Mda233 @.***> 於 2023年2月23日 週四 下午12:40寫道:

The backbone of the released models (pretrained weights) is Swin Transformer Base. Actually you can build the model from timm or by the original work: https://github.com/microsoft/Swin-Transformer

— Reply to this email directly, view it on GitHub https://github.com/jlianglab/BenchmarkTransformers/issues/3#issuecomment-1441209608, or unsubscribe https://github.com/notifications/unsubscribe-auth/A2FS2IRJWJFFI4Q6WDKF47DWY3S4DANCNFSM6AAAAAAUTP2KSU . You are receiving this because you authored the thread.Message ID: @.***>

Mda233 commented 1 year ago

I want to ask what is the meaning of the p_test.txt. Mda233 @.> 於 2023年2月23日 週四 下午12:40寫道: The backbone of the released models (pretrained weights) is Swin Transformer Base. Actually you can build the model from timm or by the original work: https://github.com/microsoft/Swin-Transformer — Reply to this email directly, view it on GitHub <#3 (comment)>, or unsubscribe https://github.com/notifications/unsubscribe-auth/A2FS2IRJWJFFI4Q6WDKF47DWY3S4DANCNFSM6AAAAAAUTP2KSU . You are receiving this because you authored the thread.Message ID: @.>

Please point to me which p_test you are refering to. In general, p_test is used with y_test when testing. p_test means the predictions from the model, and the y_test means the ground truth labels.

wenxin06133 commented 1 year ago

In trainer.py here we can print(out), I originally think it was the probability of each class. So,why p_test is the probability of each class, how you calculate?

Mda233 @.***>於 2023年5月4日 週四,下午1:53寫道:

I want to ask what is the meaning of the p_test.txt. Mda233 @.

> 於 2023年2月23日 週四 下午12:40寫道: … <#m-2580572937022357807> The backbone of the released models (pretrained weights) is Swin Transformer Base. Actually you can build the model from timm or by the original work: https://github.com/microsoft/Swin-Transformer https://github.com/microsoft/Swin-Transformer — Reply to this email directly, view it on GitHub <#3 (comment) https://github.com/jlianglab/BenchmarkTransformers/issues/3#issuecomment-1441209608>, or unsubscribe https://github.com/notifications/unsubscribe-auth/A2FS2IRJWJFFI4Q6WDKF47DWY3S4DANCNFSM6AAAAAAUTP2KSU https://github.com/notifications/unsubscribe-auth/A2FS2IRJWJFFI4Q6WDKF47DWY3S4DANCNFSM6AAAAAAUTP2KSU . You are receiving this because you authored the thread.Message ID: @.>

Please point to me which p_test you are refering to. In general, p_test is used with y_test when testing. p_test means the predictions from the model, and the y_test means the ground truth labels.

— Reply to this email directly, view it on GitHub https://github.com/jlianglab/BenchmarkTransformers/issues/3#issuecomment-1534129190, or unsubscribe https://github.com/notifications/unsubscribe-auth/A2FS2IQ5KTS545YFHFSKWTLXEM76PANCNFSM6AAAAAAUTP2KSU . You are receiving this because you authored the thread.Message ID: @.***>

Mda233 commented 1 year ago

p_test is from def test_classification() in train.py, where you can find out = model(varInput) out = torch.sigmoid(out) outMean = out.view(bs, n_crops, -1).mean(1) p_test = torch.cat((p_test, outMean.data), 0) This is how we get p_test for all the samples in the test set. For example, if you are test on a task with 14 classes and the test set has N samples. It should have the shape of [N, 14], representing the probability of each class.