ValueError: Размеры должны быть равны, но равны 2 и 80 для 'mul_18' (op: 'Mul') с входными формами: [?,?,?, 5,2], [?,?,?, 5,80] - PullRequest
0 голосов
/ 26 апреля 2020

Я пытаюсь обнаружить объекты в использовании в Yolo в Google Collab. Вот фрагмент кода, который я выполняю, но получаю ошибку значения. Нужна помощь, Застрявший здесь больше недели.

img = plt.imread('/content/drive/My Drive/Social_distance/img.jpg')
imshow(img)
image_shape = float(img.shape[0]), float(img.shape[1])
print(image_shape)
scores, boxes, classes = yolo_eval(yolo_outputs, image_shape=(720,1280))

определение yolo_eval ()

def yolo_eval(yolo_outputs, image_shape = (720., 1280.), max_boxes=10, score_threshold=.6, iou_threshold=.5):
   print(image_shape)
   box_confidence, box_xy, box_wh, box_class_probs = yolo_outputs
   boxes = yolo_boxes_to_corners(box_xy, box_wh)
   scores, boxes, classes = yolo_filter_boxes(box_confidence, boxes, box_class_probs, threshold = 
   score_threshold)
   boxes = scale_boxes(boxes, image_shape)
   scores, boxes, classes = yolo_non_max_suppression(scores, boxes, classes, max_boxes, iou_threshold)

   return scores, boxes, classes

Вот ошибка:

   1606   try:
  -> 1607     c_op = c_api.TF_FinishOperation(op_desc)
   1608   except errors.InvalidArgumentError as e:

  InvalidArgumentError: Dimensions must be equal, but are 2 and 80 for 
  'mul_19' (op: 'Mul') with input shapes: [?,?,?,5,2], [?,?,?,5,80].

  During handling of the above exception, another exception occurred:

  ValueError                                Traceback (most recent call last)
  11 frames
  /tensorflow-1.15.2/python3.6/tensorflow_core/python/framework/ops.py in 
  _create_c_op(graph, node_def, inputs, control_inputs)
  1608   except errors.InvalidArgumentError as e:
  1609     # Convert to ValueError for backwards compatibility.
  -> 1610     raise ValueError(str(e))
   1611 
  1612   return c_op

  ValueError: Dimensions must be equal, but are 2 and 80 for 'mul_19' (op: 
  'Mul') with input shapes: [?,?,?,5,2], [?,?,?,5,80].
...