why two different mini-batch Accuracy in CNN

I am trying train a CNN.GPU device is Nvidia 1050.
My code
train_data_total=img;
label_4=YTrain;
layers_first = [imageInputLayer([32 32 3],'Normalization','none');
convolution2dLayer(5,130);
reluLayer();
maxPooling2dLayer(2,'Stride',2);
convolution2dLayer(5,180);
reluLayer();
maxPooling2dLayer(2,'Stride',2);
fullyConnectedLayer(256);
reluLayer();
fullyConnectedLayer(2);
softmaxLayer();
classificationLayer()];
opts_first = trainingOptions('sgdm','MiniBatchSize',256,'MaxEpochs',70 ...
,'InitialLearnRate',0.01,'Momentum',0,'Shuffle','once');
train_data_total=imresize(train_data_total,[32 32]);
net_first = trainNetwork(train_data_total,label_4,layers_first,opts_first);
YTrain_output1=classify(net_first,train_data_total);
train_accuracy1 = sum(YTrain_output1 == label_4)/numel(label_4)
My question is why Mini-batch Accuracy is around 50%.
And another computer using the same code and same input has Mini-batch Accuracy is around 98%.
Anyone has an idea of this

回答(1 个)

You need to install the patch.

3 个评论

Please accept the answer.
hello sir
i am using Matlab R2017b
I am facing the same problem when traing CNN for ECG signals
My Mini-batch Accuracy is around 50%. and Mini Batch loss is Fixed at 0.69xx.
how can i resolve this problem ???
Training on single CPU.
|=======================================================================|
| Epoch | Iteration | Time Elapsed | Mini-batch | Mini-batch | Base Learning|
| | | (seconds) | Loss | Accuracy | Rate |
|=======================================================================|
| 1 | 1 | 0.72 | 0.6930 | 70.00% | 0.0010 |
| 4 | 320 | 11.36 | 0.6931 | 50.00% | 0.0010 |
| 8 | 640 | 21.76 | 0.6929 | 70.00% | 0.0010 |
| 12 | 960 | 32.12 | 0.6937 | 40.00% | 0.0010 |
| 16 | 1280 | 42.50 | 0.6932 | 50.00% | 0.0010 |
| 20 | 1600 | 53.04 | 0.6932 | 50.00% | 0.0010 |
| 23 | 1920 | 63.60 | 0.6930 | 50.00% | 0.0010 |
| 27 | 2240 | 74.73 | 0.6929 | 70.00% | 0.0010 |
| 31 | 2560 | 85.56 | 0.6932 | 50.00% | 0.0010 |
| 35 | 2880 | 96.81 | 0.6929 | 80.00% | 0.0010 |
| 39 | 3200 | 107.51 | 0.6930 | 60.00% | 0.0010 |
| 42 | 3520 | 118.29 | 0.6938 | 40.00% | 0.0010 |
| 46 | 3840 | 129.85 | 0.6933 | 30.00% | 0.0010 |
| 50 | 4160 | 140.92 | 0.6946 | 30.00% | 0.0010 |
| 54 | 4480 | 151.81 | 0.6928 | 60.00% | 0.0010 |
| 58 | 4800 | 163.14 | 0.6936 | 30.00% | 0.0010 |
| 61 | 5120 | 174.09 | 0.6932 | 50.00% | 0.0010 |
| 65 | 5440 | 184.38 | 0.6933 | 40.00% | 0.0010 |
| 69 | 5760 | 194.80 | 0.6928 | 60.00% | 0.0010 |
| 73 | 6080 | 205.18 | 0.6938 | 40.00% | 0.0010 |
| 77 | 6400 | 215.87 | 0.6931 | 60.00% | 0.0010 |
| 80 | 6720 | 227.45 | 0.6934 | 30.00% | 0.0010 |
| 84 | 7040 | 239.33 | 0.6932 | 50.00% | 0.0010 |
| 88 | 7360 | 250.64 | 0.6930 | 70.00% | 0.0010 |
| 92 | 7680 | 261.30 | 0.6931 | 50.00% | 0.0010 |
| 96 | 8000 | 271.53 | 0.6931 | 60.00% | 0.0010 |
| 100 | 8320 | 282.09 | 0.6935 | 40.00% | 0.0010 |
| 100 | 8400 | 284.69 | 0.6937 | 30.00% | 0.0010 |
|=======================================================================|
accuracy = 0.5000
please help !!!!

请先登录,再进行评论。

类别

帮助中心File Exchange 中查找有关 Deep Learning Toolbox 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by