Skip to content

Commit

Permalink
Added original image filename to saved, augmented files.
Browse files Browse the repository at this point in the history
  • Loading branch information
mdbloice committed Mar 23, 2018
1 parent ec9ae3d commit 5b00eb4
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions Augmentor/Pipeline.py
Original file line number Diff line number Diff line change
Expand Up @@ -200,11 +200,11 @@ def _execute(self, augmentor_image, save_to_disk=True):
# image = image.convert("RGB")
for i in range(len(images)):
if i == 0:
save_name = augmentor_image.class_label + "_original_" + file_name \
save_name = augmentor_image.class_label + "_original_" + os.path.basename(augmentor_image.image_path) + "_" + file_name \
+ "." + (self.save_format if self.save_format else augmentor_image.file_format)
images[i].save(os.path.join(augmentor_image.output_directory, save_name))
else:
save_name = "_groundtruth_(" + str(i) + ")_" + augmentor_image.class_label + "_" + file_name \
save_name = "_groundtruth_(" + str(i) + ")_" + augmentor_image.class_label + "_" + os.path.basename(augmentor_image.image_path) + "_" + file_name \
+ "." + (self.save_format if self.save_format else augmentor_image.file_format)
images[i].save(os.path.join(augmentor_image.output_directory, save_name))
except IOError as e:
Expand Down Expand Up @@ -247,8 +247,8 @@ def set_save_format(self, save_format):
:attr:`save_format="JPEG"` or :attr:`save_format="JPG"`,
Augmentor will attempt to save the files using the
JPEG format, which may result in errors if the file cannot
be saved in this format, such as PNG images with an alpha
channel.
be saved in this format, such as trying to save PNG images
with an alpha channel as JPEG.
:param save_format: The save format to save the images
when writing to disk.
Expand Down

0 comments on commit 5b00eb4

Please sign in to comment.