glenn-jocher commited on
Commit
d5b21b1
1 Parent(s): def7a0f

HUB dataset previews to JPEG (#5627)

Browse files
Files changed (1) hide show
  1. utils/datasets.py +1 -1
utils/datasets.py CHANGED
@@ -965,7 +965,7 @@ def dataset_stats(path='coco128.yaml', autodownload=False, verbose=False, profil
965
  r = max_dim / max(im.height, im.width) # ratio
966
  if r < 1.0: # image too large
967
  im = im.resize((int(im.width * r), int(im.height * r)))
968
- im.save(f_new, quality=75) # save
969
  except Exception as e: # use OpenCV
970
  print(f'WARNING: HUB ops PIL failure {f}: {e}')
971
  im = cv2.imread(f)
 
965
  r = max_dim / max(im.height, im.width) # ratio
966
  if r < 1.0: # image too large
967
  im = im.resize((int(im.width * r), int(im.height * r)))
968
+ im.save(f_new, 'JPEG', quality=75, optimize=True) # save
969
  except Exception as e: # use OpenCV
970
  print(f'WARNING: HUB ops PIL failure {f}: {e}')
971
  im = cv2.imread(f)