Error at # Use tf.gather() to select only nms_indices from scores, boxes and classes

Hi,

I get the following error when using tf.gather

InvalidArgumentError: Value for attr 'Tindices' of float is not in the list of allowed values: int32, int64

I see that in a post from February, it’s suggested to use max_boxes_tensor instead of max_boxes, when calling tf.image.non_max_suppression, but with the latest implementation of this lab, there is no max_boxes_tensor, so I wonder what am I missing. Any suggestions are appreciated!

Thank you,
Leszek

That’s obsolete information.

When you call tf.gather(), use the selected indices and the nms indices labels.
image

Perhaps the issue is the code you’re using for nms_indices_label = ... or selected_indices = ...

so
1/ for nms_indices_labels I use tf.image.non_max_suppression
2/ to nms_indices I append result of tf.gather with ‘selected_indices’ (as indices) and nms_indices_label (as params)

Any obvious problems there? :slight_smile:

1/ OK given you provide the appropriate four parameters.
2/ OK.

1/ well, there are the following 4 parameters :slight_smile: - boxes, scores, max_boxes and iou_threshold :slight_smile:

interesting thing, tf.gather works for me with nms_indices and classes. Not with boxes or scores :confused:

Nope, those should be boxes_label and scores_label.

2 Likes

ha, this helped. Interesting thing, I had to switch selected_indices
and nms_indices_label in tf.gather. There is clearly something I dont understand about tf.gather :smiley:

thank you for your help and happy 2025! :slight_smile: that’s enough for 2024 for me, going to jump on the rest of the assignment tomorrow!

1 Like