[英]How to use exception architecture
我想使用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)
我收到此錯誤
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)
使用resnet時也會出現此錯誤。但是當我使用vgg16或vgg19時我沒有收到此錯誤。有人可以說如何使用它嗎?
您可以使用功能性API。 這是分類器的一個可能示例
#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)
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.