ich das Modell erstellt habe TensorflowWie ein Bild zu einem Modell für die Klassifizierung passieren, nachdem das Modell in Tensorflow erstellt wurde
Initialized
Minibatch loss at step 0 : 3.51275
Minibatch accuracy: 6.2%
Validation accuracy: 12.8%
Minibatch loss at step 50 : 1.48703
Minibatch accuracy: 43.8%
Validation accuracy: 50.4%
Minibatch loss at step 100 : 1.04377
Minibatch accuracy: 68.8%
Validation accuracy: 67.4%
Minibatch loss at step 150 : 0.601682
Minibatch accuracy: 68.8%
Validation accuracy: 73.0%
Minibatch loss at step 200 : 0.898649
Minibatch accuracy: 75.0%
Validation accuracy: 77.8%
Minibatch loss at step 250 : 1.3637
Minibatch accuracy: 56.2%
Validation accuracy: 75.4%
Minibatch loss at step 300 : 1.41968
Minibatch accuracy: 62.5%
Validation accuracy: 76.0%
Minibatch loss at step 350 : 0.300648
Minibatch accuracy: 81.2%
Validation accuracy: 80.2%
Minibatch loss at step 400 : 1.32092
Minibatch accuracy: 56.2%
Validation accuracy: 80.4%
Minibatch loss at step 450 : 0.556701
Minibatch accuracy: 81.2%
Validation accuracy: 79.4%
Minibatch loss at step 500 : 1.65595
Minibatch accuracy: 43.8%
Validation accuracy: 79.6%
Minibatch loss at step 550 : 1.06995
Minibatch accuracy: 75.0%
Validation accuracy: 81.2%
Minibatch loss at step 600 : 0.223684
Minibatch accuracy: 100.0%
Validation accuracy: 82.3%
Minibatch loss at step 650 : 0.619602
Minibatch accuracy: 87.5%
Validation accuracy: 81.8%
Minibatch loss at step 700 : 0.812091
Minibatch accuracy: 75.0%
Validation accuracy: 82.4%
Minibatch loss at step 750 : 0.276302
Minibatch accuracy: 87.5%
Validation accuracy: 82.3%
Minibatch loss at step 800 : 0.450241
Minibatch accuracy: 81.2%
Validation accuracy: 82.3%
Minibatch loss at step 850 : 0.137139
Minibatch accuracy: 93.8%
Validation accuracy: 82.3%
Minibatch loss at step 900 : 0.52664
Minibatch accuracy: 75.0%
Validation accuracy: 82.2%
Minibatch loss at step 950 : 0.623835
Minibatch accuracy: 87.5%
Validation accuracy: 82.1%
Minibatch loss at step 1000 : 0.243114
Minibatch accuracy: 93.8%
Validation accuracy: 82.9%
Test accuracy: 90.0%
Dies ist die Genauigkeit, die ich bekommen habe, nachdem alle Wiederholungen durchgeführt werden. Ich möchte dieses Modell speichern, so dass ich ein zufälliges Bild weitergeben kann und anzeigen, was mein Modell (gegebenes Bild) ausgibt (klassifizieren).
In Caffe wir erstellt.caffemodel Datei und dann verwendet, um ein Bild in der Befehlszeile übergeben und zum Anzeigen der ersten 5 wahrscheinlichen Objekte, die die Bilder am wahrscheinlichsten sein, möchte ich eine ähnliche Sache in durchführen Tensorflow aber weiß nicht wie.
Jede Hilfe wäre willkommen.
EDIT
Nach dem Vorschlag von mrry Ich habe versucht, für den tf.train.saver() obejct an, als wie es funktioniert.
Das ist das, was auf der Website zum Speichern von Variablen geschrieben:
# Create some variables.
v1 = tf.Variable(..., name="v1")
v2 = tf.Variable(..., name="v2")
...
# Add an op to initialize the variables.
init_op = tf.initialize_all_variables()
# Add ops to save and restore all the variables.
saver = tf.train.Saver()
# Later, launch the model, initialize the variables, do some work, save the
# variables to disk.
with tf.Session() as sess:
sess.run(init_op)
# Do some work with the model.
..
# Save the variables to disk.
save_path = saver.save(sess, "/tmp/model.ckpt")
print("Model saved in file: %s" % save_path)
für die Wiederherstellung:
# Create some variables.
v1 = tf.Variable(..., name="v1")
v2 = tf.Variable(..., name="v2")
...
# Add ops to save and restore all the variables.
saver = tf.train.Saver()
# Later, launch the model, use the saver to restore variables from disk, and
# do some work with the model.
with tf.Session() as sess:
# Restore variables from disk.
saver.restore(sess, "/tmp/model.ckpt")
print("Model restored.")
# Do some work with the model
...
Wie kann ich jetzt mein Bild an das Modell übergeben? Es ist in dem Kommentar geschrieben, dass einige Arbeit mit dem Modell, aber genau wie soll ich mein Bild an das Modell übergeben.
danke für die Antwort, Eigentlich habe ich mit der Tensorflow-Zuweisung (4_convolutions.ipynb) gearbeitet. Ich habe ein bisschen davon verstanden, aber ich bin immer noch verwirrt, wie die obige Antwort funktionieren wird. Muss ich mein Modell jedes Mal neu trainieren, nachdem ich mein System neu gestartet habe? . Die Daten, die in den Variablen vorhanden sind, gehen verloren, wenn ich mein System neu starte und wie können wir das Modell wiederverwenden? – kkk
Sie können ein ['tf.train.Saver'] (https://www.tensorflow.org/versions/r0.7/api_docs/python/state_ops.html#Saver) Objekt verwenden, um den Inhalt der Variablen zu speichern und stelle sie in ein anderes Modell wieder her. – mrry
Ich habe die Frage bearbeitet, also könntest du bitte für dasselbe antworten, es wäre eine große Hilfe für mich, Tensorflow zu lernen. – kkk