GradCAMの画像を保存したい
11 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
https://jp.mathworks.com/help/deeplearning/ug/gradcam-explains-why.html?searchHighlight=Gradcam&s_tid=srchtitle_Gradcam_2
上記ページのコードを用いてGradCAMヒートマップが乗っかった画像を作成しているのですが、このヒートマップ画像をJPG形式で自動で保存するにはどの様なコードがよろしいでしょうか。
imwrite(I,'name.jpg']);
みたいな形で行けるのかと思ったのですが、このIに入れるべきものがわかりません。
ご教授くださいますようお願い致します。
0 commentaires
Réponse acceptée
Kojiro Saito
le 6 Avr 2023
例の最後にexportgraphicsのコマンドを入れれば保存できます。
imshow(img);
hold on;
imagesc(map,'AlphaData',0.5);
colormap jet
hold off;
title("Grad-CAM");
exportgraphics(gca, 'name.jpg')
あるいはGUIからもできます。スクリプトを実行後に表示されるFigureの上矢印ボタンをクリックし、
出てきたFigureウィンドウでGradCAMの画像の上にマウスをホバーして「名前を付けて保存」ボタンをクリックすることで画像として保存できます。
2 commentaires
Kojiro Saito
le 7 Avr 2023
回答の採用ありがとうございます。GradCAMのmapという変数自体は白黒の画像ですが、この例では元画像に重ね描きしてさらにカラーマップをjetに変更しているので、座標軸(Axes)全体をgcaコマンドで取得し、画像保存するexportgraphics関数を使いました。
Plus de réponses (0)
Voir également
Catégories
En savoir plus sur データ分布プロット dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!