2017-10-09 1 views
0

Ich baute ein CNN-Klassifizierungsmodell und speicherte die Checkpoints während des Trainings. Nach dem Ausführen dieses Codes.NotFoundError: bei der Verwendung der Funktion tf.train.latest_checkpoint() aufgetreten

checkpoint_dir = "/home/user/cnn-model/trained_model_1506946529/" 
checkpoint_file = tf.train.latest_checkpoint(checkpoint_dir + 'checkpoints') 

ich den Fehler:

NotFoundError     Traceback (most recent call last) 
<ipython-input-60-8de4d687f60c> in <module>() 
    5  checkpoint_dir += '/' 
    6 print (checkpoint_dir + 'checkpoints') 
    ----> 7 checkpoint_file = tf.train.latest_checkpoint(checkpoint_dir + 'checkpoints') 
    8 print (checkpoint_file) 

    /usr/local/lib/python3.5/dist-packages/tensorflow/python/training/saver.py in latest_checkpoint(checkpoint_dir, latest_filename) 
1612  v1_path = _prefix_to_checkpoint_path(ckpt.model_checkpoint_path, 
1613           saver_pb2.SaverDef.V1) 
-> 1614  if file_io.get_matching_files(v2_path) or  file_io.get_matching_files(
1615   v1_path): 
1616  return ckpt.model_checkpoint_path 

/usr/local/lib/python3.5/dist-packages/tensorflow/python/lib/io/file_io.py in get_matching_files(filename) 
330   # Convert the filenames to string from bytes. 
331   compat.as_str_any(matching_filename) 
--> 332   for single_filename in filename 
333   for matching_filename in pywrap_tensorflow.GetMatchingFiles(
334    compat.as_bytes(single_filename), status) 

/usr/lib/python3.5/contextlib.py in __exit__(self, type, value, traceback) 
64   if type is None: 
65    try: 
---> 66     next(self.gen) 
67    except StopIteration: 
68     return 

/usr/local/lib/python3.5/dist-packages/tensorflow/python/framework/errors_impl.py in raise_exception_on_not_ok_status() 
464   None, None, 
465   compat.as_text(pywrap_tensorflow.TF_Message(status)), 
--> 466   pywrap_tensorflow.TF_GetCode(status)) 
467 finally: 
468  pywrap_tensorflow.TF_DeleteStatus(status) 

NotFoundError: /home/user/cnn-model/trained_model_1506946529/checkpoints 

Der Speicherort der Datei vorhanden ist, und tut so die Checkpoints, was kann ich tun, um es zu mildern?

Antwort

0

tf.train.latest_checkpoint nimmt einen Ordnernamen als arg. Ändern Sie einfach zu:

checkpoint_file = tf.train.latest_checkpoint(checkpoint_dir) 
Verwandte Themen