我的代码粘贴在下面:
#-------NETWORK 1---------------
network1 = Sequential()
#Dense layers - 1st param is output
network1.add(Dense(2048, input_shape=(8500,),name="dense_one"))
network1.add(Dense(2048,activation='sigmoid',name = "dense_two"))
network1.add(Dense(1000,activation='sigmoid',name = "dense_three"))
network1.add(Dense(100,activation = 'relu',name = "dense_four"))
for l in network1.layers:
print l.name, l.input_shape , "=======>", l.output_shape
print network1.summary()
#-------- NETWORK 2-----------
network2 = Sequential()
network2.add(Conv2D(32, kernel_size=(3,3), activation='relu', input_shape=(224,224,3)))
network2.add(Conv2D(64, kernel_size = (3,3)))
network2.add(MaxPooling2D(pool_size=(2,2)))
network2.add(Dropout(0.5))
network2.add(Dense(100,activation='sigmoid',name ="network2_three"))
network2.add(Flatten())
#-------------------MERGED NETWORK------------------#
model = Sequential()
model.add(Merge([network1,network2],mode = 'concat'))
上面的代码以每个 epoch 46 秒的速度运行,对于给定的 600 个数据点样本,我觉得这相当慢。我的输入是一个大小为 180 MB 的 hdf5 文件。我运行了 CNN Bechmark 测试,它似乎工作正常(如下所示),看起来我的输入或我传递它的方式有些磨损。
2017-09-07 12:58:15.380999: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1045] Creating TensorFlow device (/gpu:0) -> (device: 0, name: TITAN X (Pascal), pci bus id: 0000:01:00.0)
2017-09-07 12:58:17.686796: step 0, duration = 0.059
2017-09-07 12:58:18.244654: step 10, duration = 0.056
2017-09-07 12:58:18.802592: step 20, duration = 0.056
2017-09-07 12:58:19.364020: step 30, duration = 0.059
2017-09-07 12:58:19.983245: step 40, duration = 0.058
2017-09-07 12:58:20.541404: step 50, duration = 0.056
2017-09-07 12:58:21.098754: step 60, duration = 0.055
2017-09-07 12:58:21.656521: step 70, duration = 0.056
2017-09-07 12:58:22.216097: step 80, duration = 0.056
2017-09-07 12:58:22.773647: step 90, duration = 0.056
2017-09-07 12:58:23.275301: Forward across 100 steps, 0.056 +/- 0.002 sec / batch
2017-09-07 12:58:24.844090: step 0, duration = 0.126
2017-09-07 12:58:26.091721: step 10, duration = 0.124
2017-09-07 12:58:27.340821: step 20, duration = 0.125
2017-09-07 12:58:28.589284: step 30, duration = 0.125
2017-09-07 12:58:29.842128: step 40, duration = 0.125
2017-09-07 12:58:31.094425: step 50, duration = 0.125
2017-09-07 12:58:32.348420: step 60, duration = 0.125
2017-09-07 12:58:33.600602: step 70, duration = 0.125
2017-09-07 12:58:34.853246: step 80, duration = 0.125
2017-09-07 12:58:36.105065: step 90, duration = 0.125
2017-09-07 12:58:37.232945: Forward-backward across 100 steps, 0.125 +/- 0.001 sec / batch
如何调试输入的处理方式?