简体   繁体   中英

How to use exception architecture

I want to use xception model to classify images,but iam getting 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??

You can use the functional 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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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