亚洲在线久爱草,狠狠天天香蕉网,天天搞日日干久草,伊人亚洲日本欧美

為了賬號安全,請及時綁定郵箱和手機立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

用os的join遍歷圖片文件時出錯了

用os的join遍歷圖片文件時出錯了

拉莫斯之舞 2019-05-09 09:48:38
用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'求大神幫幫忙吧!
查看完整描述

2 回答

?
紅顏莎娜

TA貢獻1842條經驗 獲得超13個贊

fordirpath,subdirs,filenamesinos.walk(path):
forfilenameinfilenames:
fullname=os.path.join(dirpath,filename)
......
                            
查看完整回答
反對 回復 2019-05-09
  • 2 回答
  • 0 關注
  • 570 瀏覽
慕課專欄
更多

添加回答

舉報

0/150
提交
取消
微信客服

購課補貼
聯系客服咨詢優惠詳情

幫助反饋 APP下載

慕課網APP
您的移動學習伙伴

公眾號

掃描二維碼
關注慕課網微信公眾號