Does gradCAM work on 3D image inputs?

6 ビュー (過去 30 日間)
Khuhed Memon
Khuhed Memon 2024 年 10 月 17 日
編集済み: Walter Roberson 2024 年 10 月 21 日
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?

回答 (1 件)

Hitesh
Hitesh 2024 年 10 月 21 日
編集済み: Hitesh 2024 年 10 月 21 日
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.

カテゴリ

Help Center および File ExchangeImage Data Workflows についてさらに検索

製品


リリース

R2024a

Community Treasure Hunt

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

Start Hunting!

Translated by