mdbloice / Augmentor

Image augmentation library in Python for machine learning.
https://augmentor.readthedocs.io/en/stable
MIT License
5.06k stars 866 forks source link

Error writing processed data when multi-procesed #41

Open mangoHoli opened 7 years ago

mangoHoli commented 7 years ago
Processing fer2013_6_35656.png: 100%|█████████▉| 18872/18888 [03:42<00:00, 86.62 Samples/s]Error writing 6_sadness__bc322a31-1668-412c-9314-4ea527d9666c.JPEG.
Error writing 6_sadness__e97e2502-e259-4a05-ac95-d9f1c67c1e90.JPEG.
Error writing 6_sadness__4739eb49-99fa-4e54-92db-77c770248bf6.JPEG.
Error writing 6_sadness__8754065a-56fd-494f-9d51-719d71552011.JPEG.
Error writing 6_sadness__0e20f205-97fc-4d14-9c51-044033f8c404.JPEG.
Error writing 6_sadness__0e14d4ed-93e6-4132-a20c-e6f6199a0e42.JPEG.
Error writing 6_sadness__a68996d9-c0a6-4079-999f-1a3536cf6edb.JPEG.
Error writing 6_sadness__fa9383c6-a94f-4466-afc0-359efe320a62.JPEG.
Error writing 6_sadness__8f877a1d-d65e-4d13-97ce-e92f03612860.JPEG.
Error writing 6_sadness__30e297ef-2996-45fb-bf42-e458b1b2ed21.JPEG.

Hi, I run the pipeline in three loops, applying different operation strategy for each one, then I got writing error for the last two loops. The code follows:

for f in glob.glob(root_dir):
    if os.path.isdir(f):
        folders.append(os.path.abspath(f))

print("Folders (classes) found: %s " % [os.path.split(x)[1] for x in folders])

pipelines = {}
for folder in folders:
    print("Folder %s:" % (folder))
    pipelines[os.path.split(folder)[1]] = (Augmentor.Pipeline(folder))
    print("\n----------------------------\n")

for p in pipelines.values():
    p.flip_left_right(probability=1)
    p.sample(len(p.augmentor_images))

for p in pipelines.values():
#    p.flip_left_right(probability=1)
    p.rotate(probability=1,max_left_rotation=15,max_right_rotation=15)
    p.sample(len(p.augmentor_images)*6)

for p in pipelines.values():
    p.flip_left_right(probability=1)
    p.rotate(probability=1,max_left_rotation=15,max_right_rotation=15)
    p.sample(len(p.augmentor_images)*6)
    print("Class %s has down processing %s samples." % (p.augmentor_images[0].class_label, len(p.augmentor_images)))

(edited by @evizero for readability)

mdbloice commented 7 years ago

Hi there, thanks for writing up this issue and apologies for the late reply. I am trying to think what might be the issue here, and I can't really work out what might be the problem. Did you resolve this yourself by any chance? Does it occur every time? M.

dfroa34 commented 6 years ago

Hi, I am also having the same issue. I am running a simple transormation and then I'm obtaining some samples from it, but I got the same error:

p = Augmentor.Pipeline(test_folder) p.rotate(probability=0.8, max_left_rotation=10, max_right_rotation=10) p.sample(10)

Error writing original_a9ee543b-26d1-4a67-886a-67b78872234d.JPEG.

mdbloice commented 6 years ago

Hi @dfroa34 yeah I am not sure what could be happening except that perhaps you do not have write access to the test_folder location? Can you confirm that? M.

dfroa34 commented 6 years ago

Hi @mdbloice, Thanks for your message. I double checked and I realized that I had this error when the test_folder does not contain an image and when the test_folder contains files different from images.

Now everything works fine. Do you know if there is any way that I can specify the output directory in other directory different than the one containing the images? Thanks!