marcellacornia / mlnet

A Deep Multi-Level Network for Saliency Prediction. ICPR 2016

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Errors using the pre-trained model

guiluz opened this issue · comments

Hi Marcella,
I tried to compute saliency maps using the pre-trained model with the MIT300 benchmark but I have some errors.
I changed the image resolution in the config.py, however I don't know if I need to add anything more.
I don't know if there are problems for specific software versions, I have Anaconda Python 3.5.2 and Keras 1.2.0. And, I changed the backend to Theano already.

Here are the massages I got when I run python main.py test "image_folder"

Load weights ML-Net
Predict saliency maps for C:\Users\Guilherme\Desktop\BenchmarkIMAGES
Exception in thread Thread-37:
Traceback (most recent call last):
File "C:\Program Files\Anaconda3\lib\threading.py", line 914, in _bootstrap_inner
self.run()
File "C:\Program Files\Anaconda3\lib\threading.py", line 862, in run
self._target(*self._args, **self._kwargs)
File "C:\Program Files\Anaconda3\lib\site-packages\keras\engine\training.py", line 409, in data_generator_task
generator_output = next(generator)
File "main.py", line 36, in generator_test
yield preprocess_images(images[counter:counter + b_s], shape_r, shape_c)
File "C:\Users\Guilherme\Desktop\MLNET\utilities.py", line 36, in preprocess_images
padded_image = padding(original_image, shape_r, shape_c, 3)
File "C:\Users\Guilherme\Desktop\MLNET\utilities.py", line 11, in padding
original_shape = img.shape
AttributeError: 'NoneType' object has no attribute 'shape'

Traceback (most recent call last):
File "main.py", line 71, in
predictions = model.predict_generator(generator_test(b_s=1, imgs_test_path=imgs_test_path), nb_imgs_test)
File "C:\Program Files\Anaconda3\lib\site-packages\keras\engine\training.py", line 1729, in predict_generator
outs = self.predict_on_batch(x)
File "C:\Program Files\Anaconda3\lib\site-packages\keras\engine\training.py", line 1319, in predict_on_batch
self.internal_input_shapes)
File "C:\Program Files\Anaconda3\lib\site-packages\keras\engine\training.py", line 74, in standardize_input_data
'Found: ' + str(data)[:200] + '...')
TypeError: Error when checking : data should be a Numpy array, or list/dict of Numpy arrays. Found: None...

Hi @guiluz,
it seems that you are not loading the input images correctly (indeed, your img variable is None). Did you add the final slash in the second argument of main.py?

e.g. (from the readme) python main.py test path/to/images/folder/

Hi @baraldilorenzo,

Of course! I was doing it wrong. Thanks for your help.