简体   繁体   中英

Getting Test Accuracy for model.predict_generator

I am calling model.predict_generator() method for predictions on Test data-set. My question is how can I retrieve test accuracy ? Following is my code line:

predictions = model.predict_generator(test_images, steps=3,  verbose=0)

Where test_iamges in the parameter of predict_generator function has batch data retrieved from local disk by calling ImageDataGenerator

Any guidance will be highly appreciated.

Thanks

There is a corresponding function model.evaluate_generator that will give the loss, acc etc on your test set but not the predictions . Have a look at the model documentation , ex:

loss, acc = model.evaluate_generator(test_images, steps=3, verbose=0)

Returns: Scalar test loss (if the model has a single output and no metrics) or list of scalars (if the model has multiple outputs and/or metrics).

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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM