Python Forum
Running script on multiple files
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Running script on multiple files
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.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)

thank you in advanced
Use a for loop to repeat your code on each folder.

Possibly Related Threads…
Thread Author Replies Views Last Post
  Open and read multiple text files and match words kozaizsvemira 3 3,782 Jul-07-2021, 11:27 AM
Last Post: Larz60+
  Plotting Multiple files ! Helen_145 1 229 Jun-26-2021, 03:28 PM
Last Post: snippsat
  Reading Multiple text Files in pyhton Fatim 1 254 Jun-25-2021, 01:37 PM
Last Post: deanhystad
  Load the data from multiple source files to one table amy83 2 418 Apr-27-2021, 12:33 AM
Last Post: Pedroski55
  Error when running script on startup in Linux NoahTheNerd 0 393 Mar-07-2021, 04:54 PM
Last Post: NoahTheNerd
  Rename Multiple files in directory to remove special characters nyawadasi 9 796 Feb-16-2021, 09:49 PM
Last Post: BashBedlam
  Refresh data in python script while running in Terminal frankenchrist 4 752 Feb-03-2021, 09:54 AM
Last Post: Larz60+
  [SOLVED] Requiring help running an old Python script (non Python savvy user) Miletkir 13 1,284 Jan-16-2021, 10:20 PM
Last Post: Miletkir
  Need help with 3 errors when running script pythoncoder999 3 777 Dec-19-2020, 04:04 AM
Last Post: Larz60+
  Keep Application running after Python script ends PEGylated_User 0 442 Nov-12-2020, 03:27 PM
Last Post: PEGylated_User

Forum Jump:

User Panel Messages

Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020