show
説明
例
数字のサンプル データを解凍し、イメージ データストアを作成します。関数 imageDatastore は、フォルダー名に基づいてイメージに自動的にラベルを付けます。
unzip("DigitsData.zip") imds = imageDatastore("DigitsData", ... IncludeSubfolders=true, ... LabelSource="foldernames");
畳み込みニューラル ネットワーク アーキテクチャを定義します。ネットワークの入力層にイメージのサイズを指定し、最終全結合層にクラスの数を指定します。イメージはそれぞれ 28 x 28 x 1 ピクセルです。
inputSize = [28 28 1];
numClasses = numel(categories(imds.Labels));
layers = [
imageInputLayer(inputSize)
convolution2dLayer(5,20)
batchNormalizationLayer
reluLayer
fullyConnectedLayer(numClasses)
softmaxLayer];学習オプションを指定します。
SGDM ソルバーを使用して 4 エポック学習させます。
精度メトリクスを監視します。
options = trainingOptions("sgdm", ... MaxEpochs=4, ... Metrics="accuracy");
ニューラル ネットワークを学習させます。分類には、クロスエントロピー損失を使用します。学習済みネットワークと学習情報を返します。
[net,info] = trainnet(imds,layers,"crossentropy",options); Iteration Epoch TimeElapsed LearnRate TrainingLoss TrainingAccuracy
_________ _____ ___________ _________ ____________ ________________
1 1 00:00:01 0.01 2.7615 3.9062
50 1 00:00:06 0.01 0.48211 85.938
100 2 00:00:09 0.01 0.16471 96.094
150 2 00:00:13 0.01 0.10177 96.094
200 3 00:00:17 0.01 0.057216 100
250 4 00:00:20 0.01 0.031815 100
300 4 00:00:24 0.01 0.021116 100
312 4 00:00:25 0.01 0.029253 99.219
Training stopped: Max epochs completed
学習情報を表示します。
info
info =
TrainingInfo with properties:
TrainingHistory: [312×5 table]
ValidationHistory: [0×0 table]
OutputNetworkIteration: 312
StopReason: "Max epochs completed"
show 関数を使用して、学習情報をプロットに表示します。
show(info)

close 関数を使用してプロットを閉じます。
close(info)
入力引数
学習情報。TrainingInfo オブジェクトとして指定します。
バージョン履歴
R2023b で導入
MATLAB Command
You clicked a link that corresponds to this MATLAB command:
Run the command by entering it in the MATLAB Command Window. Web browsers do not support MATLAB commands.
Web サイトの選択
Web サイトを選択すると、翻訳されたコンテンツにアクセスし、地域のイベントやサービスを確認できます。現在の位置情報に基づき、次のサイトの選択を推奨します:
また、以下のリストから Web サイトを選択することもできます。
最適なサイトパフォーマンスの取得方法
中国のサイト (中国語または英語) を選択することで、最適なサイトパフォーマンスが得られます。その他の国の MathWorks のサイトは、お客様の地域からのアクセスが最適化されていません。
南北アメリカ
- América Latina (Español)
- Canada (English)
- United States (English)
ヨーロッパ
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)