Python Forum
Running script on multiple files
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Running script on multiple files
#1
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
Reply
#2
Use a for loop to repeat your code on each folder.
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  No Internet connection when running a Python script basil_555 8 442 Mar-11-2024, 11:02 AM
Last Post: snippsat
Question Running Python script through Task Scheduler? Winfried 8 335 Mar-10-2024, 07:24 PM
Last Post: Winfried
  python convert multiple files to multiple lists MCL169 6 1,432 Nov-25-2023, 05:31 AM
Last Post: Iqratech
  Help Running Python Script in Mac OS emojistickers 0 306 Nov-20-2023, 01:58 PM
Last Post: emojistickers
  Trying to make a board with turtle, nothing happens when running script Quascia 3 607 Nov-01-2023, 03:11 PM
Last Post: deanhystad
  splitting file into multiple files by searching for string AlphaInc 2 814 Jul-01-2023, 10:35 PM
Last Post: Pedroski55
Question Need help for a python script to extract information from a list of files lephunghien 6 1,033 Jun-12-2023, 05:40 PM
Last Post: snippsat
  script to calculate data in csv-files ledgreve 0 1,056 May-19-2023, 07:24 AM
Last Post: ledgreve
  Python script running under windows over nssm.exe JaroslavZ 0 671 May-12-2023, 09:22 AM
Last Post: JaroslavZ
  Merging multiple csv files with same X,Y,Z in each Auz_Pete 3 1,085 Feb-21-2023, 04:21 AM
Last Post: Auz_Pete

Forum Jump:

User Panel Messages

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