Skip to content

Commit

Permalink
HUBDatasetStats() preview images to 50 quality (#8880)
Browse files Browse the repository at this point in the history
@kalenmike should represent a 30% filesize reduction vs 75 quality
  • Loading branch information
glenn-jocher committed Aug 5, 2022
1 parent 731a2f8 commit bc9fcb1
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion utils/dataloaders.py
Original file line number Diff line number Diff line change
Expand Up @@ -1034,7 +1034,7 @@ def _hub_ops(self, f, max_dim=1920):
r = max_dim / max(im.height, im.width) # ratio
if r < 1.0: # image too large
im = im.resize((int(im.width * r), int(im.height * r)))
im.save(f_new, 'JPEG', quality=75, optimize=True) # save
im.save(f_new, 'JPEG', quality=50, optimize=True) # save
except Exception as e: # use OpenCV
print(f'WARNING: HUB ops PIL failure {f}: {e}')
im = cv2.imread(f)
Expand Down

0 comments on commit bc9fcb1

Please sign in to comment.