(“关键字参数无法理解:”,“实现”)在测试模型时

时间:2019-02-26 22:23:15

标签: python python-3.x tensorflow keras

我在Anaconda python 3.6中工作,我训练了模型,然后使用以下代码测试了模型:

  

测试代码

from keras.models import load_model
import numpy as np 

def mean_squared_loss(x1,x2):

        ''' Compute Euclidean Distance Loss  between 
input frame and the reconstructed frame'''

    diff=x1-x2
    a,b,c,d,e=diff.shape
    n_samples=a*b*c*d*e
    sq_diff=diff**2
    Sum=sq_diff.sum()
    dist=np.sqrt(Sum)
    mean_dist=dist/n_samples

    return mean_dist

threshold=0.1

model=load_model('model.h5')

X_test=np.load('test.npy')
frames=X_test.shape[2]
#Need to make number of frames divisible by 10
flag=0 #Overall video flagq
frames=frames-frames%10




  

然后我得到了以下

Using TensorFlow backend.
Traceback (most recent call last):
  File "test.py", line 57, in <module>
    model=load_model('model.h5')
  File "C:\Users\alaaa\Anaconda3\envs\python-3.6\lib\site-packages\keras\engine\saving.py", line 419, in load_model
    model = _deserialize_model(f, custom_objects, compile)
  File "C:\Users\alaaa\Anaconda3\envs\python-3.6\lib\site-packages\keras\engine\saving.py", line 225, in _deserialize_model
    model = model_from_config(model_config, custom_objects=custom_objects)
   File "C:\Users\alaaa\Anaconda3\envs\python-3.6\lib\site-packages\keras\engine\saving.py", line 458, in model_from_config
   return deserialize(config, custom_objects=custom_objects)
   File "C:\Users\alaaa\Anaconda3\envs\python-3.6\lib\site-packages\keras\layers\__init__.py", line 55, in deserialize
   printable_module_name='layer')
  File "C:\Users\alaaa\Anaconda3\envs\python-3.6\lib\site-packages\keras\utils\generic_utils.py", line 145, in deserialize_keras_object
    list(custom_objects.items())))
  File "C:\Users\alaaa\Anaconda3\envs\python-3.6\lib\site-packages\keras\engine\sequential.py", line 300, in from_config
    custom_objects=custom_objects)
  File "C:\Users\alaaa\Anaconda3\envs\python-3.6\lib\site-packages\keras\layers\__init__.py", line 55, in deserialize
    printable_module_name='layer')
  File "C:\Users\alaaa\Anaconda3\envs\python-3.6\lib\site-packages\keras\utils\generic_utils.py", line 147, in deserialize_keras_object
    return cls.from_config(config['config'])
  File "C:\Users\alaaa\Anaconda3\envs\python-3.6\lib\site-packages\keras\layers\convolutional_recurrent.py", line 151, in __init__
**kwargs)
 File "C:\Users\alaaa\Anaconda3\envs\python-3.6\lib\site-packages\keras\layers\recurrent.py", line 408, in __init__
    super(RNN, self).__init__(**kwargs)
  File "C:\Users\alaaa\Anaconda3\envs\python-3.6\lib\site-packages\keras\engine\base_layer.py", line 128, in __init__
raise TypeError('Keyword argument not understood:', kwarg)
TypeError: ('Keyword argument not understood:', 'implementation')

我正在使用Keras 2.2.4和tensorflow-gpu 1.12.0的最新版本 任何帮助将不胜感激

0 个答案:

没有答案