Forked from CMCDragonkai/probabilities_to_one_hot_vectors.py
Created
September 7, 2019 07:26
-
-
Save minesh1291/de8d5a6437e18bd8fa48c29f570d9598 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