Can regression network training and testing of images with different sizes?
3 views (last 30 days)
Show older comments
I trained a simple regression network to perform the image conversion task. In the training session, the size of the input image was set to a fixed value of 128*128. But in the test session, the input size is 1000*1000. The code is shown below:
inputSize = [128 128 1];
filterSize = 3;
numFilters = 128;
layers = [
imageInputLayer(inputSize,'Normalization','rescale-zero-one','Min',-pi,'Max',pi)
convolution2dLayer(filterSize,128,'DilationFactor',1,'Padding','same')
batchNormalizationLayer
reluLayer
convolution2dLayer(filterSize,128,'DilationFactor',2,'Padding','same')
batchNormalizationLayer
reluLayer
convolution2dLayer(filterSize,128,'DilationFactor',4,'Padding','same')
batchNormalizationLayer
reluLayer
convolution2dLayer(1,1)
regressionLayer]
options = trainingOptions('adam', ...
'InitialLearnRate',0.001, ...
'MaxEpochs',100, ...
'MiniBatchSize',30, ...
'Verbose',true,...
'ValidationFrequency',30, ...
'ValidationPatience',inf, ...
'OutputNetwork','best-validation-loss', ...
'ValidationData',{wrapVal,pVal});
[simplenet,info] = trainNetwork(wrapTrain,pTrain,layers,options);
An error message appears after the above code is run.
错误使用 DAGNetwork/predict
输入大小不正确。输入图像的大小必须为 [128 128 1]。
出错 SeriesNetwork/predict (第 302 行)
Y = this.UnderlyingDAGNetwork.predict(X, varargin{:});
0 Comments
Answers (0)
See Also
Categories
Find more on Statistics and Machine Learning Toolbox in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!