为什么在我定义steps_per_epoch时,ETA会增加太多?

时间:2019-07-15 15:39:18

标签: python tensorflow keras

这是我的训练功能:

model.fit(treinar_estados, treinar_mov, epochs= numEpochs,
        validation_data = (testar_estados,testar_mov)) 

生成以下内容:

Train on 78800 samples, validate on 33780 samples
Epoch 1/100

   32/78800 [..............................] - ETA: 6:37 - loss: 4.8805 - acc: 0.0000e+00
  640/78800 [..............................] - ETA: 26s - loss: 4.1140 - acc: 0.0844     
 1280/78800 [..............................] - ETA: 16s - loss: 3.7132 - acc: 0.1172
 1920/78800 [..............................] - ETA: 12s - loss: 3.5422 - acc: 0.1354
 2560/78800 [..............................] - ETA: 11s - loss: 3.4102 - acc: 0.1582
 3200/78800 [>.............................] - ETA: 10s - loss: 3.3105 - acc: 0.1681
 3840/78800 [>.............................] - ETA: 9s - loss: 3.2102 - acc: 0.1867 
...

但是当我定义steps_per_epoch时:

model.fit(treinar_estados, treinar_mov, epochs= numEpochs,
        validation_data = (testar_estados,testar_mov),
        steps_per_epoch=78800//32,
        validation_steps=33780//32) 

发生这种情况:

Epoch 1/100

   1/2462 [..............................] - ETA: 2:53:46 - loss: 4.8079 - acc: 9.3909e-04
   2/2462 [..............................] - ETA: 2:02:31 - loss: 4.7448 - acc: 0.0116    
   3/2462 [..............................] - ETA: 1:45:10 - loss: 4.6837 - acc: 0.0437
   4/2462 [..............................] - ETA: 1:36:48 - loss: 4.6196 - acc: 0.0583
   5/2462 [..............................] - ETA: 1:30:55 - loss: 4.5496 - acc: 0.0666
   6/2462 [..............................] - ETA: 1:26:40 - loss: 4.4721 - acc: 0.0718
   7/2462 [..............................] - ETA: 1:23:43 - loss: 4.3886 - acc: 0.0752

所以我真的想理解,这正常吗?如果没有,那可能是什么原因?

这是模型:

model = keras.Sequential([
        keras.layers.Flatten(input_shape=(8, 4, 4)),
        keras.layers.Dense(300, activation=tf.nn.relu),
        keras.layers.Dense(300, activation=tf.nn.relu),
        keras.layers.Dense(300, activation=tf.nn.relu),
        keras.layers.Dense(128, activation=tf.nn.softmax)
    ])

    model.compile(optimizer='adam', 
                  loss='categorical_crossentropy',
                  metrics=['accuracy'])

0 个答案:

没有答案