How to visualize the features of the vision transfomer after training using t-sne visualizion?
I could not apply the same in vision transformer beacuse there are an error during using actication function as follows:
earlyLayerName = "'encoderblock1_mha1";
pool1Activations = activations(net,...
augimdsTrain,earlyLayerName,"OutputAs","rows");

답변 (1개)

Garmit Pant
Garmit Pant 2024년 3월 5일

0 개 추천

From what I gather, you are following the MATLAB examples “Train Vision Transformer Network for Image Classification” and “View Network Behavior Using tsne” to visualise the results of the network activations of a trained vision transformer. You are encountering an error in the process.
The line of code where you are encountering the error is trying to refer to a non-existent layer, assuming you are using the MATLAB default implementation of the “visionTransformer” network. By analysing the network, we can see the layer is named “encoderblock1_mha” and not “encoderblock1_mha1”. Unless you have renamed and replaced the layer, passing the correct layer name shall eliminate the result.
I hope you find the above explanation and suggestions useful!

댓글 수: 5

MAHMOUD EID
MAHMOUD EID 2024년 3월 7일
Hi Garmit,
I think this is not the problem.
I ensured from the layer name . if you choose any layer for visulazion in the activation command :
pool1Activations = activations(net,...
augimdsTrain,earlyLayerName,"OutputAs","rows");
usually, I have this error "Incorrect number or types of inputs or outputs for function activations."
Garmit Pant
Garmit Pant 2024년 3월 8일
Hi Mahmoud
Are you using the same data as mentioned and included in the examples?
MAHMOUD EID
MAHMOUD EID 2024년 3월 8일
Hi Garmit
The problem is the same during using any dataset.
you can use the examples mentioned above and try to visualize the transformer after training using the same data of the example, and share the code for the visualiztion .
adolf hitler
adolf hitler 2024년 5월 15일
Hi Garmit
Have you solved the problem? I had the same problem when I was executing code.
adolf hitler
adolf hitler 2024년 5월 15일
Hi Mahmoud
Have you solved the problem? I had the same problem when I was executing code.

댓글을 달려면 로그인하십시오.

제품

릴리스

R2023b

질문:

2024년 2월 28일

댓글:

2024년 5월 15일

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by