mirror of
https://github.com/ultralytics/yolov5.git
synced 2025-06-03 14:49:29 +08:00
HUBDatasetStats() preview images to 50 quality (#8880)
@kalenmike should represent a 30% filesize reduction vs 75 quality
This commit is contained in:
parent
731a2f8c1f
commit
bc9fcb1767
@ -1034,7 +1034,7 @@ class HUBDatasetStats():
|
||||
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)
|
||||
|
Loading…
x
Reference in New Issue
Block a user