marcellacornia / sam

Predicting Human Eye Fixations via an LSTM-based Saliency Attentive Model. IEEE Transactions on Image Processing (2018)
https://ieeexplore.ieee.org/document/8400593
MIT License
205 stars 76 forks source link

AttributeError: 'NoneType' object has no attribute 'shape' #10

Closed FelixIsCoding closed 6 years ago

FelixIsCoding commented 6 years ago

Hello, I've meet some errors when trying to use this code. I have the same version as mentioned and I didn't change any code. But it gives me these two errors. Exception in thread Thread-1: Traceback (most recent call last): File "/usr/lib/python2.7/threading.py", line 810, in __bootstrap_inner self.run() File "/usr/lib/python2.7/threading.py", line 763, in run self.target(*self.args, **self.__kwargs) File "/usr/local/lib/python2.7/dist-packages/keras/engine/training.py", line 425, in data_generator_task generator_output = next(generator) File "main.py", line 48, in generator_test yield [preprocess_images(images[counter:counter + b_s], shape_r, shape_c), gaussian] File "/home/huying/workspace_linux/Saliency/sam-master/utilities.py", line 79, in preprocess_images padded_image = padding(original_image, shape_r, shape_c, 3) File "/home/huying/workspace_linux/Saliency/sam-master/utilities.py", line 13, in padding original_shape = img.shape AttributeError: 'NoneType' object has no attribute 'shape'

Traceback (most recent call last): File "main.py", line 112, in predictions = m.predict_generator(generator_test(b_s=b_s, imgs_test_path=imgs_test_path), nb_imgs_test)[0] File "/usr/local/lib/python2.7/dist-packages/keras/engine/training.py", line 1634, in predict_generator outs = self.predict_on_batch(x) File "/usr/local/lib/python2.7/dist-packages/keras/engine/training.py", line 1268, in predict_on_batch self.internal_input_shapes) File "/usr/local/lib/python2.7/dist-packages/keras/engine/training.py", line 70, in standardize_input_data 'Found: ' + str(data)[:200] + '...') Exception: Error when checking : data should be a Numpy array, or list/dict of Numpy arrays. Found: None...

Can you help with that?

FelixIsCoding commented 6 years ago

I'm using the sample images in your code, and I put a print in main.py images = [imgs_test_path + f for f in os.listdir(imgs_test_path) if f.endswith(('.jpg', '.jpeg', '.png'))] images.sort()
print len(images) So I'm sure the images have been read.

FelixIsCoding commented 6 years ago

OMG, such a silly bug! I lost a '/' when giving the image path.... /home/usr/workspace_linux/Saliency/Image to /home/usr/workspace_linux/Saliency/Image/ problem solved