Fixed uint8 all zeros bug

This commit is contained in:
Newmu
2014-09-12 14:48:06 -04:00
parent d6cb1bf1d9
commit e6fac9ad6a
+3 -2
View File
@@ -95,13 +95,14 @@ def image_preprocess(image):
image = np.asarray(image)
if type(image).__module__ != np.__name__:
raise ValueError('Image was not of type numpy.ndarray or list.')
if image.max() > 1:
if str(image.dtype) in ['int64','uint8']:
image = image/255.
if len(image.shape) == 2:
image = np.dstack((image,image,image))
if len(image.shape) == 4:
image = image[:,:,:3]
print image
print image.dtype,image.min(),image.max()
image = resize(image,(64,64))
image = image.tolist()
return image