mdbloice / Augmentor

Image augmentation library in Python for machine learning.
https://augmentor.readthedocs.io/en/stable
MIT License
5.08k stars 866 forks source link

expected conv2d_23 to have 4 dimensions, but got array with shape (64, 1) #164

Open tigerdhl opened 5 years ago

tigerdhl commented 5 years ago

I use the library to a segmentation project p = augm.Pipeline(img_path) p.ground_truth(mask_path) p.rotate(probability=1, max_left_rotation=5, max_right_rotation=5) p.flip_left_right(probability=0.7) p.zoom_random(probability=0.7, percentage_area=0.8) p.flip_top_bottom(probability=0.7) g = p.keras_generator(batch_size=64) image,label = next(g) print("the image shape:",image.shape) print("the label shape:",label.shape)

the result is: the image shape: (64, 256, 256, 3) the label shape: (64, 1) so the error show like this: expected conv2d_23 to have 4 dimensions, but got array with shape (64, 1) how can I solve this problem? thank you!

mdbloice commented 5 years ago

Hi @tigerdhl, yeah this could be a configuration problem with your network that you have set up. Hard to know from this code snippet. Does the network work if you just add your regular images and do not use a generator?