Как решить вывод слоя плохо определен - PullRequest
0 голосов
/ 20 апреля 2019

Я хочу получить плотный слой resnet, но в выводе есть некоторые ошибки. Я пытаюсь использовать layer [-1], он будет напечатан, но layer [-4] это ошибка.Я новичок в глубоком обучении.Большое спасибо.

weight_path = '/triplet_loss_resnet50.h5'
model = load_model(weight_path, compile=False)

model.summary()

# compile model
model.compile(optimizer='rmsprop',
              loss=triplet_loss,
              metrics=['accuracy'])

inp = model.input # input placeholder
outputs = model.layers[-4].output

Выходное сообщение

Layer (type)                    Output Shape         Param #     Connected to                     
==================================================================================================
input_anchor (InputLayer)       (None, 224, 224, 3)  0                                            
__________________________________________________________________________________________________
input_pos (InputLayer)          (None, 224, 224, 3)  0                                            
__________________________________________________________________________________________________
input_neg (InputLayer)          (None, 224, 224, 3)  0                                            
__________________________________________________________________________________________________
resnet_model (Model)            (None, 1000)         25636712    input_anchor[0][0]               
                                                                 input_pos[0][0]                  
                                                                 input_neg[0][0]                  
__________________________________________________________________________________________________
pos_dist (Lambda)               (None, 1)            0           resnet_model[1][0]               
                                                                 resnet_model[2][0]               
__________________________________________________________________________________________________
neg_dist (Lambda)               (None, 1)            0           resnet_model[1][0]               
                                                                 resnet_model[3][0]               
__________________________________________________________________________________________________
stacked_dists (Lambda)          (None, 2, 1)         0           pos_dist[0][0]                   
                                                                 neg_dist[0][0]                   
==================================================================================================
Total params: 25,636,712
Trainable params: 2,049,000
Non-trainable params: 23,587,712
__________________________________________________________________________________________________
Traceback (most recent call last):
AttributeError: Layer resnet_model has multiple inbound nodes, hence the notion of "layer output" is ill-defined. Use `get_output_at(node_index)` instead.
...