从2.2.1后normalize_data_format 就从keras.utils.conv_utils移动到了keras.backend.common,所以
keras-contrib 不能通过 keras 2.2.1+ .引入
so
import keras
print(keras.__version__)
可以查看自己的安装Keras版本号
所以确定后改为:
from keras.utils.conv_utils import normalize_data_format
```from keras.backend.common import normalize_data_format``
https://github.com/keras-team/keras/blob/master/keras/utils/conv_utils.py
"""Utilities used in convolutional layers.
"""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from six.moves import range
import numpy as np
from .. import backend as K
def normalize_tuple(value, n, name):
"""Transforms a single int or iterable of ints into an int tuple.
# Arguments
value: The value to validate and convert. Could be an int, or any iterable
of ints.
n: The size of the tuple to be returned.
name: The name of the argument being validated, e.g. `strides` or
`kernel_size`. This is only used to format error messages.
# Returns
A tuple of n integers.
# Raises
ValueError: If something else than an int/long or iterable thereof was
passed.
"""
if isinstance(value, int):
return (value,) *