關於Tensorflow調試出現問題總結


  • ImportError: libcudart.so.8.0: cannot open shared object file: No such file or directory #5343:針對這個問題首先先分析你電腦是否裝了cuda8.0,若不是,這可能是你在默認tensorflow配置時沒有選擇正確的cuda支持版本,這里補充說道,tensorflow用pip安裝默認是cuda8.0版本,所以如果是cuda7.0的朋友需要用源碼手動設置安裝,但是對於cuda9.0,目前tensorflow不支持,如果想要安裝,可以采用源碼+補丁形式,不過過程相當麻煩,涉及bazel,gcc等。若是正確的cuda8.0,此時出現問題最有可能是因為沒有設置環境變量,可在命令行輸入export LD_LIBRARY_PATH=/usr/local/cuda-8.0/lib64,立刻解決。
  • SSD-Tensorflow:TypeError: Can not convert a tuple into a Tensor or Operation:此問題在github有詳細解答,具體如下,打開eval_ssd_network.py文件,然后加入以下代碼:

def flatten(x):  
    result = []  
    for el in x:  
         if isinstance(el, tuple):  
               result.extend(flatten(el))  
         else:  
               result.append(el)  
    return result  
# Waiting loop.  
            slim.evaluation.evaluation_loop(  
                master=FLAGS.master,  
                checkpoint_dir=checkpoint_path,  
                logdir=FLAGS.eval_dir,  
                num_evals=num_batches,  
                eval_op=flatten(list(names_to_updates.values())), #這里調用flatten  
                variables_to_restore=variables_to_restore,  
                eval_interval_secs=60,  
                max_number_of_evaluations=np.inf,  
                session_config=config,  
                timeout=None)  
# Standard evaluation loop.  
            start = time.time()  
            slim.evaluation.evaluate_once(  
                master=FLAGS.master,  
                checkpoint_path=checkpoint_path,  
                logdir=FLAGS.eval_dir,  
                num_evals=num_batches,  
                eval_op=flatten(list(names_to_updates.values())), #這里也調用flatten  
                variables_to_restore=variables_to_restore,  
                session_config=config)  

本問題是在編譯tensorflow-ssd源碼時遇到的https://github.com/balancap/SSD-Tensorflow,參考鏈接為https://github.com/balancap/SSD-Tensorflow/issues/154

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM