Reading Multiple Images One at a Time

I have multiple images stored at my desktop that need to be processed one at a time by Tensorflow. My problem is that I don't know hot to create a loop to accomplish the individual reading and processing of images. I found on this site the code that enables the reading of multiple images stored locally. I placed the code where I thought I would work but it didn't. The results obtained by the code below, out of thirty images only the first two were shown. Sorry about the formatting. Not an expert. I think the for loop shouldn't be placed there as a whole and the indentation has to do something with the bad results. Any tips will be highly appreciated.

Thanks

...code

from PIL import Image
import os, sys

path = 'C:\\Users\\Owner\\Desktop\\Images\\'

dirs = os.listdir( path )


....Code


if __name__ == '__main__':

    ...code

 for item in dirs:
        if os.path.isfile(path+item):
            im = Image.open(path+item)
            f, e = os.path.splitext(path+item)
 loadedImage = path + item


 parser.add_argument('--image', type=str, default='loadedImage')


   ....code

    for i, single_3d in enumerate(pose_3d):
           plot_pose(single_3d)

    pass

I switched the above code to and it worked. However, my images are nor displayed sequentially. Can anyone tell me how to fix this?:

if __name__ == '__main__':

for item in dirs:      
    im = Image.open(path+item)        
    f, e = os.path.splitext(path+item)        
    parser = argparse.ArgumentParser(description='tf-pose-estimation run')    
    nameimage = f + e
    parser.add_argument('--image', type=str, default = nameimage)