PLEASE HELP ME IDENTIFY WHAT WNET WRONG WITH BOXES HERE
def yolo_filter_boxes(boxes, box_confidence, box_class_probs, threshold = .6):
"""Filters YOLO boxes by thresholding on object and class confidence.
Arguments:
boxes -- tensor of shape (19, 19, 5, 4)
box_confidence -- tensor of shape (19, 19, 5, 1)
box_class_probs -- tensor of shape (19, 19, 5, 80)
threshold -- real value, if [ highest class probability score < threshold],
then get rid of the corresponding box
Returns:
scores -- tensor of shape (None,), containing the class probability score for selected boxes
boxes -- tensor of shape (None, 4), containing (b_x, b_y, b_h, b_w) coordinates of selected boxes
classes -- tensor of shape (None,), containing the index of the class detected by the selected boxes
Note: "None" is here because you don't know the exact number of selected boxes, as it depends on the threshold.
For example, the actual output size of scores would be (10,) if there are 10 boxes.
"""
### START CODE HERE
# mentor edit: code removed
### END CODE HERE
return scores, boxes, classes
ValueError Traceback (most recent call last)
in
----> 1 out_scores, out_boxes, out_classes = predict(“test.jpg”)
in predict(image_file)
20 yolo_outputs = yolo_head(yolo_model_outputs, anchors, len(class_names))
21
—> 22 out_scores, out_boxes, out_classes = yolo_eval(yolo_outputs, [image.size[1], image.size[0]], 10, 0.3, 0.5)
23
24 # Print predictions info
in yolo_eval(yolo_outputs, image_shape, max_boxes, score_threshold, iou_threshold)
31
32 # Use one of the functions you’ve implemented to perform Score-filtering with a threshold of score_threshold (≈1 line)
—> 33 scores, boxes, classes = yolo_filter_boxes(boxes, box_confidence, box_class_probs, threshold = score_threshold)
34
35 # Scale boxes back to original image shape.
in yolo_filter_boxes(boxes, box_confidence, box_class_probs, threshold)
40 ## (≈ 3 lines)
41 scores = tf.boolean_mask(box_class_scores, filtering_mask)
—> 42 boxes = tf.boolean_mask(boxes, filtering_mask)
43 classes = tf.boolean_mask(box_classes, filtering_mask)
44 ### END CODE HERE
/opt/conda/lib/python3.7/site-packages/tensorflow/python/util/dispatch.py in wrapper(*args, **kwargs)
199 “”“Call target, and fall back on dispatchers if there is a TypeError.”""
200 try:
→ 201 return target(*args, **kwargs)
202 except (TypeError, ValueError):
203 # Note: convert_to_eager_tensor currently raises a ValueError, not a
/opt/conda/lib/python3.7/site-packages/tensorflow/python/ops/array_ops.py in boolean_mask_v2(tensor, mask, axis, name)
1801 ```
1802 “”"
→ 1803 return boolean_mask(tensor, mask, name, axis)
1804
1805
/opt/conda/lib/python3.7/site-packages/tensorflow/python/util/dispatch.py in wrapper(*args, **kwargs)
199 “”“Call target, and fall back on dispatchers if there is a TypeError.”""
200 try:
→ 201 return target(*args, **kwargs)
202 except (TypeError, ValueError):
203 # Note: convert_to_eager_tensor currently raises a ValueError, not a
/opt/conda/lib/python3.7/site-packages/tensorflow/python/ops/array_ops.py in boolean_mask(tensor, mask, name, axis)
1728 if axis_value is not None:
1729 axis = axis_value
→ 1730 shape_tensor[axis:axis + ndims_mask].assert_is_compatible_with(shape_mask)
1731
1732 leading_size = gen_math_ops.prod(shape(tensor)[axis:axis + ndims_mask], [0])
/opt/conda/lib/python3.7/site-packages/tensorflow/python/framework/tensor_shape.py in assert_is_compatible_with(self, other)
1132 “”"
1133 if not self.is_compatible_with(other):
→ 1134 raise ValueError("Shapes %s and s are incompatible" (self, other))
1135
1136 def most_specific_compatible_shape(self, other):
ValueError: Shapes (1, 19, 19, 5) and (1, 19, 19, 80) are incompatible