albermax / innvestigate

A toolbox to iNNvestigate neural networks' predictions!
Other
1.27k stars 233 forks source link

old model IO issues re-emerged with commit fbe511f on develop #62

Closed sebastian-lapuschkin closed 6 years ago

sebastian-lapuschkin commented 6 years ago

This morning I git pulled the current files from develop and received all changes until commit fbe511f my newest local version was ba61db6. Between those two commits, something must have happened regarding the model definitions, since keras / tf reports diverging input shapes for the nasnet models:

all_methods.py for nasnet_mobile

running all_methods.py. writing output to ./logs/nasnet_mobile-all_methods.py.txt
/home/lapuschkin/.local/lib/python3.5/site-packages/h5py-2.7.1-py3.5-linux-x86_64.egg/h5py/__init__.py:36: FutureWarning: Conversion of the second argument of issubdtype from `float` to `np.floating` is deprecated. In future, it will be treated as `np.float64 == np.dtype(float).type`.
  from ._conv import register_converters as _register_converters
Using TensorFlow backend.
Traceback (most recent call last):
  File "all_methods.py", line 61, in <module>
    net = tmp(load_weights=True, load_patterns=pattern_type)
  File "/home/lapuschkin/Desktop/innvestigate-lrp-wip/innvestigate/innvestigate/applications/imagenet.py", line 329, in nasnet_mobile
    load_patterns=load_patterns)
  File "/home/lapuschkin/Desktop/innvestigate-lrp-wip/innvestigate/innvestigate/applications/imagenet.py", line 145, in _prepare_keras_net
    model = clazz(weights=weights, input_shape=net["input_shape"][1:])
  File "/usr/local/lib/python3.5/dist-packages/keras/applications/nasnet.py", line 432, in NASNetMobile
    default_size=224)
  File "/usr/local/lib/python3.5/dist-packages/keras/applications/nasnet.py", line 171, in NASNet
    weights=weights)
  File "/usr/local/lib/python3.5/dist-packages/keras/applications/imagenet_utils.py", line 271, in _obtain_input_shape
    str(default_shape) + '.')
ValueError: When setting`include_top=True` and loading `imagenet` weights, `input_shape` should be (224, 224, 3).

all_methods.py for nasnet_large

running all_methods.py. writing output to ./logs/nasnet_large-all_methods.py.txt
/home/lapuschkin/.local/lib/python3.5/site-packages/h5py-2.7.1-py3.5-linux-x86_64.egg/h5py/__init__.py:36: FutureWarning: Conversion of the second argument of issubdtype from `float` to `np.floating` is deprecated. In future, it will be treated as `np.float64 == np.dtype(float).type`.
  from ._conv import register_converters as _register_converters
Using TensorFlow backend.
Traceback (most recent call last):
  File "all_methods.py", line 61, in <module>
    net = tmp(load_weights=True, load_patterns=pattern_type)
  File "/home/lapuschkin/Desktop/innvestigate-lrp-wip/innvestigate/innvestigate/applications/imagenet.py", line 313, in nasnet_large
    load_patterns=load_patterns)
  File "/home/lapuschkin/Desktop/innvestigate-lrp-wip/innvestigate/innvestigate/applications/imagenet.py", line 145, in _prepare_keras_net
    model = clazz(weights=weights, input_shape=net["input_shape"][1:])
  File "/usr/local/lib/python3.5/dist-packages/keras/applications/nasnet.py", line 366, in NASNetLarge
    default_size=331)
  File "/usr/local/lib/python3.5/dist-packages/keras/applications/nasnet.py", line 171, in NASNet
    weights=weights)
  File "/usr/local/lib/python3.5/dist-packages/keras/applications/imagenet_utils.py", line 271, in _obtain_input_shape
    str(default_shape) + '.')
ValueError: When setting`include_top=True` and loading `imagenet` weights, `input_shape` should be (331, 331, 3).

That last seems familiar to me.

other models have not been tested yet. Commit ba61db6 loads both models without issue.

sebastian-lapuschkin commented 6 years ago

also affects vgg-type networks. are there some un-pushed local commits on your side?

albermax commented 6 years ago

Fixed.