简体   繁体   English

如何使用异常架构

[英]How to use exception architecture

I want to use xception model to classify images,but iam getting valuerror. 我想使用xception模型对图像进行分类,但是我得到了valuerror。

xception=keras.applications.xception.Xception(include_top=False,input_shape=(71,71,3))
classifier=Sequential()
for layer in xception.layers:
    classifier.add(layer)

Iam getting this error 我收到此错误

ValueError: Input 0 is incompatible with layer conv2d_1: expected axis -1 of input shape to have value 64 but got shape (None, 33, 33, 128)

I also get this error when using resnet.But i dont get it when iam using vgg16 or vgg19.Can anyone say how to use it?? 使用resnet时也会出现此错误。但是当我使用vgg16或vgg19时我没有收到此错误。有人可以说如何使用它吗?

You can use the functional API. 您可以使用功能性API。 Here is one possible example of classifier 这是分类器的一个可能示例

#Base model Xception
xception=keras.applications.xception.Xception(include_top=False,input_shape=(71,71,3))

# Input of your model
input=Input(shape=(71,71,3))
# Add the inception base model to your model
y=xception(input)
    .

    .
# Other layers by passing previous output  
y=Dense(...)(y)
# Define model
model=Model(input,y)

Docs 文件

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM