I looked, but it seems I can’t find examples of how to decode or convert back to a single whole from a single hot value in TensorFlow.
I used tf.one_hotand was able to train my model, but got a little confused about how to understand the brand after my classification. My data is uploaded through the file TFRecordsI created. I was thinking about storing a text label in a file, but could not get it to work. It seemed that it TFRecordscould not store the text string, or maybe I was wrong.
tf.one_hot
TFRecords
, tf.argmax. 1 0 s, , .
tf.argmax
1
0
index = tf.argmax(one_hot_vector, axis=0)
batch_size * num_classes axis=1, batch_size * 1.
batch_size * num_classes
axis=1
batch_size * 1
batch_size num_classes, , , tf.argmax() :
batch_size
num_classes
tf.argmax()
BATCH_SIZE = 3 NUM_CLASSES = 4 one_hot_encoded = tf.constant([[0, 1, 0, 0], [1, 0, 0, 0], [0, 0, 0, 1]]) # Compute the argmax across the columns. decoded = tf.argmax(one_hot_encoded, axis=1) # ... print sess.run(decoded) # ==> array([1, 0, 3])
Source: https://habr.com/ru/post/1665353/More articles:Breakpoints in Visual Studio code do not fall when debugging mocha tests - node.jsDoes Swift have a built-in flyback function for Bool? - booleanИспользование threading.Timer с asycnio - pythonпочему бы? появляются в IEnumerable?. ToList()? - c#Play Push Notification Sound effect when the application does not work (Mac) - apple-push-notificationsWhy is the throughput of this C # data processing application much lower than the raw capabilities of the server? - c #How to make a class completely immutable in Scala - immutabilityPython Pandas concatenates a series of strings into a single string - stringhttps://translate.googleusercontent.com/translate_c?depth=1&pto=aue&rurl=translate.google.com&sl=ru&sp=nmt4&tl=en&u=https://fooobar.com/questions/1665357/sparkscala-repeated-calls-to-withcolumn-using-the-same-function-on-multiple-columns&usg=ALkJrhiF7I1Goo6KFCbMawuMoeKfKPbxhAShell Script believes that the directory does not exist when running cd - bashAll Articles