Reputation: 11
i try to work with chest x-ray images data from stanford ml group. However, in order to train my data i need to load images from subfolders:
chestXray/train/#patiendIDs-here/#studyIDs-here/view-jpeg-files.jpg
i tried different ways with 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, 'cHexpert/train' ,file )
#print(files)
if name not in exclude_files:
samples2.append(file)
but the first one gave me these paths:
/content/cHexpert/train/patient00006
and after a while: /content/cHexpert/train/study2
second pile of code gave this which looks more true but it miss some subdictioneries:
/content/cHexpert/train/view1_frontal.jpg
how to concenate them? thanks in advance
Upvotes: 1
Views: 46