Filtering mask in Yolo_filter_boxes

Hi,
I have been tinkering for a while with the mask filter and I don’t know what else to try.
My filter_mask variable assignment is using supposed to return booleans on the last axis with the threshold comparison

filtering_mask = box_class_scores[box_class_scores[-1] > threshold]

But I’m getting ValueError: Shapes (19, 19) and (19, 5) are incompatible
I’m kind of stuck.

This should work:
filtering_mask = (box_class_scores >= threshold)

Thank you! All test past.

Hi am getting some issues can u help?
this is my code
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
# Step 1: Compute box scores
##(≈ 1 line)


# Step 2: Find the box_classes using the max box_scores, keep track of the corresponding score
##(≈ 2 lines)
box_scores = box_confidence*box_class_probs
box_classes = tf.math.argmax(box_scores, axis = -1)
box_class_scores = tf.math.reduce_max(box_classes)


# Step 3: Create a filtering mask based on "box_class_scores" by using "threshold". The mask should have the
# same dimension as box_class_scores, and be True for the boxes you want to keep (with probability >= threshold)
## (≈ 1 line)
filtering_mask = box_class_scores > threshold

# Step 4: Apply the mask to box_class_scores, boxes and box_classes
## (≈ 3 lines)
scores  = tf.boolean_mask(box_class_scores, filtering_mask)
boxes   = tf.boolean_mask(boxes, filtering_mask)
classes = tf.boolean_mask(box_classes, filtering_mask)
### END CODE HERE

return scores, boxes, classes