Browse Source

fix for missing image handling

Dimitri Korsch 5 years ago
parent
commit
c492df6daf
1 changed files with 3 additions and 2 deletions
  1. 3 2
      cvdatasets/dataset/image.py

+ 3 - 2
cvdatasets/dataset/image.py

@@ -22,13 +22,14 @@ class ImageWrapper(object):
 			assert isfile(im_path), "Image \"{}\" does not exist!".format(im_path)
 			return _read()
 		else:
+			error = None
 			for i in range(n_retries):
 				try:
 					return _read()
 				except Exception as e:
-					pass
+					error = e
 
-			raise RuntimeError("Reading image \"{}\" failed after {} n_retries! ({})".format(im_path, n_retries, e))
+			raise RuntimeError("Reading image \"{}\" failed after {} n_retries! ({})".format(im_path, n_retries, error))
 
 
 	def __init__(self, im_path, label, parts=None, mode="RGB", part_rescale_size=None, center_cropped=True):