我正在尝试将MATLAB CNN代码转换为基于PyTorch的CNN,但没有得到相同的结果。事实上PyTorch代码并没有学到任何东西。输入是64X64大小的黑白图像,批量大小为64。如何将下面的MATLAB代码编码到PyTorch中?
MATLAB CNN:
boxsize = 64;
layers = [imageInputLayer([boxSize boxSize 1])
convolution2dLalyer(3,16,'Padding',1)
batchNormalizationLayer
reluLayer
maxPooling2dLayer(2,'Stride',2)
convolution2dLayer(3,32,'Padding', 1)
batchNormalizationLayer
reluLayer
maxPooling2dLayer(2,'Stride',2)
convolution2dLayer(3,64,'Padding',1)
batchNormalizationLayer
reluLayer
fullyConnvectedLayer(Nclasses)
softmaxLayer
classificationLayer];
您尝试过Small Matlab和Octave to Python吗?它可能对它有用。