用os的join遍歷圖片文件時出錯了importosimporttensorflowastfwithtf.Session()assess:softmax_tensor=sess.graph.get_tensor_by_name('final_result:0')#遍歷目錄forroot,dirs,fileinos.walk('data/train/'):#載入圖片image_data=tf.gfile.FastGFile(os.path.join(root,file),'rb').read()predictions=sess.run(softmax_tensor,{'DecodeJpeg/contents:0':image_data})#圖片格式是jpg格式predictions=np.squeeze(predictions)#把結果轉為1維數據#打印圖片路徑及名稱image_path=os.path.join(root,file)print(image_path)報錯信息:File"D:\Anaconda3\envs\tensorflow-gpu\lib\genericpath.py",line149,in_check_arg_types(funcname,s.__class__.__name__))fromNoneTypeError:join()argumentmustbestrorbytes,not'list'求大神幫幫忙吧!
用os的join遍歷圖片文件時出錯了
拉莫斯之舞
2019-05-09 09:48:38
