Created
September 4, 2018 05:41
-
-
Save CMCDragonkai/0f5bb84fb989c2b140fbf084bb1ebf3a to your computer and use it in GitHub Desktop.
Conversion of Keras/Tensorflow Probabilities to One Hot Vectors #python
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # pred_batch shape is (N, CLASS_COUNT), where N is the batch size | |
| # it is returned by Keras as a probabilities/logits | |
| # this converts the probabilities to a 1 hot vector | |
| pred_batch = model.predict_on_batch(image_batch) | |
| pred_batch = (pred_batch == pred_batch.max(axis=1)).astype(int) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment