matlab - 无法使用 DAGNetwork 类型的值作为 Matlab 中的索引
问题描述
我已经在 MATLAB 中构建了 UNET 模型,训练被中断,现在我正在尝试从最后一个检查点恢复/继续训练(在训练期间保存),但我得到了错误
" 无法使用 DAGNetwork 类型的值作为索引。
错误(第 31 行)训练 = trainNetwork(pximds,lgraph(net),options); "
这是我的代码,有人可以告诉我为什么会出现此错误。
1- clear all
2- close all
3- load('net_checkpoint__226644__2021_07_08__16_18_25.mat','net')
4- matlabpath = 'E:\My project';
5- data = fullfile(matlabpath,'ImageDatasetforPixelLabelDataSeries6-
6- 21');
7- data1 = fullfile(matlabpath,'PixelLabelDataSeries6-21');
8- imds = imageDatastore(data,'IncludeSubfolders',true,
9- 'LabelSource','foldernames');
10- classes = ["CatheterMarkerVessel" "Background"];
11- pixelLabelIDs = [0 1];
12- pxds = pixelLabelDatastore(data1, classes ,pixelLabelIDs);
13- trainingdata = pixelLabelImageSource(imds,pxds);
14- tbl = countEachLabel(trainingdata);
15- imageSize = [1024 1024 1];
16- numClasses = numel(classes);
17- lgraph = unetLayers(imageSize,numClasses,'EncoderDepth',5);
18- %% Data Augmentation
19- augmenter = imageDataAugmenter('RandXReflection',true,
20- 'RandYReflection',true);
21- pximds = pixelLabelImageDatastore(imds,pxds,'DataAugmentation',
22- augmenter);
23- %% Training
24- options = trainingOptions('sgdm', ...
25- 'InitialLearnRate',0.0001, ...
26- 'Momentum',0.99, ...
27- 'MiniBatchSize',1, ...
28- 'MaxEpochs',300, ...
29- 'Plots','training-progress', ...
30- 'CheckpointPath','E:\My Project');
31- training = trainNetwork(pximds,lgraph(net),options);
解决方案
推荐阅读
- javascript - 为什么我的 javascript 在我的导航部分中不起作用?
- mysql - 将行转换为列以删除 SQL 中公共值上的重复条目
- ruby-on-rails - 为整个 Rails 服务器保留一个对象实例?
- c# - 导航属性中的另一个类没有被映射:AutoMapper
- flutter - 如果 API 无法获取文件,则显示不同的小部件
- javascript - 如何等待环境变量加载到 Node.JS/TypeScript/JavaScript
- excel - 请帮助使用此代码后,我无法保存对工作簿的任何更改
- image - 关于如何使用 office 创建 Windows 服务器 docker 映像的指南
- laravel - 如何在 Laravel vue js 中对嵌套数据进行删除功能
- function - 随机选择键时如何增加字典键?如何创建一个循环来遍历函数给出的迭代?