Can regression network training and testing of images with different sizes?

조회 수: 4 (최근 30일)
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개)

카테고리

Help CenterFile Exchange에서 Statistics and Machine Learning Toolbox에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!