【发布时间】:2021-04-12 22:12:55
【问题描述】:
我正在使用 Keras 为 224x224x3 大小的图像开发一个用于人脸识别的连体网络。 Siamese Network 的架构是这样的:
对于 CNN 模型,我正在考虑使用已经在 Keras.applications 模块中预训练的 InceptionV3 模型。
#Assume all the other modules are imported correctly
from keras.applications.inception_v3 import InceptionV3
IMG_SHAPE=(224,224,3)
def return_siamese_net():
left_input=Input(IMG_SHAPE)
right_input=Input(IMG_SHAPE)
model1=InceptionV3(include_top=False, weights="imagenet", input_tensor=left_input) #Left SubConvNet
model2=InceptionV3(include_top=False, weights="imagenet", input_tensor=right_input) #Right SubConvNet
#Do Something here
distance_layer = #Do Something
prediction = Dense(1,activation='sigmoid')(distance_layer) # Outputs 1 if the images match and 0 if it does not
siamese_net = #Do Something
return siamese_net
model=return_siamese_net()
由于模型是预训练的,所以我遇到了错误,我现在一直在为双网络实现距离层。
我应该在两者之间添加什么才能使这个 Siamese Network 正常工作?
【问题讨论】:
-
I get error since the model is pretrained您遇到的错误是什么? -
@AkshaySehgal 属性错误:功能对象没有值:
标签: python keras conv-neural-network face-recognition siamese-network