Retraining Alexnet - works on windows 7 not on windows 10?

3 visualizaciones (últimos 30 días)
James Silk
James Silk el 1 de Abr. de 2022
Comentada: Joss Knight el 4 de Abr. de 2022
Hi All,
I wrote the below code a few years ago on a windows 7 machine and it works quite well on the data set provided. I have recently tried resuing it on a new windows 10 machine and, while the code runs, it only gets a 20% accuracy as it just guesses the same label each time.
In both instances the code is identical, both using matlab 2019b and both using the same set of images. Slightly confused as to why this is happening any help would be appreciated.
It does also show this warning which seems to slow it down more on the windows 10 machine: Warning: The CUDA driver must recompile the GPU libraries because your device is more recent than the libraries. Recompiling can take several minutes. Learn more.
folder = 'Roads';
road_ds = imageDatastore(folder,'IncludeSubfolders',true,'LabelSource',"foldernames");
roadlabels = road_ds.Labels;
net = alexnet;
[roadTrain, roadTest] = splitEachLabel(road_ds,0.6);
roadTrain_auds = augmentedImageDatastore([227 227 3],roadTrain,'ColorPreprocessing','gray2rgb')
roadTest_auds = augmentedImageDatastore([227 227 3],roadTest,'ColorPreprocessing','gray2rgb')
layers = net.Layers;
inputlayer = imageInputLayer([227 227 3],'Name','input')
fc = fullyConnectedLayer(5);
layers(23) = fc;
layers(end) = classificationLayer;
options = trainingOptions('sgdm','InitialLearnRate', 0.001,'Plots',"training-progress",'MaxEpochs',25,"MiniBatchSize",50,'ValidationFrequency',5,'ValidationData',roadTest_auds);
[roadnet, info] = trainNetwork(roadTrain_auds,layers,options);
roadpreds = classify(roadnet, roadTest_auds);
roadact = roadTest.Labels;
numCorrect = nnz(roadpreds == roadact);
accuracy = 100 * numCorrect / numel(roadTest.Labels)

Respuestas (1)

Joss Knight
Joss Knight el 2 de Abr. de 2022
The difference here is not your OS but your GPU. You have a newer GPU on your Windows 10 machine. Probably it is an Ampere GPU which is not supported for Deep Learning in R2019b (see GPU Support archive documentation).
  2 comentarios
James Silk
James Silk el 4 de Abr. de 2022
Thanks Joss for the answer, So it seems that it might be that the machine is newer than the version of matlab that is causing the error in the answers if I'm understanding that right? It also seems like the only solution is to have the matlab 2021a or b installed?
Thanks again for your answer.
Joss Knight
Joss Knight el 4 de Abr. de 2022
Not the machine, the GPU in the machine. Type gpuDevice on your two machines and show us the output.

Iniciar sesión para comentar.

Categorías

Más información sobre Image Data Workflows en Help Center y File Exchange.

Productos


Versión

R2019b

Community Treasure Hunt

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

Start Hunting!

Translated by