Does gradCAM work on 3D image inputs?

6 visualizzazioni (ultimi 30 giorni)
Khuhed Memon
Khuhed Memon il 17 Ott 2024
Modificato: Walter Roberson il 21 Ott 2024
I have 3D MRI volume in a 256x256x49 uint8 array. The same is the input expectation of my model.
[class,score]=classify(trainedNetwork_1,MRI)
The above statement runs fine, with output:
class =
categorical
MS
score =
1×2 single row vector
0.6391 0.3609
but the following function throws an error:
gradCamMap=gradCAM(trainedNetwork_1,MRI,class);
Error using gradCAM (line 144)
Index exceeds the number of array elements. Index must not exceed 2.
What am I doing wrong here?

Risposte (1)

Hitesh
Hitesh il 21 Ott 2024
Modificato: Hitesh il 21 Ott 2024
From what I understand is that if your model has multiple classes, ensure that the index you are passing to "gradCAM" corresponds to the correct class index. You need to convert the categorical class label to an index. Kindly refer to the below code for an example:
classIndex = find(class == categories(class)); % Example conversion to index
% Call the gradCAM function
gradCamMap = gradCAM(trainedNetwork_1, MRI, classIndex);
For more information on "gridCAM", refer to this MATLAB documentation:
If the issue persists, could you please share the code file where you are encountering this error? So that I can investigate the issue.

Categorie

Scopri di più su Image Data Workflows in Help Center e File Exchange

Prodotti


Release

R2024a

Community Treasure Hunt

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

Start Hunting!

Translated by