marcellacornia / mlnet

A Deep Multi-Level Network for Saliency Prediction. ICPR 2016
MIT License
94 stars 37 forks source link

Incompatibility between weights of the model layers and vgg16_weights.h5 file!! #26

Closed rakehsaleem closed 2 years ago

rakehsaleem commented 3 years ago

Hi @marcellacornia! thank you for open-sourcing your code. I am trying to test some sample images using your code and I have installed all the dependencies like you said, however, when I run the test file, it gives me the following error about weights incompatibility and I am wondering what changes should be adjusted to run the testing. I use the updated weights file. Thank you! image

rakehsaleem commented 3 years ago

I would like to clarify that I was using Keras backend as "Tensorflow" and I learned that Keras initializes weights differently with different backends. So I changed Keras backend to "theano" backend and when I run the test images, it raises the following exception.

Traceback (most recent call last): File "main.py", line 43, in model = ml_net_model(img_cols=shape_c, img_rows=shape_r, downsampling_factor_product=10) File "C:\Users\mqs6680\PycharmProjects\Saliency\model.py", line 78, in ml_net_model eltprod = EltWiseProduct(init='zero', W_regularizer=l2(1/(rows_eltcols_elt)))(pre_final_conv) File "C:\Users\mqs6680\PycharmProjects\Saliency\venv\lib\site-packages\keras\engine\topology.py", line 514, in call self.add_inbound_node(inbound_layers, node_indices, tensor_indices) File "C:\Users\mqs6680\PycharmProjects\Saliency\venv\lib\site-packages\keras\engine\topology.py", line 572, in add_inbound_node Node.create_node(self, inbound_layers, node_indices, tensor_indices) File "C:\Users\mqs6680\PycharmProjects\Saliency\venv\lib\site-packages\keras\engine\topology.py", line 149, in create_node output_tensors = to_list(outbound_layer.call(input_tensors[0], mask=input_masks[0])) File "C:\Users\mqs6680\PycharmProjects\Saliency\eltwise_product.py", line 56, in call output = xT.nnet.abstract_conv.bilinear_upsampling(K.expand_dims(K.expand_dims(1 + self.W, 0), 0), self.downsampling_factor, 1, 1) File "C:\Users\mqs6680\PycharmProjects\Saliency\venv\lib\site-packages\theano\tensor\nnet\abstract_conv.py", line 1911, in bilinear_upsampling raise ValueError("can't use ratio and frac_ratio together") ValueError: can't use ratio and frac_ratio together

Any help on how to fix this will be much appreciated!