akirasosa / mobile-semantic-segmentation

Real-Time Semantic Segmentation in Mobile device
MIT License
715 stars 135 forks source link

Training Issue #19

Closed shadow111 closed 6 years ago

shadow111 commented 6 years ago

when i run this command python train_full.py \ --img_file=/path/to/images.npy \ --mask_file=/path/to/masks.npy

i got this error:

Traceback (most recent call last): File "train_full.py", line 96, in <module> train(**vars(args)) File "train_full.py", line 21, in train train_gen, validation_gen, img_shape = load_data(img_file, mask_file) File "/home/lafi/Desktop/HairSegmentation/mobile-semantic-segmentation-master/data.py", line 60, in load_data train_img_gen.fit(images) File "/usr/local/lib/python2.7/dist-packages/keras/preprocessing/image.py", line 675, in fit 'Got array with shape: ' + str(x.shape)) ValueError: Input to.fit()should have rank 4. Got array with shape: (0,) Please how i can fix it Thank you Lafi

edumucelli commented 6 years ago

Are you using the placeholder path path/to/images.npy? You should replace it by your actual path.

AlexRablau commented 6 years ago

I am having the same issue.

I do use the correct paths. Without the correct paths it does not even get this far.

I am using python3. Could that be the issue?

AlexRablau commented 6 years ago

I discovered the issue for me.

I did not have the training images in the correct folder hierarchy.

Make sure you do:

data/ raw/ images/ 0001.jpg 0002.jpg masks/ 0001.ppm 0002.ppm

I accidentally had all the images in a folder called "raw" and the masks in a separate folder called "masks". The "images" and "masks" folders must go inside the "raw" folder.