用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)......
添加回答
举报
0/150
提交
取消