为了账号安全,请及时绑定邮箱和手机立即绑定

用os的join遍历图片文件时出错了

用os的join遍历图片文件时出错了

慕田峪7331174 2019-05-11 09:24:47
用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 回答

?
慕妹3242003

TA贡献1824条经验 获得超6个赞

fordirpath,subdirs,filenamesinos.walk(path):
forfilenameinfilenames:
fullname=os.path.join(dirpath,filename)
......
                            
查看完整回答
反对 回复 2019-05-11
  • 2 回答
  • 0 关注
  • 354 浏览
慕课专栏
更多

添加回答

举报

0/150
提交
取消
微信客服

购课补贴
联系客服咨询优惠详情

帮助反馈 APP下载

慕课网APP
您的移动学习伙伴

公众号

扫描二维码
关注慕课网微信公众号