Source code link: https://github.com/rndbrtrnd/udacity-deep-learning/blob/master/1_notmnist.ipynb
I am working with some of the existing code already written to read image's data as part of deep-learning course using ndimage.imread which is depricated and I changed it to imageio.imread to proceed. But I am still facing some issues (I think it is related to bad image's data).
Initial Code to read image data using ndimage.imread (depreciated). This code does not work as ndimage is depricated from 1.2.0 version of SciPy.
try:
image_data = (ndimage.imread(image_file).astype(float) -
pixel_depth / 2) / pixel_depth
if image_data.shape != (image_size, image_size):
raise Exception('Unexpected image shape: %s' % str(image_data.shape))
dataset[image_index, :, :] = image_data
image_index += 1
except IOError as e:
print('Could not read:', image_file, ':', e, '- it\'s ok, skipping.')
I modified it to use imageio.imread
try:
# read the image and normalize it
image_data = (imageio.imread(image_file).astype(float) - pixel_depth/2)/pixel_depth
if image_data.shape!= (image_size,image_size):
raise Exception('Unexpected images shape: %s' % str(image_data.shape))
dataset[image_index,:,:] = image_data
image_index+=1
except IOError as e:
print('could not read the',image_file ,':',e,'hence skipping it.')
Issues description: While using imageio.imread, it is throwing the below error:
ValueError: Could not find a format to read the specified file in single-image mode