Skip to content

Commit

Permalink
Handle upper-case extensions
Browse files Browse the repository at this point in the history
  • Loading branch information
d4nst committed Jun 29, 2018
1 parent 5f8cf12 commit 67b44e0
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions correct_rotation.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,20 +13,20 @@

def process_images(model, input_path, output_path,
batch_size=64, crop=True):
extensions = ['.jpg', '.jpg', '.bmp', '.png']
extensions = ['.jpg', '.jpeg', '.bmp', '.png']

output_is_image = False
if os.path.isfile(input_path):
image_paths = [input_path]
if os.path.splitext(output_path)[1] in extensions:
if os.path.splitext(output_path)[1].lower() in extensions:
output_is_image = True
output_filename = output_path
output_path = os.path.dirname(output_filename)
else:
image_paths = [os.path.join(input_path, f)
for f in os.listdir(input_path)
if os.path.splitext(f)[1] in extensions]
if os.path.splitext(output_path)[1] in extensions:
if os.path.splitext(f)[1].lower() in extensions]
if os.path.splitext(output_path)[1].lower() in extensions:
print('Output must be a directory!')

predictions = model.predict_generator(
Expand Down

0 comments on commit 67b44e0

Please sign in to comment.