I was able to upload images to a folder using the sklearn command line: load_sample_images()
Now I would like to convert it to numpy.ndarray format with float32 datatype
I managed to convert it to np.ndarray using: np.array(X) , however np.array(X, dtype=np.float32) and np.asarray(X).astype('float32') give me an error:
ValueError: setting an array element with a sequence.
Is there any way around this?
from sklearn_theano.datasets import load_sample_images import numpy as np kinect_images = load_sample_images() X = kinect_images.images X_new = np.array(X) # works X_new = np.array(X[1], dtype=np.float32) # works X_new = np.array(X, dtype=np.float32) # does not work
source share