Does gradCAM work on 3D image inputs?

6 visualizaciones (últimos 30 días)
Khuhed Memon
Khuhed Memon el 17 de Oct. de 2024
Editada: Walter Roberson el 21 de Oct. de 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?

Respuestas (1)

Hitesh
Hitesh el 21 de Oct. de 2024
Editada: Hitesh el 21 de Oct. de 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.

Categorías

Más información sobre Image Data Workflows en Help Center y File Exchange.

Productos


Versión

R2024a

Community Treasure Hunt

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

Start Hunting!

Translated by