Exception encountered when calling layer “tf.math.multiply_4” (type TFOpLambda).
Dimensions must be equal, but are 2 and 80 for ‘{{node tf.math.multiply_2/Mul}} = Mul[T=DT_FLOAT](Placeholder, Placeholder_1)’ with input shapes: [?,19,19,5,2], [?,19,19,5,80].
解决:将#yolo_outputs = yolo_head(yolo_model.output, anchors, len(class_names))
改为:
yolo_outputs = yolo_head(yolo_model.output, anchors, len(class_names))
box_xy, box_wh, box_confidence, box_class_probs = yolo_outputs
yolo_outputs = (box_confidence, box_xy, box_wh, box_class_probs)
原因:维度不匹配不能乘,需要将参数更换顺序。
接着可能会报另一个错,如果没有请忽略
‘NoneType’ object has no attribute ‘run’
这需要重新运行之前的会话 tf.session
运行之后我的问题就解决了