如何解决从子文件夹加载医学图像
我尝试使用斯坦福大学医学实验室的胸部X射线图像数据。但是,为了训练我的数据,我需要从子文件夹加载图像:
chestXray/train/#patiendIDs-here/#studyIDs-here/view-jpeg-files.jpg
我用os.walk尝试了不同的方式:
root='/content'
exclude_files = ''
#exclude_files = read_file.read() csv
samples=[]
samples2=[]
for rt,dirs,files in os.walk(os.path.join(root,'cHexpert','train')):
for name in dirs:
name = os.path.join(root,'cHexpert/train',name)
#print(files)
if name not in exclude_files:
samples.append(name)
for file in files:
file = os.path.join(root,file )
#print(files)
if name not in exclude_files:
samples2.append(file)
但是第一个给了我这些路径:
/content/cHexpert/train/patient00006
一段时间后:/content/cHexpert/train/study2
第二堆代码使它看起来更真实,但缺少一些子领域:
/content/cHexpert/train/view1_frontal.jpg
如何凝视它们?预先感谢
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。