#python #keras #deep-learning #conv-neural-network #data-generation
Вопрос:
вот мой код
opt= 'Adam'
model.compile(optimizer=opt, loss='categorical_crossentropy', metrics=['acc'])
steps_per_epoch=len(trainX)//32
validation_steps=len(valX)//32
history=model.fit_generator(traingen,steps_per_epoch=steps_per_epoch,epochs=80, validation_data=valgen, validation_steps=validation_steps, class_weight=class_weights)
и вот результат
loss: nan - acc: 1.0000WARNING:tensorflow:Your input ran out of data; interrupting training. Make sure that your dataset or generator can generate at least `steps_per_epoch * epochs` batches (in this case, 17440 batches). You may need to use the repeat() function when building your dataset.
что не так, потому что я считаю, что мои шаги за эпоху получены из формулы. мой генератор в любом случае такой :
datagen= ImageDataGenerator(
#rotation_range=45,
#brightness_range=(0.3,1.8),
#shear_range=0.5,
#zoom_range=0.2,
#channel_shift_range=0.0,
#horizontal_flip=True,
#vertical_flip=True,
validation_split=0.2
)
traingen=datagen.flow(trainX,trainy,batch_size=32,subset='training')
valgen=datagen.flow(valX,valy,batch_size=32,subset='validation')