Hi, I use autokeras to train a model using my image data. What I want to do is comparing different classifiers using little data. So I try to search a NN model with autokeras. I use load_image_dataset to load image data. But when I run it, there is an error:
Traceback (most recent call last):
File "autoCNNclassifier.py", line 31, in
train_model()
File "autoCNNclassifier.py", line 15, in train_model
images_path=train_data_dir)
File "/usr/local/lib/python3.5/dist-packages/autokeras/image_supervised.py", line 108, in load_image_dataset
x = read_images(img_file_name, images_path)
File "/usr/local/lib/python3.5/dist-packages/autokeras/image_supervised.py", line 86, in read_images
return np.asanyarray(x_train)
File "/usr/local/lib/python3.5/dist-packages/numpy/core/numeric.py", line 544, in asanyarray
return array(a, dtype, copy=False, order=order, subok=True)
ValueError: could not broadcast input array from shape (256,256,1) into shape (256,256)
autoCNNclassifier.py and the dataset can be found here. What's the matter?
Thank you.
I'm having the same problem.
Should u squeezed your image? Try this method to remove single dimension in image. https://docs.scipy.org/doc/numpy/reference/generated/numpy.squeeze.html
@marooncn @mariolys07 The problem seems to occur when you have black and white images. With np.repeat I could work around the issue, copying the last channel two times. See my commit above, not sure if this is the way to go. I think we should look forward to fixing #204 instead of tinkering with this function.
@soerface Thank you, your solution is correct. After three days run the final result is about 82% on my dataset. It's much higher than a simple neural network I designed which the precision is 68.75%.
Most helpful comment
@marooncn @mariolys07 The problem seems to occur when you have black and white images. With
np.repeatI could work around the issue, copying the last channel two times. See my commit above, not sure if this is the way to go. I think we should look forward to fixing #204 instead of tinkering with this function.