tensorflow.python.framework.errors_impl.InvalidArgumentError:输入必须至少包含k列。有1,需要3

时间:2019-07-02 13:12:47

标签: tensorflow

在执行model.fit操作时出现此错误(tensorflow.python.framework.errors_impl.InvalidArgumentError:输入必须至少有k列。必须1,需要3) 以下[[{{node loss / logits_variance_loss / montecarlo_total_loss_results / while / cond / TopKV2}}]]

我检查了输入和输出变量的形状和大小

x = Input(shape=(img_height, img_width, img_channels))
x1 = Lambda(identity_layer,output_shape=(img_height,img_width,img_channels),name ='identity_layer')(x)

。 。 。 。 。 。

classes_concat = Concatenate(axis=1, name='classes_concat')([classes4_reshaped,
                                                             classes5_reshaped,
                                                             classes6_reshaped,
                                                             classes7_reshaped])

# Output shape of `boxes_concat`: (batch, n_boxes_total, 4)
boxes_concat = Concatenate(axis=1, name='boxes_concat')([boxes4_reshaped,
                                                         boxes5_reshaped,
                                                         boxes6_reshaped,
                                                         boxes7_reshaped])

variance_pre = Dense(1,name ='variance_pre')(classes_concat)
variance = Activation('softplus', name='variance')(variance_pre)

logits_variance_class = Concatenate(axis=2,name='logits_variance_class')([classes_concat, variance])

print('logits_variance_class shape: ',logits_variance_class.shape)


variance_pre_box = Dense(1, name='variance_pre_box')(boxes_concat)
variance_box = Activation('softplus', name='variance_box')(variance_pre_box)

logits_variance_box = Concatenate(axis=2, name='logits_variance_box')([boxes_concat, variance_box])

print('logits_variance_box shape: ', logits_variance_box.shape)

# Output shape of `anchors_concat`: (batch, n_boxes_total, 8)
anchors_concat = Concatenate(axis=1, name='anchors_concat')([anchors4_reshaped,
                                                             anchors5_reshaped,
                                                             anchors6_reshaped,
                                                             anchors7_reshaped])

classes_softmax = Activation('softmax', name='classes_softmax')(classes_concat)

logits_variance = Concatenate(axis=2, name='logits_variance')([logits_variance_class,logits_variance_box,anchors_concat])

model = Model(inputs=x, outputs=logits_variance)

0 个答案:

没有答案