测试一下keras和mxnet的速度
win10 64 cuda8.0 cudnn5.1 gtx1060
cnn mnist
____________________________________________________________________________________________________
Layer (type) Output Shape Param # Connected to
====================================================================================================
convolution2d_1 (Convolution2D) (None, 64, 24, 24) 1664 convolution2d_input_1[0][0]
____________________________________________________________________________________________________
maxpooling2d_1 (MaxPooling2D) (None, 64, 12, 12) 0 convolution2d_1[0][0]
____________________________________________________________________________________________________
convolution2d_2 (Convolution2D) (None, 128, 8, 8) 204928 maxpooling2d_1[0][0]
____________________________________________________________________________________________________
maxpooling2d_2 (MaxPooling2D) (None, 128, 4, 4) 0 convolution2d_2[0][0]
____________________________________________________________________________________________________
flatten_1 (Flatten) (None, 2048) 0 maxpooling2d_2[0][0]
____________________________________________________________________________________________________
dense_1 (Dense) (None, 1024) 2098176 flatten_1[0][0]
____________________________________________________________________________________________________
dense_2 (Dense) (None, 1024) 1049600 dense_1[0][0]
____________________________________________________________________________________________________
dense_3 (Dense) (None, 10) 10250 dense_2[0][0]
====================================================================================================
Total params: 3364618
____________________________________________________________________________________________________
keras+theano
Train on 60000 samples, validate on 10000 samples
Epoch 1/5
60000/60000 [==============================] - 7s - loss: 0.1975 - acc: 0.9379 - val_loss: 0.0450 - val_acc: 0.9856
Epoch 2/5
60000/60000 [==============================] - 7s - loss: 0.0449 - acc: 0.9857 - val_loss: 0.0351 - val_acc: 0.9891
Epoch 3/5
60000/60000 [==============================] - 7s - loss: 0.0303 - acc: 0.9907 - val_loss: 0.0248 - val_acc: 0.9921
Epoch 4/5
60000/60000 [==============================] - 7s - loss: 0.0207 - acc: 0.9932 - val_loss: 0.0257 - val_acc: 0.9920
Epoch 5/5
60000/60000 [==============================] - 7s - loss: 0.0151 - acc: 0.9954 - val_loss: 0.0232 - val_acc: 0.9929
mxnet
INFO:root:Start training with [gpu(0)]
INFO:root:Epoch[0] Batch [200] Speed: 2960.54 samples/secTrain-accuracy=0.845600
INFO:root:Epoch[0] Batch [400] Speed: 2878.78 samples/secTrain-accuracy=0.975150
INFO:root:Epoch[0] Batch [600] Speed: 2875.59 samples/secTrain-accuracy=0.980750
INFO:root:Epoch[0] Resetting Data Iterator
INFO:root:Epoch[0] Time cost=21.459
INFO:root:Epoch[0] Validation-accuracy=0.986700
INFO:root:Epoch[1] Batch [200] Speed: 2888.17 samples/secTrain-accuracy=0.985850
INFO:root:Epoch[1] Batch [400] Speed: 2867.33 samples/secTrain-accuracy=0.988150
INFO:root:Epoch[1] Batch [600] Speed: 2867.63 samples/secTrain-accuracy=0.990200
INFO:root:Epoch[1] Resetting Data Iterator
INFO:root:Epoch[1] Time cost=20.874
INFO:root:Epoch[1] Validation-accuracy=0.980700
INFO:root:Epoch[2] Batch [200] Speed: 2894.78 samples/secTrain-accuracy=0.992200
INFO:root:Epoch[2] Batch [400] Speed: 2876.13 samples/secTrain-accuracy=0.993150
INFO:root:Epoch[2] Batch [600] Speed: 2858.85 samples/secTrain-accuracy=0.994650
INFO:root:Epoch[2] Resetting Data Iterator
INFO:root:Epoch[2] Time cost=20.875
INFO:root:Epoch[2] Validation-accuracy=0.990300
INFO:root:Epoch[3] Batch [200] Speed: 2879.48 samples/secTrain-accuracy=0.994600
INFO:root:Epoch[3] Batch [400] Speed: 2859.86 samples/secTrain-accuracy=0.995800
INFO:root:Epoch[3] Batch [600] Speed: 2860.25 samples/secTrain-accuracy=0.995800
INFO:root:Epoch[3] Resetting Data Iterator
INFO:root:Epoch[3] Time cost=20.951
INFO:root:Epoch[3] Validation-accuracy=0.990300
INFO:root:Epoch[4] Batch [200] Speed: 2887.86 samples/secTrain-accuracy=0.995750
INFO:root:Epoch[4] Batch [400] Speed: 2865.84 samples/secTrain-accuracy=0.997100
INFO:root:Epoch[4] Batch [600] Speed: 2868.30 samples/secTrain-accuracy=0.997700
INFO:root:Epoch[4] Resetting Data Iterator
INFO:root:Epoch[4] Time cost=20.915
INFO:root:Epoch[4] Validation-accuracy=0.988300
keras的速度我挺满意的,基本上达到了同类卡应该有的效果,而且gpu经常100%
但是theano后端的编译速度好慢好慢好慢!
mxnet好慢啊,三倍时间啊!跑一个官方例子也比gtx980慢一倍,感觉是什么地方配置跪了
不过我发现mxnet训练的时候cpu一直是100,可能是这个原因。。。。
悲伤的故事