我收到了这个错误,我不知道为什么会这样。任何人都帮帮我。
import warnings
warnings.filterwarnings('ignore',category=FutureWarning)
import tensorflow as tf
import keras
from keras.layers.convolutional import Conv2D, AtrousConvolution2D
from keras.layers import Activation, Dense, Input, Conv2DTranspose, Dense, Flatten
from keras.layers import Dropout, Concatenate, BatchNormalization, Reshape
from keras.layers.advanced_activations import LeakyReLU
from keras.models import Model, model_from_json
from keras.optimizers import Adam
from keras.layers.convolutional import UpSampling2D
import keras.backend as K
from keras.activations import relu
def g_build_conv(layer_input, filter_size, kernel_size=4, strides=2, activation='leakyrelu',
dropout_rate=g_dropout, norm='inst', dilation=1):
c = AtrousConvolution2D(filter_size, kernel_size=kernel_size, strides=strides,atrous_rate=
(dilation,dilation), padding='same')(layer_input)
if activation == 'leakyrelu':
c = relu()(c)
if dropout_rate:
c = Dropout(dropout_rate)(c)
if norm == 'inst':
c = InstanceNormalization()(c)
return c
警告(来自警告模块):文件“C:\Users\xyz\AppData\Local\Programs\Python\Python35\lib\site-packages\keras\legacy\layers.py”,第 762 行 warnings.warn('The
AtrousConvolution2D
layer ' UserWarning:该AtrousConvolution2D
层已被弃用。使用Conv2D
带有dilation_rate
参数的层。回溯(最近一次调用最后):文件“D:\Image Outpaining\outpaint.py”,第 146 行,在 GEN = build_generator() 文件“D :\Image Outpaining\outpaint.py",第 120 行,在 build_generator g1 = g_build_conv(g_input, 64, 5, strides=1) 文件“D:\Image Outpaining\outpaint.py”,第 102 行,在 g_build_conv c = relu ()(c) 类型错误:relu() 缺少 1 个必需的位置参数:'x'