Python Forum

Full Version: Running script on multiple files
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hello all,

I am using a package called 'augmentor' that creates augmented versions of an image. I have over 60 images and I want each image contained within its own folder with its own specific augmentations. I can't figure out how to run this script on a batch of folders where each folder contains one image. currently only works on one folder containing the image

Images are labelled m3a, m3b , m3c etc and each folder is labelled the same


import Augmentor
p = Augmentor.Pipeline("augmented_images/m3b" ) #this is where the script is directed to the folder with the image

p.rotate(probability=0.7, max_left_rotation=10, max_right_rotation=10)

p.zoom(probability=0.3, min_factor=0.5, max_factor=1)
p.flip_left_right(probability=0.4)
p.flip_top_bottom(probability=0.8)
p.skew(probability=0.5)
p.shear(probability=0.5, max_shear_left=0.5, max_shear_right=0.5)
p.random_distortion(probability=0.5, magnitude=1, grid_width=1, grid_height=1)

p.sample(50)
thank you in advanced
Use a for loop to repeat your code on each folder.