I am new to keras
. Now I am going to predict test image groups with the model I trained using model.fit_generator
. Can I use model.predict
? Not sure how to use model.predict_generator
. And the literature showed the results of these two are different, which one is better?
Thanks a lot!
datagen = ImageDataGenerator(
enter code here`rotation_range=
...
zoom_range = 0.05)
model = Sequential()
model.add
...
model.fit_generator(datagen.flow(train_x, train_y, batch_size=batch_size),
steps_per_epoch=train_x.shape[0] // batch_size,
epochs=epochs, validation_data=(test_x, test_y))
from sklearn.metrics import roc_auc_score
test_y_hat = model.predict(test_x)
roc_auc_score(test_y, test_y_hat)
Yes you can do that Taking a look at the code for fit_generator()
you can see that model does not remember how it was trained. In fact you can use all these APIs ( fit
, fit_generator
, predict
, predict_generator
) on a keras model in any order.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.